/* MoneyMzansi: one stylesheet for the whole site.
   Light tokens follow BRIEF.md section 3 exactly. Dark mode (approved by the owner) redefines
   the same tokens under [data-theme="dark"], so components only ever use var(--c-*). */

/* ============ Fonts (self-hosted Inter, Latin subset, SIL OFL: /fonts/OFL.txt) ============ */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/inter-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/inter-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/inter-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Arial tuned to Inter's metrics, so text doesn't jump when Inter arrives (keeps layout shift low). */
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/fraunces-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Fallback'; src: local('Arial'), local('Helvetica Neue'), local('Helvetica');
  size-adjust: 107.4%; ascent-override: 90.2%; descent-override: 22.5%; line-gap-override: 0%;
}

/* ============ Tokens ============ */
:root {
  /* Brief section 3 colours, with the warm Ledger paper and ink neutrals (the live look since Nov 2026). */
  --c-primary: #0B6E4F;
  --c-primary-dark: #08553D;
  --c-primary-soft: #DCE7D3;
  --c-accent: #F2A900;
  --c-text: #1B2420;
  --c-muted: #55594F;
  --c-border: #D8CEB8;
  --c-surface: #EFE7D6;
  --c-bg: #F6F0E4;
  --c-danger: #B42318;
  --c-warn-soft: #FFF6E0;
  --c-chart-3: #5B6B7A;
  --c-chart-4: #2F6EB5; /* added with owner approval: 4th chart series */

  /* Derived tokens, so dark mode can retune each role separately */
  --c-primary-ink: #0B6E4F;        /* green text and icons */
  --c-logo-bar: #3F9A5F;           /* lighter green bars in the logo mark */
  --c-primary-line: #0B6E4F;       /* green borders on selected controls */
  --c-on-primary: #FFFFFF;         /* text on a solid green fill */
  --c-elevated: #FBF7EC;           /* cards and panels */
  --c-input: #FFFDF6;
  --c-border-strong: #B3A78C;
  --c-input-line: #7A745F;         /* 3:1 against the input background (WCAG 1.4.11) */
  --c-hover: #EBE2CE;
  --c-result: #E3EAD6;
  --c-result-line: rgba(11, 110, 79, .22);
  --c-danger-soft: #FEF3F2;
  --c-warn-line: #F3D48A;
  --c-warn-ink: #8A5A00;
  --c-focus: #0B6E4F;
  --c-series-0: var(--c-primary);
  --c-series-1: var(--c-accent);
  --c-series-2: var(--c-chart-3);
  --c-series-3: var(--c-chart-4);
  --c-header: rgba(246, 240, 228, .94);
  --c-rule: #1B2420;               /* ink lines: header, tiles, result card */

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);

  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Noto Serif', serif;
  --font: 'Inter', 'Inter Fallback', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;
  --fs-40: 2.5rem;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --r-card: 4px;
  --r-ctl: 3px;
  --r-pill: 999px;
  --shadow: none;     /* flat paper in light mode; dark mode keeps a faint shadow */
  --shadow-md: none;
  --shadow-lg: 0 10px 24px rgba(27, 36, 32, .18);
  --shadow-lift: 0 6px 14px color-mix(in srgb, var(--c-text) 14%, transparent); /* hover on link cards */
  --border-ink: 1.5px solid var(--c-rule); /* ink rule on header, tiles, result card, slip */
  --ls-caps: .06em;   /* small uppercase labels: table heads, stats, footer headings */
  --ls-kicker: .1em;  /* green receipt kickers: result label, hero slip */
  --tap: 44px;
  --input-h: 48px;
  --max: 1080px;
  --gutter: 16px;
  --header-h: 64px;

  color-scheme: light;
}

/* Dark: deep neutral surfaces, brand green lifted for contrast, gold kept as the one accent.
   Contrast (WCAG AA) checked for text, muted text, links, buttons and borders on every surface. */
:root[data-theme="dark"] {
  --c-primary: #14875F;            /* fills: white text on it is 4.6:1 */
  --c-primary-dark: #0F7352;
  --c-primary-soft: #16261D;
  --c-accent: #F2B533;
  --c-text: #EFE9DA;
  --c-muted: #A9A491;
  --c-border: #2E2B21;
  --c-surface: #1B1913;
  --c-bg: #14120D;
  --c-danger: #FF8A7F;
  --c-warn-soft: #272012;
  --c-chart-3: #8D9CAA;
  --c-chart-4: #66A3E9;

  --c-primary-ink: #5CCB9F;
  --c-logo-bar: #8FDDBB;
  --c-primary-line: #3AA87D;
  --c-on-primary: #FFFFFF;
  --c-elevated: #1F1D16;
  --c-input: #17150F;
  --c-border-strong: #4A4638;
  --c-input-line: #6E6955;
  --c-hover: #26231A;
  --c-result: #15251C;
  --c-result-line: rgba(92, 203, 159, .22);
  --c-danger-soft: #2A1513;
  --c-warn-line: #5E4818;
  --c-warn-ink: #F2B533;
  --c-focus: #5CCB9F;
  --c-series-0: #3DBE8B;
  --c-header: rgba(20, 18, 13, .92);
  --c-rule: #EFE9DA;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .02);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, .6);

  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--s-4));
}
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: var(--fs-16);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--s-3); font-weight: 700; color: var(--c-text); text-wrap: balance; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.012em; }
h1 { font-size: var(--fs-32); }
h2 { font-size: var(--fs-24); }
h3 { font-size: var(--fs-18); font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0 0 var(--s-4); }
p, li { text-wrap: pretty; }
a { color: var(--c-primary-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--c-primary-dark); text-decoration-thickness: 2px; }
:root[data-theme="dark"] a:hover { color: var(--c-text); }
strong { font-weight: 600; }
img, svg { max-width: 100%; }
ul, ol { padding-left: 1.25em; }
input, button, select, textarea { font: inherit; color: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--c-primary); }
button { cursor: pointer; }
table, input, output, dd, data, .num, .result-headline, .sticky-value, .chart-legend, .chart-tip { font-variant-numeric: tabular-nums; }
::selection { background: var(--c-primary-soft); color: var(--c-text); }

:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

@media (min-width: 768px) {
  h1 { font-size: var(--fs-40); }
}

/* ============ Layout ============ */
.container { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 24px; } }
main { display: block; padding-bottom: var(--s-8); }

/* ============ Header ============ */
.skip-link {
  position: absolute; left: var(--s-2); top: -100px; z-index: 100;
  background: var(--c-primary); color: var(--c-on-primary); padding: var(--s-2) var(--s-4); border-radius: var(--r-ctl); font-weight: 600;
}
.skip-link:focus { top: var(--s-2); color: var(--c-on-primary); }

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--c-header); border-bottom: var(--border-ink);
  -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: var(--s-4); }
.wordmark {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap);
  font-size: var(--fs-20); font-weight: 700; text-decoration: none; letter-spacing: -0.02em; color: var(--c-text);
}
.wordmark:hover { color: var(--c-text); }
.logo-mark { width: 28px; height: 30px; flex: none; }
.logo-m { fill: var(--c-primary-ink); }
.logo-bar { fill: var(--c-logo-bar); }
.wm-mzansi { color: var(--c-text); }
.wm-money { color: var(--c-primary-ink); }

.site-nav { display: flex; align-items: center; gap: var(--s-1); }
.nav-menu { position: relative; }
.nav-toggle {
  list-style: none; display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s-3);
  border-radius: var(--r-ctl); font-weight: 600; font-size: var(--fs-16); cursor: pointer; user-select: none; color: var(--c-text);
}
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle::marker { content: ''; }
.nav-toggle:hover, .nav-menu[open] .nav-toggle { background: var(--c-hover); }
.nav-toggle-label::after {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-left: var(--s-2);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg); transition: transform .15s;
}
.nav-menu[open] .nav-toggle-label::after { transform: translateY(0) rotate(-135deg); }
.nav-burger { display: none; width: 24px; height: 24px; }
.nav-link, .nav-about {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3);
  border-radius: var(--r-ctl); color: var(--c-text); font-weight: 600; text-decoration: none;
}
.nav-link:hover, .nav-about:hover { background: var(--c-hover); color: var(--c-text); }
.nav-about { display: none; }

.nav-panel {
  position: absolute; right: 0; top: calc(100% + var(--s-2)); width: min(1040px, 94vw);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-5) var(--s-6);
  padding: var(--s-5) var(--s-6); background: var(--c-elevated); border: 1px solid var(--c-border);
  border-radius: var(--r-card); box-shadow: var(--shadow-lg);
}
.nav-group-title { font-size: var(--fs-16); font-weight: 600; letter-spacing: normal; color: var(--c-muted); margin: 0 0 var(--s-1); }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a {
  display: flex; align-items: center; min-height: 40px; padding: var(--s-1) var(--s-2); margin: 0 calc(-1 * var(--s-2));
  border-radius: var(--r-ctl); color: var(--c-text); text-decoration: none; font-size: var(--fs-16); line-height: 1.35;
}
.nav-group a:hover { background: var(--c-hover); color: var(--c-primary-ink); }
.nav-group .nav-hub { font-weight: 700; color: var(--c-primary-ink); font-size: var(--fs-16); min-height: var(--tap); }
.nav-group .nav-all { color: var(--c-primary-ink); font-weight: 600; font-size: var(--fs-14); text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 1024px) { .nav-panel { grid-template-columns: repeat(4, 1fr); } }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--tap); height: var(--tap); padding: 0; border: 1px solid transparent; border-radius: 50%;
  background: transparent; color: var(--c-muted); transition: background-color .15s, color .15s;
}
.theme-toggle:hover { background: var(--c-hover); color: var(--c-text); }
.theme-icon { width: 20px; height: 20px; }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

@media (max-width: 767.98px) {
  .nav-menu { position: static; }
  .nav-toggle-label, .nav-link { display: none; }
  .nav-burger { display: block; }
  .nav-toggle { padding: 0; justify-content: center; }
  .nav-panel {
    position: fixed; left: 0; right: 0; top: var(--header-h); width: auto; grid-template-columns: 1fr; gap: var(--s-5);
    border-radius: 0; border-width: 0 0 1px; padding: var(--s-5) var(--gutter) var(--s-6);
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto; box-shadow: var(--shadow-lg);
  }
  .nav-group a { min-height: var(--tap); }
  .nav-about { display: flex; border-top: 1px solid var(--c-border); border-radius: 0; padding: var(--s-4) 0 0; margin-top: 0; }
  .site-nav { gap: 0; }
}

