/* ============================================================
   ILDATA.org stylesheet
   Atkinson Hyperlegible, self-hosted. Tokens on :root; dark theme follows
   prefers-color-scheme. Every colour pairing below is measured, not eyeballed;
   the layout audit re-measures in a browser.
   ============================================================ */
@font-face { font-family: 'Atkinson Hyperlegible'; src: url('../fonts/atkinson-hyperlegible-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url('../fonts/atkinson-hyperlegible-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;
  --color-primary: #0b3c5d;        /* navy: 10.5:1 on white */
  --color-primary-end: #15577f;
  --color-accent: #0f766e;         /* teal: 5.5:1 on white; links and CTA */
  --color-accent-hover: #0b5a54;
  --color-accent-soft: #ccfbf1;
  --color-bg: #f7fafc;
  --color-surface: #ffffff;
  --color-surface-alt: #eef3f7;
  --color-text: #0b1220;           /* 18:1 on bg */
  --color-muted: #3b4a5c;          /* 8:1 on bg */
  --color-border: #c7d2de;
  --color-border-input: #5b6b7d;   /* 4.9:1 non-text contrast */
  --color-on-dark: #ffffff;
  --color-on-dark-muted: #d7e3ee;  /* 11:1 on navy */
  --color-focus: #ffbf47;          /* GOV.UK yellow: 3:1+ on navy and on white backgrounds via the 2-tone ring */
  --color-danger-text: #a4161a;    /* 6.6:1 on white */
  --color-danger-surface: #fde8e8;
  --color-success-text: #156b3a;   /* 6.2:1 */
  --color-success-surface: #dcfce7;
  --color-warning-surface: #fef3c7;
  --color-warning-text: #7a4b00;
  --color-info-surface: #e6f1fb;
  --color-table-stripe: #f1f5f9;

  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --max-width: 1200px;
  --measure: 70ch;
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 180ms ease;
  --space-xs: .25rem; --space-sm: .5rem; --space-md: 1rem; --space-lg: 1.5rem;
  --space-xl: 2rem; --space-2xl: 3rem; --space-3xl: 4rem;
  --shadow: 0 1px 2px rgba(11,18,32,.06), 0 4px 12px rgba(11,18,32,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #0b2b42;
    --color-primary-end: #0f3a57;
    --color-accent: #5eead4;       /* 11:1 on #0f1620 */
    --color-accent-hover: #99f6e4;
    --color-accent-soft: #134e4a;
    --color-bg: #0f1620;
    --color-surface: #16202c;
    --color-surface-alt: #1c2836;
    --color-text: #eef2f6;
    --color-muted: #b8c4d2;        /* 9:1 */
    --color-border: #34465a;
    --color-border-input: #93a3b5;
    --color-on-dark: #ffffff;
    --color-on-dark-muted: #d7e3ee;
    --color-danger-text: #fca5a5;
    --color-danger-surface: #3b1214;
    --color-success-text: #86efac;
    --color-success-surface: #0f2e1c;
    --color-warning-surface: #3a2a07;
    --color-warning-text: #fde68a;
    --color-info-surface: #15283a;
    --color-table-stripe: #141d28;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6; color: var(--color-text); background: var(--color-bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--space-md); font-weight: 700; color: inherit; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2vw, 2.75rem); }
h2 { font-size: clamp(1.45rem, 1.15rem + 1vw, 1.9rem); margin-top: var(--space-xl); }
h3 { font-size: 1.25rem; margin-top: var(--space-lg); }
h4 { font-size: 1.05rem; margin-top: var(--space-md); }
p, ul, ol, dl, table, figure, blockquote { margin: 0 0 var(--space-md); }
p, li, dd, dt, figcaption, .lead { max-width: var(--measure); }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: .35em; }
a { color: var(--color-accent); text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .15em; }
a:hover { color: var(--color-accent-hover); text-decoration-thickness: .15em; }
strong { font-weight: 700; }
small, .small { font-size: .9rem; }
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
pre { background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: var(--space-md); overflow-x: auto; max-width: 100%; }
code { background: var(--color-surface-alt); padding: .1em .35em; border-radius: var(--radius-sm); }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-xl) 0; }
blockquote { border-left: 4px solid var(--color-accent); padding-left: var(--space-md); color: var(--color-muted); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; }
dl.kv dt { font-weight: 700; }
dl.kv dd { margin: 0; }
abbr[title] { text-decoration: underline dotted; }

/* Focus: a two-tone ring that is visible on light, dark and navy backgrounds. */
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--color-text); border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }
.site-header :focus-visible, .site-footer :focus-visible, .hero :focus-visible, .page-header :focus-visible { box-shadow: 0 0 0 6px var(--color-primary); }

