/* ============================================================
   Design tokens. Light is the default; dark overrides below.
   ============================================================ */
:root {
  /* Neutrals — "paper" */
  --bg:            #f7f7f5;
  --bg-raised:     #fffffe;
  --bg-sunken:     #eeede8;
  --ink:           #14211e;
  --ink-muted:     #5a665f;
  --ink-faint:     #667470;
  --rule:          rgba(10, 46, 42, 0.13);
  --rule-strong:   rgba(10, 46, 42, 0.26);

  /* The dark teal panel — present in both themes, it's the signature */
  --panel:         #0a2e2a;
  --panel-deep:    #072320;
  --panel-ink:     #e8f3ef;
  --panel-muted:   #8fb3aa;

  /* Accents */
  --teal:          #5DCAA5;
  --teal-deep:     #0d6b55;
  --coral:         #993C1D;
  --coral-soft:    #c25a35;

  /* Status colors — used by project state chips */
  --st-building:   #0d6b55;
  --st-shipped:    #2f6b3f;
  --st-research:   #4a5a86;
  --st-archived:   #7b7168;

  /* Type */
  --font-body:  'DM Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-hero:    clamp(2.75rem, 8vw, 5.5rem);
  --t-h1:      clamp(2rem, 5vw, 3.25rem);
  --t-h2:      clamp(1.45rem, 3vw, 2rem);
  --t-h3:      1.15rem;
  --t-body:    1.0625rem;
  --t-small:   0.9rem;
  --t-micro:   0.78rem;

  --lh-body: 1.68;
  --lh-tight: 1.2;

  /* Space */
  --page-x:    clamp(1.5rem, 6vw, 6rem);
  --sec-y:     clamp(3.5rem, 8vw, 6rem);
  --measure:   720px;
  --measure-wide: 960px;

  --radius:    10px;
  --radius-sm: 6px;
  --radius-pill: 2rem;

  --shadow: 0 1px 2px rgba(10,46,42,.05), 0 6px 20px -8px rgba(10,46,42,.13);
  --tr: 0.2s cubic-bezier(.4,0,.2,1);
}

:root[data-theme="dark"] {
  --bg:            #0b1513;
  --bg-raised:     #121f1c;
  --bg-sunken:     #070f0e;
  --ink:           #e6efeb;
  --ink-muted:     #97a8a1;
  --ink-faint:     #8b9a94;
  --rule:          rgba(232, 243, 239, 0.13);
  --rule-strong:   rgba(232, 243, 239, 0.28);

  --panel:         #071f1c;
  --panel-deep:    #041614;

  --teal-deep:     #6fd9b6;
  --coral:         #e08a63;
  --coral-soft:    #eda684;

  --st-building:   #6fd9b6;
  --st-shipped:    #7fc08e;
  --st-research:   #9fb0e0;
  --st-archived:   #a89c90;

  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.6);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--tr), color var(--tr);
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

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

/* ---- Film grain. Sits above everything, catches no clicks. ---- */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] body::after { opacity: 0.055; }

.wrap { max-width: var(--measure); margin: 0 auto; }
.wrap-wide { max-width: var(--measure-wide); margin: 0 auto; }

/* ============================================================
   Header panel — always dark teal
   ============================================================ */
.header {
  background: var(--panel);
  color: var(--panel-ink);
  padding: 0 var(--page-x);
  position: relative;
  overflow: hidden;
}
/* Faint topographic wash so the panel isn't flat color */
.header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(120% 90% at 88% -20%, rgba(93,202,165,.14), transparent 62%),
    radial-gradient(80% 70% at 0% 110%, rgba(153,60,29,.14), transparent 60%);
}
.header > * { position: relative; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.6rem 0;
}
.nav__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.01em;
}
.nav__right { display: flex; align-items: center; gap: 1.75rem; }
.nav__links { display: flex; gap: 1.75rem; }
.nav__link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--panel-ink);
  position: relative;
  transition: color var(--tr);
}
.nav__link::after {
  content: "";
  position: absolute; left: 0; bottom: -5px;
  width: 0; height: 2px;
  background: var(--teal);
  transition: width var(--tr);
}
.nav__link:hover, .nav__link[aria-current="page"] { color: var(--teal); }
.nav__link:hover::after, .nav__link[aria-current="page"]::after { width: 100%; }