/* ============ Footer ============ */
.site-footer { background: var(--c-surface); border-top: 1px solid var(--c-border); padding: var(--s-7) 0 var(--s-6); font-size: var(--fs-14); color: var(--c-muted); }
.footer-top { display: grid; grid-template-columns: 1fr; gap: var(--s-6); padding-bottom: var(--s-6); }
.footer-brand .wordmark { font-size: var(--fs-18); }
.footer-tagline { max-width: 40ch; margin: var(--s-3) 0 0; line-height: 1.55; }
.footer-cols { display: grid; grid-template-columns: 1fr; gap: var(--s-5); }
.footer-col h2 { font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--c-muted); margin-bottom: var(--s-2); }
.footer-col ul, .footer-links { list-style: none; margin: 0; padding: 0; }
.footer-col a, .footer-links a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--c-text); text-decoration: none; line-height: 1.35; }
.footer-col h2 a { color: inherit; text-decoration: none; }
.footer-col .footer-all { color: var(--c-primary-ink); font-weight: 600; }
.footer-col a:hover, .footer-links a:hover { color: var(--c-primary-ink); text-decoration: underline; }
.footer-bottom { padding-top: var(--s-5); border-top: 1px solid var(--c-border); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); margin-bottom: var(--s-3); }
.footer-links a { min-height: var(--tap); font-weight: 600; }
.footer-meta { margin: 0 0 var(--s-1); }
@media (min-width: 560px) { .footer-cols { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) {
  .footer-top { grid-template-columns: minmax(240px, 1fr) 2.6fr; gap: var(--s-7); }
  .footer-cols { grid-template-columns: repeat(4, 1fr); }
}

/* ============ Components: buttons, chips, icons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-4); border: 1px solid var(--c-primary); border-radius: var(--r-card);
  background: var(--c-primary); color: var(--c-on-primary); font-weight: 600; font-size: var(--fs-16); line-height: 1.2;
  text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: var(--c-on-primary); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
/* Disabled and busy buttons: faded, no hover change, so a button that does nothing never looks tappable. */
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.btn-secondary:disabled:hover { background: var(--c-elevated); border-color: var(--c-border-strong); color: var(--c-primary-ink); }
.btn-ghost:disabled:hover { background: transparent; border-color: transparent; color: var(--c-muted); }
.btn[aria-busy="true"] { cursor: progress; }
.btn-secondary { background: var(--c-elevated); color: var(--c-primary-ink); border-color: var(--c-border-strong); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--c-primary-soft); border-color: var(--c-primary-line); color: var(--c-primary-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-muted); }
.btn-ghost:hover { background: var(--c-hover); border-color: transparent; color: var(--c-text); }
.btn .icon { width: 18px; height: 18px; }

.chip-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.chip {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-pill); background: var(--c-elevated); color: var(--c-text);
  font-size: var(--fs-14); font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--c-primary-line); color: var(--c-primary-ink); }
.chip[aria-pressed="true"] { background: var(--c-primary-soft); border-color: var(--c-primary-line); color: var(--c-primary-ink); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ============ Calculator page ============ */
.breadcrumbs { font-size: var(--fs-14); color: var(--c-muted); padding: var(--s-2) 0 0; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; }
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li + li::before { content: '/'; margin: 0 var(--s-2); color: var(--c-border-strong); }
.breadcrumbs a { color: var(--c-muted); display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: none; }
.breadcrumbs a:hover { color: var(--c-primary-ink); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--c-text); font-weight: 600; }

.page-intro { padding: var(--s-3) 0 var(--s-5); }
.page-intro h1 { margin-bottom: var(--s-3); }
.lead { font-size: var(--fs-18); color: var(--c-muted); max-width: 64ch; margin: 0; line-height: 1.55; }

.calc-card {
  display: grid; grid-template-columns: 1fr; gap: var(--s-5);
  background: var(--c-elevated); border: 1px solid var(--c-border); border-radius: var(--r-card);
  box-shadow: var(--shadow-md); padding: var(--s-4);
}
@media (min-width: 480px) { .calc-card { padding: var(--s-5); } }
@media (min-width: 900px) {
  .calc-card { grid-template-columns: 380px 1fr; gap: var(--s-6); padding: var(--s-6); align-items: start; }
}

.calc-inputs { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field.is-disabled .field-label { color: var(--c-muted); }
.field-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.field-head .field-label { margin-bottom: 0; }
.field-label { display: block; font-weight: 600; font-size: var(--fs-16); margin-bottom: var(--s-2); padding: 0; color: var(--c-text); }
.hint { font-size: var(--fs-14); color: var(--c-muted); margin: var(--s-2) 0 0; line-height: 1.45; }
.field-error { display: flex; align-items: flex-start; gap: var(--s-2); margin: var(--s-2) 0 0; font-size: var(--fs-14); font-weight: 600; color: var(--c-danger); line-height: 1.45; }
.field-error .icon { margin-top: 1px; }
.field-pair { display: grid; grid-template-columns: 1fr; gap: var(--s-5); }
@media (min-width: 480px) { .field-pair { grid-template-columns: 1fr 1fr; gap: var(--s-4); } }
/* Several pairs inside one fieldset (bond and car finance lump sums): same spacing as between ordinary fields. */
fieldset.field > .hint + .field-pair { margin-top: var(--s-4); }
fieldset.field > .field-pair + .field-pair { margin-top: var(--s-5); }
.mode-note { font-size: var(--fs-14); color: var(--c-muted); margin: 0; padding: var(--s-2) var(--s-3); background: var(--c-surface); border-radius: var(--r-ctl); line-height: 1.45; }

.input {
  width: 100%; min-height: var(--input-h); padding: var(--s-2) var(--s-3);
  border: 1px solid var(--c-input-line); border-radius: var(--r-card); background: var(--c-input); color: var(--c-text);
  font-size: var(--fs-18); font-weight: 500; line-height: 1.3; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--c-muted); opacity: 1; font-weight: 400; }
.input:hover { border-color: var(--c-text); }
.input:focus-visible, .input:focus { outline: 2px solid var(--c-focus); outline-offset: 2px; border-color: var(--c-primary-line); }
.input[aria-invalid="true"] { border-color: var(--c-danger); background: var(--c-danger-soft); }
.input:disabled { background: var(--c-surface); color: var(--c-muted); border-color: var(--c-border); cursor: not-allowed; }
.input[readonly] { background: var(--c-surface); }
input[type="search"].input::-webkit-search-cancel-button { cursor: pointer; }

.input-affix { position: relative; display: flex; align-items: center; }
.affix { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; color: var(--c-muted); font-size: var(--fs-18); font-weight: 500; pointer-events: none; }
.affix-prefix { left: var(--s-3); }
.affix-suffix { right: var(--s-3); }
.input-affix:has(.affix-prefix) .input { padding-left: calc(var(--s-3) + 1.25em); }
.input-affix:has(.affix-suffix) .input { padding-right: calc(var(--s-3) + 1.5em); }

/* Range slider kept in sync with a text field (inputs.js data-sync). */
.range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: var(--tap); margin: var(--s-1) 0 0;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
.range::-webkit-slider-runnable-track { height: 6px; border-radius: var(--r-pill); background: var(--c-border); }
.range::-moz-range-track { height: 6px; border-radius: var(--r-pill); background: var(--c-border); }
.range::-moz-range-progress { height: 6px; border-radius: var(--r-pill); background: var(--c-primary); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: var(--c-elevated); border: 2px solid var(--c-primary-line); box-shadow: var(--shadow-md);
}
.range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--c-elevated); border: 2px solid var(--c-primary-line); box-shadow: var(--shadow-md);
}
.range:focus { outline: none; }
.range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.range:focus-visible::-moz-range-thumb { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.range:disabled { opacity: .5; cursor: not-allowed; }

/* Segmented toggle: visually hidden radios + labels */
.segmented { display: inline-flex; flex-wrap: wrap; margin: 0; padding: 3px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); gap: 2px; min-width: 0; }
.segmented-field .segmented { display: flex; }
.segmented-field .segmented label { flex: 1 1 0; }
.segmented input {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.segmented label {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: calc(var(--tap) - 6px); padding: 0 var(--s-3); border: 1px solid transparent; border-radius: 7px;
  font-weight: 600; font-size: var(--fs-16); color: var(--c-muted); cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s;
}
.segmented label:hover { color: var(--c-text); }
.segmented input:checked + label { background: var(--c-elevated); color: var(--c-primary-ink); border-color: var(--c-primary-line); box-shadow: var(--shadow); }
.segmented input:focus-visible + label { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.segmented input:disabled + label { opacity: .5; cursor: not-allowed; }
.segmented--sm { padding: 2px; }
/* A true 44px tap target: label plus the segmented control's own padding and border. */
.segmented--sm label { font-size: var(--fs-14); min-height: 44px; padding: 0 var(--s-3); }

.stepper { display: flex; align-items: stretch; gap: var(--s-2); max-width: 220px; }
.stepper .input { text-align: center; flex: 1 1 auto; min-width: 0; }
.stepper-btn {
  flex: none; width: 48px; min-height: 48px; border: 1px solid var(--c-input-line); border-radius: var(--r-ctl);
  background: var(--c-elevated); color: var(--c-primary-ink); font-size: var(--fs-20); font-weight: 600; line-height: 1;
  transition: background-color .15s, border-color .15s;
}
.stepper-btn:hover { background: var(--c-primary-soft); border-color: var(--c-primary-line); }
.stepper-btn:disabled { color: var(--c-muted); background: var(--c-surface); border-color: var(--c-border); cursor: not-allowed; }

/* ============ Results ============ */
.calc-results { min-width: 0; }
/* Receipt-style result card: paper, ink rule, green stamp shadow, torn bottom edge (::after, below). */
.result-card { position: relative; background: var(--c-elevated); border: var(--border-ink); border-radius: var(--r-card); box-shadow: 5px 5px 0 var(--c-primary); padding: var(--s-5) var(--s-5) calc(var(--s-5) + 8px); }
@media (min-width: 900px) { .result-card { padding: var(--s-6) var(--s-6) calc(var(--s-5) + 8px); } }
.result-label { font-size: var(--fs-12); font-weight: 600; color: var(--c-primary-ink); margin: 0 0 var(--s-2); text-transform: uppercase; letter-spacing: var(--ls-kicker); }
.result-headline {
  display: inline-block; margin: 0 0 var(--s-5) -6px; padding: 0 6px; font-family: var(--font-display); font-size: var(--fs-32); font-weight: 700; line-height: 1.1;
  color: var(--c-text); letter-spacing: -0.01em; background: linear-gradient(transparent 62%, var(--c-accent) 62%);
  overflow-wrap: anywhere;
}
@media (min-width: 900px) { .result-headline { font-size: var(--fs-40); } }
.result-list { margin: 0 0 var(--s-4); }
.result-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding: 7px 0; }
.result-row dt { display: flex; align-items: baseline; gap: 8px; flex: 1 1 auto; min-width: 0; color: var(--c-muted); }
.result-row dd { margin: 0; font-weight: 600; text-align: right; color: var(--c-text); flex: 0 1 auto; max-width: 60%; font-variant-numeric: tabular-nums; }
.result-sub { font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ls-caps); margin: var(--s-5) 0 var(--s-1); color: var(--c-primary-ink); }

