/* ==========================================================================
   Prometheus — site stylesheet
   Ground: petrol (not near-black). Two neons with a semantic role:
   turquoise = signal/action, lime = verification & guarantee
   (gates, PASS verdicts, budgets met) — never decoration, never syntax.
   Identity typeface: monospace — a project about canonical bytes, hashes
   and measurement windows speaks mono.
   Dark is the default; light is reachable via the toggle.
   ========================================================================== */

:root {
  color-scheme: dark;

  --ground:      #04212A;
  --ground-deep: #021519;
  --surface:     #0A3341;
  --surface-2:   #0E4152;
  --line:        #16505F;
  --line-soft:   #0F3E4B;

  --neon:        #22F0CE;
  --neon-dim:    #17B49A;
  --neon-glow:   rgba(34, 240, 206, 0.28);

  --lime:        #C8FF4D;
  --lime-glow:   rgba(200, 255, 77, 0.22);

  --ink:         #E4F6F8;
  --ink-soft:    #B9D9E0;
  --muted:       #86AEB8;
  --muted-deep:  #5C8592;

  --warn:        #FF7A6B;

  --mono: ui-monospace, "JetBrains Mono", "IBM Plex Mono", "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 1180px;
  --prose: 68ch;

  --r-sm: 3px;
  --r-md: 6px;

  --step--1: clamp(0.76rem, 0.74rem + 0.10vw, 0.82rem);
  --step-0:  clamp(0.98rem, 0.95rem + 0.16vw, 1.09rem);
  --step-1:  clamp(1.18rem, 1.10rem + 0.40vw, 1.44rem);
  --step-2:  clamp(1.48rem, 1.30rem + 0.85vw, 2.05rem);
  --step-3:  clamp(1.90rem, 1.52rem + 1.85vw, 3.10rem);
  --step-4:  clamp(2.45rem, 1.70rem + 3.60vw, 5.20rem);
}

/* Light stays reachable but is deliberately not the default.
   Neon on paper is illegible -> deepened rather than inverted. */
:root[data-theme="light"] {
  color-scheme: light;
  --ground:      #F1F7F8;
  --ground-deep: #E3EFF1;
  --surface:     #FFFFFF;
  --surface-2:   #EAF4F5;
  --line:        #C3DBE0;
  --line-soft:   #D9E9EC;
  --neon:        #06786A;
  --neon-dim:    #0A9C89;
  --neon-glow:   rgba(6, 120, 106, 0.16);
  --lime:        #4F7A08;
  --lime-glow:   rgba(79, 122, 8, 0.14);
  --ink:         #042028;
  --ink-soft:    #17414D;
  --muted:       #4B707B;
  --muted-deep:  #6B8E98;
  --warn:        #B23A2B;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--neon); color: var(--ground-deep); }

a { color: var(--neon); text-decoration-color: color-mix(in oklab, var(--neon) 40%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--neon); }

:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; border-radius: var(--r-sm); }

h1, h2, h3 {
  font-family: var(--mono); font-weight: 600; text-wrap: balance;
  margin: 0; letter-spacing: -0.03em; line-height: 1.08;
}
p { margin: 0; }
code, kbd { font-family: var(--mono); }

.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.prose { max-width: var(--prose); }

.eyebrow {
  font-family: var(--mono); font-size: var(--step--1);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--neon);
  display: flex; align-items: center; gap: 0.7rem;
}
.eyebrow::before { content: ""; width: 1.6rem; height: 1px; background: var(--neon); flex: none; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--neon); color: var(--ground-deep);
  padding: 0.7rem 1.1rem; font-family: var(--mono); font-size: var(--step--1);
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--ground) 84%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.site-head__in { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; padding: 0.85rem 0; }
.brand {
  font-family: var(--mono); font-weight: 600; font-size: var(--step-0);
  letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 0.6rem; flex: none;
}
.brand__mark {
  width: 11px; height: 11px; flex: none; background: var(--neon);
  box-shadow: 0 0 12px var(--neon-glow); animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1);} 50% { opacity:.55; transform:scale(.82);} }

