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

/* Any author `display` beats the UA rule for [hidden], which would leave
   fixed overlays (.modal, .devdrawer) invisible but still swallowing every
   click on the page. Keep this ahead of every component rule. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 92px; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { line-height: 1.14; margin: 0; letter-spacing: -0.02em; font-weight: 600; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font: inherit; color: inherit; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================================
   SCROLL REVEAL
   ========================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* =========================================================================
   TOP BAR
   ========================================================================= */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  background: rgba(13, 13, 13, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
  transform: translateY(-100%);
  transition: transform var(--dur) var(--ease-out);
}
.topbar.is-visible { transform: none; }

.topbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-5);
}

.brand { display: flex; align-items: center; gap: var(--sp-3); color: inherit; flex: 0 0 auto; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--series-1), var(--series-3));
  box-shadow: 0 0 0 1px var(--hairline), 0 0 20px rgba(57,135,229,0.35);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-size: var(--fs-sm); font-weight: 600; letter-spacing: -0.01em; }
.brand__text em { font-style: normal; font-size: var(--fs-xs); color: var(--text-muted); }

.chapnav { flex: 1 1 auto; display: flex; justify-content: center; }
.chapnav ol { display: flex; gap: var(--sp-1); list-style: none; margin: 0; padding: 0; }
.chapnav button {
  background: none; border: 0; cursor: pointer;
  padding: var(--sp-2) var(--sp-3); border-radius: 999px;
  font-size: var(--fs-xs); color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.chapnav button:hover { color: var(--text-primary); background: var(--surface-2); }
.chapnav button.is-active { color: var(--text-primary); background: var(--accent-wash); }
.chapnav button .n { font-variant-numeric: tabular-nums; color: var(--accent); margin-right: 6px; }

.pulse { display: flex; align-items: center; gap: var(--sp-3); flex: 0 0 auto; }
.pulse__label { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.pulse__meter { position: relative; width: 96px; height: 6px; }
.pulse__track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; }
.pulse__fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--accent); border-radius: 999px;
  transition: width var(--dur-slow) var(--ease-out), background var(--dur);
}
.pulse__value {
  font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
  color: var(--text-secondary); min-width: 34px; text-align: right;
}

.topbar__scrollrail { height: 2px; background: transparent; }
#scrollrail-fill { height: 100%; width: 0%; background: var(--accent); }

/* =========================================================================
   HERO
   ========================================================================= */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center;
  padding: var(--sp-10) var(--sp-5) var(--sp-9);
  overflow: hidden;
}
.hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 78% 62% at 50% 42%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 42%, #000 25%, transparent 78%);
  opacity: 0.5;
  animation: gridDrift 32s linear infinite;
}
@keyframes gridDrift { to { background-position: 72px 72px, 72px 72px; } }

.hero__inner { position: relative; max-width: var(--maxw); margin: 0 auto; width: 100%; }

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.18em;
  font-size: var(--fs-xs); color: var(--accent); font-weight: 600;
  margin-bottom: var(--sp-5);
}

