/* FutureOD — design tokens
   Paper is a cool exam-room white; ink is a deep slate; the accent is the
   blue of a trial-lens rim. Red and green come from the duochrome test and
   are used only to mean "below" / "above" the national figure. */
:root {
  --paper: #f3f5f7;
  --surface: #ffffff;
  --ink: #18212e;
  --muted: #576274;
  --rule: #d3d9e1;
  --rule-strong: #aeb7c3;
  --lens: #2147c4;
  --lens-ink: #1a389c;
  --lens-wash: #e6ebfa;
  --duo-red: #b8362d;
  --duo-red-wash: #f8e4e2;
  --duo-green: #23704a;
  --duo-green-wash: #e1f1e8;
  --amber: #8a5a00;
  --amber-wash: #fbf0d9;
  --radius-s: 4px;
  --radius-m: 10px;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --measure: 68ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10151d;
    --surface: #171e29;
    --ink: #e8edf3;
    --muted: #a3aebd;
    --rule: #2b3544;
    --rule-strong: #445063;
    --lens: #7f9bff;
    --lens-ink: #a9bbff;
    --lens-wash: #1e2a4a;
    --duo-red: #f0857c;
    --duo-red-wash: #3a1f1d;
    --duo-green: #6fd09d;
    --duo-green-wash: #173326;
    --amber: #f0c36b;
    --amber-wash: #3a2e14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #10151d;
    --surface: #171e29;
    --ink: #e8edf3;
    --muted: #a3aebd;
    --rule: #2b3544;
    --rule-strong: #445063;
    --lens: #7f9bff;
    --lens-ink: #a9bbff;
    --lens-wash: #1e2a4a;
    --duo-red: #f0857c;
    --duo-red-wash: #3a1f1d;
    --duo-green: #6fd09d;
    --duo-green-wash: #173326;
    --amber: #f0c36b;
    --amber-wash: #3a2e14;
    color-scheme: dark;
  }


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; }
a { color: var(--lens); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--lens-ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--lens); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); font-weight: 650; margin-top: 2.2em; }
h3 { font-size: 1.2rem; font-weight: 650; margin-top: 1.6em; }
p { margin: 0 0 1em; max-width: var(--measure); }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }
.small, small { font-size: 0.875rem; }
.muted { color: var(--muted); }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.wrap-narrow { width: min(760px, 100% - 32px); margin-inline: auto; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand b { color: var(--lens); font-weight: 800; }
.brand:hover { color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 0.95rem; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--lens); color: var(--ink); }

main { padding-bottom: 72px; }

/* Hero: the Snellen chart is the one loud element on the site */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--rule); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; }
.snellen {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 28px 24px 22px;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.05;
  overflow: hidden;
}
.snellen ol { list-style: none; margin: 0; padding: 0; }
.snellen li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 12px; padding: 5px 0; }
.snellen li span:first-child { letter-spacing: 0.12em; }
.snellen li span:last-child { font-family: var(--body); font-weight: 500; font-size: 0.72rem; color: var(--muted); text-transform: none; letter-spacing: 0; min-width: 4.2em; text-align: right; }
.snellen .r1 { font-size: clamp(4.2rem, 10vw, 6.6rem); letter-spacing: 0.06em; }
.snellen .r2 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); }
.snellen .r3 { font-size: clamp(1.35rem, 3vw, 1.9rem); }
.snellen .r4 { font-size: clamp(1.05rem, 2.3vw, 1.4rem); }
.snellen .r5 { font-size: clamp(0.85rem, 1.8vw, 1.05rem); }
.snellen .r6 { font-size: 0.78rem; }
.snellen .r7 { font-size: 0.6rem; }
.duochrome { display: grid; grid-template-columns: 1fr 1fr; margin-top: 14px; border-radius: var(--radius-s); overflow: hidden; font-family: var(--body); text-transform: none; font-weight: 600; font-size: 0.8rem; }
.duochrome span { padding: 6px 8px; }
.duochrome span:first-child { background: var(--duo-red-wash); color: var(--duo-red); }
.duochrome span:last-child { background: var(--duo-green-wash); color: var(--duo-green); }
@media (prefers-reduced-motion: no-preference) {
  .snellen li { animation: focus-in 900ms cubic-bezier(.2,.7,.2,1) both; }
  .snellen li:nth-child(2) { animation-delay: 70ms; }
  .snellen li:nth-child(3) { animation-delay: 140ms; }
  .snellen li:nth-child(4) { animation-delay: 210ms; }
  .snellen li:nth-child(5) { animation-delay: 280ms; }
  .snellen li:nth-child(6) { animation-delay: 350ms; }
  .snellen li:nth-child(7) { animation-delay: 420ms; }
  @keyframes focus-in { from { filter: blur(6px); opacity: 0.35; } to { filter: blur(0); opacity: 1; } }
}
.hero-copy .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 0.98rem; text-decoration: none; border: 1.5px solid var(--lens); cursor: pointer; font-family: var(--body); line-height: 1.2; }
.btn-primary { background: var(--lens); color: #fff; }
.btn-primary:hover { background: var(--lens-ink); border-color: var(--lens-ink); color: #fff; text-decoration: none; }
.btn-quiet { background: transparent; color: var(--lens); }
.btn-quiet:hover { background: var(--lens-wash); text-decoration: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Sections */
.section { padding: 48px 0 8px; }
.tools-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); margin-top: 8px; }
.tools-list a { display: block; padding: 22px 22px 22px 0; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--rule); }
.tools-list a + a { padding-left: 22px; border-left: 1px solid var(--rule); }
.tools-list a strong { display: block; font-family: var(--display); font-size: 1.2rem; color: var(--lens); margin-bottom: 4px; }
.tools-list a:hover strong { text-decoration: underline; }
.tools-list a span { color: var(--muted); font-size: 0.97rem; }

