/* Fonts (self-hosted, SIL Open Font License) */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap; src: url('/fonts/space-grotesk-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url('/fonts/space-grotesk-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }

/* Colours: light by default, dark when chosen or when the system is dark */
:root {
  --accent: #FB4F14;
  --navy: #002244;
  --bg: #FFFFFF; --bg-alt: #F4F6F9; --card: #FFFFFF; --border: #E3E8EF; --border-code: #D4DCE6;
  --text: #0B1B2B; --heading: #002244; --muted: #3A4B5E; --pill: #002244; --link-hover: #C2410C;
  --pass-bg: #E6F4EA; --pass: #14532D; --warn-bg: #FFF4D6; --warn: #6B4500;
  --fail-bg: #FDECEA; --fail: #8A1C12; --fail-border: #B42318; --info-bg: #E8EEF6; --info: #23415F;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1622; --bg-alt: #0F1E2E; --card: #142538; --border: #26394F; --border-code: #33496A;
  --text: #E6EDF5; --heading: #FFFFFF; --muted: #A9B8C9; --pill: #2C4A6B; --link-hover: #FF8A5C;
  --pass-bg: #12351F; --pass: #86EFAC; --warn-bg: #3D2E05; --warn: #FCD34D;
  --fail-bg: #4A1512; --fail: #FCA5A5; --fail-border: #F87171; --info-bg: #1C3048; --info: #BFD3EA;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1622; --bg-alt: #0F1E2E; --card: #142538; --border: #26394F; --border-code: #33496A;
    --text: #E6EDF5; --heading: #FFFFFF; --muted: #A9B8C9; --pill: #2C4A6B; --link-hover: #FF8A5C;
    --pass-bg: #12351F; --pass: #86EFAC; --warn-bg: #3D2E05; --warn: #FCD34D;
    --fail-bg: #4A1512; --fail: #FCA5A5; --fail-border: #F87171; --info-bg: #1C3048; --info: #BFD3EA;
    color-scheme: dark;
  }
}

/* Light/dark-only elements (logo, toggle label) */
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-flex; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: inline-flex; }
  :root:not([data-theme="light"]) .only-light { display: none; }
}

/* Fade between light and dark */
body, body * { transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; }

/* Base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--heading); }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4, p, ol, ul { margin: 0; }
.display { font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; }
.container { max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--card); color: var(--heading); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 12px 20px; border-radius: 8px; font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer; border: 2px solid transparent; }
.btn-accent { background: var(--accent); color: var(--navy); }
.btn-accent:hover { color: var(--navy); filter: brightness(1.06); }
.btn-outline { border-color: var(--heading); color: var(--heading); background: transparent; }
.btn-ghost { border: 1px solid var(--border); background: var(--card); color: var(--heading); font-weight: 500; padding: 10px 14px; }
.btn-lg { font-size: 18px; min-height: 52px; padding: 14px 24px; }
.icon { width: 18px; height: 18px; flex: none; }

/* Header and footer */
.site-header { background: var(--bg); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--heading); }
.brand img { width: 44px; height: 44px; }
.brand-name { font-size: 22px; color: var(--heading); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.site-nav > a:not(.btn) { text-decoration: none; font-weight: 500; }
.site-footer { background: var(--bg); border-top: 1px solid var(--border); }
.site-footer .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 32px; padding-bottom: 32px; }
.site-footer .brand img { width: 32px; height: 32px; }
.site-footer .brand-name { font-size: 18px; }
.site-footer p { font-size: 14px; color: var(--muted); }