.hero__title { font-size: var(--fs-hero); font-weight: 600; margin-bottom: var(--sp-6); }
.hero__title .line { display: block; overflow: hidden; }
.hero__title .line > span { display: block; }
.hero__title .line.accent > span {
  background: linear-gradient(94deg, var(--series-1) 8%, var(--series-3) 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__title .line.reveal { opacity: 1; transform: none; }
.hero__title .line.reveal > span {
  opacity: 0; transform: translateY(105%);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.hero__title .line.is-in > span { opacity: 1; transform: none; }

.hero__lede {
  font-size: var(--fs-lede); color: var(--text-secondary);
  max-width: 62ch; margin-bottom: var(--sp-6);
}

.hero__authors { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin-bottom: var(--sp-7); }
.author { display: flex; align-items: center; gap: var(--sp-3); }
.author__initials {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--hairline);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
}
.author__meta { display: flex; flex-direction: column; line-height: 1.35; }
.author__meta strong { font-size: var(--fs-sm); }
.author__meta em { font-style: normal; font-size: var(--fs-xs); color: var(--text-muted); }

.hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.hero__note { font-size: var(--fs-xs); color: var(--text-muted); }

.hero__scrollcue {
  position: absolute; bottom: var(--sp-6); left: 50%; transform: translateX(-50%);
  width: 22px; height: 36px; border: 1px solid var(--hairline-strong); border-radius: 999px;
}
.hero__scrollcue span {
  position: absolute; top: 7px; left: 50%; margin-left: -2px;
  width: 4px; height: 7px; border-radius: 2px; background: var(--accent);
  animation: cue 1.9s var(--ease-in-out) infinite;
}
@keyframes cue { 0%,100% { transform: translateY(0); opacity: 1; } 55% { transform: translateY(12px); opacity: 0.15; } }

/* =========================================================================
   BUTTONS & CHIPS
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--hairline-strong); color: var(--text-secondary); }
.btn--ghost:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.btn--sm { padding: 8px 16px; font-size: var(--fs-xs); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 9px 15px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--hairline-strong); color: var(--text-primary); transform: translateY(-1px); }
.chip.is-selected {
  background: var(--accent-wash); border-color: var(--accent);
  color: var(--text-primary);
}
.chip.is-selected::before { content: "✓"; color: var(--accent); font-weight: 700; }

/* status chip — icon + label so colour never carries meaning alone */
.statuschip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid var(--hairline);
  color: var(--text-primary);
}
.statuschip__icon { font-size: 0.7em; line-height: 1; }
.statuschip--good     { background: var(--status-good-wash); }
.statuschip--good .statuschip__icon     { color: var(--status-good); }
.statuschip--warning  { background: var(--status-warning-wash); }
.statuschip--warning .statuschip__icon  { color: var(--status-warning); }
.statuschip--serious  { background: var(--status-serious-wash); }
.statuschip--serious .statuschip__icon  { color: var(--status-serious); }
.statuschip--critical { background: var(--status-critical-wash); }
.statuschip--critical .statuschip__icon { color: var(--status-critical); }

/* =========================================================================
   CHAPTER SHELL
   ========================================================================= */
.chapter {
  position: relative;
  max-width: var(--maxw); margin: 0 auto;
  padding: var(--sp-10) var(--sp-5);
  border-top: 1px solid var(--hairline);
}
.chapter:first-child { border-top: 0; }
.chapter--feature::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(57,135,229,0.07), transparent 70%);
}
.chapter__head { max-width: var(--maxw-text); margin-bottom: var(--sp-8); position: relative; }
.chapter__num {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent); font-weight: 600; margin-bottom: var(--sp-4);
}
.chapter__title { font-size: var(--fs-h2); margin-bottom: var(--sp-4); }
.chapter__lede { font-size: var(--fs-lede); color: var(--text-secondary); }

.pullquote {
  margin: var(--sp-9) auto 0; max-width: 54ch; text-align: center;
  padding: var(--sp-7) var(--sp-5); border-top: 1px solid var(--hairline);
}
.pullquote p {
  font-size: clamp(1.3rem, 2.4vw, 1.9rem); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.35; color: var(--text-primary);
}

/* card primitive */
.card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

/* =========================================================================
   CH1 — SCENARIO
   ========================================================================= */
.scenario { margin-bottom: var(--sp-7); }
.scenario__frame {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: var(--sp-7);
  position: relative; overflow: hidden;
}
.scenario__clock {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-family: var(--font-mono);
  color: var(--text-muted); margin-bottom: var(--sp-5);
  letter-spacing: 0.04em;
}
.scenario__clock-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--status-critical);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.scenario__q { font-size: var(--fs-h3); margin-bottom: var(--sp-6); max-width: 40ch; }
.scenario__choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); }

.choicecard {
  text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-5);
  transition: all var(--dur) var(--ease-out);
}
.choicecard:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-2); }
.choicecard.is-chosen { border-color: var(--accent); background: var(--accent-wash); }
.choicecard.is-dimmed { opacity: 0.42; }
.choicecard__title { font-size: var(--fs-body); font-weight: 600; margin-bottom: var(--sp-2); }
.choicecard__sub { font-size: var(--fs-sm); color: var(--text-muted); }

