:root {
  /* Light theme (base) — cool paper, blue-biased neutrals, instrument teal */
  --bg: #F4F6F9;
  --bg-elevated: #FFFFFF;
  --surface: #FBFCFE;
  --hairline: #DCE2EC;
  --hairline-strong: #C4CDDC;
  --ink: #141B27;
  --ink-soft: #46536A;
  --ink-muted: #5C6A80;      /* WCAG AA: 5.07:1 on --bg (was #6E7C93 at 3.90:1) */
  --accent: #0A7466;         /* WCAG AA as text: 5.24:1 on --bg; white-on-accent 5.67:1 (was #0E8C7E) */
  --accent-bright: #0B8072;  /* hover: keeps white text at 4.83:1 */
  --accent-ghost: rgba(18, 165, 148, 0.10);
  --sig-red: #B23A2E;        /* AA on --bg (5.48) and on its own tag tint (4.79) */
  --sig-amber: #875A12;      /* AA on --bg (5.54) and on its own tag tint (4.79) */
  --sig-safe: #0A7466;       /* AA on its own tag tint (4.52) */
  --wave: rgba(14, 140, 126, 0.30);
  --shadow: 0 1px 2px rgba(20, 27, 39, 0.06), 0 12px 32px rgba(20, 27, 39, 0.07);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --measure: 62ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1420;
    --bg-elevated: #161E2E;
    --surface: #131A28;
    --hairline: #26324A;
    --hairline-strong: #33425F;
    --ink: #D2D9E6;
    --ink-soft: #9BA8BF;
    --ink-muted: #808EA8;      /* AA: 5.04:1 on --bg-elevated (was #74829B at 4.30:1) */
    --accent: #39D3C0;
    --accent-bright: #4FE3D0;
    --accent-ghost: rgba(57, 211, 192, 0.10);
    --sig-red: #EC7468;        /* AA on its own tag tint (4.75, was 4.31) */
    --sig-amber: #E0A64B;
    --sig-safe: #39D3C0;
    --wave: rgba(57, 211, 192, 0.22);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.42);
  }
}