.nav { display: flex; gap: 1.35rem; align-items: center; flex-wrap: wrap; }
.nav a {
  font-family: var(--mono); font-size: var(--step--1); color: var(--muted);
  text-decoration: none; letter-spacing: 0.02em; position: relative;
  padding-block: 0.25rem; transition: color .2s ease;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--neon); transform: scaleX(0); transform-origin: left;
  transition: transform .28s cubic-bezier(.2,.8,.3,1);
}
.nav a:hover { color: var(--neon); }
.nav a:hover::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { transform: scaleX(1); background: var(--neon); }
@media (max-width: 940px) { .nav { display: none; } }

.head-tools { display: flex; gap: 0.6rem; align-items: center; flex: none; }
.theme-btn, .menu-btn {
  font-family: var(--mono); font-size: var(--step--1);
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 0.4rem 0.7rem; cursor: pointer; transition: color .2s ease, border-color .2s ease;
}
.theme-btn:hover, .menu-btn:hover { color: var(--neon); border-color: var(--neon); }
.menu-btn { display: none; }
@media (max-width: 940px) { .menu-btn { display: inline-block; } }

.lang-switcher {
  display: flex; gap: 0.2rem; align-items: center; flex: none;
  margin-left: 0.6rem;
  border-left: 1px solid var(--line-soft);
  padding-left: 0.6rem;
}

.lang-btn {
  font-family: var(--mono); font-size: var(--step--1);
  color: var(--muted); text-decoration: none;
  padding: 0.4rem 0.6rem; border-radius: var(--r-sm);
  transition: color .2s ease, background-color .2s ease;
  cursor: pointer;
}

.lang-btn:hover { color: var(--neon); background: var(--surface); }
.lang-btn--active { color: var(--ink); background: var(--surface); font-weight: 600; }

.mobnav__lang {
  display: flex; gap: 0.4rem; justify-content: flex-end;
  padding-top: 0.8rem; border-top: 1px solid var(--line-soft);
  margin-top: 0.4rem;
}

.mobnav { display: none; border-top: 1px solid var(--line-soft); background: var(--ground-deep); }
.mobnav.open { display: block; }
.mobnav ul { list-style: none; margin: 0; padding: 0.6rem 0 1.1rem; display: flex; flex-direction: column; }
.mobnav a {
  display: block; padding: 0.72rem 0; font-family: var(--mono);
  font-size: var(--step-0); color: var(--ink-soft); text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.mobnav a[aria-current="page"] { color: var(--neon); }

/* ---------- Hero (home) ---------- */
.hero { position: relative; padding: clamp(4rem, 11vw, 9rem) 0 clamp(3rem, 7vw, 6rem); overflow: hidden; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .85; pointer-events: none; }
.hero__in { position: relative; z-index: 1; }
.hero h1 { font-size: var(--step-4); margin-top: 1.4rem; max-width: 20ch; }
.hero h1 .lit { color: var(--neon); text-shadow: 0 0 34px var(--neon-glow); }
.hero__sub { margin-top: 1.7rem; max-width: 60ch; font-size: var(--step-1); color: var(--ink-soft); line-height: 1.55; }
.hero__meta { margin-top: 2.2rem; display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; font-family: var(--mono); font-size: var(--step--1); color: var(--muted); }
.hero__meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Staggered entrance on load — once, not on every scroll */
.stagger > * { opacity: 0; transform: translateY(16px); animation: riseIn .78s cubic-bezier(.2,.8,.3,1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .16s; }
.stagger > *:nth-child(3) { animation-delay: .27s; }
.stagger > *:nth-child(4) { animation-delay: .38s; }
.stagger > *:nth-child(5) { animation-delay: .49s; }
.stagger > *:nth-child(6) { animation-delay: .60s; }
@keyframes riseIn { to { opacity: 1; transform: none; } }

/* ---------- Page hero (sub-pages) ---------- */
.phero { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3.2rem); border-bottom: 1px solid var(--line-soft); position: relative; overflow: hidden; }
.phero h1 { font-size: var(--step-3); margin-top: 1.1rem; max-width: 24ch; }
.phero p { margin-top: 1.3rem; max-width: var(--prose); color: var(--ink-soft); font-size: var(--step-1); line-height: 1.55; }
.phero__idx { font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep); letter-spacing: .14em; }

