/* Inter, self-hosted so the page has no runtime dependency on a font CDN.
   SIL Open Font License 1.1: fonts/LICENSE.txt. Latin subset, variable weight. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2");
}

:root {
  --bg: #F4EFE3;
  --surface: #FBF8F1;
  --primary: #1F4D3A;
  --primary-dark: #163A2B;
  --accent: #C9A227;
  --text: #1C2A23;
  --muted: #56645C;
  --rule: #DDD5C3;
  --warn-bg: #FBF1D4;
  --seg-tax: #7FA391;
  --seg-payroll: #BFD0C5;
  --seg-deduction: #C9A227;
  --seg-take: #1F4D3A;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--primary); }
small { color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }

header.site, main, footer.site {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}
header.site { padding-top: 16px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { border-radius: 9px; display: block; }

.hero { padding: 28px 0 20px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 14px;
  color: var(--primary);
  font-size: clamp(1.85rem, 7vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.trust {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 1rem;
}

/* --- form ------------------------------------------------------------------ */

.offers { margin: 8px 0 24px; }
.shared { margin-bottom: 12px; }
.shared .field { max-width: 10rem; margin-bottom: 0; }
.offer-forms { display: grid; gap: 16px; }
fieldset.offer {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
legend {
  padding: 0 6px;
  margin-left: -6px;
  font-weight: 600;
  color: var(--primary);
}
.tag {
  display: inline-grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg);
  font-size: 0.85em;
  font-weight: 700;
}
.field { display: block; margin-bottom: 12px; min-width: 0; }
.field > span:first-child, .field > .label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 500;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #C9C0AC;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* stops iOS zooming on focus */
}
select { padding-right: 8px; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.money, .pct { position: relative; display: block; }
.money::before, .pct::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.money::before { content: "$"; left: 12px; }
.money input { padding-left: 26px; }
.pct::after { content: "%"; right: 12px; }
.pct input { padding-right: 30px; }
.check { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; font-size: 0.95rem; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.hint { margin: 0; font-size: 0.85rem; color: var(--muted); }
.shared .hint { margin-top: 6px; }
.hint.stale { padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--text); }

button {
  font: inherit;
  font-weight: 600;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
}
button.secondary {
  margin-top: 12px;
  width: 100%;
  border: 1.5px dashed var(--primary);
  background: transparent;
  color: var(--primary);
}
button.primary { border: 0; background: var(--primary); color: var(--bg); width: 100%; }
button.primary:hover { background: var(--primary-dark); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- results --------------------------------------------------------------- */

.results { margin-bottom: 32px; }
.empty, .problem {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}
.problem { background: var(--warn-bg); color: var(--text); text-align: left; }
.result-grid { display: grid; gap: 24px; }
.result { min-width: 0; }
.offer-title { margin: 8px 0 12px; font-size: 1.2rem; color: var(--primary); display: flex; align-items: center; gap: 8px; }

.headline {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--bg);
}
.headline .label { margin: 0; font-size: 0.9rem; color: #BFD0C5; }
.headline .big { margin: 2px 0 14px; font-size: clamp(2.4rem, 11vw, 3.25rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.pair dt { font-size: 0.85rem; color: #BFD0C5; }
.pair dd { margin: 0; font-size: 1.25rem; font-weight: 600; }
.headline .note { color: #BFD0C5; margin: 14px 0 0; }

.block { margin-top: 16px; padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.block h2, .block h3 { margin: 0 0 12px; font-size: 1.05rem; color: var(--primary); }
.block h2 { font-size: 1.2rem; }
.block h4 { margin: 18px 0 6px; font-size: 0.95rem; }
.note { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }

.bar { display: flex; gap: 2px; height: 22px; margin-bottom: 12px; border-radius: 6px; overflow: hidden; }
.bar span { min-width: 3px; }

table.lines { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.lines th, table.lines td { padding: 8px 4px; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; }
table.lines th:first-child { text-align: left; font-weight: 400; padding-left: 0; }
table.lines td:last-child { padding-right: 0; }
table.lines thead th { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
table.lines thead th:first-child { text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--text); }
table.lines tr.take th, table.lines tr.take td { font-weight: 700; color: var(--primary); border-bottom: 0; }
table.lines th i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 2px; vertical-align: 0; }
table.lines th small { display: block; font-size: 0.78rem; }
.share { color: var(--muted); }
table.lines thead th:first-child small { display: block; font-size: 0.8rem; }
@media (max-width: 479px) {
  table.lines .share { display: none; }
  table.lines { font-size: 0.85rem; }
  table.lines th, table.lines td { padding-left: 2px; padding-right: 2px; }
  /* Comparison rows: label on its own line, then A, B and the difference. */
  .compare table.lines tr { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .compare table.lines thead th:first-child { display: none; }
  .compare table.lines tbody th { grid-column: 1 / -1; padding: 10px 0 0; border-bottom: 0; font-weight: 600; }
  .compare table.lines tbody td { padding-top: 2px; }
}
.compare td.diff { font-weight: 700; }
.compare td.up { color: var(--primary); }
.compare td.down { color: #8A3B2E; }

.years { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 0; }
.years dt { font-size: 0.82rem; color: var(--muted); }
.years dd { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.match { margin: 0; font-size: 1rem; }

.notices { background: var(--surface); }
.notices.warn { background: var(--warn-bg); border-color: #E6CF8A; }
.notices ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.notices li + li { margin-top: 6px; }

details.math summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  list-style-position: inside;
}
details.math[open] summary { margin-bottom: 4px; }
details.math p { margin: 4px 0; font-size: 0.9rem; }
table.wages td { white-space: nowrap; }
.math-lines { margin: 0; padding: 0; list-style: none; }
.math-line { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.math-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.sources { margin: 6px 0 0; padding: 0; list-style: none; font-size: 0.82rem; }
.sources li { margin-top: 4px; }
.sources a { font-weight: 500; overflow-wrap: anywhere; }
.sources .eff { color: var(--muted); }
.sources code { display: block; color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }

.actions { margin-top: 24px; }
.actions .note { text-align: center; }

.assumptions { padding: 20px 0 8px; border-top: 1px solid var(--rule); }
.assumptions h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--primary); }
.assumptions ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.assumptions li + li { margin-top: 4px; }
.fine { font-size: 0.82rem; color: var(--muted); }

footer.site { padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.82rem; }
footer.site p { margin: 0; }

.print-only { display: none; }

@media (min-width: 900px) {
  header.site, main, footer.site { max-width: 72rem; }
  .hero { max-width: 44rem; }
  .offer-forms.two { grid-template-columns: 1fr 1fr; }
  .offers:not(:has(.two)) { max-width: 44rem; }
  .result-grid:not(.two), .results > .actions, .results > .compare { max-width: 44rem; }
  .result-grid.two { grid-template-columns: 1fr 1fr; }
  button.secondary { width: auto; }
}

@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  header.site, .offers, .actions, footer.site .no-print { display: none !important; }
  .hero { padding: 0 0 8px; }
  .hero h1 { font-size: 18pt; }
  .print-only { display: block; }
  .print-title { font-weight: 600; margin: 0 0 8px; }
  .inputs { margin: 0 0 8px; font-size: 9.5pt; color: var(--muted); }
  .tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .block, .headline { break-inside: avoid; }
  .headline { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar, table.lines th i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .result-grid.two { display: block; }
  .result + .result { break-before: page; }
  details.math { break-inside: auto; }
  details.math summary { list-style: none; }
  .sources a::after { content: " " attr(href); color: var(--muted); font-weight: 400; }
  main, header.site, footer.site { max-width: none; }
}