.scenario__result {
  margin-top: var(--sp-6); padding-top: var(--sp-6);
  border-top: 1px solid var(--hairline);
  animation: fadeUp var(--dur-slow) var(--ease-out) both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   BAR CHART (single series, horizontal) — used for poll results
   ========================================================================= */
.barchart { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-5); }
.barchart__row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr auto; gap: var(--sp-4); align-items: center; }
.barchart__label { font-size: var(--fs-sm); color: var(--text-secondary); }
.barchart__track { position: relative; height: 20px; background: var(--surface-3); border-radius: 4px; }
.barchart__fill {
  height: 100%; width: 0%;
  background: var(--series-1);
  border-radius: 0 4px 4px 0;   /* 4px rounded data-end, square at baseline */
  transition: width 900ms var(--ease-out);
}
.barchart__fill.is-you { background: var(--accent); }
.barchart__fill.is-context { background: var(--series-mute); }
.barchart__value {
  font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
  color: var(--text-secondary); min-width: 46px; text-align: right;
}
.barchart__caption { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-3); }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-4); }
.legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--text-secondary); }
.legend__swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend__line { width: 16px; height: 2px; border-radius: 2px; flex: 0 0 auto; }

/* table view twin */
.tableview { margin-top: var(--sp-4); }
.tableview summary {
  cursor: pointer; font-size: var(--fs-xs); color: var(--text-muted);
  padding: var(--sp-2) 0; list-style: none;
}
.tableview summary::-webkit-details-marker { display: none; }
.tableview summary::before { content: "▸ "; }
.tableview[open] summary::before { content: "▾ "; }
.tableview summary:hover { color: var(--text-secondary); }
.tableview table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); margin-top: var(--sp-2); }
.tableview th, .tableview td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--hairline);
}
.tableview th { color: var(--text-muted); font-weight: 600; }
.tableview td { color: var(--text-secondary); }
.tableview td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* =========================================================================
   PROBE (inline follow-up questions)
   ========================================================================= */
.probe {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius); padding: var(--sp-5) var(--sp-6);
  margin-top: var(--sp-6);
}
.probe__q { font-size: var(--fs-body); font-weight: 600; margin-bottom: var(--sp-2); }
.probe__hint { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-4); }
.probe__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.probe__ack {
  margin-top: var(--sp-4); font-size: var(--fs-sm); color: var(--text-secondary);
  padding-top: var(--sp-4); border-top: 1px solid var(--hairline);
}
.probe + .probe { margin-top: var(--sp-4); }

/* =========================================================================
   CH2 — KPI ROW / FLIP TILES
   ========================================================================= */
.dashsim {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: var(--sp-6);
}
.dashsim__bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.dashsim__counter { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.kpirow { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }

.kpitile { perspective: 1200px; cursor: pointer; }
/* Both faces share one grid cell, so the tile grows to fit the TALLER face.
   A fixed height here would let the longer back-face copy overflow and
   collide with whatever follows the KPI row. */
.kpitile__inner {
  position: relative; width: 100%; height: 100%;
  display: grid;
  transition: transform 640ms var(--ease-in-out);
  transform-style: preserve-3d;
}
.kpitile.is-flipped .kpitile__inner { transform: rotateY(180deg); }
.kpitile__face {
  grid-area: 1 / 1; min-height: 190px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-5);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: border-color var(--dur-fast);
}
.kpitile:hover .kpitile__face { border-color: var(--hairline-strong); }
.kpitile__face--back { transform: rotateY(180deg); background: var(--surface-3); }