/* Explicit toggle overrides — must win in both directions */
:root[data-theme="light"] {
  --bg: #F4F6F9; --bg-elevated: #FFFFFF; --surface: #FBFCFE;
  --hairline: #DCE2EC; --hairline-strong: #C4CDDC;
  --ink: #141B27; --ink-soft: #46536A; --ink-muted: #5C6A80;
  --accent: #0A7466; --accent-bright: #0B8072; --accent-ghost: rgba(18, 165, 148, 0.10);
  --sig-red: #B23A2E; --sig-amber: #875A12; --sig-safe: #0A7466;
  --wave: rgba(14, 140, 126, 0.30);
  --shadow: 0 1px 2px rgba(20, 27, 39, 0.06), 0 12px 32px rgba(20, 27, 39, 0.07);
}
:root[data-theme="dark"] {
  --bg: #0E1420; --bg-elevated: #161E2E; --surface: #131A28;
  --hairline: #26324A; --hairline-strong: #33425F;
  --ink: #D2D9E6; --ink-soft: #9BA8BF; --ink-muted: #808EA8;
  --accent: #39D3C0; --accent-bright: #4FE3D0; --accent-ghost: rgba(57, 211, 192, 0.10);
  --sig-red: #EC7468; --sig-amber: #E0A64B; --sig-safe: #39D3C0;
  --wave: rgba(57, 211, 192, 0.22);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

/* In-page anchors (topnav, footer/privacy links, "back to top") must land
   below the sticky topbar rather than under it. scroll-padding-top applies
   the offset to every anchor jump in one place; the value tracks the bar's
   measured height (75px desktop/tablet, 120px once it stacks on mobile). */
html {
  scroll-padding-top: 96px;
  scroll-behavior: smooth;
}
@media (max-width: 520px) {
  html { scroll-padding-top: 148px; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }

a { color: inherit; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

h1, h2, h3 { text-wrap: balance; letter-spacing: -0.015em; margin: 0; }

/* ---------- Top bar ---------- */
.topbar-outer {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.topbar-outer.is-scrolled { border-bottom-color: var(--hairline); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 28px;
  max-width: 1080px; margin: 0 auto;
}
.wordmark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: inline-flex; align-items: baseline; gap: 0.05em;
  flex: none;
  text-decoration: none;
}
.wordmark .q { color: var(--accent); }
.topnav {
  display: flex; align-items: center; gap: 22px;
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--ink-muted);
  overflow-x: auto; scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a { text-decoration: none; white-space: nowrap; }
.topnav a:hover { color: var(--accent); }
.topnav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
@media (max-width: 760px) {
  .topnav { display: none; }
}
.stealth-chip {
  font-family: var(--font-mono);
  font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 5px 12px;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.stealth-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-ghost);
}
.topbar-right { display: inline-flex; align-items: center; gap: 14px; }
/* Theme toggle — progressive enhancement: hidden until JS reveals it (.ready),
   so no dead control appears when scripting is unavailable. */
.theme-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle.ready { display: inline-flex; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 32px 0 60px; overflow: hidden; }
#wave-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.9;
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 54px; align-items: start;
}
/* Nudge the card down to align with the headline rather than the small
   eyebrow line above it — a plain grid "start" alignment looks slightly
   too high next to the much larger h1. */
.readout { margin-top: 44px; }
/* Opaque backdrop for the copy column only (the readout card has its own).
   Without this the decorative wave-canvas paints directly behind the hero
   text, which real users see as thin animated strokes crossing letters and
   which axe's color-contrast check (correctly) flags as an unreliable
   foreground/background pairing — #main > .../.hero-copy p:nth-child(1) etc.
   A solid backdrop here removes the ambiguity for both. */
.hero-copy { position: relative; background: var(--bg); }
.hero h1 {
  font-size: clamp(2.3rem, 5.2vw, 3.9rem);
  font-weight: 680;
  line-height: 1.04;
  margin: 20px 0 0;
}
.hero h1 .em { color: var(--accent); }
.hero .lede {
  color: var(--ink-soft);
  font-size: 1.16rem;
  max-width: 30rem;
  margin: 22px 0 0;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; align-items: center; }
.btn {
  font-family: var(--font-sans);
  font-size: 0.98rem; font-weight: 600;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: 10px;
  display: inline-flex; align-items: center; gap: 9px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: #04120F; border: 1px solid var(--accent); }
:root[data-theme="light"] .btn-primary { color: #FFFFFF; }
@media (prefers-color-scheme: light) { .btn-primary { color: #FFFFFF; } }
:root[data-theme="dark"] .btn-primary { color: #04120F; }
.btn-primary:hover { background: var(--accent-bright); transform: translateY(-1px); }
.btn-ghost { border: 1px solid var(--hairline-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.cta-note { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); letter-spacing: 0.04em; }

/* ---------- Readout card ---------- */
.readout {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.readout-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-muted);
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--hairline-strong); display: block; }
.readout-body { padding: 6px 0; }
.row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 11px 16px;
  font-family: var(--font-mono); font-size: 0.82rem;
  border-bottom: 1px solid var(--hairline);
}
.row:last-child { border-bottom: 0; }
.row .proto { color: var(--ink); }
.row .meta { color: var(--ink-muted); font-size: 0.75rem; display: block; margin-top: 2px; }
.tag {
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; white-space: nowrap; font-weight: 600;
}
.tag.red   { color: var(--sig-red);   background: color-mix(in srgb, var(--sig-red) 14%, transparent); }
.tag.amber { color: var(--sig-amber); background: color-mix(in srgb, var(--sig-amber) 16%, transparent); }
.tag.safe  { color: var(--sig-safe);  background: color-mix(in srgb, var(--sig-safe) 16%, transparent); }
.readout-foot {
  padding: 11px 16px; border-top: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-muted);
  display: flex; justify-content: space-between; letter-spacing: 0.04em;
}

/* ---------- Section scaffold ---------- */
section { padding: 48px 0; border-top: 1px solid var(--hairline); }
.sec-head { max-width: var(--measure); margin-bottom: 32px; }
.sec-head h2 { font-size: clamp(1.55rem, 3.2vw, 2.15rem); font-weight: 650; margin-top: 12px; }
.sec-head p { color: var(--ink-soft); margin: 14px 0 0; }

/* ---------- Pipeline ---------- */
.pipe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.step { padding: 26px 22px; border-right: 1px solid var(--hairline); background: var(--surface); position: relative; }
.step:last-child { border-right: 0; }
.step .n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); letter-spacing: 0.12em; }
.step h3 { font-size: 1.02rem; font-weight: 640; margin: 12px 0 8px; }
.step p { font-size: 0.9rem; color: var(--ink-soft); margin: 0; line-height: 1.6; }

/* ---------- Capabilities ---------- */
.caps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.cap { background: var(--bg-elevated); padding: 24px 24px; }
.cap h3 { font-size: 1.0rem; font-weight: 640; margin: 0 0 7px; display: flex; align-items: baseline; gap: 10px; }
.cap h3::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); transform: translateY(-1px); flex: none; }
.cap p { font-size: 0.9rem; color: var(--ink-soft); margin: 0; line-height: 1.6; }