/* Optional mini stat grid inside the result card (e.g. "with extra payment" vs "without"). */
.result-compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin: 0 0 var(--s-4); }
.result-compare > div { padding: var(--s-3); background: var(--c-elevated); border: 1px solid var(--c-result-line); border-radius: var(--r-ctl); min-width: 0; }
.result-compare dt, .result-compare .compare-label { font-size: var(--fs-12); font-weight: 600; color: var(--c-muted); margin: 0 0 2px; }
.result-compare dd, .result-compare .compare-value { margin: 0; font-size: var(--fs-18); font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.callout { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-ctl); font-size: var(--fs-14); line-height: 1.5; margin-top: var(--s-4); }
.callout p { margin: 0; }
.callout .icon { margin-top: 2px; }
.callout-warn { background: var(--c-warn-soft); border: 1px solid var(--c-warn-line); color: var(--c-text); }
.callout-warn .icon { color: var(--c-warn-ink); }
.callout-info { background: var(--c-elevated); border: 1px solid var(--c-border); color: var(--c-text); }
.callout-info .icon { color: var(--c-primary-ink); }

.estimate-note { font-size: var(--fs-14); color: var(--c-muted); margin: var(--s-3) 0 0; }

/* ============ Share bar ============ */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-4) 0 var(--s-6); }
/* The share bar acts on the result, so it is drawn as part of the calculator card: a top rule and a shared
   elevated background read as "answer, then what you can do with it" — one region, not a floating toolbar. */
.calc-card + .share-bar {
  margin-top: calc(-1 * var(--s-4));
  padding: var(--s-3) var(--s-4) var(--s-4);
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  border-top: none;
  border-radius: 0 0 var(--r-card) var(--r-card);
}
.share-status { font-size: var(--fs-14); color: var(--c-primary-ink); font-weight: 600; }
.share-status:empty { display: none; }
.share-fallback { flex: 1 1 100%; }
.share-fallback label { display: block; font-size: var(--fs-14); font-weight: 600; margin-bottom: var(--s-1); }
.share-fallback .input { font-size: var(--fs-14); }
@media (max-width: 479.98px) {
  .share-bar .btn { flex: 1 1 auto; }
}

/* ============ Panels and charts ============ */
.panel { background: var(--c-elevated); border: 1px solid var(--c-border-strong); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--s-4); margin-bottom: var(--s-5); min-width: 0; }
.panel > h2 { font-size: var(--fs-20); margin-bottom: var(--s-4); }
@media (min-width: 480px) { .panel { padding: var(--s-5); } }
@media (min-width: 900px) { .panel { padding: var(--s-5) var(--s-6) var(--s-6); } }

.chart { min-width: 0; }
.chart-plot { position: relative; width: 100%; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-grid { stroke: var(--c-border); stroke-width: 1; shape-rendering: crispEdges; fill: none; }
.chart-axis { fill: var(--c-muted); font-size: 12px; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.is-dashed, .is-dashed { stroke-dasharray: 6 5; }
.chart-guide { stroke: var(--c-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-marker { stroke: var(--c-muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart-marker-label { fill: var(--c-text); font-size: 12px; font-weight: 600; }
.chart-dot { stroke: var(--c-elevated); stroke-width: 2; }
.chart-bar { shape-rendering: crispEdges; }
.donut-seg { stroke: var(--c-elevated); stroke-width: 2; cursor: pointer; }
.donut-seg:hover { opacity: .88; }
.donut-center-label { fill: var(--c-muted); font-size: 13px; }
.donut-center-value { fill: var(--c-text); font-size: 20px; font-weight: 700; }

.stroke-0 { stroke: var(--c-series-0); }
.stroke-1 { stroke: var(--c-series-1); }
.stroke-2 { stroke: var(--c-series-2); }
.stroke-3 { stroke: var(--c-series-3); }
.fill-0 { fill: var(--c-series-0); }
.fill-1 { fill: var(--c-series-1); }
.fill-2 { fill: var(--c-series-2); }
.fill-3 { fill: var(--c-series-3); }
.bg-0 { background: var(--c-series-0); }
.bg-1 { background: var(--c-series-1); }
.bg-2 { background: var(--c-series-2); }
.bg-3 { background: var(--c-series-3); }

.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px; max-width: 260px;
  padding: var(--s-2) var(--s-3); background: var(--c-elevated); color: var(--c-text); border: 1px solid var(--c-border);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-lg);
  font-size: var(--fs-14); line-height: 1.45;
}
.chart-tip-title { font-weight: 600; margin-bottom: var(--s-1); }
.chart-tip-row { display: flex; align-items: center; gap: var(--s-2); }
.chart-tip-row span:last-child { margin-left: auto; padding-left: var(--s-3); font-weight: 600; white-space: nowrap; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

.chart-legend { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2) var(--s-5); margin: var(--s-4) 0 0; padding: 0; font-size: var(--fs-14); color: var(--c-text); }
.chart-legend li { display: inline-flex; align-items: center; gap: var(--s-2); }

/* ============ Tables ============ */
.table-block { min-width: 0; }
.table-wrap { overflow: auto; max-height: 32rem; border: 1px solid var(--c-border); border-radius: var(--r-ctl); -webkit-overflow-scrolling: touch; background: var(--c-elevated); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-14); }
.data-table th, .data-table td { padding: 10px var(--s-3); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--c-border); }
.data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--c-surface); font-weight: 600; font-size: var(--fs-12); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--c-muted); border-bottom-color: var(--c-border-strong); }
.data-table tbody th { font-weight: 400; }
.data-table tbody tr:nth-child(even) > * { background: var(--c-surface); }
.data-table tbody tr:hover > * { background: var(--c-hover); }
.data-table .num { text-align: right; }
.data-table tr.is-sub > * { color: var(--c-muted); }
.data-table tfoot > tr > *, .data-table tr.total > * { font-weight: 700; background: var(--c-result); border-bottom: 0; color: var(--c-text); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tfoot tr:first-child > * { border-top: 1px solid var(--c-border-strong); }

@media (max-width: 639px) {
  /* Wide tables scroll sideways, but the row label stays put so each number keeps its description. */
  .data-table:not(.data-table--stack) tbody th[scope="row"], .data-table:not(.data-table--stack) thead th:first-child, .data-table:not(.data-table--stack) tfoot th:first-child { position: sticky; left: 0; background-clip: padding-box; border-right: 1px solid var(--c-border-strong); }
  .data-table:not(.data-table--stack) tbody th[scope="row"] { z-index: 1; background: var(--c-elevated); max-width: 9.5rem; white-space: normal; min-width: 6.5rem; }
  .data-table:not(.data-table--stack) tbody tr:nth-child(even) > th[scope="row"] { background: var(--c-surface); }
  .data-table:not(.data-table--stack) thead th:first-child { z-index: 3; }
  .data-table:not(.data-table--stack) tfoot th:first-child, .data-table:not(.data-table--stack) tr.total > th { background: var(--c-result); z-index: 1; }
}

@media (max-width: 639px) {
  /* Tighter cells and wrapping headings so most tables fit without sideways scrolling. */
  .data-table { font-size: calc(var(--fs-14) - 1px); }
  .data-table th, .data-table td { padding: 8px 8px; }
  .data-table thead th { white-space: normal; vertical-align: bottom; }
}

@media (max-width: 639px) {
  .table-wrap:has(.data-table--stack) { max-height: none; overflow: visible; border: 0; background: transparent; }
  .data-table--stack, .data-table--stack tbody, .data-table--stack tfoot { display: block; }
  .data-table--stack thead { display: none; }
  .data-table--stack tfoot tr > * { background: var(--c-result) !important; border-top: 0; }
  .data-table--stack :is(tbody, tfoot) tr { display: block; margin-bottom: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-ctl); background: var(--c-elevated); overflow: hidden; }
  .data-table--stack :is(tbody, tfoot) tr > * { display: flex; justify-content: space-between; gap: var(--s-3); white-space: normal; text-align: right; background: transparent !important; border-bottom: 1px solid var(--c-border); }
  .data-table--stack :is(tbody, tfoot) tr > *::before { content: attr(data-label); color: var(--c-muted); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: var(--ls-caps); text-align: left; flex: 0 0 auto; padding-top: 2px; }
  .data-table--stack :is(tbody, tfoot) tr > :first-child { display: block; text-align: left; font-weight: 600; background: var(--c-surface) !important; }
  .data-table--stack :is(tbody, tfoot) tr > :first-child::before { display: none; }
  .data-table--lead2 :is(tbody, tfoot) tr > :first-child { display: flex; font-weight: 400; color: var(--c-muted); }
  .data-table--lead2 :is(tbody, tfoot) tr > :first-child::before { display: block; }
  .data-table--lead2 :is(tbody, tfoot) tr > :nth-child(2) { display: block; font-weight: 600; text-align: left; }
  .data-table--lead2 :is(tbody, tfoot) tr > :nth-child(2)::before { display: none; }
  .data-table--stack :is(tbody, tfoot) tr > :last-child { border-bottom: 0; }
}
.table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: var(--s-3); }
.copy-status { font-size: var(--fs-14); color: var(--c-primary-ink); font-weight: 600; }
.copy-status:empty { display: none; }

/* ============ Ad and partner slots ============ */
.ad-slot { position: relative; display: flex; align-items: center; justify-content: center; min-height: 250px; margin: var(--s-5) 0; background: var(--c-surface); border: 1px dashed var(--c-border-strong); border-radius: var(--r-ctl); }
.ad-label { position: absolute; top: var(--s-1); left: var(--s-2); font-size: var(--fs-12); color: var(--c-muted); text-transform: uppercase; letter-spacing: var(--ls-caps); }
.ad-slot--guide-mid { max-width: 68ch; }
.ad-slot--sidebar { display: none; }
@media (min-width: 1080px) { .ad-slot--sidebar { display: flex; min-height: 600px; } }