/* ---------- Buttons ---------- */
.cta-row { margin-top: 2.6rem; display: flex; flex-wrap: wrap; gap: 0.9rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--mono); font-size: var(--step-0); font-weight: 600;
  padding: 0.82rem 1.4rem; border-radius: var(--r-sm);
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, color .18s ease;
}
.btn--primary { background: var(--neon); color: #02181D; }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 34px var(--neon-glow); }
.btn--ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--neon); color: var(--neon); transform: translateY(-2px); }

.status {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--mono); font-size: var(--step--1);
  border: 1px solid var(--line); border-radius: 100px;
  padding: 0.34rem 0.85rem; color: var(--muted);
  background: color-mix(in oklab, var(--surface) 60%, transparent);
}
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime-glow); flex: none; }

/* ---------- Bands ---------- */
.band { padding: clamp(3.5rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--line-soft); }
.band:first-of-type { border-top: 0; }
.band--sunk { background: var(--ground-deep); }
.band__head { max-width: var(--prose); }
.band__head h2 { font-size: var(--step-3); margin-top: 1.1rem; }
.band__head p { margin-top: 1.2rem; color: var(--ink-soft); font-size: var(--step-1); line-height: 1.55; }

/* ---------- Topic cards (home -> sub-pages) ---------- */
.topics { margin-top: 3rem; display: grid; gap: 1.1rem; }
@media (min-width: 700px) { .topics { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .topics { grid-template-columns: repeat(3, 1fr); } }

.topic {
  position: relative; overflow: hidden; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 1.7rem 1.5rem 1.6rem; display: flex; flex-direction: column; gap: 0.8rem;
  transition: border-color .28s ease, transform .28s ease, box-shadow .28s ease;
}
.topic::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--neon-glow), transparent 62%);
  opacity: 0; transition: opacity .35s ease; pointer-events: none;
}
.topic:hover { border-color: var(--neon-dim); transform: translateY(-5px); box-shadow: 0 18px 44px rgba(0,0,0,.26); }
.topic:hover::before { opacity: 1; }
.topic__i { font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep); letter-spacing: .14em; }
.topic h3 { font-size: var(--step-1); position: relative; }
.topic p { color: var(--ink-soft); font-size: var(--step--1); line-height: 1.65; position: relative; }
.topic__go {
  margin-top: auto; padding-top: 1rem; font-family: var(--mono); font-size: var(--step--1);
  color: var(--neon); display: inline-flex; align-items: center; gap: .45rem; position: relative;
}
.topic__go span { transition: transform .3s cubic-bezier(.2,.8,.3,1); }
.topic:hover .topic__go span { transform: translateX(5px); }

/* ---------- Contrast cells ---------- */
.contrast { margin-top: 3rem; display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
@media (min-width: 760px) { .contrast { grid-template-columns: repeat(3, 1fr); } }
.contrast__cell { background: var(--ground); padding: 1.8rem 1.6rem; }
.contrast__cell h3 { font-size: var(--step-1); color: var(--muted); }
.contrast__cell p { margin-top: 0.8rem; color: var(--ink-soft); font-size: var(--step-0); }
.contrast__cell--live { background: var(--surface); }
.contrast__cell--live h3 { color: var(--neon); }
.contrast__cell--live p { color: var(--ink); }

/* ---------- Meter bars (problem page) ---------- */
.meters { margin-top: 3rem; display: flex; flex-direction: column; gap: 2rem; }
.meter__top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-family: var(--mono); font-size: var(--step-0); }
.meter__name { color: var(--ink); font-weight: 600; }
.meter__what { color: var(--muted); font-size: var(--step--1); }
.meter__track { margin-top: 0.75rem; height: 10px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 100px; overflow: hidden; position: relative; }
/* Without JS the bar must already show its value; with JS it starts at 0 and
   animates. data-fill is only ever 0 or 100, so an attribute selector suffices. */
.meter[data-fill="100"] .meter__fill { width: 100%; }        /* (0,3,0) */
.js .meter[data-fill="100"] .meter__fill { width: 0; }       /* (0,4,0) — must
   outrank the rule above, not merely follow it: an attribute selector counts as
   a class, so a bare `.js .meter__fill` (0,2,0) would lose and the bar would sit
   at 100% from the first paint, never firing its transition. */