/* ---------- Principles ---------- */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.principle .k { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.principle h3 { font-size: 1.12rem; font-weight: 640; margin: 12px 0 8px; }
.principle p { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }
.principle .srcs { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.src {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.02em;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-ghost); padding-bottom: 1px;
}
.src:hover { border-bottom-color: var(--accent); }
.srcs .sep { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.7rem; }

/* ---------- CTA band ---------- */
.band { border-radius: 16px; border: 1px solid var(--hairline); background: var(--surface); padding: 40px 36px; text-align: center; }
.band h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); font-weight: 660; }
.band p { color: var(--ink-soft); max-width: 34rem; margin: 14px auto 0; }
.band .cta-row { justify-content: center; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--hairline); padding: 34px 0 52px; }
.foot-grid { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-start; }
.legal { font-size: 0.8rem; color: var(--ink-muted); line-height: 1.7; max-width: 40rem; }
.legal .name { color: var(--ink-soft); font-weight: 600; }
.foot-mono { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--ink-muted); text-transform: uppercase; }

a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .pipe { grid-template-columns: 1fr 1fr; }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(1), .step:nth-child(2) { border-bottom: 1px solid var(--hairline); }
  .caps { grid-template-columns: 1fr 1fr; }
  .principles { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 520px) {
  .pipe { grid-template-columns: 1fr; }
  .step { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .step:last-child { border-bottom: 0; }
  .caps { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 14px; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .skip-link { transition: none; }
  .theme-toggle { transition: none; }
}

/* ---------- Accessibility ---------- */
/* Let native controls, scrollbars and form UI follow the active theme. */
:root { color-scheme: light dark; }

/* Skip link — first tab stop, jumps keyboard/screen-reader users past the header.
   Uses ink-on-bg for maximum contrast in both themes. */
.skip-link {
  position: absolute; left: 8px; top: -56px; z-index: 100;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px;
  font-family: var(--font-sans); font-weight: 600; text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; outline: 2px solid var(--accent); outline-offset: 2px; }

/* Raise the smallest labels so low-vision readers aren't forced to zoom.
   Every value here clears ~12px; contrast is handled by the token changes above. */
.stealth-chip { font-size: 0.74rem; }
.eyebrow { font-size: 0.78rem; }
.tag { font-size: 0.74rem; }
.cta-note { font-size: 0.8rem; }
.readout-head, .readout-foot { font-size: 0.76rem; }
.row .meta { font-size: 0.78rem; }
.step .n, .principle .k { font-size: 0.78rem; }
.src, .srcs .sep, .foot-mono { font-size: 0.76rem; }

/* Honour an explicit high-contrast preference: drop the muted greys to the
   stronger ink, firm up hairlines, and underline the accent links. */
@media (prefers-contrast: more) {
  :root { --ink-muted: var(--ink-soft); --hairline: var(--hairline-strong); }
  .btn-ghost { border-color: currentColor; }
  .src { border-bottom-color: currentColor; }
  .stealth-chip { border-color: var(--hairline-strong); }
}

/* ---------- Request-access capture form ---------- */
.capture { background: var(--bg-elevated); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow); padding: 22px 22px 20px; max-width: 30rem; }
.capture--centered { margin: 28px auto 0; text-align: left; }
.capture-head { font-size: 0.98rem; font-weight: 640; margin: 0 0 3px; }
.capture-sub { font-size: 0.86rem; color: var(--ink-muted); margin: 0 0 16px; }
.capture-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 170px; min-width: 0; }
.field label { font-family: var(--font-sans); font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.capture input, .capture select { font-family: var(--font-sans); font-size: 0.92rem; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: 9px; padding: 11px 13px; width: 100%; }
.capture input:focus, .capture select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.consent-row { display: flex; align-items: flex-start; gap: 9px; font-size: 0.84rem; color: var(--ink-soft); margin: 14px 0 4px; cursor: pointer; width: 100%; }
.consent-row input { flex: none; width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.consent-row span { color: var(--ink-muted); }
.capture-error { font-size: 0.86rem; color: var(--sig-red); margin: 10px 0 0; display: none; }
.capture-error:not(:empty) { display: block; }
.capture-legal { font-size: 0.76rem; color: var(--ink-muted); margin: 12px 0 0; line-height: 1.55; }
.capture-legal a { color: var(--accent); border-bottom: 1px solid var(--accent-ghost); text-decoration: none; }
.capture-legal a:hover { border-bottom-color: var(--accent); }
.capture-done { display: none; align-items: center; gap: 10px; font-size: 0.94rem; color: var(--accent); font-weight: 600; }
.capture-done svg { width: 19px; height: 19px; flex: none; }
.capture.is-sent .capture-form { display: none; }
.capture.is-sent .capture-done { display: flex; }

/* ---------- Sample CBOM output ---------- */
.cbom-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 30px; align-items: start; }
.code-card { background: #10151F; border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.code-card .readout-head { background: #161C28; border-color: #232B3A; color: #8996AC; }
.code-card pre { margin: 0; padding: 20px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.65; color: #C9D3E4; }
.code-card .k { color: #7FD9CC; }
.code-card .s { color: #E3B979; }
.code-card .n { color: #9AC7F0; }
.cbom-notes .cap-mini { margin-bottom: 22px; }
.cbom-notes h3 { font-size: 1rem; font-weight: 650; margin: 0 0 6px; }
.cbom-notes p { font-size: 0.9rem; color: var(--ink-soft); margin: 0; }
.dl-row { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.dl-note { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); }
@media (max-width: 860px) { .cbom-grid { grid-template-columns: 1fr; } }

/* ---------- Privacy notice ---------- */
.policy { max-width: none; }
.policy .stamp { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); letter-spacing: 0.04em; }
.policy h3 { font-size: 1.18rem; font-weight: 650; margin: 26px 0 10px; }
.policy h3:first-of-type { margin-top: 22px; }
.policy p, .policy li { color: var(--ink-soft); font-size: 0.96rem; }
.policy ul { margin: 10px 0; padding-left: 22px; }
.policy li { margin: 5px 0; }
.p-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.92rem; }
.p-table th, .p-table td { text-align: left; padding: 10px 14px; border: 1px solid var(--hairline); vertical-align: top; }
.p-table th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface); }
.p-table td { color: var(--ink-soft); }
.p-table-wrap { overflow-x: auto; }
.to-top { display: inline-block; margin-top: 30px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-ghost); }
.to-top:hover { border-bottom-color: var(--accent); }