.partner-slot { margin: var(--s-5) 0; }
.partner-label { font-size: var(--fs-12); color: var(--c-muted); margin: 0 0 var(--s-1); }
.partner-card { display: block; padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-card); background: var(--c-elevated); box-shadow: var(--shadow); color: var(--c-text); text-decoration: none; }
.partner-card:hover { border-color: var(--c-primary-line); color: var(--c-text); }
.partner-name { display: block; font-weight: 700; }
.partner-blurb { display: block; margin-top: var(--s-1); color: var(--c-muted); }
.partner-cta { display: inline-block; margin-top: var(--s-3); font-weight: 600; color: var(--c-primary-ink); }
.partner-note { margin: var(--s-2) 0 0; font-size: var(--fs-14); color: var(--c-muted); }
.amount-picks { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-3) 0 0; padding: 0; list-style: none; }
.amount-picks a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-ctl); background: var(--c-surface); }

/* ============ Guide, FAQ, related ============ */
.guide { max-width: 68ch; margin: var(--s-8) 0 var(--s-6); font-size: var(--fs-18); line-height: 1.7; }
.guide h2 { margin-top: var(--s-7); font-size: var(--fs-24); }
.guide > h2:first-child { margin-top: 0; font-size: var(--fs-32); }
.guide h3 { margin-top: var(--s-5); }
.guide li { margin-bottom: var(--s-2); }
.guide li::marker { color: var(--c-muted); }
.guide-updated { font-size: var(--fs-14); color: var(--c-muted); }
.guide-example { background: var(--c-surface); border: 1px solid var(--c-border); border-left: 4px solid var(--c-primary-line); border-radius: var(--r-ctl); padding: var(--s-4) var(--s-5); margin: var(--s-4) 0 var(--s-5); font-size: var(--fs-16); font-variant-numeric: tabular-nums; }
.guide-example > :last-child { margin-bottom: 0; }
@media (max-width: 479.98px) { .guide { font-size: var(--fs-16); } .guide > h2:first-child { font-size: var(--fs-24); } }

.faq { max-width: 68ch; margin: var(--s-7) 0; }
.faq-item { border-bottom: 1px solid var(--c-border); }
.faq-item:first-of-type { border-top: 1px solid var(--c-border); }
.faq-item summary {
  list-style: none; position: relative; display: flex; align-items: center; min-height: 60px;
  padding: var(--s-3) var(--s-7) var(--s-3) 0; font-weight: 600; cursor: pointer; line-height: 1.4;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { content: ''; }
.faq-item summary::after {
  content: ''; position: absolute; right: var(--s-3); top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--c-primary-ink); border-bottom: 2px solid var(--c-primary-ink);
  transform: translateY(-70%) rotate(45deg); transition: transform .15s;
}
.faq-item[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq-item summary:hover { color: var(--c-primary-ink); }
.faq-answer { padding: 0 0 var(--s-4); color: var(--c-text); }
.faq-answer > :last-child { margin-bottom: 0; }

.related { margin: var(--s-7) 0 var(--s-6); }
.tile-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .tile-grid { grid-template-columns: repeat(3, 1fr); gap: var(--s-4); } }
.tile {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; column-gap: var(--s-4);
  align-items: start; padding: var(--s-4); background: var(--c-elevated); border: var(--border-ink);
  border-radius: var(--r-card); box-shadow: var(--shadow); color: var(--c-text); text-decoration: none;
  transition: background .15s, box-shadow .2s, transform .2s;
}
/* Search results on the home page have no icon, so they stack in one column instead of the icon-and-text grid. */
.finder-results .tile { grid-template-columns: 1fr; grid-template-rows: none; }
.finder-results .tile .tile-blurb { grid-column: 1; }
/* "Show all N results" sits inside the tile grid but spans its full width, so it reads as an action, not another tile. */
.finder-show-all { grid-column: 1 / -1; justify-self: stretch; }
a.tile:hover { border-color: var(--c-rule); background: var(--c-hover); color: var(--c-text); text-decoration: none; }
a.tile:hover .tile-name { color: var(--c-primary-ink); }
.tile-icon { grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 2px; border: var(--border-ink); background: transparent; color: var(--c-text); }
.tile-icon svg, .cat-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile-name { font-family: var(--font-display); font-size: var(--fs-18); font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; padding-right: var(--s-4); }
.tile-blurb { grid-column: 2; font-size: var(--fs-14); color: var(--c-muted); line-height: 1.5; margin-top: var(--s-1); }
.tile-arrow {
  position: absolute; top: calc(var(--s-4) + 8px); right: var(--s-4); width: 7px; height: 7px;
  border-top: 2px solid var(--c-text); border-right: 2px solid var(--c-text); transform: rotate(45deg); transition: transform .15s, border-color .15s;
}
a.tile:hover .tile-arrow { border-color: var(--c-primary-ink); transform: translateX(2px) rotate(45deg); }
.tile.is-soon { box-shadow: none; background: var(--c-surface); color: var(--c-muted); pointer-events: none; }
.tile.is-soon .tile-icon { background: var(--c-border); color: var(--c-muted); }
.tile.is-soon .tile-name { color: var(--c-muted); }
.tile-badge { grid-column: 2; justify-self: start; margin-top: var(--s-2); padding: 2px var(--s-2); border: 1px solid var(--c-border); border-radius: var(--r-pill); background: var(--c-elevated); font-size: var(--fs-12); font-weight: 600; color: var(--c-muted); }

.figures-checked, .disclaimer-line { font-size: var(--fs-14); color: var(--c-muted); max-width: 68ch; }
.figures-checked { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--c-border); }
.figures-checked a, .disclaimer-line a { color: var(--c-muted); }
.figures-checked a:hover, .disclaimer-line a:hover { color: var(--c-primary-ink); }

/* ============ Sticky mobile result ============ */
.sticky-result {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 56px; padding: var(--s-2) var(--gutter) calc(var(--s-2) + env(safe-area-inset-bottom, 0px));
  background: var(--c-elevated); border-top: 1px solid var(--c-border); box-shadow: 0 -6px 20px rgba(16, 24, 40, .08);
}
:root[data-theme="dark"] .sticky-result { box-shadow: 0 -6px 20px rgba(0, 0, 0, .5); }
.sticky-label { font-size: var(--fs-14); color: var(--c-muted); font-weight: 600; }
.sticky-value { font-size: var(--fs-20); font-weight: 700; color: var(--c-text); border-bottom: 3px solid var(--c-accent); line-height: 1.2; letter-spacing: -0.01em; }
/* Copy-to-clipboard icon button in the sticky bar: a 44px edge-anchored target, consistent with the share bar's copy. */
.sticky-copy {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0 var(--s-2); margin: 0 0 0 auto;
  border: 1px solid var(--c-border-strong); border-radius: var(--r-ctl);
  background: transparent; color: var(--c-primary-ink); cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.sticky-copy:hover { background: var(--c-primary-soft); border-color: var(--c-primary-line); }
.sticky-copy:active { transform: translateY(1px); }
.sticky-copy .icon { width: 20px; height: 20px; }
.sticky-copy-status { font-size: var(--fs-14); color: var(--c-primary-ink); font-weight: 600; }
.sticky-copy-status:empty { display: none; }
/* Slide-and-settle entry: transform-only, no layout shift. The animation restarts each time the bar is un-hidden. */
@keyframes sticky-enter { from { transform: translateY(100%); } 70% { transform: translateY(-4px); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: no-preference) { .sticky-result:not([hidden]) { animation: sticky-enter 280ms var(--ease-out); } }
@media (max-width: 899.98px) {
  body:has(.sticky-result:not([hidden])) { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 900px) { .sticky-result { display: none !important; } }

/* ============ Home ============ */
.hero { background: var(--c-bg); border-bottom: var(--border-ink); padding: var(--s-7) 0 var(--s-6); }
@media (min-width: 768px) { .hero { padding: 80px 0 var(--s-7); } }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-4); padding: 4px var(--s-3);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-pill); background: var(--c-elevated);
  font-size: var(--fs-14); font-weight: 600; letter-spacing: .02em; color: var(--c-text);
}
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); }
.hero h1 { max-width: 16ch; margin-bottom: var(--s-4); font-size: 2.25rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; }
@media (min-width: 768px) { .hero h1 { font-size: 3.25rem; } }
.hero-sub { font-size: var(--fs-18); color: var(--c-muted); max-width: 54ch; margin: 0; line-height: 1.55; }
@media (min-width: 768px) { .hero-sub { font-size: var(--fs-20); } }

.finder { max-width: 560px; margin-top: var(--s-6); }
.hero-chips { margin-top: var(--s-4); }
.hero-chips .chip { text-decoration: none; }
.hero-chips .chip:hover { background: var(--c-primary-soft); border-color: var(--c-primary-line); color: var(--c-primary-ink); }
.finder-label { display: block; font-weight: 600; margin-bottom: var(--s-2); }
.finder-field { position: relative; }
.finder-field .icon { position: absolute; left: var(--s-4); top: 50%; transform: translateY(-50%); color: var(--c-muted); pointer-events: none; width: 20px; height: 20px; }
.finder-field .input { min-height: 56px; padding-left: 48px; font-size: var(--fs-18); border-radius: 10px; box-shadow: var(--shadow); }
.finder-status { font-size: var(--fs-14); color: var(--c-muted); margin: var(--s-2) 0 0; min-height: 1.5em; }
.finder-empty { padding: var(--s-6) var(--s-5); text-align: center; color: var(--c-muted); background: var(--c-surface); border: 1px dashed var(--c-border-strong); border-radius: var(--r-card); margin: 0 0 var(--s-7); }

.trust-list { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: var(--s-5) 0 0; padding: 0; font-size: var(--fs-14); font-weight: 600; color: var(--c-muted); }
.trust-list li { display: inline-flex; align-items: center; gap: var(--s-2); }
.trust-list .icon { color: var(--c-primary-ink); width: 18px; height: 18px; }