/* Navy sections (same in both modes) */
.navy { background: var(--navy); color: #FFFFFF; }
.navy a:not(.btn) { color: #FFFFFF; }

/* Hero */
.hero .container { padding-top: 96px; padding-bottom: 104px; display: flex; flex-direction: column; gap: 24px; }
.eyebrow { font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(40px, 6vw, 60px); line-height: 1.05; max-width: 760px; }
.hero .lead { font-size: 20px; line-height: 1.6; max-width: 640px; color: #D6E0EC; }
.check-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 16px; max-width: 640px; }
.field { display: flex; flex-direction: column; gap: 8px; flex: 1 1 320px; }
.field label { font-size: 15px; font-weight: 500; color: #D6E0EC; }
.field input { font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 8px; border: 2px solid #4A6688; background: #FFFFFF; color: #0B1B2B; min-height: 52px; width: 100%; }
.field input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.form-error { flex-basis: 100%; font-size: 15px; font-weight: 500; color: #FFB4A0; }
.form-error:empty { display: none; }
.hero .note { font-size: 15px; color: #B7C6D8; }

/* Sections */
.section { padding-top: 88px; padding-bottom: 88px; }
.section-alt { background: var(--bg-alt); }
.section .container { display: flex; flex-direction: column; gap: 40px; }
.section-intro { display: flex; flex-direction: column; gap: 12px; max-width: 680px; }
.section h2 { font-size: 40px; color: var(--heading); }
.navy.section h2 { color: #FFFFFF; }
.section-intro p { font-size: 18px; line-height: 1.6; color: var(--muted); }
.cards { display: flex; flex-wrap: wrap; gap: 20px; }
.card { flex: 1 1 300px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.card h3 { font-size: 20px; font-weight: 600; color: var(--heading); }
.card p { font-size: 16px; line-height: 1.6; color: var(--muted); }
.pill { align-self: flex-start; background: var(--pill); color: #FFFFFF; font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 6px; }
.steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 32px; }
.steps li { flex: 1 1 280px; display: flex; flex-direction: column; gap: 12px; }
.steps h3 { font-size: 20px; font-weight: 600; color: var(--heading); }
.steps p { font-size: 16px; line-height: 1.6; color: var(--muted); }
.step-num { width: 48px; height: 48px; border-radius: 24px; background: var(--accent); color: var(--navy); font-size: 22px; display: flex; align-items: center; justify-content: center; }
.promises { display: flex; flex-wrap: wrap; gap: 32px; }
.promises > div { flex: 1 1 280px; display: flex; flex-direction: column; gap: 8px; }
.promises h3 { font-size: 20px; font-weight: 600; color: var(--accent); }
.promises p { font-size: 16px; line-height: 1.6; color: #D6E0EC; }

/* Results page */
.results-page { background: var(--bg-alt); }
.results-main { max-width: 880px; margin: 0 auto; padding: 56px 24px 88px; display: flex; flex-direction: column; gap: 32px; }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; text-decoration: none; }
.results-heading { display: flex; flex-direction: column; gap: 8px; }
.results-heading .label, .results-heading .time { font-size: 15px; color: var(--muted); }
.results-heading .label { font-weight: 500; }
.results-heading h1 { font-size: clamp(32px, 5vw, 44px); color: var(--heading); overflow-wrap: anywhere; }
.summary { border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.summary h2 { font-size: 22px; font-weight: 600; }
.summary p { font-size: 16px; line-height: 1.6; color: #D6E0EC; }
.counts { display: flex; flex-wrap: wrap; gap: 12px; }
.results-list { display: flex; flex-direction: column; gap: 16px; }
.result { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.result.is-fail { border: 2px solid var(--fail-border); }
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.result h3 { font-size: 20px; font-weight: 600; color: var(--heading); }
.result h3 .tech { font-size: 15px; font-weight: 500; color: var(--muted); }
.result > p { font-size: 16px; line-height: 1.6; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; padding: 6px 12px; border-radius: 6px; }
.badge svg { width: 16px; height: 16px; }
.badge-pass { background: var(--pass-bg); color: var(--pass); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-fail { background: var(--fail-bg); color: var(--fail); }
.badge-info { background: var(--info-bg); color: var(--info); }
.found { font-size: 14px; color: var(--muted); }
.found summary { cursor: pointer; font-weight: 500; min-height: 32px; display: inline-flex; align-items: center; }
.found ul { list-style: none; padding: 0; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
code, .code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 15px; background: var(--card); border: 1px solid var(--border-code); border-radius: 6px; padding: 10px 12px; color: var(--text); overflow-wrap: anywhere; display: block; }
.toggle-fix { align-self: flex-start; font: inherit; font-size: 16px; font-weight: 600; min-height: 44px; padding: 0; border: none; background: none; color: var(--heading); text-decoration: underline; cursor: pointer; }
.toggle-fix:hover { color: var(--link-hover); }
.fix-wrap { display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden; transition: grid-template-rows 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s; }
.fix-wrap.is-open { grid-template-rows: 1fr; opacity: 1; visibility: visible; transition: grid-template-rows 0.3s ease, opacity 0.3s ease, visibility 0s linear 0s; }
.fix-inner { overflow: hidden; min-height: 0; }
.fix { background: var(--bg-alt); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.fix h4 { font-size: 16px; font-weight: 600; color: var(--heading); }
.fix ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 16px; line-height: 1.5; }
.record { display: flex; flex-direction: column; gap: 6px; }
.record-label { font-size: 14px; font-weight: 500; color: var(--muted); }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row code { flex: 1; }
.copy-btn { font: inherit; font-size: 14px; font-weight: 600; min-width: 72px; min-height: 44px; border-radius: 6px; border: 1px solid var(--border-code); background: var(--card); color: var(--heading); cursor: pointer; }
.done { font-size: 15px; color: var(--muted); }
.status-box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.status-box h2 { font-size: 22px; font-weight: 600; color: var(--heading); }
.status-box p { font-size: 16px; line-height: 1.6; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body, body *, .fix-wrap, .fix-wrap.is-open { transition: none; }
  .spinner { animation-duration: 3s; }
}
@media (max-width: 600px) {
  .site-nav { gap: 12px; }
  .site-nav > a:not(.btn) { display: none; }
  .hero .container { padding-top: 56px; padding-bottom: 64px; }
  .section { padding-top: 56px; padding-bottom: 56px; }
  .section h2 { font-size: 32px; }
}

#report { display: flex; flex-direction: column; gap: 32px; }
#report[hidden], .status-box[hidden] { display: none; }
.status-box .btn { align-self: flex-start; }
[data-theme-toggle] .only-light { display: inline-flex; }
[data-theme-toggle] span { align-items: center; gap: 8px; }
.fix-wrap:not(.is-open) { margin-top: -12px; }