.kpitile__label { font-size: var(--fs-xs); color: var(--text-muted); }
.kpitile__value { font-size: 2.3rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; margin: var(--sp-3) 0; }
.kpitile__delta { font-size: var(--fs-xs); display: flex; align-items: center; gap: 5px; }
.kpitile__delta--good { color: var(--status-good); }
.kpitile__delta--bad  { color: var(--status-critical); }
.kpitile__spark { height: 30px; margin-top: var(--sp-3); }
.kpitile__hintline {
  font-size: var(--fs-xs); color: var(--accent); margin-top: var(--sp-3);
  display: flex; align-items: center; gap: 5px;
}
.kpitile__sig { font-size: var(--fs-sm); color: var(--text-secondary); }
.kpitile__sig strong { color: var(--text-primary); display: block; margin-bottom: var(--sp-2); font-size: var(--fs-body); }

.dashsim__reveal {
  margin-top: var(--sp-6); padding-top: var(--sp-6); border-top: 1px solid var(--hairline);
  animation: fadeUp var(--dur-slow) var(--ease-out) both;
}

/* =========================================================================
   CH3 — LENS
   ========================================================================= */
.lens {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: var(--sp-6);
}
.lens__switch {
  position: relative; display: inline-flex; gap: 0;
  background: var(--surface-3); border-radius: 999px; padding: 4px;
  margin-bottom: var(--sp-6);
}
.lens__btn {
  position: relative; z-index: 1; background: none; border: 0; cursor: pointer;
  padding: 9px 20px; border-radius: 999px; font-size: var(--fs-sm);
  color: var(--text-muted); transition: color var(--dur-fast); white-space: nowrap;
}
.lens__btn.is-active { color: var(--text-primary); font-weight: 600; }
.lens__thumb {
  position: absolute; top: 4px; left: 4px; height: calc(100% - 8px);
  background: var(--surface-1); border-radius: 999px;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease-out), width var(--dur) var(--ease-out);
}

.lens__stage { min-height: 340px; }
.lens__panel { animation: fadeUp var(--dur) var(--ease-out) both; }

.streamgrid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--sp-6); align-items: start; }
@media (max-width: 900px) { .streamgrid { grid-template-columns: 1fr; } }

.stream { display: flex; flex-direction: column; gap: var(--sp-2); max-height: 330px; overflow-y: auto; padding-right: var(--sp-2); }
.stream::-webkit-scrollbar { width: 6px; }
.stream::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

.record {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm); color: var(--text-secondary);
  animation: recordIn var(--dur) var(--ease-out) both;
  animation-delay: var(--i-delay, 0ms);
}
@keyframes recordIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.record__meta {
  display: flex; gap: var(--sp-3); font-size: var(--fs-xs);
  color: var(--text-muted); margin-bottom: 5px; font-family: var(--font-mono);
}
.record__site { display: inline-flex; align-items: center; gap: 5px; }
.record__sitedot { width: 8px; height: 8px; border-radius: 50%; }

mark.phrase {
  background: transparent; color: inherit; padding: 1px 3px; border-radius: 3px;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
  cursor: pointer;
}
.is-ai mark.phrase {
  background: rgba(250, 178, 25, 0.20);
  color: var(--text-primary);
  box-shadow: inset 0 -1px 0 var(--status-warning);
}
.is-ai mark.phrase:hover { background: rgba(250, 178, 25, 0.34); }
mark.phrase.is-watched {
  background: var(--accent-wash) !important;
  box-shadow: inset 0 -1px 0 var(--accent) !important;
}

.lens__verdict { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--hairline); }
.verdictbox { display: flex; gap: var(--sp-4); align-items: flex-start; }
.verdictbox__icon { flex: 0 0 auto; margin-top: 2px; }
.verdictbox__body h4 { font-size: var(--fs-body); margin-bottom: var(--sp-2); }
.verdictbox__body p { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; }