.home-sections { padding-top: var(--s-7); }
/* Latest update line on the home page, and the dated updates log at /updates/. */
.update-strip { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-3); margin: 0 0 var(--s-6); padding: var(--s-3) var(--s-4); background: var(--c-elevated); border: 1px solid var(--c-border); border-radius: var(--r-card); font-size: var(--fs-14); }
.update-strip-label { font-weight: 600; color: var(--c-primary-ink); }
.update-strip-date { color: var(--c-muted); font-variant-numeric: tabular-nums; }
.update-strip-text { flex: 1 1 18rem; color: var(--c-text); }
.update-strip-link { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.update-list { list-style: none; margin: var(--s-6) 0; padding: 0; }
.update-entry { padding: var(--s-5) 0; border-top: 1px solid var(--c-border); }
.update-entry:first-child { border-top: 0; padding-top: 0; }
.update-entry h2 { margin: 0 0 var(--s-2); font-size: var(--fs-20); }
.update-date { margin: 0 0 var(--s-1); color: var(--c-muted); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.update-meta { margin: var(--s-2) 0 0; font-size: var(--fs-14); color: var(--c-muted); overflow-wrap: break-word; }
.category-section { margin: 0 0 var(--s-7); }
.category-section h2 { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-24); margin-bottom: var(--s-4); }
.cat-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 2px; border: var(--border-ink); background: transparent; color: var(--c-text); flex: none; }
.home-about { max-width: 68ch; padding-top: var(--s-6); border-top: 1px solid var(--c-border); }
.home-about h2 { font-size: var(--fs-24); }
.home-about p { color: var(--c-text); }

/* ============ Simple article pages (About, legal, 404) ============ */
.article { max-width: 68ch; padding: var(--s-6) 0 var(--s-6); font-size: var(--fs-18); line-height: 1.7; }
.article h1 { margin-bottom: var(--s-3); }
.article h2 { font-size: var(--fs-24); margin-top: var(--s-7); }
.article h3 { margin-top: var(--s-5); }
.article li { margin-bottom: var(--s-2); }
.article-updated { font-size: var(--fs-14); color: var(--c-muted); margin-bottom: var(--s-6); }
.article .lead { margin-bottom: var(--s-5); font-size: var(--fs-20); }
.article-note { font-size: var(--fs-16); padding: var(--s-4) var(--s-5); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-ctl); }
.contact-email { font-size: var(--fs-20); font-weight: 600; padding: var(--s-4) var(--s-5); background: var(--c-elevated); border: 1px solid var(--c-border); border-radius: var(--r-ctl); display: inline-block; user-select: all; }
@media (max-width: 479.98px) { .article { font-size: var(--fs-16); } }

.not-found { padding: var(--s-8) 0 var(--s-6); max-width: 720px; }
.not-found .code { font-size: var(--fs-14); font-weight: 600; color: var(--c-muted); letter-spacing: var(--ls-caps); text-transform: uppercase; margin-bottom: var(--s-2); }
.category-links { list-style: none; margin: var(--s-5) 0 var(--s-6); padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
@media (min-width: 560px) { .category-links { grid-template-columns: 1fr 1fr; } }
.category-link {
  display: flex; align-items: center; gap: var(--s-3); min-height: 64px; padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-border); border-radius: var(--r-card); background: var(--c-elevated); box-shadow: var(--shadow);
  color: var(--c-text); font-weight: 600; text-decoration: none;
}
.category-link:hover { border-color: var(--c-primary-line); color: var(--c-primary-ink); text-decoration: none; }

/* ============ Utilities ============ */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============ Ledger components: receipt lines, result slip, hero slip, team note, figures register ============
   Paper, ink rules and dotted leaders. Tokens only. */



/* Ledger lines: label, dotted leader, value */
.ln { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-14); color: var(--c-muted); }
.ln > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln i { flex: 1; min-width: 12px; border-bottom: 1.5px dotted var(--c-border-strong); transform: translateY(-3px); }
.ln b { color: var(--c-text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ln-last { color: var(--c-text); font-weight: 600; }
.ln-last b { background: linear-gradient(transparent 58%, var(--c-accent) 58%); padding: 0 3px; font-weight: 700; }
.tile-ex { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--c-border-strong); }

/* Receipt-style result: torn bottom edge and dotted leaders */
.result-card::after { content: ""; position: absolute; left: -1.5px; right: -1.5px; bottom: -1.5px; height: 9px; background: radial-gradient(circle at 50% 100%, var(--c-bg) 0 4px, transparent 4.6px) 0 0 / 14px 9px repeat-x; pointer-events: none; }
.result-row dt::after { content: ""; flex: 1 1 auto; min-width: 16px; border-bottom: 1.5px dotted var(--c-border-strong); transform: translateY(-4px); order: 2; }
.result-row.is-strong dt { color: var(--c-text); font-weight: 600; }
.result-row.is-strong dd { background: linear-gradient(transparent 62%, var(--c-accent) 62%); padding: 0 3px; font-weight: 700; }
:root[data-theme="dark"] .result-row.is-strong dd { background: linear-gradient(transparent 86%, var(--c-accent) 86%); }
.result-sub, .result-group { padding-top: var(--s-3); border-top: var(--border-ink); }

/* Home hero: copy on the left, a worked slip on the right */
.hero-grid { display: grid; gap: var(--s-6); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--s-7); } }
.hero h1 .mark { background: linear-gradient(transparent 66%, var(--c-accent) 66%); }
.trust-list li::before { content: "\2014\00a0"; color: var(--c-primary-ink); }
.trust-list svg { display: none; }
.slip { display: flex; flex-direction: column; gap: var(--s-2); background: var(--c-elevated); border: var(--border-ink); padding: var(--s-5); color: var(--c-text); text-decoration: none; transform: rotate(-1.2deg); box-shadow: 6px 6px 0 var(--c-primary); transition: transform .2s; }
.slip:hover { transform: rotate(0deg); text-decoration: none; color: var(--c-text); }
.slip .ln { font-size: var(--fs-16); padding: 3px 0; }
.slip-kicker { font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--ls-kicker); text-transform: uppercase; color: var(--c-primary-ink); }
.slip-title { font-family: var(--font-display); font-size: var(--fs-24); font-weight: 700; margin-bottom: var(--s-2); border-bottom: var(--border-ink); padding-bottom: var(--s-2); }
.slip-foot { margin-top: var(--s-3); font-size: var(--fs-12); color: var(--c-muted); }
@media (prefers-reduced-motion: reduce) { .slip, .slip:hover { transform: none; transition: none; } }

/* Note from the team */
.team-note { max-width: 46rem; margin: var(--s-7) 0; padding: var(--s-5) var(--s-5) var(--s-4); border-left: 4px solid var(--c-primary); background: var(--c-elevated); border-top: 1px solid var(--c-border-strong); border-bottom: 1px solid var(--c-border-strong); border-right: 1px solid var(--c-border-strong); }
.team-note h2 { font-size: var(--fs-20); }
.team-note p { max-width: 62ch; }
.team-sign { font-family: var(--font-display); font-weight: 700; margin-bottom: 0; }

/* Figures register */
.status { display: inline-block; font-size: var(--fs-12); font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border: var(--border-ink); border-radius: 2px; background: var(--c-elevated); }
.status-verified, .status-definition { background: var(--c-result); }
.status-partly, .status-derived, .status-assumption { background: var(--c-warn-soft); }
.status-unverified, .status-not-shown { background: var(--c-danger-soft); }
.status-note { display: block; margin-top: 4px; font-size: var(--fs-12); font-weight: 400; color: var(--c-muted); }
.data-table--register td, .data-table--register th { white-space: normal; vertical-align: top; }
.data-table--register thead th:nth-child(1) { min-width: 14rem; }
.data-table--register thead th:nth-child(3) { min-width: 12rem; }
.table-wrap:has(.data-table--register) { max-height: none; }
.data-table--register td:last-child { white-space: nowrap; }
.status-wrap { display: block; }
@media (max-width: 639px) { .status-wrap { text-align: right; } .status-wrap .status { text-align: left; } .data-table--register tbody tr > :first-child { font-weight: 600; } .data-table--register td:last-child { white-space: normal; } }

/* Dark mode: keep light text off the gold, so the highlight becomes an underline */
:root[data-theme="dark"] .result-headline, :root[data-theme="dark"] .ln-last b, :root[data-theme="dark"] .hero h1 .mark { background: linear-gradient(transparent 84%, var(--c-accent) 84%); }

@media print {
  .site-header, .site-footer, .share-bar, .sticky-result, .ad-slot, .partner-slot, .theme-toggle, .table-actions, .related { display: none !important; }
  .calc-card, .panel { box-shadow: none; }
  body { background: #fff; color: #000; }
}

/* Stacked segmented toggle for longer option labels (full-width choices on phones). */
.segmented--stack { display: flex; flex-direction: column; width: 100%; }
@media (min-width: 640px) { .segmented--stack { flex-direction: row; } .segmented--stack label { flex: 1 1 0; text-align: center; } }


/* Tip jar link in the footer. */
.footer-tip { margin-top: var(--s-4); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); color: var(--c-muted); font-size: var(--fs-14); }
.btn-tip { min-height: var(--tap); }

/* ============ Toolkit: declarative tools, repeatable rows, exports ============ */
.form-heading { font-size: var(--fs-20); margin: var(--s-3) 0 0; }
.check { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--c-primary); }
.input-affix.has-unit .input { padding-right: calc(var(--s-3) + 2.5em); }
.affix.unit { font-size: var(--fs-14); }
select.input, textarea.input { width: 100%; }
textarea.input { min-height: 88px; resize: vertical; }

.rows { min-width: 0; }
.rows-list { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
.row-item { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); align-items: end; padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-ctl); background: var(--c-surface); min-width: 0; }
.row-cell { min-width: 0; }
.row-cell:first-child { grid-column: 1 / -1; }
.row-label { display: block; margin-bottom: var(--s-1); font-size: var(--fs-14); font-weight: 600; color: var(--c-muted); }
.row-remove { grid-column: 1 / -1; justify-self: end; min-height: var(--tap); }
@media (min-width: 900px) {
  .is-wide .row-item { grid-template-columns: minmax(170px, 2fr) repeat(auto-fit, minmax(120px, 1fr)); }
  .is-wide .row-cell:first-child { grid-column: auto; }
  .is-wide .row-remove { grid-column: auto; justify-self: stretch; }
}
.calc-card.is-wide { grid-template-columns: 1fr; }
@media (min-width: 900px) { .calc-card.is-wide { grid-template-columns: 1fr; } }
.is-wide .calc-results { max-width: 720px; }