/* ⌘K hint button + theme toggle */
.nav__tools { display: flex; align-items: center; gap: 0.5rem; }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--panel-muted);
  border: 1px solid rgba(232,243,239,.2);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.5rem;
  transition: color var(--tr), border-color var(--tr), background var(--tr);
}
.kbd-btn:hover { color: var(--teal); border-color: var(--teal); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border: 1px solid rgba(232,243,239,.2);
  border-radius: var(--radius-sm);
  color: var(--panel-muted);
  transition: color var(--tr), border-color var(--tr);
}
.icon-btn:hover { color: var(--teal); border-color: var(--teal); }
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root:not([data-theme="dark"]) .icon-moon { display: none; }

/* ---- Hero ---- */
.hero { max-width: var(--measure); margin: 0 auto; padding: clamp(2.5rem,7vw,5rem) 0 clamp(3rem,8vw,6rem); }
.hero--sm { padding: clamp(1.5rem,4vw,2.5rem) 0 clamp(2rem,5vw,3.5rem); }
.hero__name {
  font-family: var(--font-serif);
  font-size: var(--t-hero);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.015em;
}
.hero__title {
  font-family: var(--font-serif);
  font-size: var(--t-h1);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
.hero__tagline {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--panel-muted);
  margin-top: 1.15rem;
  max-width: 46ch;
}
.hero__meta {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.04em;
  color: var(--panel-muted);
  margin-top: 1.5rem;
}
.hero__meta a { border-bottom: 1px solid rgba(143,179,170,.4); }
.hero__meta a:hover { color: var(--teal); border-color: var(--teal); }
.accent { color: var(--teal); }

/* Breadcrumb on subpages */
.crumb {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--panel-muted);
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
}
.crumb a:hover { color: var(--teal); }

/* ============================================================
   Body
   ============================================================ */
.section { padding: var(--sec-y) var(--page-x); }
.section--tight { padding-top: calc(var(--sec-y) * 0.55); }
.section--sunken { background: var(--bg-sunken); }

.label {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 1.4rem;
  display: flex; align-items: center; gap: 0.85rem;
}
.label::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.prose { display: flex; flex-direction: column; gap: 1.35rem; }
.prose p { line-height: var(--lh-body); }
.prose strong { font-weight: 600; }
.prose a {
  border-bottom: 1px solid var(--rule-strong);
  transition: color var(--tr), border-color var(--tr);
}
.prose a:hover { color: var(--coral); border-color: var(--coral); }
.lead { font-size: 1.2rem; line-height: 1.55; }