/* line chart */
.linechart { width: 100%; }
.linechart .grid-line { stroke: var(--gridline); stroke-width: 1; }
.linechart .axis-line { stroke: var(--baseline); stroke-width: 1; }
.linechart .series-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linechart .series-area { fill: var(--series-1); opacity: 0.10; }
.linechart .tick { fill: var(--text-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.linechart .end-dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.linechart .end-label { fill: var(--text-secondary); font-size: 11px; }

.draw-in { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1400ms var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* cluster plot */
.cluster { width: 100%; }
.cluster .cell-dot { stroke: var(--surface-1); stroke-width: 2; transition: r var(--dur) var(--ease-out); }
.cluster .band-label { fill: var(--text-muted); font-size: 10px; }
.cluster .cluster-ring { fill: none; stroke: var(--status-warning); stroke-width: 1.5; opacity: 0; animation: ringIn 700ms var(--ease-out) 900ms forwards; }
@keyframes ringIn { to { opacity: 0.75; } }

/* =========================================================================
   CH4 — ASSESSMENT
   ========================================================================= */
.assess {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); overflow: hidden;
}

.assess__intro { padding: var(--sp-8); text-align: center; }
.assess__intro h3 { font-size: var(--fs-h3); margin-bottom: var(--sp-3); }
.assess__intro p { color: var(--text-secondary); max-width: 56ch; margin-inline: auto; margin-bottom: var(--sp-5); }
.dimlist {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}
.dimpill {
  font-size: var(--fs-xs); padding: 6px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text-secondary);
}

/* runner */
.assess__runner { padding: var(--sp-7); }
.qprogress { margin-bottom: var(--sp-6); }
.qprogress__meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-3);
}
.qprogress__dim { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.qprogress__track { height: 3px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.qprogress__fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width var(--dur) var(--ease-out); }

.qcard { animation: qIn var(--dur) var(--ease-out) both; }
.qcard.is-out { animation: qOut var(--dur-fast) var(--ease-in-out) both; }
@keyframes qIn  { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes qOut { to { opacity: 0; transform: translateX(-26px); } }

.qcard__text { font-size: clamp(1.15rem, 1.9vw, 1.5rem); font-weight: 600; margin-bottom: var(--sp-2); max-width: 44ch; }
.qcard__help { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-5); max-width: 56ch; }
.qcard__opts { display: flex; flex-direction: column; gap: var(--sp-2); }

.optbtn {
  display: flex; align-items: center; gap: var(--sp-4);
  width: 100%; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-4) var(--sp-5);
  transition: all var(--dur-fast) var(--ease-out);
}
.optbtn:hover { border-color: var(--accent); background: var(--accent-wash); transform: translateX(4px); }
.optbtn.is-picked { border-color: var(--accent); background: var(--accent-wash); }
.optbtn__key {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--hairline);
  font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600;
}
.optbtn:hover .optbtn__key, .optbtn.is-picked .optbtn__key { background: var(--accent); color: #fff; border-color: transparent; }
.optbtn__text { font-size: var(--fs-sm); }

.assess__nav { display: flex; justify-content: space-between; align-items: center; margin-top: var(--sp-6); }
.assess__navhint { font-size: var(--fs-xs); color: var(--text-muted); }

/* results */
.assess__results { padding: var(--sp-7); animation: fadeUp var(--dur-slow) var(--ease-out) both; }
.results__top {
  display: grid; grid-template-columns: minmax(240px, 320px) 1fr;
  gap: var(--sp-7); align-items: center; margin-bottom: var(--sp-7);
  padding-bottom: var(--sp-7); border-bottom: 1px solid var(--hairline);
}
@media (max-width: 820px) { .results__top { grid-template-columns: 1fr; } }

.heroscore { text-align: left; }
.heroscore__label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: var(--sp-3); }
.heroscore__value {
  font-size: var(--fs-figure); font-weight: 600; line-height: 0.95;
  letter-spacing: -0.04em; display: flex; align-items: baseline; gap: 6px;
  /* proportional figures — no tabular-nums on a display number */
}
.heroscore__outof { font-size: 1.4rem; color: var(--text-muted); font-weight: 400; }
.heroscore__band { margin-top: var(--sp-4); }

/* meter: fill = severity, track = lighter step of the same ramp */
.meter { margin-top: var(--sp-5); }
/* Neutral track, not a step of the blue ramp: the fill here carries STATUS
   colour, and a blue unfilled remainder reads as a second data series. */