/* Cost-vs-cap chart */
.capchart { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 20px 20px 14px; margin-top: 16px; }
.capchart .legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.capchart .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; }
.caprow { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr) 5.4rem; align-items: center; gap: 10px; font-size: 0.88rem; padding: 3px 0; }
.caprow a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caprow a:hover { color: var(--lens); text-decoration: underline; }
.capbar { position: relative; height: 14px; background: transparent; }
.capbar .fed { position: absolute; left: 0; top: 0; bottom: 0; background: var(--lens); border-radius: 2px 0 0 2px; }
.capbar .gap { position: absolute; top: 0; bottom: 0; background: var(--duo-red); opacity: 0.85; border-radius: 0 2px 2px 0; }
.capbar .capline { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.caprow .val { text-align: right; color: var(--muted); }

/* Tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: var(--surface); white-space: nowrap; font-size: 0.85rem; }
thead th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--rule-strong); }
td.num, th.num { text-align: right; }
tbody tr:hover { background: var(--lens-wash); }
tbody tr:last-child td { border-bottom: 0; }
th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
th button.sort:focus-visible { outline: 3px solid var(--lens); outline-offset: 2px; }
th button.sort::after { content: ""; width: 0.8em; text-align: center; }
th[aria-sort="ascending"] button.sort::after { content: "▲"; font-size: 0.7em; }
th[aria-sort="descending"] button.sort::after { content: "▼"; font-size: 0.7em; }
th[aria-sort] { color: var(--ink); }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
.sub { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }

/* Status chips: duochrome logic */
.vs { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.vs.up { background: var(--duo-green-wash); color: var(--duo-green); }
.vs.down { background: var(--duo-red-wash); color: var(--duo-red); }
.vs.none { background: var(--paper); color: var(--muted); border: 1px solid var(--rule); }
.fit { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 650; white-space: nowrap; }
.fit-0 { background: var(--duo-green-wash); color: var(--duo-green); }
.fit-1 { background: var(--lens-wash); color: var(--lens-ink); }
.fit-2 { background: var(--amber-wash); color: var(--amber); }
.fit-3 { background: var(--duo-red-wash); color: var(--duo-red); }

/* Filters */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; margin: 20px 0 14px; }
.field { display: grid; gap: 4px; font-size: 0.88rem; font-weight: 600; }
.field input[type="search"], .field input[type="number"], .field input[type="email"], .field select {
  font: inherit; font-weight: 400; font-size: 1rem; padding: 9px 11px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius-s); background: var(--surface); color: var(--ink); min-width: 0;
}
.field input[type="search"] { width: min(320px, 80vw); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 0.92rem; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--lens); }
.comparebar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--rule); padding: 12px 0; margin-top: 16px; z-index: 2; }
.comparebar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* School page */
.crumbs { font-size: 0.88rem; margin: 28px 0 10px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.school-head { padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.school-head .where { color: var(--muted); font-size: 1.05rem; margin: 0; }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--rule-strong); font-size: 0.78rem; color: var(--muted); vertical-align: 2px; }
.tag.warn { border-color: var(--amber); color: var(--amber); background: var(--amber-wash); }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0 8px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.figures div { padding: 16px 16px 16px 0; }
.figures div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.figures dt { font-size: 0.85rem; color: var(--muted); }
.figures dd { margin: 2px 0 4px; font-family: var(--display); font-size: 1.85rem; font-weight: 700; line-height: 1.1; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 0.97rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.boards { display: grid; gap: 10px; margin-top: 8px; }
.boardrow { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 4rem; align-items: center; gap: 10px; font-size: 0.92rem; }
.track { position: relative; height: 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--lens); border-radius: 999px; }
.track .nat { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }
.pros, .cons { padding-left: 1.2em; margin: 0; }
.pros li::marker { color: var(--duo-green); }
.cons li::marker { color: var(--duo-red); }
.note { border-left: 3px solid var(--amber); background: var(--amber-wash); padding: 12px 16px; border-radius: 0 var(--radius-s) var(--radius-s) 0; max-width: var(--measure); font-size: 0.97rem; }

