/* Page shell. Every colour is a token below, set for the light and the dark theme.
   Direction (design preview "worksheet"): paper, ink and one green for money set aside — a page you
   read line by line like a worked sheet, not a dashboard. Not styled after any IRS form. */
:root {
  --bg: #f7f5ef; --paper: #fffefb; --ink: #1b211e; --text: #363e3a; --muted: #5b6560; --faint: #5b6560;
  --rule: #e2ddd1; --head: #fffefb; --foot: #1b211e; --foot-text: #c9cfca;
  --blue: #17694f; --blue-dark: #10523d; --blue-soft: #e8f1ec; --blue-ring: #c3ddd0;
  --link: #17694f; --link-hover: #10523d; --link-strong: #10523d;
  --green: #17694f; --green-soft: #e8f1ec; --green-line: #b7d5c5; --red: #b42318;
  --amber-soft: #fbf2dd; --amber: #714500; --amber-line: #ead29b; --amber-accent: #9a5d00;
  --soft: #efebe1; --soft-2: #f7f5ef; --switch-off: #c7c1b3; --btn-dark: #1b211e;
  color-scheme: light;
  --chart-expenses: #8b908c; --chart-se: #c0611c; --chart-federal: #2f6e9e; --chart-state: #7656a3; --chart-medicare: #b0457a; --chart-home: #17694f;
  --radius: 8px; --r-sm: 6px; --wrap: 720px;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
/* Self-hosted fonts (public/fonts, SIL OFL 1.1, latin subset). Both files are variable, so one file
   covers every weight used here. */
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/fonts/source-sans-3-latin.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/fonts/source-serif-4-latin.woff2") format("woff2"); }
/* Dark theme: the device setting, unless the visitor chose light; or chosen with the header button. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141816; --paper: #1b201d; --ink: #eef0ec; --text: #cfd5d0; --muted: #a2aca6; --faint: #a2aca6;
    --rule: #2f3632; --head: #1b201d; --foot: #0e110f; --foot-text: #b9c1bb;
    --blue: #1d7a5b; --blue-dark: #17694f; --blue-soft: #1d2c25; --blue-ring: #2e5444;
    --link: #8fd4b4; --link-hover: #b5e6cf; --link-strong: #b5e6cf;
    --green: #8fd4b4; --green-soft: #1c2c24; --green-line: #2e5444; --red: #b42318;
    --amber-soft: #2a2414; --amber: #f0cb7e; --amber-line: #5a4519; --amber-accent: #d9a441;
    --soft: #252b28; --soft-2: #1b201d; --switch-off: #4b534e; --btn-dark: #3a423e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141816; --paper: #1b201d; --ink: #eef0ec; --text: #cfd5d0; --muted: #a2aca6; --faint: #a2aca6;
  --rule: #2f3632; --head: #1b201d; --foot: #0e110f; --foot-text: #b9c1bb;
  --blue: #1d7a5b; --blue-dark: #17694f; --blue-soft: #1d2c25; --blue-ring: #2e5444;
  --link: #8fd4b4; --link-hover: #b5e6cf; --link-strong: #b5e6cf;
  --green: #8fd4b4; --green-soft: #1c2c24; --green-line: #2e5444; --red: #b42318;
  --amber-soft: #2a2414; --amber: #f0cb7e; --amber-line: #5a4519; --amber-accent: #d9a441;
  --soft: #252b28; --soft-2: #1b201d; --switch-off: #4b534e; --btn-dark: #3a423e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
::selection { background: var(--blue-ring); color: var(--ink); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.75rem; margin: 0 0 .6rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .4rem; }
code { font-size: .9em; background: var(--soft); padding: 0 .3em; border-radius: 4px; }
.muted { color: var(--muted); font-size: .9rem; }
/* Ads: labelled, apart from the content around them, and gone when no ad is filled. */
.ad { margin: 2rem 0; padding-top: .25rem; border-top: 1px solid var(--rule); min-height: 120px; }
.ad .ad-label { margin: 0 0 .35rem; font-size: .78rem; color: var(--muted); }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* First Tab stop on every page: past the six header links, straight to the content. */
.skip { position: absolute; left: 16px; top: -100px; z-index: 30; background: var(--paper); color: var(--link-strong); padding: .65rem 1rem; border: 1px solid var(--rule); border-radius: 0 0 var(--r-sm) var(--r-sm); font-weight: 700; text-decoration: none; }
.skip:focus { top: 0; }
@media print { .skip { display: none; } }
main:focus { outline: none; }
/* main starts right under the sticky header; this keeps the skip from scrolling the h1 under it. */
main { scroll-margin-top: 8rem; }

/* Header: the same paper as the page, divided by a rule — no dark app bar. */
.site-head { background: var(--head); color: var(--ink); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--rule); }
.head-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding-top: .6rem; padding-bottom: .6rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand b { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .78rem; }
.head-nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .92rem; }
.head-nav a { color: var(--text); text-decoration: none; padding: .2rem 0; min-height: 28px; display: inline-flex; align-items: center; border-bottom: 2px solid transparent; }
.head-nav a:hover { color: var(--ink); }
.head-nav .nav-narrow { display: none; }
.head-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--blue); }

