/* ==========================================================================
   bivdi.com
   One stylesheet, no external requests. Light palette on :root, dark applied
   by system preference and by an explicit [data-theme] toggle.
   ========================================================================== */

/* --- 1. Tokens ---------------------------------------------------------- */

:root {
  --bg: #fbfbf9;
  --bg-2: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f7f7f4;
  --line: rgba(16, 24, 32, 0.12);
  --line-strong: rgba(16, 24, 32, 0.22);
  --text: #11161b;
  --text-2: #39434d;
  --muted: #5f6b78;
  --accent: #0c7f70;
  --accent-soft: rgba(12, 127, 112, 0.1);
  --accent-line: rgba(12, 127, 112, 0.28);
  --warn: #8f5a12;
  --warn-soft: rgba(143, 90, 18, 0.1);
  --open: #7a4aa8;
  --open-soft: rgba(122, 74, 168, 0.1);
  --shadow: 0 1px 2px rgba(16, 24, 32, 0.05), 0 12px 32px -18px rgba(16, 24, 32, 0.28);
  --shadow-lg: 0 2px 4px rgba(16, 24, 32, 0.05), 0 32px 60px -30px rgba(16, 24, 32, 0.35);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", "Fira Code", Menlo,
    Consolas, "Liberation Mono", monospace;

  --wrap: 1180px;
  --prose: 74ch;
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 62px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090b0f;
    --bg-2: #0d1116;
    --surface: #12171e;
    --surface-2: #161c24;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.2);
    --text: #e9eff6;
    --text-2: #c2ccd7;
    --muted: #8d9bab;
    --accent: #3ec4ae;
    --accent-soft: rgba(62, 196, 174, 0.12);
    --accent-line: rgba(62, 196, 174, 0.32);
    --warn: #e0a95e;
    --warn-soft: rgba(224, 169, 94, 0.13);
    --open: #b28ce0;
    --open-soft: rgba(178, 140, 224, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 34px -20px rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 34px 70px -34px rgba(0, 0, 0, 0.9);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #090b0f;
  --bg-2: #0d1116;
  --surface: #12171e;
  --surface-2: #161c24;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #e9eff6;
  --text-2: #c2ccd7;
  --muted: #8d9bab;
  --accent: #3ec4ae;
  --accent-soft: rgba(62, 196, 174, 0.12);
  --accent-line: rgba(62, 196, 174, 0.32);
  --warn: #e0a95e;
  --warn-soft: rgba(224, 169, 94, 0.13);
  --open: #b28ce0;
  --open-soft: rgba(178, 140, 224, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 34px -20px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 34px 70px -34px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

/* --- 2. Base ------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 18px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.028em;
  font-weight: 640;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.3rem); }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.15rem); }
h3 { font-size: 1.12rem; letter-spacing: -0.018em; }
h1 code, h2 code, h3 code { font-size: 0.8em; font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

code, pre, kbd, samp { font-family: var(--mono); font-size: 0.88em; font-variant-ligatures: none; }

:where(p, li, td, th, dd) > code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.36em;
  white-space: nowrap;
}

img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.6rem 0; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #04110f;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip:focus { top: 0; }

/* --- 3. Layout ---------------------------------------------------------- */

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap--split {
  display: grid;
  gap: clamp(2rem, 4vw, 4rem);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 900px) { .wrap--split { grid-template-columns: 1fr 1fr; } }

.band { padding: clamp(3.5rem, 7vw, 6.5rem) 0; border-top: 1px solid var(--line); }
.band--alt { background: var(--bg-2); }
/* Spans the quote band's two columns: it is the page's definition, not a
   column of it. */
.definition {
  grid-column: 1 / -1;
  max-width: 76ch;
  margin: 0 auto;
  padding-bottom: clamp(1.4rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--line);
  text-align: center;
  color: var(--text-2);
  font-size: 1.04rem;
  line-height: 1.6;
}
.definition strong { color: var(--text); }
.definition strong { color: var(--text); }

.band--quote { padding-block: clamp(2.5rem, 5vw, 4rem); }
.band--feature { background: var(--bg-2); }

.band__head { max-width: 60ch; margin-bottom: clamp(2rem, 4vw, 3rem); }
.band__lede { color: var(--muted); font-size: 1.06rem; margin-top: 1rem; }
.band__after { margin-top: 2.2rem; display: flex; flex-wrap: wrap; gap: 1.6rem; }
.wrap--split h2 { margin-bottom: 1.1rem; }
.wrap--split .kicker + h2 { margin-top: 0; }

.kicker {
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
}

.grid { display: grid; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(318px, 1fr)); }

/* --- 4. Header ---------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-size: 1.08rem;
}
.brand .mark { color: var(--accent); flex: none; }
.brand__word { font-variant-caps: all-small-caps; letter-spacing: 0.02em; }

.nav { display: none; gap: 0.15rem; margin-right: auto; }
@media (min-width: 1000px) { .nav { display: flex; } }

.nav__link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  white-space: nowrap;
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__link.is-active { color: var(--text); background: var(--accent-soft); }

.header__actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
@media (min-width: 1000px) { .header__actions { margin-left: 0; } }
.header__repo { display: none; }
@media (min-width: 640px) { .header__repo { display: inline-flex; } }

.theme-toggle, .menu-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover, .menu-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle__moon { display: block; }
}

.menu-toggle { flex-direction: column; gap: 4px; }
@media (min-width: 1000px) { .menu-toggle { display: none; } }
.menu-toggle span { display: block; width: 15px; height: 1.6px; background: currentColor; border-radius: 2px; }

.mobile-nav {
  display: grid;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0.5rem 0;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
  padding: 0.7rem clamp(1.25rem, 5vw, 2rem);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.95rem;
}
.mobile-nav a:hover { background: var(--surface-2); color: var(--text); }

/* --- 5. Buttons, tags, links -------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.1rem;
  border-radius: 9px;
  font-size: 0.93rem;
  font-weight: 560;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 0.4rem 0.72rem; font-size: 0.85rem; }

.btn--primary { background: var(--accent); color: #03100e; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
:root[data-theme="dark"] .btn--primary,
.btn--primary { color: #03100e; }

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--accent-line); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 560;
  font-size: 0.95rem;
  text-decoration: none;
}
.link-arrow::after { content: "→"; transition: transform 0.15s ease; }
.link-arrow:hover::after { transform: translateX(3px); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3em 0.6em;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.tag--decided, .tag--in-progress { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tag--proposed, .tag--next { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.tag--open, .tag--planned, .tag--optional { color: var(--open); border-color: color-mix(in srgb, var(--open) 35%, transparent); background: var(--open-soft); }
.tag--resolved { color: var(--muted); border-color: var(--line); background: var(--surface-2); }

/* --- 6. Hero ------------------------------------------------------------ */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 6vw, 5rem);
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 30% auto -10%;
  height: 70vh;
  background: radial-gradient(60% 50% at 50% 50%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
}
@media (min-width: 960px) { .hero__inner { grid-template-columns: 1.08fr 0.92fr; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: 500 0.78rem/1 var(--mono);
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  margin: 0 0 1.5rem;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex: none;
}

.hero__title { margin-bottom: 1.3rem; letter-spacing: -0.035em; }
.grad {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--text)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lede {
  font-size: clamp(1.02rem, 0.96rem + 0.3vw, 1.16rem);
  color: var(--text-2);
  max-width: 56ch;
  margin-bottom: 1.9rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 2.4rem 0 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.hero__stats div { margin: 0; }
.hero__stats dt {
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.hero__stats dd { margin: 0; font-size: 1.75rem; font-weight: 640; letter-spacing: -0.03em; }

/* Attenuation cascade figure */
.cascade { margin: 0; }
.cascade svg { width: 100%; height: auto; display: block; }
.cascade__bar {
  fill: color-mix(in srgb, var(--accent) calc(var(--o) * 100%), transparent);
  stroke: var(--accent-line);
  stroke-width: 1;
}
.cascade__label { font: 500 12.5px var(--mono); letter-spacing: -0.01em; fill: var(--text); }
.cascade__ticks path { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 4; opacity: .55; }
.cascade figcaption {
  margin-top: 1.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 48ch;
}
.cascade__row {
  animation: slide-in 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
  animation-delay: calc(var(--i) * 90ms + 120ms);
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: none; }
}

/* --- 7. Quote band + etymology ------------------------------------------ */

.band--quote .wrap {
  display: grid;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: center;
}
@media (min-width: 900px) { .band--quote .wrap { grid-template-columns: 1.15fr 0.85fr; } }

.pull { margin: 0; border-left: 3px solid var(--accent); padding-left: clamp(1.1rem, 3vw, 2rem); }
.pull p {
  margin: 0;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem);
  line-height: 1.38;
  letter-spacing: -0.024em;
  font-weight: 500;
  text-wrap: balance;
}

.etymology {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.etymology__word {
  font-size: 1.4rem;
  font-weight: 640;
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.etymology__word span {
  font: 500 0.7rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.etymology__gloss { color: var(--text-2); font-style: italic; margin-bottom: 0.9rem; }
.etymology__note { font-size: 0.9rem; color: var(--muted); margin: 0; }

/* --- 8. Cards ----------------------------------------------------------- */

.cards .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.cards .card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.card__icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1rem;
}
.card__icon svg { width: 21px; height: 21px; }
.card h3 { margin-bottom: 0.55rem; }
.card p { font-size: 0.94rem; color: var(--text-2); margin-bottom: 0.8rem; }
.card p.card__was {
  font: 500 0.78rem/1.4 var(--mono);
  color: var(--muted);
  margin: 0;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
}
.card__was span { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.68rem; opacity: 0.75; margin-right: 0.5rem; }

/* --- 9. Tables ---------------------------------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.78rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font: 600 0.72rem/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--line-strong);
  white-space: nowrap;
}
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }

.compare tbody th {
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--text);
  width: 1%;
  white-space: nowrap;
}
.compare__before { color: var(--muted); }
.compare__after { color: var(--text); }
.compare tbody tr:hover td, .compare tbody tr:hover th { background: var(--surface); }
@media (min-width: 720px) {
  .compare__after { border-left: 2px solid var(--accent-line); }
}

/* --- 10. Code ----------------------------------------------------------- */

.code {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 1.6rem 0;
  overflow: hidden;
}
.code__lang {
  position: absolute;
  top: 0; right: 0;
  font: 500 0.66rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
}
.code pre { margin: 0; padding: 1.05rem 1.15rem; overflow-x: auto; }
.code code { color: var(--text-2); line-height: 1.6; }

/* --- 11. Stack figure --------------------------------------------------- */

.stack { margin: 0; display: grid; gap: 4px; }
.stack__layer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  display: grid;
  gap: 0.5rem;
}
.stack__layer--app { border-color: var(--line-strong); }
.stack__layer--svc { background: var(--accent-soft); border-color: var(--accent-line); }
.stack__layer--kern { background: var(--surface-2); }
.stack__layer--hw { background: transparent; border-style: dashed; }
.stack__name {
  font-weight: 620;
  font-size: 0.96rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.stack__name em {
  font: 500 0.72rem/1 var(--mono);
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.stack__name em.tag { color: var(--warn); }
.stack__detail { font-size: 0.88rem; color: var(--muted); }
.stack__chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.stack__chips span {
  font: 500 0.74rem/1 var(--mono);
  padding: 0.34em 0.55em;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.stack__boundary {
  display: grid;
  place-items: center;
  padding: 0.3rem 0;
  position: relative;
}
.stack__boundary::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px dashed var(--line-strong);
}
.stack__boundary span {
  position: relative;
  background: var(--bg);
  padding: 0 0.7rem;
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.band--alt .stack__boundary span { background: var(--bg-2); }
.stack figcaption {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 70ch;
}

/* --- 12. Injection figure ----------------------------------------------- */

.injection { margin: 0; }
.injection__flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.injection__step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
}
.injection__step p { margin: 0; font-size: 0.94rem; color: var(--text-2); }
.injection__tag {
  display: block;
  font: 600 0.66rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.injection__step--attack { border-left-color: var(--warn); }
.injection__step--attack p { font-family: var(--mono); font-size: 0.85rem; }
.injection__step--attack .injection__tag { color: var(--warn); }
.injection__step--deny { border-left-color: var(--accent); background: var(--accent-soft); }
.injection__step--deny .injection__tag { color: var(--accent); }
.redact {
  background: currentColor;
  border-radius: 3px;
  opacity: 0.35;
  padding-inline: 1.6em;
}
.injection figcaption { margin-top: 1rem; font-size: 0.87rem; color: var(--muted); }

/* --- 13. Status cards and phases ---------------------------------------- */

.status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top-width: 3px;
  border-radius: var(--radius);
  padding: 1.5rem;
}
.status-card--decided { border-top-color: var(--accent); }
.status-card--proposed { border-top-color: var(--warn); }
.status-card--open { border-top-color: var(--open); }
.status-card p.status-card__n {
  font-size: 2.6rem;
  font-weight: 660;
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 0 0 0.3rem;
}
.status-card--decided .status-card__n { color: var(--accent); }
.status-card--proposed .status-card__n { color: var(--warn); }
.status-card--open .status-card__n { color: var(--open); }
.status-card h3 { margin-bottom: 0.6rem; }
.status-card p { font-size: 0.93rem; color: var(--text-2); }

.phases { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: phase; }
.phase {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  display: grid;
  gap: 0.7rem;
}
.phase--in-progress { border-color: var(--accent-line); background: var(--accent-soft); }
/* The parked research track: present, legible, visibly not on the critical path. */
.phase--parked { border-style: dashed; opacity: .72; }
.phase--parked .phase__n { font-size: 1.05rem; }
.phase__head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.phase__n {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font: 620 0.9rem/1 var(--mono);
  color: var(--muted);
  flex: none;
}
.phase--in-progress .phase__n { background: var(--accent); color: #03100e; border-color: transparent; }
.phase__head h3 { margin-right: auto; }
.phase__body { margin: 0; color: var(--text-2); font-size: 0.95rem; }
.phase__gate {
  margin: 0;
  font-size: 0.89rem;
  color: var(--muted);
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}
.phase__gate span {
  display: block;
  font: 600 0.66rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* --- 14. CTA ------------------------------------------------------------ */

.band--cta { border-top: 1px solid var(--line); background: var(--bg-2); }
.cta { text-align: center; max-width: 60ch; margin-inline: auto; }
.cta__mark { color: var(--accent); margin-bottom: 1.2rem; }
.cta h2 { margin-bottom: 1rem; }
.cta p { color: var(--muted); margin-bottom: 1.8rem; }
.cta .hero__actions { justify-content: center; }


/* --- 14b. Try it -------------------------------------------------------- */

.band--try { border-top: 1px solid var(--line); }

.try {
  display: grid;
  gap: clamp(1.6rem, 3vw, 2.6rem);
  align-items: start;
}
@media (min-width: 900px) {
  .try { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}

.try__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.try__step { min-width: 0; }
.try__label {
  margin: 0 0 0.6rem;
  font-weight: 620;
  font-size: 0.95rem;
}

/* The command is the most important object on the page: give it weight, and
   keep the copy affordance inside the same box so they read as one control. */
.try__cmd {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #0b0e13;
  padding: 0.15rem 0.15rem 0.15rem 0.9rem;
  overflow: hidden;
}
.try__cmd code {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  padding: 0.7rem 0 0.7rem 0;
  background: none;
  border: 0;
  color: #d7dee6;
  font-size: 0.86rem;
}
.try__cmd code::before { content: '$ '; color: var(--accent); }

.try__copy {
  flex: none;
  align-self: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #d7dee6;
  font: 600 0.74rem/1 var(--mono);
  padding: 0.5rem 0.7rem;
  margin-right: 0.15rem;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}
.try__copy:hover { background: rgba(255, 255, 255, 0.12); }
.try__copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.try__copy.is-done { color: var(--accent); border-color: var(--accent-line); }

.try__hint { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.88rem; }
.try__hint code { font-size: 0.85em; }

.try__aside {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  background: var(--bg-2);
  min-width: 0;
}
.try__aside-title {
  margin: 0 0 0.75rem;
  font-weight: 620;
  font-size: 0.9rem;
}
.try__pre {
  margin: 0;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
}
.try__hint--lock {
  grid-column: 1 / -1;
  margin-top: 1.6rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}
.try__hint--lock code { word-break: break-all; }
.try__foot {
  margin: 2rem 0 0;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 78ch;
}

/* --- 15. Content pages -------------------------------------------------- */

.main { padding-bottom: clamp(4rem, 8vw, 7rem); }
.main--wide { padding-bottom: 0; }

.page-head {
  margin: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { margin-bottom: 0.9rem; }
.page-head__lede { font-size: 1.1rem; color: var(--text-2); max-width: 62ch; margin-bottom: 0; }
.page-head__source { margin: 1.2rem 0 0; font-size: 0.85rem; color: var(--muted); }

.layout {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
@media (min-width: 1040px) {
  .layout { grid-template-columns: 218px minmax(0, 1fr); }
  .layout .prose { max-width: var(--prose); min-width: 0; }
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  display: none;
}
@media (min-width: 1040px) { .toc { display: block; } }
.toc__title {
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; border-left: 1px solid var(--line); }
.toc__list a {
  display: block;
  padding: 0.32rem 0 0.32rem 0.9rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-size: 0.87rem;
  text-decoration: none;
  line-height: 1.4;
}
.toc__list a:hover { color: var(--text); }
.toc__list a.is-active { color: var(--accent); border-left-color: var(--accent); }

.prose { max-width: var(--prose); }
.prose > h2 {
  margin: 3rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.prose > h2:first-child, .page-head + h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.prose > h3 { margin: 2.1rem 0 0.8rem; }
.prose > h4 { margin: 1.6rem 0 0.6rem; font-size: 1rem; color: var(--text-2); }
.prose p, .prose li { color: var(--text-2); }
.prose > ul, .prose > ol { margin: 0 0 1.3em; padding-left: 1.3em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--accent-line);
  color: var(--text);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose .table-scroll {
  margin: 1.8rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.prose table { font-size: 0.9rem; }
.prose th, .prose td { padding: 0.7rem 0.85rem; }
.prose thead th { background: var(--surface-2); }
.prose strong { color: var(--text); font-weight: 620; }

.anchor {
  margin-left: 0.45rem;
  color: var(--line-strong);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s ease;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }

/* Callout, used from content via raw HTML */
.note {
  margin: 1.8rem 0;
  padding: 1.15rem 1.3rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.94rem;
}
.note > :last-child { margin-bottom: 0; }
.note--warn { border-left-color: var(--warn); }
.note--open { border-left-color: var(--open); }
.note__label {
  display: block;
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.55rem;
}
.note--warn .note__label { color: var(--warn); }
.note--open .note__label { color: var(--open); }

.quiet { color: var(--muted); font-size: 0.95rem; }

.prose > ul.doc-list, .prose > ul.dec { padding-left: 0; }

/* Document index used on /docs */
.doc-list { list-style: none; margin: 1.5rem 0; padding: 0; display: grid; gap: 0.6rem; }
.doc-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.7rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.doc-list p { flex: 1 1 100%; }
.doc-list a { font-weight: 580; text-decoration: none; font-size: 0.98rem; }
.doc-list p { margin: 0; font-size: 0.88rem; color: var(--muted); }


/* Decision rows */
.dec { display: grid; gap: 0.6rem; list-style: none; margin: 1.5rem 0; padding: 0; }
.dec li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  align-items: baseline;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.dec .dec__id {
  font: 620 0.8rem/1.5 var(--mono);
  color: var(--accent);
  letter-spacing: 0.02em;
}
.dec--proposed .dec__id { color: var(--warn); }
.dec .dec__what { margin: 0; color: var(--text); font-weight: 560; }
.dec .dec__why { grid-column: 2; margin: 0; font-size: 0.9rem; color: var(--muted); }


/* --- 16. Terminal recordings -------------------------------------------- */

.demo-provenance {
  font-size: 0.86rem;
  color: var(--muted);
  border-left: 2px solid var(--line-strong);
  padding-left: 0.9rem;
  margin: 0 0 2.2rem;
}

.demo { margin: 0 0 3rem; }
.demo__head { margin-bottom: 0.9rem; }
.demo__title { margin: 0 0 0.35rem; font-size: 1.1rem; }
.demo__caption { margin: 0; color: var(--text-2); font-size: 0.95rem; }

/* The frame is a terminal, so it commits to the dark end in both themes —
   a terminal that follows the page theme stops reading as a terminal. */
.demo__frame {
  margin-top: 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  background: #0b0e13;
}

.demo__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: #13171e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font: 500 0.72rem/1 var(--mono);
  color: rgba(233, 238, 243, 0.5);
}
.demo__dots { display: inline-flex; gap: 0.32rem; }
.demo__dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.demo__file { color: rgba(233, 238, 243, 0.72); }
.demo__meta { margin-left: auto; font-variant-numeric: tabular-nums; }

.demo__screen {
  margin: 0;
  padding: 1rem 1.1rem;
  min-height: 11.5rem;
  max-height: 26rem;
  overflow: auto;
  background: none;
  border: 0;
  border-radius: 0;
  color: #d7dee6;
  font-size: 0.83rem;
  line-height: 1.55;
  white-space: pre;
  tab-size: 4;
}
.demo__screen:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* A block cursor while replaying, so a pause reads as a pause and not a stall. */
.demo.is-playing .demo__screen::after {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: demo-caret 1s steps(2, start) infinite;
}
@keyframes demo-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.demo__controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: #0e1219;
}
.demo__status {
  font: 500 0.75rem/1 var(--mono);
  color: rgba(233, 238, 243, 0.5);
}
.demo__note {
  margin: 0.9rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--accent-line);
  font-size: 0.89rem;
  color: var(--text-2);
}

@media (max-width: 560px) {
  .demo__screen { font-size: 0.74rem; padding: 0.8rem; }
  .demo__meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .demo.is-playing .demo__screen::after { animation: none; }
}

/* --- 17. Footer --------------------------------------------------------- */

.footer { border-top: 1px solid var(--line); background: var(--bg-2); }
.footer__inner {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  padding: clamp(2.5rem, 5vw, 4rem) 0 2.5rem;
  display: grid;
  gap: 2.5rem;
}
@media (min-width: 900px) { .footer__inner { grid-template-columns: 1fr 1.5fr; } }

.footer__tagline { margin: 1rem 0 0.8rem; font-weight: 520; }
.footer__note { font-size: 0.86rem; color: var(--muted); max-width: 42ch; margin: 0; }
.footer__note strong { color: var(--text-2); font-style: italic; }

.footer__cols { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.footer__col h2 {
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.footer__col a { color: var(--text-2); text-decoration: none; font-size: 0.9rem; }
.footer__col a:hover { color: var(--accent); }

.footer__bar {
  border-top: 1px solid var(--line);
  padding: 1.3rem 0;
}
.footer__bar p {
  width: min(100% - 2.5rem, var(--wrap));
  margin: 0 auto;
  font-size: 0.82rem;
  color: var(--muted);
}
.footer__bar p + p { margin-top: 0.4rem; }
.footer__bar a { color: var(--muted); }
.footer__updated { font-variant-numeric: tabular-nums; }
.footer__updated code { font-size: 0.95em; background: none; padding: 0; }

/* --- 18. Motion and print ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .header, .footer, .toc, .hero__figure, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .band { border: 0; padding: 1rem 0; }
  a { text-decoration: underline; }
}