.sr-only, .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -100%; left: var(--space-md); z-index: 1000; background: var(--color-text); color: var(--color-bg); padding: .75rem 1.25rem; border-radius: var(--radius); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: var(--space-md); }

/* Layout bands. Children are capped and centred; write `margin: x auto` on
   any child that sets its own margin, or the centring is lost. */
.section { padding: var(--space-2xl) var(--space-md); }
.section--alt { background: var(--color-surface-alt); }
.section > *, .hero > *, .page-header > * { max-width: var(--max-width); margin-left: auto; margin-right: auto; }
.section > h2:first-child, .section > .section-head { margin-top: 0; }
.narrow > * { max-width: 860px; }
.hero, .page-header { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-end)); color: var(--color-on-dark); padding: var(--space-3xl) var(--space-md); }
.hero a:not(.btn), .page-header a:not(.btn) { color: var(--color-on-dark); }
.hero .lead, .page-header .lead { color: var(--color-on-dark-muted); }
.page-header { padding: var(--space-2xl) var(--space-md); }
.page-header h1 { margin-bottom: var(--space-sm); }
.lead { font-size: 1.2rem; line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-lg); }
.hero-note { font-size: .95rem; color: var(--color-on-dark-muted); }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0 0 var(--space-md); display: flex; flex-wrap: wrap; gap: .25rem .5rem; font-size: .95rem; max-width: none; }
.breadcrumbs li + li::before { content: "/"; margin-right: .5rem; color: var(--color-on-dark-muted); }
.breadcrumbs [aria-current] { color: var(--color-on-dark-muted); }

/* Header and menu */
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: var(--max-width); margin: 0 auto; padding: .6rem var(--space-md); display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; }
.site-logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--color-text); }
.logo-mark { color: var(--color-primary); display: inline-flex; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-weight: 700; font-size: 1.35rem; letter-spacing: .02em; }
.logo-tld { font-weight: 400; color: var(--color-muted); }
.logo-tag { font-size: .8rem; color: var(--color-muted); }
.nav-toggle { display: none; align-items: center; gap: .5rem; background: none; border: 2px solid var(--color-border-input); border-radius: var(--radius); padding: .55rem .9rem; font: inherit; font-weight: 700; color: var(--color-text); cursor: pointer; min-height: 44px; }
.nav-toggle .close-icon { display: none; }
.nav-toggle[aria-expanded="true"] .hamburger-icon { display: none; }
.nav-toggle[aria-expanded="true"] .close-icon { display: inline; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav-list li { margin: 0; }
.nav-list a, .submenu-toggle { display: inline-flex; align-items: center; gap: .35rem; padding: .6rem .8rem; border-radius: var(--radius); color: var(--color-text); text-decoration: none; font-weight: 700; font: inherit; font-weight: 700; background: none; border: 0; cursor: pointer; min-height: 44px; }
.nav-list a:hover, .submenu-toggle:hover, .nav-list a[aria-current="page"], .submenu-toggle.is-current-section { background: var(--color-surface-alt); color: var(--color-text); }
.nav-list a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--color-accent); }
.has-submenu { position: relative; }
.nav-submenu { list-style: none; margin: 0; padding: .4rem; display: none; position: absolute; top: 100%; left: 0; min-width: 16rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50; }
.submenu-toggle[aria-expanded="true"] + .nav-submenu { display: block; }
.submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-submenu li a { display: block; padding: .55rem .75rem; font-weight: 400; }
.nav-cta a { background: var(--color-accent); color: #fff; }
.nav-cta a:hover, .nav-cta a[aria-current="page"] { background: var(--color-accent-hover); color: #fff; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav-cta a { color: #0b1220; } }
@media (max-width: 62em) {
  .nav-toggle { display: inline-flex; }
  .main-nav { width: 100%; }
  .nav-list { display: none; flex-direction: column; align-items: stretch; padding: .5rem 0 1rem; }
  .nav-list.is-open { display: flex; }
  .nav-list a, .submenu-toggle { width: 100%; justify-content: space-between; }
  .nav-submenu { position: static; box-shadow: none; border: 0; border-left: 3px solid var(--color-border); border-radius: 0; margin-left: .75rem; }
  .header-inner { align-items: flex-start; }
  .site-header { max-height: 100vh; overflow-y: auto; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 1.4rem; border-radius: var(--radius); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 2px solid transparent; min-height: 44px; transition: background var(--transition), color var(--transition); }
.btn-primary { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: #fff; }
.btn-outline { background: transparent; color: var(--color-accent); border-color: currentColor; }
.btn-outline:hover { background: var(--color-accent-soft); }
.hero .btn-outline, .page-header .btn-outline { color: var(--color-on-dark); }
.hero .btn-outline:hover, .page-header .btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-input); }
.btn-secondary:hover { background: var(--color-surface-alt); }
.btn-danger { background: var(--color-danger-text); color: #fff; border-color: var(--color-danger-text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0b1220; } :root:not([data-theme="light"]) .btn-primary:hover { color: #0b1220; } }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; }

/* Cards */
.card-grid { display: grid; gap: var(--space-lg); grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); list-style: none; padding: 0; }
.card-grid > li { margin: 0; }
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-lg); box-shadow: var(--shadow); height: 100%; }
.card h2, .card h3 { margin-top: 0; font-size: 1.2rem; }
.card p:last-child { margin-bottom: 0; }
.card-meta { color: var(--color-muted); font-size: .95rem; }
.stat-grid { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); list-style: none; padding: 0; }
.stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-md) var(--space-lg); }
.stat .stat-value { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--color-primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stat .stat-value { color: var(--color-accent); } }
.stat .stat-label { display: block; color: var(--color-muted); font-size: .95rem; }
.stat .stat-note { display: block; font-size: .85rem; color: var(--color-muted); margin-top: .25rem; }