.h2 {
  font-family: var(--font-serif);
  font-size: var(--t-h2);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
.h3 { font-size: var(--t-h3); font-weight: 600; margin-bottom: 0.5rem; }

/* ---- Pull quote ---- */
.pullquote {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.35;
  color: var(--ink);
  border-left: 2px solid var(--coral);
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

/* ============================================================
   Project list
   ============================================================ */
.projects { display: flex; flex-direction: column; }
/* Author display rules beat the UA [hidden] rule, so state it explicitly. */
[hidden] { display: none !important; }
.project {
  display: block;
  padding: 1.6rem 0;
  border-top: 1px solid var(--rule);
  transition: background var(--tr);
  position: relative;
}
.project:last-child { border-bottom: 1px solid var(--rule); }
.project__head {
  display: flex; align-items: baseline; gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.project__name {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color var(--tr);
}
.project:hover .project__name { color: var(--coral); }
.project__year {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--ink-faint);
  margin-left: auto;
}
.project__blurb { color: var(--ink-muted); line-height: 1.55; max-width: 62ch; }
.project__stack {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--ink-faint);
  margin-top: 0.6rem;
  letter-spacing: 0.02em;
}

/* State chips */
.chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.chip--building { color: var(--st-building); }
.chip--shipped  { color: var(--st-shipped); }
.chip--research { color: var(--st-research); }
.chip--archived { color: var(--st-archived); }

/* Filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.75rem; }
.filter {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.04em;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-pill);
  color: var(--ink-muted);
  transition: all var(--tr);
}
.filter:hover { border-color: var(--coral); color: var(--coral); }
.filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.filter__n { opacity: .55; margin-left: .35rem; }

/* ---- Pills ---- */
.pills { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pill {
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  transition: all var(--tr);
}
a.pill:hover { color: var(--coral); border-color: var(--coral); background: var(--bg-raised); }

/* ---- Signature + footer ---- */
.sig { font-family: var(--font-serif); color: var(--ink-muted); margin-top: 3rem; }
.sig b { color: var(--coral); font-weight: 400; }

.footer {
  padding: 2.5rem var(--page-x) 3.5rem;
  border-top: 1px solid var(--rule);
}
.footer__inner {
  max-width: var(--measure); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  align-items: baseline; justify-content: space-between;
}
.social { display: flex; flex-wrap: wrap; gap: 1.75rem; }
.social a {
  font-size: 0.92rem; font-weight: 500;
  color: var(--ink-muted); position: relative;
  transition: color var(--tr);
}
.social a::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 0; height: 1.5px; background: var(--coral);
  transition: width var(--tr);
}
.social a:hover { color: var(--coral); }
.social a:hover::after { width: 100%; }
.footer__note { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--ink-faint); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   Command palette (⌘K)
   ============================================================ */
.cmdk { position: fixed; inset: 0; z-index: 9999; }
.cmdk[hidden] { display: none; }
.cmdk__scrim {
  position: absolute; inset: 0;
  background: rgba(7, 22, 20, 0.55);
  backdrop-filter: blur(3px);
  animation: cmdk-fade .14s ease;
}
.cmdk__panel {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  margin: clamp(3rem, 12vh, 8rem) auto 0;
  background: var(--bg-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px -12px rgba(0,0,0,.45);
  overflow: hidden;
  animation: cmdk-rise .16s cubic-bezier(.2,.8,.3,1);
}
@keyframes cmdk-fade { from { opacity: 0 } }
@keyframes cmdk-rise { from { opacity: 0; transform: translateY(-8px) scale(.985) } }

.cmdk__bar {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.cmdk__ico { width: 15px; height: 15px; color: var(--ink-faint); flex: none; }
.cmdk__input {
  flex: 1; border: 0; background: none; outline: none;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
}
.cmdk__input::placeholder { color: var(--ink-faint); }
.cmdk__esc, .cmdk__foot kbd {
  font-family: var(--font-mono); font-size: 0.66rem;
  color: var(--ink-faint);
  border: 1px solid var(--rule-strong); border-radius: 4px;
  padding: 0.12rem 0.36rem;
}

.cmdk__list { max-height: min(46vh, 380px); overflow-y: auto; padding: 0.4rem; }
.cmdk__item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.cmdk__item.is-active { background: var(--bg-sunken); }
.cmdk__item.is-active .cmdk__t { color: var(--coral); }
.cmdk__t { font-weight: 500; }
.cmdk__s {
  font-family: var(--font-mono); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.cmdk__empty { padding: 1.5rem 0.75rem; text-align: center; color: var(--ink-faint); font-size: var(--t-small); }
.cmdk__foot {
  display: flex; gap: 1.1rem; flex-wrap: wrap;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--rule);
  background: var(--bg-sunken);
  font-size: 0.7rem; color: var(--ink-faint);
}
.cmdk__foot span { display: inline-flex; align-items: center; gap: 0.3rem; }

/* ============================================================
   Project detail pages
   ============================================================ */
.spec {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.5rem;
  font-size: var(--t-small);
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(232,243,239,.15);
}
.spec dt {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--panel-muted);
  padding-top: 0.1rem;
}
.spec dd { margin: 0; color: var(--panel-ink); }
.spec dd a { border-bottom: 1px solid rgba(143,179,170,.45); }
.spec dd a:hover { color: var(--teal); border-color: var(--teal); }

/* Architecture diagram frame */
.figure { margin: 2rem 0 0; }
.figure__frame {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.75rem);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.figure__frame svg { display: block; width: 100%; height: auto; min-width: 520px; }
.figure figcaption {
  font-family: var(--font-mono); font-size: var(--t-micro);
  color: var(--ink-faint); margin-top: 0.85rem; line-height: 1.5;
}

/* SVG diagram primitives — themed via currentColor + vars */
.d-box  { fill: var(--bg-sunken); stroke: var(--rule-strong); stroke-width: 1.25; }
.d-box-accent { fill: none; stroke: var(--teal-deep); stroke-width: 1.5; }
.d-box-warn { fill: none; stroke: var(--coral); stroke-width: 1.5; }
.d-label { font-family: var(--font-body); font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.d-sub   { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-muted); }
.d-note  { font-family: var(--font-mono); font-size: 10.5px; fill: var(--ink-faint); }
.d-line  { stroke: var(--rule-strong); stroke-width: 1.25; fill: none; }
.d-line-accent { stroke: var(--teal-deep); stroke-width: 1.5; fill: none; }
.d-line-warn { stroke: var(--coral); stroke-width: 1.5; fill: none; }
.d-dash  { stroke-dasharray: 4 4; }
.d-fill-accent { fill: var(--teal-deep); }
.d-fill-warn { fill: var(--coral); }
.d-group { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 3; }

/* Numbers row */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 1.75rem;
}
.metric { background: var(--bg); padding: 1.15rem 1.25rem; }
.metric__n {
  font-family: var(--font-serif);
  font-size: 1.75rem; line-height: 1;
  color: var(--ink);
}
.metric__l {
  font-family: var(--font-mono); font-size: var(--t-micro);
  color: var(--ink-muted); margin-top: 0.45rem; line-height: 1.4;
}

/* Bullet list with hanging markers */
.bullets { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.bullets li { position: relative; padding-left: 1.4rem; line-height: 1.6; }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--coral);
}
.bullets code, .prose code, .metric code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--bg-sunken); border: 1px solid var(--rule);
  padding: 0.08em 0.36em; border-radius: 4px;
}