.meter__fill {
  height: 100%; width: 0; border-radius: 100px;
  background: linear-gradient(90deg, var(--muted-deep), var(--muted));
  transition: width 1.5s cubic-bezier(.2,.8,.25,1);
}
.meter--live .meter__fill { background: linear-gradient(90deg, var(--neon-dim), var(--neon)); box-shadow: 0 0 18px var(--neon-glow); }
.meter--blind .meter__track { border-style: dashed; border-color: var(--warn); }
.meter--blind .meter__fill { background: repeating-linear-gradient(45deg, color-mix(in oklab, var(--warn) 45%, transparent) 0 8px, transparent 8px 16px); }
.meter__note { margin-top: 0.6rem; font-size: var(--step--1); color: var(--muted); }
.meter--blind .meter__note { color: var(--warn); }

/* ---------- Flow diagram (collection page) ---------- */
.flowbox { margin-top: 3rem; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--ground-deep); padding: 1.6rem 1.2rem; overflow-x: auto; }
.flowbox svg { display: block; width: 100%; min-width: 620px; height: auto; }
.flow-path { fill: none; stroke: var(--line); stroke-width: 1.4; }
.flow-dash {
  fill: none; stroke: var(--neon); stroke-width: 1.6;
  stroke-dasharray: 5 190; stroke-linecap: round;
  animation: dashRun 3.4s linear infinite;
}
.flow-dash--b { animation-delay: .85s; }
.flow-dash--c { animation-delay: 1.7s; }
.flow-dash--d { animation-delay: 2.55s; }
@keyframes dashRun { to { stroke-dashoffset: -195; } }
.flow-node { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.flow-node--hub { fill: var(--surface-2); stroke: var(--neon-dim); }
.flow-node--mirror { fill: var(--surface); stroke: var(--neon-dim); }
.flow-lbl { fill: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.flow-sub { fill: var(--muted); font-family: var(--mono); font-size: 9px; }
/* Mode D bypasses the signed protocol — dashed so the path does not read
   like the three signed routes. */
.flow-path--bypass { stroke-dasharray: 4 4; stroke: var(--muted-deep); }
.flow-sub--bypass { fill: var(--muted-deep); }
.flow-soon .flow-node { stroke-dasharray: 3 3; }
.flow-soon .flow-lbl { fill: var(--muted); }

/* ---------- Mode cards ---------- */
.modes { margin-top: 3rem; display: grid; gap: 1.1rem; }
@media (min-width: 700px) { .modes { grid-template-columns: repeat(2, 1fr); } }
.mode {
  position: relative; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 1.7rem 1.5rem; display: flex; flex-direction: column; gap: 0.85rem;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.mode::after {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
  opacity: 0; transition: opacity .3s ease;
}
.mode:hover { border-color: var(--neon-dim); transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.mode:hover::after { opacity: 1; }
.mode__id { font-family: var(--mono); font-size: var(--step-2); font-weight: 700; color: var(--neon); line-height: 1; letter-spacing: -0.04em; }
.mode h3 { font-size: var(--step-1); }
.mode p { color: var(--ink-soft); font-size: var(--step--1); line-height: 1.65; }
.mode__tag { margin-top: auto; font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep); padding-top: 0.9rem; border-top: 1px solid var(--line-soft); }
.mode--soon .mode__id { color: var(--muted); }
.mode--soon:hover { border-color: var(--muted); }
.mode--soon::after { background: linear-gradient(90deg, transparent, var(--muted), transparent); }

/* ---------- k-anon demo ---------- */
.kdemo { margin-top: 3rem; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
@media (min-width: 900px) { .kdemo { grid-template-columns: 1fr 1.15fr; } }
.kdemo__ctrl { padding: 2rem 1.8rem; border-bottom: 1px solid var(--line-soft); }
@media (min-width: 900px) { .kdemo__ctrl { border-bottom: 0; border-right: 1px solid var(--line-soft); } }
.kdemo__ctrl h3 { font-size: var(--step-1); }
.kdemo__ctrl p { margin-top: 0.9rem; color: var(--ink-soft); font-size: var(--step--1); line-height: 1.65; }
.kslider { margin-top: 1.8rem; }
.kslider label { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); display: flex; justify-content: space-between; align-items: baseline; }
.kslider label b { color: var(--neon); font-size: var(--step-2); font-weight: 700; font-variant-numeric: tabular-nums; transition: color .3s ease; }
.kdemo.is-sup .kslider label b { color: var(--warn); }
input[type="range"] { width: 100%; margin-top: 0.9rem; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; margin-top: -7px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 14px var(--neon-glow); border: 0; }
input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 14px var(--neon-glow); border: 0; }
.kdemo__out { padding: 2rem 1.8rem; background: var(--ground-deep); }
.khost { display: flex; flex-wrap: wrap; gap: 6px; min-height: 92px; align-content: flex-start; }
.kdot { width: 15px; height: 15px; border-radius: 3px; background: var(--neon); box-shadow: 0 0 9px var(--neon-glow); animation: dotIn .32s cubic-bezier(.2,.8,.3,1) both; transition: background .3s ease, box-shadow .3s ease, opacity .3s ease; }
@keyframes dotIn { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
.kdot--sup { background: var(--muted-deep); box-shadow: none; opacity: .5; }
.kverdict { margin-top: 1.5rem; padding-top: 1.3rem; border-top: 1px solid var(--line-soft); font-family: var(--mono); font-size: var(--step--1); line-height: 1.75; }
.kverdict__row { display: flex; gap: 0.8rem; align-items: baseline; }
.kverdict__k { color: var(--muted); min-width: 8ch; }
.kverdict__v { font-weight: 600; }
.is-pass .kverdict__v { color: var(--lime); }
.is-sup .kverdict__v { color: var(--warn); }
.kverdict code { background: var(--surface-2); border: 1px solid var(--line-soft); padding: 0.12em 0.45em; border-radius: var(--r-sm); font-size: 0.94em; color: var(--ink); }

/* ---------- 14-stage pipeline ---------- */
.pipe { margin-top: 3rem; }
.pipe__legend { display: flex; flex-wrap: wrap; gap: 1.4rem; font-family: var(--mono); font-size: var(--step--1); color: var(--muted); margin-bottom: 1.4rem; }
.pipe__legend i { width: 9px; height: 9px; display: inline-block; margin-right: .45rem; }
.pipe__track { display: flex; gap: 3px; flex-wrap: wrap; }
.stage {
  flex: 1 1 42px; min-width: 42px; height: 58px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep);
  position: relative; cursor: default;
  transition: background .25s ease, border-color .25s ease, color .25s ease, transform .25s ease;
}
/* Hidden only when JS can bring them back — see the Reveal section. */
.js .stage { opacity: 0; transform: translateY(10px); }
.js .pipe.in .stage { animation: stageIn .5s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes stageIn { to { opacity: 1; transform: none; } }
.stage--local { border-color: var(--line); }
.stage--gate { background: var(--surface-2); border-color: var(--lime); color: var(--lime); font-weight: 700; }
.stage--gate::after {
  content: ""; position: absolute; inset: -3px; border: 1px solid var(--lime);
  border-radius: var(--r-sm); opacity: 0; animation: gatePing 2.6s ease-out infinite;
}
@keyframes gatePing { 0% { opacity: .7; transform: scale(1);} 70%,100% { opacity: 0; transform: scale(1.22);} }
.stage:hover { transform: translateY(-4px); border-color: var(--neon-dim); color: var(--ink); }
.stage__tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ground-deep); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .45rem .7rem; font-size: .72rem; color: var(--ink); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 5;
}
.stage:hover .stage__tip { opacity: 1; }
.pipe__split { display: flex; justify-content: space-between; margin-top: .8rem; font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep); }