.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; }
.prose { margin: 1.5rem 0; }
.prose p, .prose li { font-size: 1rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: .75rem 0 1rem; display: block; overflow-x: auto; }
.prose th { text-align: left; color: var(--ink); padding: .45rem .6rem; border-bottom: 2px solid var(--ink); font-weight: 600; }
.prose td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.example { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.example p { margin: .35rem 0; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

.intro { padding: 2rem 0 .5rem; }
.lede { font-size: 1.08rem; margin: 0; max-width: 62ch; }
.explain > h2, .faq > h2 { margin-top: 2.5rem; }
.explain p, .explain li { max-width: 68ch; }
.faq details { margin-bottom: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--ink); font-size: 1rem; }
.faq details p { margin: 0; padding: 0 0 16px; font-size: .97rem; }

.site-foot { background: var(--foot); color: var(--foot-text); margin-top: 3rem; font-size: .85rem; }
.site-foot .wrap { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.site-foot a { color: #eef0ec; }
.foot-links { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .75rem 0; }
.foot-note, .foot-year { margin: .25rem 0; }

@media (max-width: 639px) {
  /* One scrollable row of links, so the sticky header stays two lines tall on phones. */
  /* The theme button sits beside the logo; the links take the second line. */
  .brand { order: 1; flex: 1; min-width: 0; }
  .theme-btn { order: 2; }
  .head-nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; max-width: 100%; scrollbar-width: none; gap: .25rem .75rem; }
  .head-nav::-webkit-scrollbar { display: none; }
  /* Short labels ("Calculator", "Annual", "Sources"), so the last link is not cut off at 360–375px. */
  .head-nav .nav-wide { display: none; }
  .head-nav .nav-narrow { display: inline; }
}
@media (min-width: 640px) {
  h1 { font-size: 2.2rem; }
  .panel { padding: 28px; }
  /* One header row: logo left, links and the theme button right. */
  .head-nav { margin-left: auto; }
  .brand small { display: none; }
}
@media (min-width: 1000px) {
  .site-head .wrap { max-width: 960px; }
  .brand small { display: block; }
}

/* Theme button in the header. */
.theme-btn { min-height: 44px; min-width: 44px; padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: none; color: var(--text); font: 600 .85rem var(--sans); cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --paper: #fff; --ink: #000; --text: #1b211e; --muted: #4a524e; --faint: #4a524e;
    --rule: #cfc9bc; --head: #fff; --foot: #fff; --foot-text: #1b211e;
    --blue: #17694f; --blue-dark: #10523d; --blue-soft: #e8f1ec; --blue-ring: #c3ddd0;
    --link: #10523d; --link-hover: #10523d; --link-strong: #10523d;
    --green: #17694f; --green-soft: #e8f1ec; --green-line: #b7d5c5; --red: #b42318;
    --amber-soft: #fbf2dd; --amber: #714500; --amber-line: #ead29b; --amber-accent: #9a5d00;
    --soft: #efebe1; --soft-2: #f7f5ef; --switch-off: #c7c1b3; --btn-dark: #1b211e;
    color-scheme: light;
  }
}
.related { margin: 2rem 0; }
.related-list { list-style: none; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.related-list li { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sm, 8px); padding: 10px 14px; }
.related-list a { font-weight: 700; }
.related-list small { display: block; color: var(--muted); }
.steps { padding-left: 1.2rem; } .steps h3 { margin-bottom: .25rem; }