/* Notices */
.notice { border-left: 5px solid var(--color-accent); background: var(--color-info-surface); padding: var(--space-md) var(--space-lg); border-radius: var(--radius-sm); margin-bottom: var(--space-lg); }
.notice > :last-child { margin-bottom: 0; }
.notice--warning { border-color: var(--color-warning-text); background: var(--color-warning-surface); }
.notice--danger { border-color: var(--color-danger-text); background: var(--color-danger-surface); }
.notice--success { border-color: var(--color-success-text); background: var(--color-success-surface); }
.notice-title { font-weight: 700; margin-bottom: .25rem; }

/* Tables. Data tables sit in .table-scroll, a labelled region that scrolls
   sideways on its own so the page never does. */
.table-scroll { overflow-x: auto; max-width: 100%; margin-bottom: var(--space-lg); border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.table-scroll:focus-visible { outline-offset: -3px; }
table { border-collapse: collapse; width: 100%; font-size: .98rem; background: var(--color-surface); }
caption { text-align: left; font-weight: 700; padding: var(--space-md) var(--space-md) var(--space-sm); caption-side: top; font-size: 1.05rem; }
caption .caption-note { display: block; font-weight: 400; color: var(--color-muted); font-size: .92rem; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
th { background: var(--color-surface-alt); font-weight: 700; }
thead th { position: sticky; top: 0; }
tbody tr:nth-child(even) td { background: var(--color-table-stripe); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th[scope="row"] { background: var(--color-surface); font-weight: 700; }
tbody tr:nth-child(even) th[scope="row"] { background: var(--color-table-stripe); }
tfoot td, tfoot th { font-weight: 700; border-top: 2px solid var(--color-border-input); }
.rank-pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: var(--color-surface-alt); border: 1px solid var(--color-border); font-size: .9rem; white-space: nowrap; }

/* Inline SVG charts: decorative twins of the table beside them. */
.chart { margin: 0 0 var(--space-lg); }
.chart svg { width: 100%; height: auto; display: block; }
.chart figcaption { font-size: .95rem; color: var(--color-muted); }
.bar-list { list-style: none; padding: 0; }
.bar-list li { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr max-content; align-items: center; gap: .75rem; margin: 0 0 .4rem; max-width: none; }
.bar-list .bar { height: 1rem; background: var(--color-accent); border-radius: 2px; min-width: 2px; }
.bar-list .bar-track { background: var(--color-surface-alt); border-radius: 2px; }

/* Forms. Labels are names; explanations are hints linked by aria-describedby.
   Fields use aria-required, never required: Chrome marks an empty required
   select invalid on load and NVDA reads "invalid entry". */
form { max-width: 48rem; }
.form-group { margin-bottom: var(--space-lg); }
label, legend { display: block; font-weight: 700; margin-bottom: .3rem; }
.form-hint { color: var(--color-muted); font-size: .95rem; margin: 0 0 .5rem; max-width: var(--measure); }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="url"], input[type="search"], select, textarea { font: inherit; width: 100%; max-width: 40rem; padding: .65rem .8rem; border: 2px solid var(--color-border-input); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); min-height: 44px; }
input.input--short, select.input--short { max-width: 14rem; }
textarea { min-height: 7rem; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--color-danger-text); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--space-lg); min-width: 0; }
fieldset legend { font-size: 1.05rem; padding: 0; }
.choice-list { list-style: none; padding: 0; margin: 0; }
.choice { display: grid; grid-template-columns: 1.6rem 1fr; gap: .6rem; align-items: start; padding: .5rem 0; max-width: none; }
.choice + .choice { margin-top: 0; }
.choice input { width: 1.6rem; height: 1.6rem; margin: .15rem 0 0; accent-color: var(--color-accent); justify-self: start; }
.choice label { font-weight: 400; margin: 0; cursor: pointer; }
.choice .choice-hint { display: block; color: var(--color-muted); font-size: .92rem; }
.choice-followup { grid-column: 2; margin-top: .4rem; }
.field-error { color: var(--color-danger-text); font-weight: 700; margin: .3rem 0 0; }
.field-error:empty { display: none; }
.error-summary { border: 4px solid var(--color-danger-text); padding: var(--space-md) var(--space-lg); margin-bottom: var(--space-lg); background: var(--color-surface); }
.error-summary h2 { margin-top: 0; font-size: 1.2rem; }
.error-summary ul { margin-bottom: 0; }
.error-summary a { color: var(--color-danger-text); font-weight: 700; }
.form-status[role="status"]:empty { display: none; }
.required-note { color: var(--color-muted); font-size: .95rem; }
.honeypot { position: absolute; left: -9999px; }