.result-group { margin: var(--s-4) 0 var(--s-1); font-size: var(--fs-14); font-weight: 600; color: var(--c-muted); }
.result-row.is-strong dt, .result-row.is-strong dd { font-weight: 700; }
.result-row.is-sub dt { padding-left: var(--s-4); color: var(--c-muted); }
.export-note { flex-basis: 100%; margin: 0; font-size: var(--fs-14); color: var(--c-muted); }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* Section identity: one colour stripe per section, drawn from the chart series tokens. */
.sec-budget, .sec-home { --sec-color: var(--c-primary); }
.sec-business, .sec-tools { --sec-color: var(--c-accent); }
.sec-cars { --sec-color: var(--c-series-3); }
.sec-study { --sec-color: var(--c-series-2); }
.sec-guides { --sec-color: var(--c-chart-4); }
.sec-hero { border-top: 4px solid var(--sec-color, var(--c-primary)); }
.tool-page .page-intro h1 { border-left: 4px solid var(--sec-color, var(--c-primary)); padding-left: var(--s-3); }
.section-switcher ul { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-6) 0; padding: 0; list-style: none; }
.section-switcher a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-4); border: 1px solid var(--c-border-strong); border-radius: var(--r-pill); background: var(--c-elevated); font-weight: 600; font-size: var(--fs-14); }
.section-switcher a[aria-current="page"] { background: var(--c-primary-soft); border-color: var(--c-primary-line); color: var(--c-primary-ink); }
.section-about { margin-top: var(--s-6); }

@media print {
  /* Reports print in the light paper-and-ink colours whatever theme is on screen, on white paper to save ink. Tokens only.
     Every token the dark theme changes is reset here, or a dark value (light ink lines, dark shadows) would reach the page. */
  :root, :root[data-theme="dark"] {
    --c-primary: #0B6E4F; --c-primary-dark: #08553D; --c-primary-soft: #DCE7D3; --c-accent: #F2A900;
    --c-text: #1B2420; --c-muted: #55594F; --c-border: #D8CEB8; --c-border-strong: #B3A78C; --c-rule: #1B2420;
    --c-bg: #FFFFFF; --c-elevated: #FFFFFF; --c-input: #FFFFFF; --c-surface: #F6F0E4; --c-hover: #EBE2CE; --c-input-line: #7A745F;
    --c-result: #E3EAD6; --c-result-line: rgba(11, 110, 79, .22); --c-primary-ink: #0B6E4F; --c-logo-bar: #3F9A5F; --c-primary-line: #0B6E4F;
    --c-on-primary: #FFFFFF; --c-focus: #0B6E4F; --c-danger: #B42318; --c-danger-soft: #FEF3F2;
    --c-series-0: #0B6E4F; --c-warn-soft: #FFF6E0; --c-warn-line: #F3D48A; --c-warn-ink: #8A5A00;
    --c-chart-3: #5B6B7A; --c-chart-4: #2F6EB5;
    --shadow: none; --shadow-md: none; --shadow-lg: none;
    color-scheme: light;
  }
  .breadcrumbs, .export-bar, .row-remove, .row-add, .guide, .faq, .figures-checked, .disclaimer-line, .hint, .page-intro .lead, .section-switcher { display: none !important; }
  .calc-card, .calc-card.is-wide { display: block; border: 0; padding: 0; }
  .row-item { break-inside: avoid; border: 1px solid var(--c-border); }
  .panel, .result-card { break-inside: avoid; }
  .input { border: 0; background: transparent; padding: 0; appearance: none; }
  .input-affix .affix { position: static; }
}

/* ============ Printable documents (invoice, quote, statement, letter) ============ */
.doc-hint { margin: 0 0 var(--s-4); color: var(--c-muted); font-size: var(--fs-14); }
.doc-sheet { max-width: 800px; margin: 0 auto; padding: var(--s-5); border: 1px solid var(--c-border-strong); border-radius: var(--r-ctl); background: var(--c-elevated); font-size: var(--fs-14); line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) { .doc-sheet { padding: var(--s-6); } }
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-5); }
.doc-brand { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.doc-logo { max-width: 180px; max-height: 80px; width: auto; height: auto; object-fit: contain; align-self: flex-start; }
.doc-party p { margin: 0; }
.doc-party h3, .doc-block h3 { margin: 0 0 var(--s-1); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
.doc-title { text-align: right; }
.doc-title h2 { margin: 0 0 var(--s-2); font-size: var(--fs-24); color: var(--c-primary-ink); }
.doc-title dl { margin: 0; }
.doc-title dl > div { display: flex; justify-content: flex-end; gap: var(--s-3); }
.doc-title dt { color: var(--c-muted); }
.doc-title dd { margin: 0; font-weight: 600; }
.doc-parties { margin-bottom: var(--s-5); }
.doc-table, .doc-totals { width: 100%; border-collapse: collapse; }
.doc-table th, .doc-table td { padding: var(--s-2); border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
.doc-table thead th { border-bottom: 2px solid var(--c-border-strong); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); }
.doc-sheet .num { text-align: right; white-space: nowrap; }
.doc-totals { width: 100%; max-width: 340px; margin: var(--s-4) 0 var(--s-5) auto; }
.doc-totals td { padding: var(--s-1) var(--s-2); }
.doc-grand td { border-top: 2px solid var(--c-border-strong); font-size: var(--fs-18); font-weight: 700; }
.doc-block { margin-bottom: var(--s-4); }
.doc-block p { margin: 0; }
.doc-sign { display: grid; grid-template-columns: 1fr; gap: var(--s-2); margin-top: var(--s-6); max-width: 420px; }
.doc-sign p { margin: var(--s-3) 0 0; }
.doc-line { border-bottom: 1px solid var(--c-text); height: 28px; }
.doc-notice { margin-top: var(--s-5); color: var(--c-muted); font-size: var(--fs-12); }
@media (max-width: 599.98px) { .doc-title { text-align: left; } .doc-title dl > div { justify-content: flex-start; } .doc-table { min-width: 30rem; } }
.doc-scroll { overflow-x: auto; }

@media print {
  .has-doc .page-intro, .has-doc .calc-card, .has-doc .estimate-note, .has-doc .related, .has-doc .doc-panel > h2, .has-doc .doc-hint, .has-doc .ad-slot, .has-doc .panel:not(.doc-panel) { display: none !important; }
  .has-doc .doc-panel { border: 0; padding: 0; margin: 0; box-shadow: none; }
  .doc-sheet { border: 0; padding: 0; max-width: none; font-size: 11pt; }
  .doc-table thead { display: table-header-group; }
  .doc-table tr { break-inside: avoid; }
}

/* ============ Text outputs and file tools ============ */
.out-text-field { margin-top: var(--s-4); }
.out-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-14); min-height: 120px; }
.out-text-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-2); }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.file-item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-ctl); background: var(--c-surface); }
.file-item .file-name { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.file-item .file-size { color: var(--c-muted); font-size: var(--fs-14); }
.file-item .btn { min-height: var(--tap); }
.file-drop { border: 2px dashed var(--c-input-line); border-radius: var(--r-card); padding: var(--s-5); text-align: center; background: var(--c-surface); }
.file-drop.is-over { border-color: var(--c-primary-line); background: var(--c-primary-soft); }
.download-list { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.download-list a.btn { text-decoration: none; }
.text-result { width: 100%; min-height: 12rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-14); line-height: 1.5; resize: vertical; margin-bottom: var(--s-3); }
.preview-img { max-width: 100%; max-height: 320px; height: auto; border: 1px solid var(--c-border); border-radius: var(--r-ctl); background: var(--c-surface); }
.privacy-note { font-size: var(--fs-14); color: var(--c-muted); margin: var(--s-3) 0 0; }
.util-card .calc-inputs { max-width: 760px; }
.qr-box { margin-top: var(--s-4); max-width: 320px; border: 1px solid var(--c-border-strong); border-radius: var(--r-ctl); overflow: hidden; background: var(--c-bg); }
.qr-box svg { display: block; width: 100%; height: auto; }
@media print { .qr-box { border: 0; } }
.calc-inputs:not(:has(*)) { display: none; }
.calc-card:has(> .calc-inputs:not(:has(*))) { grid-template-columns: 1fr; }

/* ============ CV builder ============ */
.import-box { margin-bottom: var(--s-5); }
.import-box h2 { margin-top: 0; }
.import-status { margin: var(--s-3) 0 0; }
.cv-sheet { color: var(--c-text); }
.cv-name { margin: 0; font-size: var(--fs-24); color: var(--c-primary-ink); }
.cv-headline { margin: var(--s-1) 0 0; color: var(--c-muted); }
.cv-contact-line { margin: var(--s-3) 0 var(--s-4); padding-bottom: var(--s-3); border-bottom: 2px solid var(--c-border-strong); }
.cv-section { margin-bottom: var(--s-4); }
.cv-section h3 { margin: 0 0 var(--s-2); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .08em; color: var(--c-primary-ink); border-bottom: 1px solid var(--c-border); padding-bottom: var(--s-1); }
.cv-section p, .cv-section ul { margin: 0; }
.cv-item { margin-bottom: var(--s-3); break-inside: avoid; }
.cv-item-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-1) var(--s-4); }
.cv-item-head p { margin: 0; }
.cv-when { color: var(--c-muted); white-space: nowrap; }
.cv-item ul { margin: var(--s-1) 0 0; padding-left: 1.2em; }
.cv-note { margin: var(--s-1) 0 0; color: var(--c-muted); }
.cv-tags, .cv-contact { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); }
.cv-contact { flex-direction: column; }
.cv-sidebar .cv-head { margin-bottom: var(--s-4); padding-bottom: var(--s-3); border-bottom: 2px solid var(--c-border-strong); }
.cv-cols { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 640px) { .cv-cols { grid-template-columns: 11rem 1fr; gap: var(--s-5); } }
.cv-side .cv-tags { flex-direction: column; }
@media print {
  .has-doc .import-box { display: none !important; }
  .cv-sheet { font-size: 10.5pt; }
  .cv-cols { grid-template-columns: 11rem 1fr; }
  .cv-section { break-inside: avoid-page; }
}