.meter__track { position: relative; height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter__fill { height: 100%; width: 0%; border-radius: 999px; transition: width 1100ms var(--ease-out), background var(--dur); }
.meter__scale { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.meter__benchmark {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--text-secondary); border-radius: 1px;
}

.results__summary p { font-size: var(--fs-sm); color: var(--text-secondary); }
.results__summary h3 { font-size: var(--fs-h3); margin-bottom: var(--sp-3); }

.dimgrid { display: flex; flex-direction: column; gap: var(--sp-4); }
.dimrow {
  display: grid; grid-template-columns: minmax(150px, 230px) 1fr auto auto;
  gap: var(--sp-4); align-items: center;
}
@media (max-width: 720px) { .dimrow { grid-template-columns: 1fr auto; grid-template-areas: "label status" "bar bar" "value value"; }
  .dimrow__label { grid-area: label; } .dimrow__barwrap { grid-area: bar; } .dimrow__value { grid-area: value; text-align: left; } }
.dimrow__label { font-size: var(--fs-sm); color: var(--text-secondary); }
.dimrow__barwrap { position: relative; height: 18px; background: var(--surface-3); border-radius: 4px; }
.dimrow__bar { height: 100%; width: 0%; border-radius: 0 4px 4px 0; transition: width 900ms var(--ease-out); }
.dimrow__peer {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--text-muted); border-radius: 1px;
}
.dimrow__value { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--text-secondary); min-width: 42px; text-align: right; }

.results__actions {
  margin-top: var(--sp-7); padding-top: var(--sp-6); border-top: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center;
}
.results__gatehint { font-size: var(--fs-xs); color: var(--text-muted); flex: 1 1 240px; }

.priority {
  margin-top: var(--sp-6); background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: var(--sp-5);
}
.priority h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: var(--sp-4); }
.priority ol { margin: 0; padding-left: 1.2em; }
.priority li { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-3); }
.priority li:last-child { margin-bottom: 0; }
.priority li strong { color: var(--text-primary); }

/* =========================================================================
   CH5 — CPI SIMULATOR
   ========================================================================= */
.cpi {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: var(--sp-6); margin-bottom: var(--sp-7);
}
.cpi__grid { display: grid; grid-template-columns: 1fr minmax(280px, 380px); gap: var(--sp-7); align-items: start; }
@media (max-width: 900px) { .cpi__grid { grid-template-columns: 1fr; } }

.sliders { display: flex; flex-direction: column; gap: var(--sp-4); }
.sliderrow { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3) var(--sp-4); align-items: center; }
.sliderrow__label { font-size: var(--fs-sm); color: var(--text-secondary); }
.sliderrow__val { font-size: var(--fs-sm); color: var(--text-primary); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.sliderrow input[type="range"] { grid-column: 1 / -1; width: 100%; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 999px; background: var(--surface-3);
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 1px var(--accent-ring);
  transition: transform var(--dur-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface-1);
  background: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring);
}

.cpi__readout {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-6); position: sticky; top: 100px;
}
.cpi__weak { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--hairline); }
.cpi__weak h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: var(--sp-3); }
.cpi__weak p { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; }