/* Tool panels */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 22px; }
.tool { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 20px; }
.tool form { display: grid; gap: 16px; }
.tool fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.tool legend { font-weight: 600; font-size: 0.88rem; margin-bottom: 4px; }
.result-big { font-family: var(--display); font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.05; margin: 2px 0 6px; }
.split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); margin: 16px 0; }
.split div { padding: 12px 12px 12px 0; }
.split div + div { padding-left: 12px; border-left: 1px solid var(--rule); }
.split dt { font-size: 0.82rem; color: var(--muted); }
.split dd { margin: 0; font-weight: 700; font-size: 1.2rem; }
.split .bad { color: var(--duo-red); }
.split .good { color: var(--duo-green); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); background: var(--surface); padding: 32px 0 40px; font-size: 0.9rem; color: var(--muted); }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; align-content: start; }
.site-footer a { color: var(--muted); }

.prose ul, .prose ol { max-width: var(--measure); padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.sources { font-size: 0.9rem; padding-left: 1.2em; }

@media (max-width: 880px) {
  .hero .wrap, .two, .tool { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .tools-list { grid-template-columns: 1fr; }
  .tools-list a, .tools-list a + a { padding: 18px 0; border-left: 0; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures div:nth-child(3) { padding-left: 0; border-left: 0; }
  .figures div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .site-footer .wrap { grid-template-columns: 1fr; }
  .site-footer nav { justify-content: flex-start; }
  .caprow { grid-template-columns: 7.5rem minmax(0, 1fr) 4.6rem; font-size: 0.82rem; }
}
@media (max-width: 520px) {
  .split { grid-template-columns: 1fr; }
  .split div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .boardrow { grid-template-columns: 5.6rem minmax(0, 1fr) 3.6rem; }
}

[hidden] { display: none !important; }
#schools td:nth-child(2) { min-width: 12rem; }
#schools td:last-child { white-space: nowrap; }

/* Guide lists */
.guide-list { list-style: none; padding: 0; margin: 16px 0 0; border-top: 1px solid var(--rule); max-width: none; }
.guide-list li { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 2px; margin: 0; }
.guide-list a { font-family: var(--display); font-weight: 650; font-size: 1.15rem; text-decoration: none; }
.guide-list a:hover { text-decoration: underline; }
.guide-list span { color: var(--muted); font-size: 0.97rem; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
@media (max-width: 720px) { .guide-grid { grid-template-columns: 1fr; } }
.prose h3 { margin-top: 1.4em; }
.prose ol li strong, .prose ul li strong { font-weight: 650; }

/* Email signup */
.signup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 32px; align-items: end; background: var(--lens-wash); border-radius: var(--radius-m); padding: 24px; margin: 40px 0 8px; }
.signup h2 { margin: 0 0 6px; font-size: 1.35rem; }
.signup p { margin: 0; }
.signup-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; }
.signup-form .field { min-width: 0; }
.signup-form .field input { width: 100%; }
.signup-form .signup-msg, .signup-form .signup-fine { grid-column: 1 / -1; }
.signup-msg:empty { display: none; }
@media (max-width: 720px) { .signup { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .signup-form { grid-template-columns: 1fr; } }