/* Honest-limits callout */
.caveat {
  border-left: 2px solid var(--st-archived);
  padding: 0.15rem 0 0.15rem 1.25rem;
  color: var(--ink-muted);
  font-size: var(--t-small);
  line-height: 1.6;
  margin-top: 1.5rem;
}
.caveat b { color: var(--ink); font-weight: 600; }

/* Prev / next */
.pager {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  padding-top: 1.75rem; margin-top: var(--sec-y);
  font-family: var(--font-mono); font-size: var(--t-small);
}
.pager a:hover { color: var(--coral); }

/* /now page timeline */
.now-list { display: flex; flex-direction: column; gap: 1.6rem; }
.now-item { display: grid; grid-template-columns: 96px 1fr; gap: 1.25rem; align-items: start; }
.now-item__k {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); padding-top: 0.25rem;
}
.now-item__v { line-height: 1.6; }
.now-item__v a { border-bottom: 1px solid var(--rule-strong); }
.now-item__v a:hover { color: var(--coral); border-color: var(--coral); }

@media (max-width: 560px) {
  .now-item { grid-template-columns: 1fr; gap: 0.35rem; }
  .nav__links { gap: 1.1rem; }
  .nav__right { gap: 1rem; }
  .project__year { margin-left: 0; width: 100%; }
}

/* ---- Chart primitives (real-data plots, not schematics) ---- */
.d-axis { stroke: var(--rule-strong); stroke-width: 1; }
.d-series-prob { fill: none; stroke: var(--teal-deep); stroke-width: 1.6; stroke-linejoin: round; }
.d-series-vix  { fill: none; stroke: var(--coral); stroke-width: 1.4; stroke-linejoin: round; opacity: .85; }
.d-bar     { fill: var(--bg-sunken); stroke: var(--rule-strong); stroke-width: 1; }
.d-bar-sig { fill: var(--teal-deep); stroke: none; }

/* ---- Thesis line: the claim, stated once, under the title ---- */
.thesis {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-style: italic;
  line-height: 1.4;
  color: var(--panel-ink);
  border-left: 2px solid var(--teal);
  padding-left: 1.1rem;
  margin: 1.35rem 0 0;
  max-width: 54ch;
}
.project__thesis {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0.15rem 0 0.5rem;
  max-width: 60ch;
}

/* ---- Section numbering ---- */
.label__n {
  font-variant-numeric: tabular-nums;
  color: var(--coral);
  margin-right: 0.1rem;
}

/* ---- Stack section ---- */
.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.75rem 2rem; }
.stack__k {
  font-family: var(--font-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); margin-bottom: 0.5rem;
}
.stack__v { line-height: 1.7; color: var(--ink-muted); }
.stack__v b { color: var(--ink); font-weight: 600; }