/* Payday Dash game */
.pd-card { display: block; }
.pd-controls { display: grid; gap: var(--s-3); margin-bottom: var(--s-4); max-width: 34rem; }
.pd-help { margin: 0; color: var(--c-muted); font-size: var(--fs-14); }
.pd-stage { display: grid; gap: var(--s-3); justify-items: center; }
.pd-canvas { display: block; width: min(100%, calc(min(72vh, 640px) * 0.642857)); height: auto; aspect-ratio: 9 / 14; background: var(--c-surface); border: 2px solid var(--c-border-strong); border-radius: var(--r-ctl); box-shadow: 0 6px 20px color-mix(in srgb, var(--c-text) 14%, transparent); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.pd-canvas:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.pd-actions { display: flex; gap: var(--s-3); justify-content: center; }
.pd-status { margin: 0; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Score box at the end of a game or quiz: one look shared with the tick-list score. */
.pd-over, .tick-score { padding: var(--s-4) var(--s-5); background: var(--c-result); border: 1px solid var(--c-result-line); border-radius: var(--r-ctl); font-variant-numeric: tabular-nums; }
.pd-over { margin-top: var(--s-4); }
.pd-over h2 { margin-top: 0; }
.pd-result { font-size: var(--fs-20); font-weight: 700; margin: 0 0 var(--s-2); }
.pd-line, .pd-real { margin: 0 0 var(--s-3); }
@media (prefers-reduced-motion: reduce) { .pd-canvas { scroll-behavior: auto; } }

/* Learner licence practice test (CarMzansi) */
.quiz-card { display: block; }
.quiz-modes { border: 0; margin: 0 0 var(--s-4); padding: 0; }
.quiz-mode { display: flex; gap: var(--s-3); align-items: flex-start; min-height: var(--tap); padding: var(--s-2) 0; cursor: pointer; }
.quiz-mode input { margin-top: 4px; width: 20px; height: 20px; flex: none; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.quiz-count { margin: 0; font-variant-numeric: tabular-nums; color: var(--c-muted); }
.quiz-bar { height: 6px; border-radius: 3px; background: var(--c-border); margin: var(--s-2) 0 var(--s-4); overflow: hidden; }
.quiz-bar-fill { display: block; height: 100%; background: var(--c-primary); }
.quiz-q { margin: 0 0 var(--s-4); font-size: var(--fs-18); line-height: 1.4; }
.quiz-q:focus { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.quiz-options { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.quiz-option { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: var(--s-3); text-align: left; font: inherit; color: var(--c-text); background: var(--c-elevated); border: 1px solid var(--c-input-line); border-radius: var(--r-ctl); cursor: pointer; }
.quiz-option:hover:not(:disabled) { background: var(--c-hover); border-color: var(--c-primary-line); }
.quiz-option:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.quiz-option:disabled { cursor: default; color: var(--c-text); }
.quiz-option.is-right { background: var(--c-result); border: 2px solid var(--c-primary-line); }
.quiz-option.is-wrong { background: var(--c-danger-soft); border: 2px solid var(--c-danger); }
.quiz-letter { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--c-border-strong); font-weight: 600; font-size: var(--fs-14); }
.quiz-opt-text { flex: 1; }
.quiz-tag { flex: none; font-size: var(--fs-14); font-weight: 600; color: var(--c-text); }
.quiz-feedback { margin-top: var(--s-4); }
.quiz-verdict, .quiz-line { padding: var(--s-3) var(--s-4); border-radius: var(--r-ctl); margin: 0 0 var(--s-2); border: 1px solid var(--c-border); }
.quiz-verdict.is-right, .quiz-line.is-right { background: var(--c-result); border-color: var(--c-result-line); }
.quiz-verdict.is-wrong, .quiz-line.is-wrong { background: var(--c-danger-soft); border-color: var(--c-danger); }
.quiz-source, .quiz-note { color: var(--c-muted); font-size: var(--fs-14); margin: 0 0 var(--s-3); }
.quiz-table { width: 100%; border-collapse: collapse; margin-bottom: var(--s-3); font-variant-numeric: tabular-nums; }
.quiz-table th, .quiz-table td { text-align: left; padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-border); }
.quiz-review { padding-left: 0; list-style: none; display: grid; gap: var(--s-3); }
.quiz-review-item { padding: var(--s-3) var(--s-4); border: 1px solid var(--c-border); border-left-width: 4px; border-radius: var(--r-ctl); }
.quiz-review-item.is-right { border-left-color: var(--c-primary-line); }
.quiz-review-item.is-wrong { border-left-color: var(--c-danger); }
.quiz-review-item p { margin: 0 0 var(--s-2); }

/* Clock tools: timer, stopwatch, countdown */
.clock-card { display: block; text-align: center; }
.clock-setup { margin: 0 auto var(--s-4); padding: 0; border: 0; max-width: 34rem; display: grid; gap: var(--s-3); text-align: left; min-width: 0; }
.clock-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: var(--s-3); }
.clock-inputs-wide { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.clock-presets { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.clock-presets .btn { min-height: var(--tap); }
.clock-face { margin: var(--s-4) 0 var(--s-2); padding: var(--s-4) var(--s-3); background: var(--c-result); border: 2px solid var(--c-result-line); border-radius: var(--r-ctl); font-size: clamp(2.25rem, 12vw, 4.5rem); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: .01em; color: var(--c-text); overflow-wrap: anywhere; }
.clock-face-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); font-size: inherit; }
.clock-face-grid > div { display: grid; gap: var(--s-1); min-width: 0; }
.clock-num { font-size: clamp(1.75rem, 9vw, 3.5rem); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.clock-unit { font-size: var(--fs-14); font-weight: 600; color: var(--c-muted); }
.clock-title { margin: var(--s-4) 0 0; font-size: var(--fs-20); overflow-wrap: anywhere; }
.clock-state { margin: 0 0 var(--s-3); font-weight: 600; color: var(--c-muted); }
.clock-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: center; margin-bottom: var(--s-3); }
.clock-actions .btn { min-width: 7.5rem; min-height: 48px; }
.clock-sound { justify-content: center; }
.clock-card .field-error { margin-top: var(--s-2); }
.clock-card.is-done .clock-face { background: var(--c-warn-soft); border-color: var(--c-warn-line); color: var(--c-warn-ink); }
.clock-card.is-done .clock-state { color: var(--c-warn-ink); font-size: var(--fs-20); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .clock-card.is-done .clock-face { animation: clock-pulse 1.2s ease-in-out 4; }
  @keyframes clock-pulse { 50% { transform: scale(1.03); } }
}
.clock-laps { margin: var(--s-4) auto 0; max-width: 34rem; text-align: left; }
.clock-laps td, .clock-laps th { font-variant-numeric: tabular-nums; }
.clock-laps .lap-fastest td:last-child { color: var(--c-primary-ink); font-weight: 700; }
.clock-laps .lap-slowest td:last-child { color: var(--c-warn-ink); font-weight: 700; }

/* ============ Hubs, home and cross-links (restructure) ============ */
.hub-grid { grid-template-columns: 1fr; }
@media (min-width: 560px) { .hub-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .hub-grid { grid-template-columns: repeat(4, 1fr); } }
.hub-tile .tile-name { font-size: var(--fs-18); }
.hub-count { margin-top: auto; font-size: var(--fs-12); font-weight: 600; color: var(--c-primary-ink); font-variant-numeric: tabular-nums; }
.tile-date { grid-column: 1 / -1; margin-top: var(--s-2); font-size: var(--fs-12); color: var(--c-muted); }
.next-step, .also-use { margin: var(--s-7) 0 var(--s-6); }
.next-card { position: relative; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-7) var(--s-4) var(--s-4); background: var(--c-elevated); border: 1px solid var(--c-border-strong); border-left: 4px solid var(--c-primary); border-radius: var(--r-card); color: var(--c-text); text-decoration: none; min-height: var(--tap); }
.next-card:hover { border-color: var(--c-primary-line); text-decoration: none; }
.next-name { font-weight: 700; color: var(--c-primary-ink); }
.next-blurb { font-size: var(--fs-14); color: var(--c-muted); }
.next-card .tile-arrow { position: absolute; right: var(--s-4); top: 50%; transform: translateY(-50%) rotate(45deg); }
.next-notes { margin: var(--s-4) 0 0; padding-left: var(--s-5); }
.next-notes li { margin-bottom: var(--s-2); }
.also-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--s-2); }
@media (min-width: 640px) { .also-list { grid-template-columns: 1fr 1fr; } }
.also-list a { display: flex; flex-direction: column; gap: 2px; min-height: var(--tap); padding: var(--s-3) var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-ctl); background: var(--c-elevated); color: var(--c-text); text-decoration: none; }
.also-list a:hover { border-color: var(--c-primary-line); color: var(--c-primary-ink); }
.also-name { font-weight: 600; }
.also-blurb { font-size: var(--fs-14); color: var(--c-muted); }
@media print { .next-step, .also-use { display: none !important; } }

/* ============ Matric results by school (/matric/) ============ */
.matric-page .page-intro { padding-bottom: var(--s-4); }
.matric-page h2 { margin: var(--s-7) 0 var(--s-3); }
.matric-page .small, .matric-page .source-note { font-size: var(--fs-14); color: var(--c-muted); line-height: 1.55; max-width: 75ch; }
.matric-page .source-note a, .matric-page .small a { color: var(--c-primary-ink); }
.matric-page ul.plain { padding-left: 1.2em; line-height: 1.6; max-width: 75ch; }
.matric-page ul.plain li { margin: 0 0 var(--s-2); }
.matric-page .callout-warn { margin: var(--s-6) 0 var(--s-4); max-width: 75ch; }
.matric-page .data-table td.num, .matric-page .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.matric-page .data-table a { color: var(--c-primary-ink); }
.matric-page th[data-sort] { cursor: pointer; }
.matric-page th[data-sort]::after { content: ' \2195'; opacity: .45; }
.matric-page th[aria-sort="ascending"]::after { content: ' \25B2'; opacity: 1; }
.matric-page th[aria-sort="descending"]::after { content: ' \25BC'; opacity: 1; }
.table-wrap--tall { max-height: 40rem; }
.table-wrap--full { max-height: none; }
/* Link and text tables (official links on guide pages): let cells wrap instead of forcing one long line. */
.table-wrap--text { max-height: none; }
.table-wrap--text .data-table th, .table-wrap--text .data-table td { white-space: normal; overflow-wrap: break-word; }
/* These tables wrap instead of scrolling, so the first column needs no pinned, capped width. */
.table-wrap--text .data-table:not(.data-table--stack) tbody th[scope="row"] { position: static; max-width: none; min-width: 0; }
/* A link whose text is a long web address must wrap, not widen the page. break-word keeps whole words together
   (unlike anywhere, it does not let table columns shrink below their longest word). */
