/* AfterTaxTally – ledger paper, green ink, one highlighter. */
@font-face { font-family: "Public Sans"; src: url("/assets/fonts/public-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Zilla Slab"; src: url("/assets/fonts/zilla-slab-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --paper: #f1f6f1;
  --sheet: #ffffff;
  --ink: #14231c;
  --muted: #4e6157;
  --green: #1f6b4a;
  --green-dark: #16503a;
  --rule: #c5d5ca;
  --red: #a32d25;
  --mark: #ffe27a;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --slab: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --wrap: 70rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 1.0625rem; line-height: 1.55; }
img, svg { max-width: 100%; }
a { color: var(--green-dark); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; background: var(--sheet); padding: 0.5rem 0.75rem; z-index: 10; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.9rem; padding-bottom: 0.9rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font-family: var(--slab); font-size: 1.35rem; line-height: 1; }
.brand svg { width: 1.9rem; height: 1.55rem; color: var(--green); flex: none; }
.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.97rem; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--green); }

/* Type */
h1, h2, h3 { font-family: var(--slab); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.1rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.85rem); margin-top: 3rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.2rem; margin-top: 1.75rem; margin-bottom: 0.4rem; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 44rem; margin-top: 0.85rem; }
.crumbs { font-size: 0.9rem; color: var(--muted); padding-top: 1.25rem; }
.crumbs a { color: var(--muted); }
.page-top { padding: 1rem 0 1.75rem; }
.prose { max-width: 46rem; }
.prose ul, .prose ol { padding-left: 1.25rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.4rem; }
.note { color: var(--muted); font-size: 0.95rem; }

/* Calculator */
.calc { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 54rem) {
  .calc { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto 1fr; column-gap: 2.5rem; row-gap: 1.1rem; }
  .calc .f-main { grid-column: 1; grid-row: 1; }
  .calc .f-more { grid-column: 1; grid-row: 2; }
  .calc .slip { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 1rem; }
}
.fields { display: grid; gap: 1.1rem; }
.field label, .field .legend { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.92rem; }
.row2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0.75rem; }
input[type="text"], input[type="number"], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid #8fa397; border-radius: 4px; padding: 0.7rem 0.75rem; min-height: 3rem;
  font-variant-numeric: tabular-nums;
}
input[type="text"]:hover, input[type="number"]:hover, select:hover { border-color: var(--green); }
.money-in { position: relative; }
.money-in span { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money-in input { padding-left: 1.6rem; font-size: 1.2rem; font-weight: 600; }
.field label.choice { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.35rem 0; margin: 0; font-weight: 400; cursor: pointer; }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0.18rem 0 0; accent-color: var(--green); flex: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }

/* The tally slip: the one loud element on the page */
.slip { background: var(--sheet); border: 1px solid var(--rule); border-top: 6px solid var(--green); padding: 1.25rem 1.25rem 1.1rem; }
.slip h2 { margin: 0 0 0.85rem; font-size: 1.25rem; }
.periods { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--green); border-radius: 4px; overflow: hidden; margin-bottom: 1rem; }
.periods button { font: inherit; font-size: 0.95rem; background: var(--sheet); color: var(--green-dark); border: 0; border-right: 1px solid var(--green); padding: 0.55rem 0.25rem; cursor: pointer; min-height: 2.75rem; }
.periods button:last-child { border-right: 0; }
.periods button[aria-pressed="true"] { background: var(--green); color: #fff; font-weight: 600; }
.tally { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.tally li { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.42rem 0; }
.tally .lead { flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-0.28em); min-width: 1rem; }
.tally .amt { font-weight: 600; white-space: nowrap; }
.tally .less .amt { color: var(--red); }
.tally .total { border-top: 4px double var(--ink); margin-top: 0.5rem; padding-top: 0.8rem; font-size: 1.15rem; }
.tally .total .label { font-family: var(--slab); font-size: 1.25rem; }
.tally .total .amt { font-size: 1.7rem; line-height: 1.1; padding: 0 0.2rem; background: linear-gradient(transparent 42%, var(--mark) 42%, var(--mark) 92%, transparent 92%); }
.tally .aside { color: var(--muted); font-size: 0.95rem; border-top: 1px solid var(--rule); margin-top: 0.7rem; padding-top: 0.7rem; }
.tally .aside .amt { color: var(--ink); }
.slip .summary { margin: 0.9rem 0 0; font-size: 0.97rem; color: var(--muted); }

/* Tables */
.table-scroll { overflow-x: auto; margin: 0 0 1.25rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; background: var(--sheet); }
caption { text-align: left; color: var(--muted); font-size: 0.92rem; padding-bottom: 0.4rem; caption-side: top; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { background: #e3ede6; font-weight: 600; border-bottom: 2px solid var(--green); white-space: nowrap; }
td.n, th.n { text-align: right; white-space: nowrap; }
tbody tr.sum td, tbody tr.sum th { border-top: 4px double var(--ink); font-weight: 700; }
tbody th { font-weight: 500; }

/* Lists of calculators */
.tools { list-style: none; padding: 0; margin: 1rem 0 0; border-top: 1px solid var(--rule); max-width: 46rem; }
.tools li { border-bottom: 1px solid var(--rule); padding: 0.95rem 0; }
.tools a { font-family: var(--slab); font-size: 1.3rem; text-decoration: none; color: var(--green-dark); }
.tools a:hover { text-decoration: underline; }
.tools p { margin: 0.2rem 0 0; color: var(--muted); }

/* FAQ */
.faq h3 { margin-top: 1.5rem; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); margin-top: 4rem; padding: 1.75rem 0 2.5rem; font-size: 0.93rem; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-bottom: 0.9rem; }
.site-foot a { color: var(--muted); }
.site-foot p { max-width: 50rem; margin-bottom: 0.5rem; }

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .slip { padding: 1rem 0.9rem; }
  .tally .total .amt { font-size: 1.45rem; }
  th, td { padding: 0.5rem 0.55rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .site-head, .site-foot, .fields { display: none; } body { background: #fff; } }