/* ---------- PII reject terminal ---------- */
.term {
  margin-top: 3rem; background: var(--ground-deep); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; font-family: var(--mono);
}
.term__bar { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line-soft); font-size: var(--step--1); color: var(--muted); }
.term__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.term__body { padding: 1.3rem 1.2rem; font-size: .84rem; line-height: 1.95; min-height: 260px; }
.term__line { display: flex; gap: .8rem; }
.js .term__line { opacity: 0; transform: translateX(-6px); }
.js .term__line.in { opacity: 1; transform: none; transition: opacity .3s ease, transform .3s ease; }
.term__f { color: var(--ink-soft); min-width: 22ch; }
.term__r { color: var(--warn); font-weight: 600; }
.term__ok { color: var(--lime); font-weight: 600; }
.term__sum { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line-soft); color: var(--lime); font-weight: 600; }
.js .term__sum { opacity: 0; transition: opacity .4s ease; }
.js .term__sum.in { opacity: 1; }

/* ---------- Guarantees ---------- */
.guards { margin-top: 3rem; display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
@media (min-width: 680px) { .guards { grid-template-columns: repeat(2, 1fr); } }
.guard { background: var(--ground); padding: 1.7rem 1.5rem; display: flex; flex-direction: column; gap: 0.7rem; transition: background .25s ease; }
.guard:hover { background: var(--surface); }
.guard h3 { font-size: var(--step-0); color: var(--ink); display: flex; align-items: center; gap: 0.6rem; }
.guard h3::before { content: ""; width: 6px; height: 6px; background: var(--lime); flex: none; box-shadow: 0 0 8px var(--lime-glow); }
.guard p { color: var(--ink-soft); font-size: var(--step--1); line-height: 1.65; }

/* ---------- Table ---------- */
.tablewrap { margin-top: 2.6rem; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: var(--step-0); min-width: 620px; }
thead th {
  text-align: left; font-family: var(--mono); font-size: var(--step--1);
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--neon);
  padding: 1rem 1.3rem; background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 600;
}
tbody td { padding: 1.15rem 1.3rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { color: var(--ink); font-weight: 600; font-family: var(--mono); font-size: var(--step--1); white-space: nowrap; }
tbody tr { transition: background .2s ease; }
tbody tr:hover { background: var(--surface); }

/* ---------- Persona cards ---------- */
.personas { margin-top: 3rem; display: grid; gap: 1.1rem; }
@media (min-width: 720px) { .personas { grid-template-columns: repeat(2, 1fr); } }
.persona {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 1.8rem 1.6rem; display: flex; flex-direction: column; gap: .9rem;
  transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}
.persona:hover { transform: translateY(-4px); border-color: var(--neon-dim); box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.persona h3 { font-size: var(--step-1); color: var(--neon); }
.persona p { color: var(--ink-soft); font-size: var(--step--1); line-height: 1.7; }
.persona ul { margin: .2rem 0 0; padding-left: 1.1rem; color: var(--ink-soft); font-size: var(--step--1); line-height: 1.75; }
.persona li::marker { color: var(--neon); }

/* ---------- Developer: language switcher ---------- */
.langtabs { margin-top: 3rem; }
.langbar { display: flex; flex-wrap: wrap; gap: 2px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--r-md) var(--r-md) 0 0; overflow: hidden; }
.langbtn {
  flex: 1 1 auto; background: var(--surface); border: 0; cursor: pointer;
  font-family: var(--mono); font-size: var(--step--1); color: var(--muted);
  padding: .85rem .6rem; transition: background .2s ease, color .2s ease; position: relative;
}
.langbtn:hover { color: var(--ink); background: var(--surface-2); }
.langbtn[aria-selected="true"] { color: var(--neon); background: var(--ground-deep); }
.langbtn[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--neon); box-shadow: 0 0 12px var(--neon-glow); }
.codepane { border: 1px solid var(--line-soft); border-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); background: var(--ground-deep); overflow: hidden; }
.codepane pre { border: 0; border-radius: 0; background: transparent; }
.codepane pre.swap { animation: codeIn .34s cubic-bezier(.2,.8,.3,1); }
@keyframes codeIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.identity {
  border-top: 1px solid var(--line-soft); padding: 1.2rem 1.4rem;
  display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; align-items: baseline;
  font-family: var(--mono); font-size: var(--step--1);
}
.identity__k { color: var(--muted); }
.identity__v { color: var(--lime); font-weight: 600; word-break: break-all; }
.identity__note { color: var(--muted-deep); flex-basis: 100%; }