/* contribution bars — emphasis form: worst contributor accented, rest grey */
.contrib { display: flex; flex-direction: column; gap: 7px; margin-top: var(--sp-5); }
.contrib__row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr auto; gap: var(--sp-3); align-items: center; }
.contrib__label { font-size: var(--fs-xs); color: var(--text-muted); }
.contrib__track { height: 12px; background: var(--surface-3); border-radius: 3px; }
.contrib__bar { height: 100%; width: 0%; background: var(--series-mute); border-radius: 0 3px 3px 0; transition: width var(--dur-slow) var(--ease-out), background var(--dur); }
.contrib__bar.is-weak { background: var(--accent); }
.contrib__val { font-size: var(--fs-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

/* =========================================================================
   CH5 — AGENT CONSTELLATION
   ========================================================================= */
.constellation {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: var(--sp-6);
}
.constellation__head { max-width: var(--maxw-text); margin-bottom: var(--sp-6); }
.constellation__head h3 { font-size: var(--fs-h3); margin-bottom: var(--sp-3); }
.constellation__head p { font-size: var(--fs-sm); color: var(--text-secondary); }
.constellation__body { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: var(--sp-6); align-items: start; }
@media (max-width: 900px) { .constellation__body { grid-template-columns: 1fr; } }

.constellation__stage svg { width: 100%; height: auto; display: block; }
.orbit { fill: none; stroke: var(--hairline); stroke-width: 1; }
.spoke { stroke: var(--hairline); stroke-width: 1; transition: stroke var(--dur), stroke-width var(--dur); }
.spoke.is-lit { stroke: var(--accent); stroke-width: 1.5; }
.agentnode { cursor: pointer; }
.agentnode circle.hit { fill: transparent; }        /* >=24px hit target */
/* The default focus ring boxes the whole <g>, drawing a rectangle around the
   node AND its label. Put the visible focus indicator on the dot instead. */
.agentnode:focus { outline: none; }
.agentnode:focus-visible circle.dot { stroke: var(--text-primary); stroke-width: 3; }
.agentnode circle.dot {
  fill: var(--surface-2); stroke: var(--hairline-strong); stroke-width: 1.5;
  transition: fill var(--dur), stroke var(--dur), r var(--dur) var(--ease-out);
}
.agentnode:hover circle.dot, .agentnode.is-active circle.dot { fill: var(--accent); stroke: var(--accent); }
.agentnode text { fill: var(--text-muted); font-size: 9.5px; transition: fill var(--dur); }
.agentnode:hover text, .agentnode.is-active text { fill: var(--text-primary); }
.corenode circle { fill: var(--surface-2); stroke: var(--accent); stroke-width: 1.5; }
.corenode text { fill: var(--text-primary); font-size: 11px; font-weight: 600; }
.corenode text.sub { fill: var(--text-muted); font-size: 9px; font-weight: 400; }
.pulsering { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; transform-origin: center; }
.pulsering.is-on { animation: ringPulse 2.4s var(--ease-out) infinite; }
@keyframes ringPulse { 0% { opacity: 0.5; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }

.agentdetail {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-5); min-height: 200px;
}
.agentdetail__name { font-size: var(--fs-body); font-weight: 600; margin-bottom: var(--sp-2); }
.agentdetail__remit { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-4); }
.agentdetail__human {
  font-size: var(--fs-xs); color: var(--text-muted);
  padding-top: var(--sp-4); border-top: 1px solid var(--hairline);
}
.agentdetail__human strong { color: var(--text-secondary); }
.agentdetail__empty { font-size: var(--fs-sm); color: var(--text-muted); }
.agentdetail__count { font-size: var(--fs-xs); color: var(--accent); margin-top: var(--sp-4); }

/* =========================================================================
   PROFILE CARD
   ========================================================================= */
.chapter--close { padding-bottom: var(--sp-8); }
.profilecard {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); overflow: hidden;
}
.profilecard__body { padding: var(--sp-7); }
.profilegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.profileitem {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-5);
}
.profileitem__k { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-2); }
.profileitem__v { font-size: var(--fs-body); font-weight: 600; }
.profileitem__v.is-empty { color: var(--text-muted); font-weight: 400; font-size: var(--fs-sm); }

.profilecard__cta {
  padding: var(--sp-6) var(--sp-7);
  background: var(--surface-2); border-top: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; justify-content: space-between;
}
.profilecard__cta p { font-size: var(--fs-sm); color: var(--text-secondary); max-width: 52ch; margin: 0; }

/* =========================================================================
   FOOTER
   ========================================================================= */
.footer { border-top: 1px solid var(--hairline); margin-top: var(--sp-8); }
.footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: var(--sp-7) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.footer__brand { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; letter-spacing: 0.04em; }
.footer__legal { font-size: var(--fs-xs); color: var(--text-muted); max-width: 80ch; margin: 0; }
.footer__devbtn {
  align-self: flex-start; margin-top: var(--sp-3);
  background: none; border: 1px dashed var(--hairline-strong);
  color: var(--text-muted); font-size: var(--fs-xs);
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer;
}
.footer__devbtn:hover { color: var(--text-secondary); border-color: var(--text-muted); }