/* Survey steps */
.survey-shell { max-width: 46rem; margin: 0 auto; }
.survey-progress { display: flex; justify-content: space-between; gap: var(--space-md); font-size: .95rem; color: var(--color-muted); margin-bottom: var(--space-md); }
.survey-progress progress { width: 100%; height: .6rem; accent-color: var(--color-accent); }
.survey-step[hidden] { display: none; }
.survey-step h2 { margin-top: 0; }
.survey-actions { display: flex; flex-wrap: wrap; gap: var(--space-md); justify-content: space-between; margin-top: var(--space-xl); }
.survey-nojs-note { font-size: .95rem; }
.js .survey-nojs-only { display: none; }
.review-list dt { font-weight: 700; margin-top: var(--space-md); }
.review-list dd { margin: 0; }
.review-list button { margin-top: .25rem; }
.consent-box { border: 2px solid var(--color-border); border-radius: var(--radius); padding: var(--space-lg); background: var(--color-surface); }

/* Footer */
.site-footer { background: var(--color-primary); color: var(--color-on-dark); margin-top: var(--space-3xl); }
.footer-grid { max-width: var(--max-width); margin: 0 auto; padding: var(--space-2xl) var(--space-md) var(--space-lg); display: grid; gap: var(--space-xl); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.footer-name { font-weight: 700; font-size: 1.3rem; margin-bottom: .5rem; }
.footer-tagline { color: var(--color-on-dark-muted); font-size: .95rem; }
.footer-heading { font-size: 1rem; margin: 0 0 .75rem; text-transform: none; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { color: var(--color-on-dark-muted); font-size: .95rem; }
.site-footer a { color: var(--color-on-dark); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.2); }
.footer-bottom p { max-width: var(--max-width); margin: 0 auto; padding: var(--space-md); font-size: .9rem; color: var(--color-on-dark-muted); }

/* Utilities */
.flow > * + * { margin-top: var(--space-md); }
.muted { color: var(--color-muted); }
.text-center { text-align: center; }
.two-col { display: grid; gap: var(--space-xl); grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.toc { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-md) var(--space-lg); }
.toc h2 { font-size: 1.05rem; margin-top: 0; }
.toc ul { margin: 0; columns: 2; column-gap: var(--space-xl); }
.toc li { break-inside: avoid; max-width: none; }
@media (max-width: 40em) { .toc ul { columns: 1; } }
.defn { margin-bottom: var(--space-lg); }
.defn dt { font-weight: 700; font-size: 1.1rem; margin-top: var(--space-lg); }
.defn dd { margin: .25rem 0 0; }
details { border: 1px solid var(--color-border); border-radius: var(--radius); padding: .6rem var(--space-md); margin-bottom: var(--space-md); background: var(--color-surface); }
summary { font-weight: 700; cursor: pointer; padding: .3rem 0; }
.step-list { counter-reset: step; list-style: none; padding: 0; }
.step-list > li { counter-increment: step; position: relative; padding-left: 3rem; margin-bottom: var(--space-lg); max-width: var(--measure); }
.step-list > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--color-primary); color: #fff; font-weight: 700; display: grid; place-items: center; }

@media print {
  .skip-link, .main-nav, .site-footer .footer-links-col, .hero-actions, .survey-actions, .nav-toggle { display: none !important; }
  .site-header { position: static; }
  .hero, .page-header { background: none; color: #000; }
  a { color: #000; }
  .table-scroll { border: 0; overflow: visible; }
}