pre {
  margin: 0; background: var(--ground-deep); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); padding: 1.5rem 1.4rem; overflow-x: auto;
  font-size: 0.86rem; line-height: 1.75; font-family: var(--mono);
  color: var(--ink-soft); tab-size: 2;
}
/* Syntax colours deliberately avoid --lime: that token carries the
   "verified / PASS" meaning in the UI, and a string literal is not a verdict. */
pre .c { color: var(--muted-deep); font-style: italic; }
pre .k { color: var(--neon); }
pre .s { color: var(--ink); }
pre .f { color: var(--ink-soft); }

/* ---------- K7-Gauges ---------- */
.gauges { margin-top: 3rem; display: grid; gap: 1.1rem; }
@media (min-width: 640px) { .gauges { grid-template-columns: repeat(2, 1fr); } }
.gauge { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 1.6rem 1.5rem; }
.gauge__h { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); font-size: var(--step--1); color: var(--muted); }
.gauge__v { font-size: var(--step-2); font-weight: 700; color: var(--lime); font-variant-numeric: tabular-nums; }
.gauge__track { margin-top: .9rem; height: 6px; background: var(--ground-deep); border-radius: 100px; overflow: hidden; }
.gauge[data-fill="100"] .gauge__fill { width: 100%; }        /* (0,3,0) */
.js .gauge[data-fill="100"] .gauge__fill { width: 0; }       /* (0,4,0), see meter */
.gauge__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--lime), color-mix(in oklab, var(--lime) 60%, var(--neon))); border-radius: 100px; transition: width 1.4s cubic-bezier(.2,.8,.25,1); }
.gauge__note { margin-top: .7rem; font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep); }