/* ---- Interactive firewall demo ---- */
.demo {
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
  margin-top: 1.75rem;
  box-shadow: var(--shadow);
}
.demo__bar {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-sunken);
  font-family: var(--font-mono); font-size: var(--t-micro);
  color: var(--ink-muted); letter-spacing: 0.05em;
}
.demo__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-deep); flex: none; }
.demo__body { padding: 1rem; }
.demo__in {
  width: 100%; resize: vertical; min-height: 74px;
  font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
}
.demo__in:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.demo__try { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.demo__chip {
  font-family: var(--font-mono); font-size: 0.72rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-pill);
  padding: 0.3rem 0.7rem; color: var(--ink-muted);
  transition: all var(--tr);
}
.demo__chip:hover { border-color: var(--coral); color: var(--coral); }
.demo__out { margin-top: 1rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.demo__verdict {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.8rem;
  font-weight: 500; letter-spacing: 0.08em;
  padding: 0.35rem 0.7rem; border-radius: 4px; border: 1px solid currentColor;
}
.v-pass  { color: var(--st-shipped); }
.v-flag  { color: #9a6b16; }
.v-block { color: var(--coral); }
:root[data-theme="dark"] .v-flag { color: #d8a44a; }
.demo__detail { margin-top: 0.85rem; font-size: var(--t-small); line-height: 1.65; color: var(--ink-muted); }
.demo__detail code {
  font-family: var(--font-mono); font-size: 0.82em;
  background: var(--bg-sunken); border: 1px solid var(--rule);
  padding: 0.08em 0.36em; border-radius: 4px; color: var(--ink);
}
.demo__say {
  margin-top: 0.75rem; padding: 0.7rem 0.85rem;
  background: var(--bg-sunken); border-left: 2px solid var(--coral);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--t-small); line-height: 1.6;
}
.demo__say b { font-family: var(--font-mono); font-size: var(--t-micro); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); display: block; margin-bottom: .25rem; }
.demo__note { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--ink-faint); margin-top: 0.9rem; line-height: 1.55; }

/* ---- Extra demo controls (sliders, ranked lists, finding rows) ---- */
.demo__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin-bottom: 0.9rem; }
.demo__slider { flex: 1 1 200px; display: flex; align-items: center; gap: 0.7rem; }
.demo__slider input[type=range] { flex: 1; accent-color: var(--teal-deep); }
.demo__val {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink);
  min-width: 3.2em; text-align: right;
}
.demo__lbl { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; }

.rank { display: flex; flex-direction: column; gap: 0.4rem; }
.rank__i {
  display: grid; grid-template-columns: 1.9rem 1fr auto; gap: 0.75rem; align-items: center;
  padding: 0.55rem 0.7rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--bg); transition: transform .25s cubic-bezier(.4,0,.2,1), border-color var(--tr);
}
.rank__i.up { border-color: var(--teal-deep); }
.rank__i.down { border-color: var(--st-archived); }
.rank__n { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-faint); }
.rank__name { font-weight: 600; font-size: 0.94rem; }
.rank__meta { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--ink-faint); display: block; margin-top: .15rem; }
.rank__score { font-family: var(--font-mono); font-size: 0.86rem; color: var(--ink); text-align: right; }
.rank__delta { font-family: var(--font-mono); font-size: var(--t-micro); display: block; }
.rank__delta.up { color: var(--st-shipped); }
.rank__delta.down { color: var(--coral); }

.find { display: flex; flex-direction: column; gap: 0.5rem; }
.find__i { border-left: 2px solid var(--coral); padding: 0.4rem 0 0.4rem 0.8rem; }
.find__i.sev-medium { border-color: #9a6b16; }
.find__i.sev-low { border-color: var(--st-archived); }
.find__t { font-weight: 600; font-size: 0.92rem; }
.find__m { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--ink-faint); margin-top: .2rem; }
.find__code {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-muted);
  background: var(--bg-sunken); border: 1px solid var(--rule); border-radius: 4px;
  padding: .3rem .5rem; margin-top: .35rem; overflow-x: auto; white-space: pre;
}
.demo__btn {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: .04em;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  border-radius: var(--radius-sm); padding: 0.45rem 0.85rem;
  transition: opacity var(--tr);
}
.demo__btn:hover { opacity: .85; }
.demo__btn[disabled] { opacity: .4; cursor: not-allowed; }
.demo__btn--ghost { background: none; color: var(--ink); }
.gate { display: flex; align-items: center; gap: .6rem; margin: .8rem 0; font-family: var(--font-mono); font-size: var(--t-micro); }
.gate__bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-sunken); border: 1px solid var(--rule); position: relative; overflow: hidden; }
.gate__fill { position: absolute; inset: 0 auto 0 0; background: var(--teal-deep); transition: width .3s ease; }
.gate__fill.low { background: var(--coral); }
.gate__tau { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }

/* ---- Hero call-to-action row ---- */
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.8rem; }
.cta {
  display: inline-flex; align-items: center;
  font-size: 0.92rem; font-weight: 500;
  padding: 0.6rem 1.15rem;
  border: 1px solid rgba(232,243,239,.28);
  border-radius: var(--radius-pill);
  color: var(--panel-ink);
  transition: all var(--tr);
}
.cta:hover { border-color: var(--teal); color: var(--teal); }
.cta--solid { background: var(--teal); border-color: var(--teal); color: #06231f; font-weight: 600; }
.cta--solid:hover { background: #6fd9b6; border-color: #6fd9b6; color: #06231f; }