main a { overflow-wrap: break-word; }
.matric-page .tile-grid { margin-bottom: var(--s-5); }
.matric-page .tile { grid-template-columns: 1fr; row-gap: var(--s-2); }
.matric-page .tile .tile-blurb { grid-column: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); margin: 0 0 var(--s-5); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); background: var(--c-elevated); border: 1px solid var(--c-border); border-radius: var(--r-card); box-shadow: var(--shadow); }
.stat-label { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--c-muted); }
.stat-num { font-size: var(--fs-24); font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.chart-fig { margin: 0 0 var(--s-5); max-width: 560px; }
.chart-fig figcaption { font-size: var(--fs-14); color: var(--c-muted); margin-top: var(--s-2); }
.mm-chart { width: 100%; height: auto; display: block; }
.mm-chart .grid { stroke: var(--c-border); stroke-width: 1; }
.mm-chart .tick, .mm-chart .yr { fill: var(--c-muted); font-size: 12px; font-family: var(--font); }
.mm-chart .yr { font-size: 13px; }
.mm-chart .bar { fill: var(--c-series-0); }
.mm-chart .val { fill: var(--c-text); font-size: 13px; font-weight: 700; font-family: var(--font); }
.mm-chart .prov { stroke: var(--c-warn-ink); stroke-width: 2; stroke-dasharray: 5 4; }

.search-panel { padding: var(--s-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-card); }
.search-panel h2 { margin-top: 0; }
.matric-search, .table-filter { display: flex; flex-direction: column; gap: var(--s-2); }
.table-filter { margin: var(--s-4) 0; max-width: 28rem; }
.matric-search label, .table-filter label { font-weight: 600; font-size: var(--fs-16); }
.ms-results { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.ms-results a { display: flex; justify-content: space-between; gap: var(--s-3); min-height: var(--tap); padding: var(--s-3) var(--s-4); background: var(--c-elevated); border: 1px solid var(--c-border); border-radius: var(--r-ctl); text-decoration: none; color: var(--c-text); }
.ms-results a:hover { background: var(--c-hover); border-color: var(--c-border-strong); }
/* One hover for every link card: it lifts like a paper slip picked up. Each card keeps its own colour change. */
.category-link, .next-card, .also-list a, .ms-results a { transition: border-color .15s, background-color .15s, color .15s, box-shadow .2s, transform .2s; }
a.tile:hover, .category-link:hover, .next-card:hover, .also-list a:hover, .ms-results a:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
a.tile:active, .category-link:active, .next-card:active, .also-list a:active, .ms-results a:active { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .tile, a.tile:hover, a.tile:active, .category-link, .category-link:hover, .next-card:hover, .also-list a:hover, .ms-results a:hover { transform: none; transition: none; } }
.ms-name { font-weight: 600; }
.ms-meta { display: block; font-size: var(--fs-14); color: var(--c-muted); font-weight: 400; }
.ms-pass { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; align-self: center; }
@media print { .search-panel, .table-filter { display: none !important; } .table-wrap--tall { max-height: none; } }

/* Smoother page-to-page navigation: a short cross-fade where the browser supports cross-document view transitions. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
}

/* Just for fun: the tick-list and road-trip bingo. Tokens only; both work in dark mode. */
.tick-list { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: grid; gap: var(--s-1); }
.tick-list .check { font-weight: 400; padding: var(--s-1) 0; align-items: flex-start; }
.tick-list .check input { flex: none; margin-top: 2px; }
.tick-score { margin-bottom: var(--s-3); }
.tick-score-title { font-size: var(--fs-24); font-weight: 700; margin: 0 0 var(--s-1); }
.tick-score p { margin: 0 0 var(--s-2); }
.bingo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; margin: 0 0 var(--s-4); padding: 0; list-style: none; }
.bingo-cell { width: 100%; min-height: 76px; padding: 2px; display: flex; align-items: center; justify-content: center; text-align: center; font: inherit; font-size: var(--fs-12); line-height: 1.25; color: var(--c-text); background: var(--c-elevated); border: 1px solid var(--c-input-line); border-radius: var(--r-ctl); cursor: pointer; overflow-wrap: break-word; hyphens: manual; }
.bingo-cell:hover { background: var(--c-hover); border-color: var(--c-primary-line); }
.bingo-cell:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.bingo-cell[aria-pressed="true"] { background: var(--c-primary-soft); border: 2px solid var(--c-primary); font-weight: 700; }
.bingo-cell.is-free { border-style: dashed; }
.bingo-cell.is-line { background: var(--c-result); border-color: var(--c-primary-ink); }
@media (min-width: 640px) { .bingo-cell { min-height: 96px; font-size: var(--fs-14); padding: var(--s-2); } }
/* What costs more? (fun game): reuses the quiz option buttons; the label, unit and price stack inside each. */
.hl-option .quiz-opt-text { display: flex; flex-direction: column; gap: 2px; }
.hl-unit { font-size: var(--fs-14); color: var(--c-muted); }
.hl-price { font-size: var(--fs-20); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Matric results are easy to find: a header link on every screen size, a featured row at the top of the menu, and a search band on the home page. */
.nav-matric { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); border: var(--border-ink); border-radius: var(--r-pill); background: var(--c-primary-soft); color: var(--c-primary-ink); font-weight: 700; font-size: var(--fs-14); text-decoration: none; white-space: nowrap; }
.nav-matric:hover { background: var(--c-hover); color: var(--c-primary-ink); text-decoration: none; }
.nav-matric-short { display: none; }
@media (max-width: 479.98px) { .nav-matric-long { display: none; } .nav-matric-short { display: inline; } }
@media (max-width: 399.98px) { .nav-matric { padding: 0 10px; } .site-nav { gap: 0; } .header-inner { gap: var(--s-2); } }
@media (max-width: 374.98px) { .site-header .wordmark { font-size: var(--fs-18); gap: var(--s-2); } }
@media (max-width: 349.98px) { .site-header .theme-toggle { display: none; } }
.nav-feature { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4); border: var(--border-ink); border-radius: var(--r-card); background: var(--c-primary-soft); color: var(--c-text); text-decoration: none; }
.nav-feature:hover { background: var(--c-hover); color: var(--c-text); text-decoration: none; }
.nav-feature-name { font-weight: 700; color: var(--c-primary-ink); }
.nav-feature-note { font-size: var(--fs-14); color: var(--c-muted); }
.matric-feature { display: grid; grid-template-columns: 1fr; gap: var(--s-4); margin: 0 0 var(--s-6); padding: var(--s-5); background: var(--c-elevated); border: var(--border-ink); border-radius: var(--r-card); box-shadow: 5px 5px 0 var(--c-primary); }
.matric-feature h2 { margin: 0 0 var(--s-2); font-size: var(--fs-24); }
.matric-feature p { margin: 0 0 var(--s-2); }
.matric-feature .eyebrow { margin-bottom: var(--s-2); }
.matric-feature-form label { display: block; margin-bottom: var(--s-2); font-weight: 600; }
.matric-feature-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.matric-feature-row .input { flex: 1 1 14rem; width: auto; }
.matric-feature-row .btn { flex: 0 0 auto; }
.matric-feature .hint { margin: var(--s-2) 0 0; }
@media (min-width: 900px) { .matric-feature { grid-template-columns: 1.1fr 1fr; gap: var(--s-6); align-items: center; padding: var(--s-6); } }
@media print { .nav-matric, .matric-feature { display: none !important; } }
.ms-rank { color: var(--c-muted); font-variant-numeric: tabular-nums; }

/* Sports stars: long lists of names collapse under a summary. */
details.more { margin-top: var(--s-1, 4px); }
details.more > summary { cursor: pointer; color: var(--c-muted); min-height: 44px; display: inline-flex; align-items: center; }
details.more > summary:focus-visible { outline: 2px solid var(--c-focus, var(--c-primary)); outline-offset: 2px; }

/* Sports stars: one school per block, one person per line. */
.star-school { margin-top: var(--s-5, 24px); }
.star-school h3 { margin-bottom: var(--s-1, 4px); }
.star-count { color: var(--c-muted); font-size: var(--t-small, .875rem); font-weight: 400; }
.star-list { columns: 15rem; column-gap: var(--s-5, 24px); }
.matric-page ul.star-list { line-height: 1.5; }
.matric-page ul.star-list li { break-inside: avoid; margin: 0; padding: 3px 0; }

/* A changed calculator result flashes once; headings balance their lines and paragraphs avoid a single last word. */
@keyframes result-flash { from { background-color: color-mix(in srgb, var(--c-accent) 40%, transparent); } to { background-color: transparent; } }
/* A second beat on the same value: the sticky mobile bar confirms a change without competing with the headline flash. */
@keyframes sticky-flash { from { color: var(--c-accent); } to { color: var(--c-text); } }
@media (prefers-reduced-motion: no-preference) {
  .result-headline.is-updated { animation: result-flash 300ms var(--ease-out); }
  .sticky-value.is-updated { animation: sticky-flash 300ms var(--ease-out); }
  /* While the headline is "updated", dim the other rows so the answer stays the one focal point, then restore. */
  .result-card:has(.result-headline.is-updated) .result-list { opacity: .72; transition: opacity 300ms var(--ease-out); }
}
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* Home, less cluttered on phones: the worked slip is decoration, so it waits for a wider screen, and the section tiles
   go two to a row without their blurbs (the name and tool count are enough to choose; the hub page explains the rest). */
@media (max-width: 767px) { .hero-slip { display: none; } .hero { padding-bottom: var(--s-5); } .hero .finder { margin-top: var(--s-5); } }
@media (max-width: 559px) {
  .hub-grid { grid-template-columns: 1fr 1fr; gap: var(--s-2); }
  .hub-tile { grid-template-columns: 1fr; grid-template-rows: none; row-gap: var(--s-2); align-content: start; padding: var(--s-3); }
  .hub-tile .tile-icon { grid-row: auto; width: 34px; height: 34px; }
  .hub-tile .tile-name { padding-right: 0; font-size: var(--fs-16); line-height: 1.25; }
  .hub-tile .tile-blurb, .hub-tile .tile-arrow { display: none; }
  .hub-tile .hub-count { margin-top: 0; align-self: end; }
  .matric-feature { padding: var(--s-4); margin-bottom: var(--s-4); }
  .update-strip { margin-bottom: var(--s-4); }
}

/* /matric/2026/: countdown and live board */
.live-count { margin: 0 0 var(--s-5); padding: var(--s-5); background: var(--c-elevated); border: var(--border-ink); border-radius: var(--r-card); box-shadow: 5px 5px 0 var(--c-primary); }
.live-count-label { margin: 0 0 var(--s-2); font-size: var(--fs-14); font-weight: 600; letter-spacing: var(--ls-kicker); text-transform: uppercase; color: var(--c-primary-ink); }
.live-count-num { margin: 0 0 var(--s-2); font-family: var(--font-display); font-size: var(--fs-24); font-weight: 700; font-variant-numeric: tabular-nums; }
.live-count-num span { font-size: 2rem; }
.live-ics { margin: var(--s-4) 0 0; }
.live-ics .btn { max-width: 100%; white-space: normal; text-align: center; }
.live-board { margin: 0 0 var(--s-6); }
.live-wait { padding: var(--s-4); background: var(--c-surface); border: 1px dashed var(--c-border-strong); border-radius: var(--r-card); }
.live-stamp { margin: 0 0 var(--s-4); }
.live-board h3 { margin-top: var(--s-5); }
.stat-sub { display: block; margin-top: var(--s-1); font-size: var(--fs-12); color: var(--c-muted); }