/* =========================================================================
   MODAL
   ========================================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--sp-5); }
.modal__scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.72); backdrop-filter: blur(4px); animation: fadeIn var(--dur) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal__panel {
  position: relative; width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface-1); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg); padding: var(--sp-7);
  box-shadow: var(--shadow-3);
  animation: modalIn var(--dur) var(--ease-out) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal__close {
  position: absolute; top: var(--sp-4); right: var(--sp-4);
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--hairline);
  color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.modal__close:hover { color: var(--text-primary); background: var(--surface-3); }

.leadform h3 { font-size: var(--fs-h3); margin-bottom: var(--sp-3); padding-right: var(--sp-6); }
.leadform__intro { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-5); }

.knownbox {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5);
}
.knownbox__head { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-3); }
.knownbox ul { margin: 0; padding-left: 1.1em; }
.knownbox li { font-size: var(--fs-xs); color: var(--text-secondary); margin-bottom: 4px; }

.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: var(--fs-xs); color: var(--text-secondary); margin-bottom: var(--sp-2); }
.field input, .field select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--hairline);
  color: var(--text-primary); font-size: var(--fs-sm); font-family: inherit;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }
.field input::placeholder { color: var(--text-muted); }
.field__err { font-size: var(--fs-xs); color: var(--status-critical); margin-top: 5px; display: none; }
.field.is-err input { border-color: var(--status-critical); }
.field.is-err .field__err { display: block; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 520px) { .field--row { grid-template-columns: 1fr; } }

/* honeypot — must stay visually hidden but not display:none (bots skip those) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.consent { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-5); }
.consent input { margin-top: 3px; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--accent); }
.consent label { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.55; }
.consent.is-err label { color: var(--status-critical); }

.leadform__submitrow { display: flex; gap: var(--sp-3); align-items: center; }
.leadform__note { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-4); }

.successbox { text-align: center; padding: var(--sp-5) 0; }
.successbox__tick {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto var(--sp-5);
  display: grid; place-items: center;
  background: var(--status-good-wash); color: var(--status-good); font-size: 26px;
}
.successbox h3 { margin-bottom: var(--sp-3); }
.successbox p { font-size: var(--fs-sm); color: var(--text-secondary); }

/* =========================================================================
   DEV DRAWER
   ========================================================================= */
.devdrawer {
  position: fixed; right: 0; bottom: 0; z-index: 90;
  width: min(460px, 100vw); max-height: 62vh; display: flex; flex-direction: column;
  background: var(--surface-1); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius) 0 0 0; box-shadow: var(--shadow-3);
  animation: drawerIn var(--dur) var(--ease-out) both;
}
@keyframes drawerIn { from { transform: translateY(100%); } to { transform: none; } }
.devdrawer__head {
  display: grid; grid-template-columns: 1fr auto; gap: 2px var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--hairline);
}
.devdrawer__head strong { font-size: var(--fs-sm); }
.devdrawer__hint { font-size: var(--fs-xs); color: var(--text-muted); grid-column: 1; }
.devdrawer__head button {
  grid-row: 1 / 3; background: none; border: 0; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.devdrawer__head button:hover { color: var(--text-primary); }
#devdrawer-body {
  margin: 0; padding: var(--sp-4) var(--sp-5); overflow: auto;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.6;
  color: var(--text-secondary); white-space: pre-wrap; word-break: break-word;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1040px) {
  .chapnav { display: none; }
}
@media (max-width: 680px) {
  .pulse__label { display: none; }
  .brand__text em { display: none; }
  .chapter { padding: var(--sp-9) var(--sp-4); }
  .scenario__frame, .dashsim, .lens, .cpi, .constellation { padding: var(--sp-5); }
  .assess__runner, .assess__results, .assess__intro, .profilecard__body { padding: var(--sp-5); }
  .hero { padding: 112px var(--sp-4) var(--sp-8); }
}
