/* rails.kindlyf.com — the colours and type of kindlyf.com (contrast checked
   there against WCAG AA on these cream grounds). */
:root {
  color-scheme: light;
  --cream: #fafaf8;
  --cream-warm: #f5f4f0;
  --cream-deep: #f0ede6;
  --ink: #1a1a18;
  --ink-muted: #63635b;
  --sage: #556349;
  --sage-deep: #414c38;
  --trust: #00704e;
  --trust-soft: #e3f1ea;
  --alert: #a33a2c;
  --alert-soft: #f8e8e4;
  --notice: #7a4f00;
  --notice-soft: #fbf0d9;
  --line: #d6d3c9;
  --line-soft: #e6e3db;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--sage-deep); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--cream-deep); padding: 0.1em 0.35em; border-radius: 4px; }

.top, main, footer { max-width: 60rem; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.25rem; padding-bottom: 1.25rem; flex-wrap: wrap; }
.brand { font: 600 1.35rem/1 var(--serif); color: var(--ink); text-decoration: none; }
.brand span { color: var(--sage); }
.top nav { display: flex; gap: 1.25rem; font-weight: 500; }

.hero { padding: 2.5rem 0 1.5rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 1rem; max-width: 18em; }
h2 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.hero > p { font-size: 1.15rem; color: var(--ink-muted); max-width: 40em; margin: 0; }

.status { margin-top: 1.25rem !important; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.98rem !important; color: var(--notice) !important; background: var(--notice-soft); border: 1px solid #ecd9ae; }
.status.down { color: var(--alert) !important; background: var(--alert-soft); border-color: #eccac3; }

.demo, .developers { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; margin: 1.5rem 0; }
.lede { color: var(--ink-muted); margin: 0 0 1rem; max-width: 42em; }

form { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem 1.25rem; align-items: end; }
form .wide, form fieldset { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line-soft); border-radius: 10px; padding: 0.75rem 1rem 1rem; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem 1rem; }
legend { font-weight: 500; padding: 0 0.35rem; }
legend span, .hint { font-weight: 400; color: var(--ink-muted); font-size: 0.9em; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 500; font-size: 0.95rem; }
input, select {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--cream);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.75rem; width: 100%; min-height: 2.75rem;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--alert); }
.field-error { color: var(--alert); font-weight: 400; font-size: 0.85rem; }

button { font: inherit; cursor: pointer; }
form button[type="submit"], .button {
  display: inline-block; background: var(--sage-deep); color: #fff; border: 0; border-radius: 999px;
  padding: 0.75rem 1.5rem; font-weight: 600; text-decoration: none; min-height: 2.75rem;
}
form button[type="submit"] { justify-self: start; }
form button[type="submit"]:hover, .button:hover { background: var(--ink); color: #fff; }
form button[disabled] { opacity: 0.6; cursor: progress; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1.25rem; font-size: 0.95rem; color: var(--ink-muted); }
button.link { background: var(--cream); border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.85rem; color: var(--sage-deep); font-weight: 500; font-size: 0.9rem; min-height: 2.25rem; }
button.link:hover { border-color: var(--sage); color: var(--ink); }

.result:empty { display: none; }
.result { margin-top: 1.5rem; border-top: 1px solid var(--line-soft); padding-top: 1.5rem; }
.verdict { border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.verdict h3 { margin: 0 0 0.35rem; font-size: 1.25rem; }
.verdict p { margin: 0.25rem 0 0; }
.verdict.good { background: var(--trust-soft); color: #00513a; }
.verdict.bad { background: var(--alert-soft); color: #7d2a1f; }
.verdict.error { background: var(--alert-soft); color: #7d2a1f; }
.preview-note { font-size: 0.9rem; color: var(--notice); margin: 0 0 1rem; }

.big { font: 600 2.25rem/1.1 var(--serif); margin: 0.25rem 0; }
.paydays { color: var(--ink-muted); margin: 0 0 1rem; }

.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-weight: 500; color: var(--ink-muted); font-size: 0.85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; border-bottom: 0; }
.tag { display: inline-block; border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.tag.good { background: var(--trust-soft); color: #00513a; }
.tag.bad { background: var(--alert-soft); color: #7d2a1f; }

details { margin-top: 1rem; border: 1px solid var(--line-soft); border-radius: 10px; padding: 0.5rem 1rem; background: var(--cream); }
summary { cursor: pointer; font-weight: 500; padding: 0.25rem 0; }
details[open] summary { margin-bottom: 0.5rem; }
ol.steps { margin: 0; padding-left: 1.25rem; }
ol.steps li { margin: 0 0 0.75rem; }
.step-value { font-family: var(--mono); font-size: 0.9rem; white-space: nowrap; }
.step-source { display: block; color: var(--ink-muted); font-size: 0.85rem; }
ul.sources { margin: 0; padding-left: 1.25rem; }
ul.sources li { margin-bottom: 0.4rem; }
pre { font-family: var(--mono); font-size: 0.8rem; background: var(--ink); color: var(--cream); padding: 1rem; border-radius: 8px; overflow-x: auto; white-space: pre; margin: 0.5rem 0; }
.small { font-size: 0.85rem; color: var(--ink-muted); }

.developers p { max-width: 44em; }

footer { color: var(--ink-muted); font-size: 0.85rem; padding-top: 1rem; padding-bottom: 3rem; }
footer p { margin: 0.25rem 0; }

@media (max-width: 40rem) {
  .demo, .developers { padding: 1.25rem 1rem; border-radius: 12px; }
  /* The payslip table becomes one card per deduction, each cell with its heading. */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line-soft); border-radius: 10px; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; }
  table.stack td { border: 0; padding: 0.3rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.stack td.item { font-weight: 700; text-align: left; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--ink-muted); font-size: 0.85rem; text-align: left; }
  .hero { padding-top: 1.5rem; }
  .big { font-size: 1.9rem; }
}