.sdks { margin-top: 2.4rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
.sdk { background: var(--ground); padding: 1.15rem 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; transition: background .2s ease; }
.sdk:hover { background: var(--surface); }
.sdk__name { font-family: var(--mono); font-weight: 600; color: var(--ink); font-size: var(--step-0); }
.sdk__pkg { font-family: var(--mono); font-size: 0.74rem; color: var(--muted-deep); word-break: break-all; }

/* ---------- Roadmap timeline ---------- */
.tl { margin-top: 3.5rem; position: relative; padding-left: 2.4rem; }
.tl__rail { position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line-soft); }
.tl__prog { position: absolute; left: 0; top: 0; width: 100%; height: 0; background: linear-gradient(180deg, var(--neon), var(--neon-dim)); box-shadow: 0 0 14px var(--neon-glow); transition: height .25s linear; }
.tl__item { position: relative; padding-bottom: 2.6rem; }
.tl__item:last-child { padding-bottom: 0; }
.tl__dot {
  position: absolute; left: -2.4rem; top: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--ground); border: 2px solid var(--line);
  transition: border-color .4s ease, box-shadow .4s ease, background .4s ease;
}
.tl__item.lit .tl__dot { border-color: var(--neon); background: var(--neon); box-shadow: 0 0 16px var(--neon-glow); }
.tl__when { font-family: var(--mono); font-size: var(--step--1); color: var(--neon); letter-spacing: .1em; text-transform: uppercase; }
.tl__item h3 { font-size: var(--step-2); margin-top: .5rem; }
.tl__body { margin-top: 1rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 1.5rem 1.4rem; }
.tl__body ul { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); font-size: var(--step--1); line-height: 1.8; }
.tl__body li::marker { color: var(--neon-dim); }
.tl__item--now .tl__body { border-color: var(--neon-dim); background: var(--surface-2); }

/* ---------- Asks ---------- */
.asks { margin-top: 3rem; display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
@media (min-width: 780px) { .asks { grid-template-columns: repeat(2, 1fr); } }
.ask { background: var(--ground); padding: 1.7rem 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; transition: background .25s ease; position: relative; overflow: hidden; }
.ask::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--neon); transform: scaleY(0); transform-origin: top; transition: transform .35s cubic-bezier(.2,.8,.3,1); }
.ask:hover { background: var(--surface); }
.ask:hover::before { transform: scaleY(1); }
.ask h3 { font-size: var(--step-0); color: var(--neon); }
.ask p { color: var(--ink-soft); font-size: var(--step--1); line-height: 1.65; }

.nots { margin-top: 2.2rem; display: flex; flex-wrap: wrap; gap: 0.7rem; }
.not { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); border: 1px dashed var(--line); border-radius: 100px; padding: 0.5rem 1.1rem; display: inline-flex; align-items: center; gap: 0.55rem; transition: border-color .25s ease, color .25s ease; }
.not::before { content: "\00d7"; color: var(--warn); font-weight: 700; }
.not:hover { border-color: var(--warn); color: var(--ink); }

/* ---------- Prev/next page navigation ---------- */
.pagenav { margin-top: 0; border-top: 1px solid var(--line-soft); display: grid; }
@media (min-width: 700px) { .pagenav { grid-template-columns: 1fr 1fr; } }
.pagenav a {
  padding: 2.2rem 1.6rem; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: .4rem; transition: background .25s ease;
}
.pagenav a:hover { background: var(--surface); }
.pagenav a + a { border-top: 1px solid var(--line-soft); }
@media (min-width: 700px) { .pagenav a + a { border-top: 0; border-left: 1px solid var(--line-soft); text-align: right; align-items: flex-end; } }
.pagenav__k { font-family: var(--mono); font-size: var(--step--1); color: var(--muted-deep); letter-spacing: .12em; text-transform: uppercase; }
.pagenav__t { font-family: var(--mono); font-size: var(--step-1); color: var(--ink); }
.pagenav a:hover .pagenav__t { color: var(--neon); }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--line-soft); padding: 3.5rem 0 4rem; background: var(--ground-deep); }
.foot__grid { display: grid; gap: 2.2rem; }
@media (min-width: 760px) { .foot__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.foot h4 { font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted-deep); margin: 0 0 1rem; font-weight: 600; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.foot a { font-family: var(--mono); font-size: var(--step--1); color: var(--ink-soft); text-decoration: none; }
.foot a:hover { color: var(--neon); }
.foot__note { margin-top: 2.8rem; padding-top: 1.8rem; border-top: 1px solid var(--line-soft); color: var(--muted-deep); font-size: var(--step--1); font-family: var(--mono); line-height: 1.8; }

/* ---------- Reveal ----------
   The default is VISIBLE. Only `html.js` (set by theme-init.js before the
   first paint) hides them so site.js can fade them in. Without JavaScript the
   content stays readable instead of being stuck at opacity:0 forever — this
   affects virtually the whole page below the hero. */
.rv { opacity: 1; transform: none; }
.js .rv {
  opacity: 0; transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1);
}
.js .rv.in { opacity: 1; transform: none; }

/* ---------- Utilities ----------
   These replace the former style="" attributes. Without inline styles the
   Content-Security-Policy can carry `style-src 'self'` instead of
   'unsafe-inline'. */
.brand--lg { font-size: var(--step-1); }
.foot__tag { margin-top: 1rem; color: var(--muted); font-size: var(--step--1); max-width: 34ch; }
.note {
  margin-top: 2rem; font-family: var(--mono); font-size: var(--step--1);
  color: var(--muted-deep); max-width: var(--prose);
}
.note--tight { margin-top: 1.4rem; }
.note--loose { margin-top: 2.5rem; }
.legend-i--box  { background: var(--surface); border: 1px solid var(--line); }
.legend-i--gate { background: var(--lime); }
.term__title { margin-left: .5rem; }
.stack-lg { margin-top: 3rem; }

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .rv, .js .rv { opacity: 1; transform: none; transition: none; }
  .stagger > * { opacity: 1; transform: none; animation: none; }
  .brand__mark, .flow-dash, .stage--gate::after { animation: none; }
  /* These mirror the `.js`-gated rules above and must match their specificity
     (0,2,0) — a bare `.stage` here would lose against `.js .stage`. */
  .kdot, .stage, .js .stage { animation: none; opacity: 1; transform: none; }
  .btn, .mode, .sdk, .ask, tbody tr, .topic, .persona, .guard { transition: none; }
  .meter__fill, .gauge__fill, .tl__prog { transition: none; }
  .js .meter[data-fill="100"] .meter__fill,
  .js .gauge[data-fill="100"] .gauge__fill { width: 100%; }
  .codepane pre.swap { animation: none; }
  .term__line, .js .term__line { opacity: 1; transform: none; }
  .term__sum, .js .term__sum { opacity: 1; }
}
