/* ============================================================================
   Companion site — shared stylesheet.
   Provenance: factory worker (Claude), 2026-07-01 companion rebuild.
   Tokens = the premium-ui-design skill's Geist-style system (tokens.css),
   light mode, one blue accent. Chart colors follow the dataviz skill
   (validated class palette; see assets/app.js CLASS_META).
   No external fonts, no CDNs, no trackers. Anonymous.
   ========================================================================== */

:root {
  /* --- neutral system (Geist gray, light) --- */
  --background: #ffffff;
  --canvas: #f6f6f5;            /* recessed frame below surface */
  --surface: #fafafa;           /* raised panel */
  --surface-2: #f4f4f4;         /* grouped/quiet panel + hover base */
  --surface-3: #ededec;         /* hover-lift / active */
  --ink: #171717;               /* primary text */
  --muted: #4d4d4d;             /* secondary text */
  --faint: #8f8f8f;             /* tertiary text */
  --border: #ebebeb;            /* hairline */
  --border-strong: #dcdcdc;     /* hover/interactive hairline */

  /* --- the one accent (blue; dataviz series-1) --- */
  --accent: #2a78d6;            /* fills, active, focus */
  --accent-text: #1c5cab;       /* links / small text (AA on white) */
  --accent-soft: rgba(42, 120, 214, 0.08);
  --accent-ring: rgba(42, 120, 214, 0.35);
  --ring: var(--accent);

  /* --- semantic --- */
  --warning-bg: #fffbeb;
  --warning-border: #f1d27a;
  --warning-ink: #713f12;
  --warning-strong: #b45309;

  /* --- fidelity classes (validated: CVD all-pairs pass; LOW = deliberate
         de-emphasis gray; every use pairs color with a text label) --- */
  --class-high: #166534;
  --class-partial: #bd8004;
  --class-low: #64748b;
  --class-anti: #be123c;
  --class-high-soft: #e9f3ec;
  --class-partial-soft: #faf3e0;
  --class-low-soft: #eef1f4;
  --class-anti-soft: #faeaee;

  /* --- chart chrome (dataviz) --- */
  --grid-line: #ececea;
  --axis-line: #c9c9c9;

  /* --- scales --- */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 2px rgba(0, 0, 0, 0.04);
  --shadow-popover: 0 1px 1px rgba(0,0,0,.02), 0 4px 8px -4px rgba(0,0,0,.04), 0 16px 24px -8px rgba(0,0,0,.06);
  --shadow-modal: 0 1px 1px rgba(0,0,0,.02), 0 8px 16px -4px rgba(0,0,0,.04), 0 24px 32px -8px rgba(0,0,0,.06);
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
  --hover-wash: rgba(0, 0, 0, 0.04);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 600; }
h1 { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.2; letter-spacing: -0.04em; }
h2 { font-size: clamp(21px, 2.6vw, 24px); line-height: 1.35; letter-spacing: -0.04em; }
h3 { font-size: 16px; line-height: 1.5; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--surface-2); border-radius: 4px; padding: 1px 5px;
}
::selection { background: var(--accent-soft); }

*:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
  border-radius: var(--radius-sm);
}

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

/* ---- layout ---------------------------------------------------------------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint);
}
.lead { font-size: 16px; line-height: 1.6; color: var(--muted); }
.small { font-size: 13px; line-height: 1.55; color: var(--muted); }
.footnote { font-size: 12px; line-height: 1.5; color: var(--faint); }

/* ---- placeholder banner (sticky, honest) ----------------------------------- */
.banner {
  position: sticky; top: 0; z-index: 60;
  background: var(--warning-bg); border-bottom: 1px solid var(--warning-border);
  color: var(--warning-ink); font-size: 13px; line-height: 1.45;
}
.banner .wrap { display: flex; gap: 10px; align-items: baseline; padding-top: 9px; padding-bottom: 9px; }
.banner .tag {
  flex: none; align-self: center; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; background: var(--warning-strong); color: #fff;
  border-radius: 999px; padding: 2px 8px;
}
.banner b { font-weight: 600; }
.banner .banner-more { display: inline; }
@media (max-width: 640px) { .banner .banner-more { display: none; } }

/* ---- top nav ---------------------------------------------------------------- */
.nav {
  border-bottom: 1px solid var(--border); background: var(--background);
}
.nav .wrap { display: flex; align-items: center; gap: 20px; height: 52px; }
.nav .wordmark {
  font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em;
  white-space: nowrap;
}
.nav .wordmark:hover { text-decoration: none; }
.nav ul {
  display: flex; gap: 2px; margin: 0 0 0 auto; padding: 0; list-style: none;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.nav ul::-webkit-scrollbar { display: none; }
.nav a.navlink {
  display: block; padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.nav a.navlink:hover { color: var(--ink); background: var(--hover-wash); text-decoration: none; }
.nav a.navlink[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--surface-2); }

/* ---- sections / story beats -------------------------------------------------- */
.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 720px; }
.section-head h2 { margin-top: 10px; }
.section-head .lead { margin-top: 12px; }
@media (max-width: 640px) { .section { padding: 52px 0; } }

/* scroll reveal (one calm settle; opacity+translate only) */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.55s var(--ease-out-quint), transform 0.55s var(--ease-out-quint); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---- cards ------------------------------------------------------------------- */
.card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background); padding: 20px;
}
.card-soft { background: var(--surface); }
.card h3 { font-size: 15px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---- pills & chips ------------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.pill-HIGH { background: var(--class-high-soft); color: var(--class-high); }
.pill-PARTIAL { background: var(--class-partial-soft); color: #8a5e03; }
.pill-LOW { background: var(--class-low-soft); color: #47566b; }
.pill-ANTI { background: var(--class-anti-soft); color: var(--class-anti); }
.pill-plain { background: var(--surface-2); color: var(--muted); }

.chip {
  appearance: none; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  background: var(--background); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); font-weight: 600; }
.chip .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* ---- controls row (filters live in one row above the chart) ------------------- */
.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; margin: 20px 0 14px; }
.ctl { display: flex; flex-direction: column; gap: 5px; }
.ctl label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.ctl { max-width: 100%; min-width: 0; }
.ctl select {
  appearance: none; font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--background) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238f8f8f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 10px center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 30px 7px 10px; cursor: pointer; min-width: 150px;
  max-width: 100%; text-overflow: ellipsis;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- the fidelity map --------------------------------------------------------- */
.map-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background); padding: 14px 14px 10px;
}
.map-shell { position: relative; width: 100%; }
.map-shell svg { display: block; width: 100%; height: auto; }
.map-shell svg text { font-family: var(--font-sans); }
.map-foot {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  padding: 10px 4px 4px; font-size: 12px; color: var(--faint);
}
.map-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.map-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.map-legend i.hollow { background: transparent !important; border: 1.5px solid var(--faint); }

.viz-tip {
  position: absolute; pointer-events: none; z-index: 30; opacity: 0; transform: translateY(3px);
  transition: opacity 0.12s, transform 0.12s;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 10px;
  font-size: 12px; line-height: 1.5; max-width: 250px; box-shadow: var(--shadow-modal);
}
.viz-tip.show { opacity: 1; transform: none; }
.viz-tip .t-title { font-weight: 600; }
.viz-tip .t-row { color: #c9c9c9; font-variant-numeric: tabular-nums; }
.viz-tip .t-pill { display: inline-block; margin-top: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; color: #fff; }

details.tableview { margin-top: 10px; }
details.tableview > summary {
  cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none;
  padding: 4px 0; list-style-position: inside;
}
details.tableview > summary:hover { color: var(--ink); }

/* ---- tables -------------------------------------------------------------------- */
.table-card { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--background); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data thead th {
  background: var(--surface); color: var(--faint); font-weight: 600; font-size: 10.5px;
  letter-spacing: 0.07em; text-transform: uppercase; text-align: right;
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data thead th:first-child { text-align: left; }
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--ink); }
table.data thead th .arrow { color: var(--border-strong); margin-left: 4px; font-size: 9px; }
table.data thead th[aria-sort="ascending"] .arrow::after { content: "\2191"; color: var(--ink); }
table.data thead th[aria-sort="descending"] .arrow::after { content: "\2193"; color: var(--ink); }
table.data tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right;
  font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap;
}
table.data tbody td:first-child { text-align: left; font-weight: 500; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--hover-wash); }
table.data a { color: var(--ink); }
table.data a:hover { color: var(--accent-text); }

/* ---- stat tiles ------------------------------------------------------------------ */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); padding: 13px 15px; }
.tile .t-label { font-size: 11px; color: var(--faint); font-weight: 500; }
.tile .t-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 3px; }
.tile .t-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ---- scenario / account cards ----------------------------------------------------- */
.scn {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 18px; background: var(--background);
}
.scn .code { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--faint); font-family: var(--font-mono); }
.scn h3 { font-size: 14.5px; margin-top: 3px; }
.scn .sig { font-size: 12px; color: var(--faint); margin-top: 7px; line-height: 1.5; }
.scn .sig b { color: var(--muted); font-weight: 600; }
.scn .reading { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.55; border-top: 1px solid var(--border); padding-top: 10px; }

.account { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.account h3 { font-size: 14.5px; }
.account .acc-what { font-size: 13px; color: var(--muted); line-height: 1.55; }
.account .acc-sig { font-size: 12px; color: var(--faint); line-height: 1.5; }
.account .acc-sig b { color: var(--muted); font-weight: 600; }
.account .mini { margin-top: auto; padding-top: 6px; }
.account .mini svg { display: block; width: 100%; height: auto; }
.account .mini-cap { font-size: 10.5px; color: var(--faint); margin-top: 4px; }

/* ---- glossary (fidelity classes) --------------------------------------------------- */
.gloss { border: 1px solid var(--border); border-left-width: 3px; border-radius: 10px; padding: 13px 15px; background: var(--background); }
.gloss h3 { font-size: 13px; display: flex; align-items: center; gap: 7px; }
.gloss p { margin-top: 7px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.gloss .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.gloss-HIGH { border-left-color: var(--class-high); }
.gloss-PARTIAL { border-left-color: var(--class-partial); }
.gloss-LOW { border-left-color: var(--class-low); }
.gloss-ANTI { border-left-color: var(--class-anti); }

/* ---- context-effect demo (beat 2) --------------------------------------------------- */
.demo { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.demo .demo-panel { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); padding: 16px 18px 14px; }
.demo .demo-panel h4 { font-size: 12px; font-weight: 600; color: var(--muted); }
.demo .demo-panel .sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.demo .demo-arrow { display: flex; align-items: center; color: var(--faint); }
.demo .bars { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.demo .bar-row { display: grid; grid-template-columns: 92px 1fr 40px; gap: 10px; align-items: center; }
.demo .bar-name { font-size: 12.5px; color: var(--ink); }
.demo .bar-name .why { display: block; font-size: 10.5px; color: var(--faint); }
.demo .bar-track { height: 18px; position: relative; }
.demo .bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; }
.demo .bar-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .demo { grid-template-columns: 1fr; }
  .demo .demo-arrow { justify-content: center; transform: rotate(90deg); }
}

/* ---- footer -------------------------------------------------------------------------- */
footer.site {
  border-top: 1px solid var(--border); margin-top: 40px; padding: 36px 0 56px;
  color: var(--faint); font-size: 12.5px; line-height: 1.6;
}
footer.site .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px 28px; }
footer.site .kicker { color: var(--muted); }
footer.site p { margin-top: 6px; }

/* ---- error box ------------------------------------------------------------------------ */
.errbox {
  display: none; margin: 32px 0; padding: 16px 18px;
  border: 1px solid var(--class-anti); background: var(--class-anti-soft);
  color: var(--class-anti); border-radius: var(--radius-md); font-size: 14px;
}

/* ============================================================================
   THE DECISION-TREE FLOW (methods page) — Cortex Architecture idiom
   ========================================================================== */
.flow-frame {
  position: relative; height: min(78vh, 760px); min-height: 460px;
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.flow-viewport {
  position: absolute; inset: 0; overflow: hidden; cursor: grab;
  touch-action: none; user-select: none;
  /* the Cortex canvas: warm paper + a quiet dot grid that pans with the world */
  background-color: #f7f7f6;
  background-image: radial-gradient(rgba(23, 23, 23, 0.065) 1px, transparent 1.3px);
  background-size: 22px 22px;
}
.flow-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-ring); border-radius: var(--radius-lg); outline: none; }
.flow-viewport.panning { cursor: grabbing; }
.flow-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.flow-node {
  position: absolute; display: flex; align-items: center; text-align: left;
  appearance: none; background: none; border: none; padding: 0; margin: 0;
  font-family: inherit; cursor: pointer;
  transition: opacity 0.2s;
}
.flow-face {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 100%;
  overflow: hidden; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--background); padding: 0 11px; box-shadow: var(--shadow-card);
}
.flow-face .icon {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 8px;
}
.flow-face .icon svg { width: 16px; height: 16px; }
.flow-face .fn-body { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.flow-face .fn-eyebrow { font-size: 9px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.flow-face .fn-title { font-size: 12.5px; font-weight: 600; line-height: 1.25; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flow-face .fn-sub { font-size: 10px; color: var(--faint); margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }

.flow-colhead { position: absolute; transform: translateX(-50%); pointer-events: none; z-index: 2; }
.flow-colhead span {
  white-space: nowrap; border-radius: 999px; border: 1px solid; padding: 2px 9px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}

.flow-edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 1; }
.flow-edge-hit { pointer-events: stroke; cursor: help; }
.flow-edge-label {
  font-size: 10px; font-weight: 500; fill: var(--ink);
}
.flow-edge-labelbg { fill: var(--background); stroke: var(--border-strong); rx: 5; }

/* chip rows above the canvas */
.flow-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.flow-chips .lbl {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); margin-right: 2px;
}
/* an active highlight chip fills with the accent (the Cortex story-chip idiom) */
.flow-chips .chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: var(--shadow-card);
}

/* quiet right-aligned stat chip beside a section kicker (the Cortex header idiom) */
.head-row { display: flex; align-items: baseline; gap: 12px; }
.head-row .kicker { flex: 1; min-width: 0; }
.head-stat { font-size: 12px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.flow-banner {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 10px;
  border: 1px solid var(--accent-ring); background: var(--accent-soft);
  border-radius: var(--radius-md); padding: 9px 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink);
}
.flow-banner b { font-weight: 600; }
.flow-banner button {
  appearance: none; background: none; border: none; cursor: pointer; margin-left: auto;
  color: var(--faint); font-size: 15px; line-height: 1; padding: 2px;
}
.flow-banner button:hover { color: var(--ink); }

/* zoom + fullscreen controls (top-right, the Cortex Controls position) */
.flow-zoom {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  display: flex; align-items: center; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(6px);
  box-shadow: var(--shadow-popover);
}
.flow-zoom button {
  appearance: none; border: none; background: none; cursor: pointer;
  width: 34px; height: 32px; display: grid; place-items: center; color: var(--muted);
  font-size: 15px;
}
.flow-zoom button svg { width: 15px; height: 15px; }
.flow-zoom button:hover { background: var(--surface-3); color: var(--ink); }
.flow-zoom .pct {
  width: 46px; text-align: center; font-size: 11px; font-weight: 500; color: var(--muted);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

/* fullscreen fallback (when the Fullscreen API is unavailable) */
.flow-frame.fs-fallback {
  position: fixed; inset: 10px; z-index: 90; height: auto; min-height: 0;
  background: var(--background); box-shadow: var(--shadow-modal);
}
body.flow-fs-lock { overflow: hidden; }
.flow-frame:fullscreen { border-radius: 0; border: none; }
.flow-frame:fullscreen .flow-viewport { border-radius: 0; }

/* minimap (top-left, the Cortex MiniMap position) */
.flow-minimap {
  position: absolute; top: 12px; left: 12px; z-index: 20;
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
  background: var(--surface-2); box-shadow: var(--shadow-card);
  cursor: crosshair; line-height: 0;
}
.flow-minimap svg { display: block; }
@media (max-width: 720px) { .flow-minimap { display: none; } }

/* legend (bottom-left) */
.flow-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 20;
  max-width: min(20rem, calc(100% - 24px)); overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(6px);
  box-shadow: var(--shadow-popover);
}
.flow-legend > button {
  appearance: none; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 8px 12px; font-family: inherit;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.flow-legend > button:hover { color: var(--ink); }
.flow-legend > button .chev { margin-left: auto; transition: transform 0.15s; font-size: 10px; }
.flow-legend[data-open="true"] > button .chev { transform: rotate(180deg); }
.flow-legend .legend-body { display: none; border-top: 1px solid var(--border); padding: 10px 12px; max-height: 40vh; overflow-y: auto; }
.flow-legend[data-open="true"] .legend-body { display: block; }
.flow-legend .lg-title { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.flow-legend .lg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.flow-legend .lg-grid span { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.flow-legend .lg-grid i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.flow-legend .lg-grid + .lg-title { margin-top: 10px; }

/* detail panel (right overlay; sheet on narrow) */
.flow-detail {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 30; width: 330px; max-width: 88%;
  border-left: 1px solid var(--border); background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(6px); box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
  transform: translateX(8px); opacity: 0; pointer-events: none;
  transition: transform 0.22s var(--ease-out-quint), opacity 0.22s;
}
.flow-detail.open { transform: none; opacity: 1; pointer-events: auto; }
.flow-detail .fd-head { display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--border); padding: 14px 16px 12px; }
.flow-detail .fd-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; flex: none; }
.flow-detail .fd-icon svg { width: 17px; height: 17px; }
.flow-detail .fd-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.flow-detail .fd-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.flow-detail .fd-tag { border-radius: var(--radius-sm); padding: 1px 7px; font-size: 10.5px; font-weight: 600; }
.flow-detail .fd-close {
  appearance: none; background: none; border: none; cursor: pointer; margin-left: auto;
  color: var(--faint); font-size: 16px; line-height: 1; padding: 4px; border-radius: 6px;
}
.flow-detail .fd-close:hover { background: var(--surface-3); color: var(--ink); }
.flow-detail .fd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.flow-detail .fd-desc { font-size: 13px; line-height: 1.6; color: var(--ink); }
.flow-detail .fd-sec-title { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.flow-detail .fd-reading { font-size: 12.5px; line-height: 1.6; color: var(--muted); border-left: 2px solid var(--border-strong); padding-left: 10px; }
.flow-detail .fd-conn {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  appearance: none; font-family: inherit; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  padding: 6px 9px; margin-bottom: 5px; transition: border-color 0.15s, background 0.15s;
}
.flow-detail .fd-conn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.flow-detail .fd-conn .dir { font-size: 12px; flex: none; }
.flow-detail .fd-conn .cn-name { font-size: 12px; font-weight: 500; color: var(--ink); display: block; }
.flow-detail .fd-conn .cn-type { font-size: 10.5px; color: var(--faint); display: block; }

@media (max-width: 640px) {
  .flow-frame { height: min(54vh, 420px); min-height: 300px; }
  .flow-detail { width: 100%; max-width: none; top: auto; height: 62%; border-left: none; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; transform: translateY(10px); }
  .flow-detail.open { transform: none; }
}

/* ============================================================================
   STIMULUS BROWSER (effects page)
   ========================================================================== */
.stim-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); overflow: hidden; }
.stim-card .stim-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.stim-card .stim-head .id { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.stim-card .stim-body { padding: 14px 16px 16px; }
.stim-card .stem { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.stim-card .stat-line { font-size: 12px; color: var(--faint); margin-top: 8px; line-height: 1.5; }
.stim-card table.opts { border-collapse: collapse; width: 100%; font-size: 12.5px; margin-top: 12px; }
.stim-card table.opts th { text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.stim-card table.opts td { padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stim-card table.opts tr:last-child td { border-bottom: none; }
.stim-card table.opts .role { color: var(--faint); font-size: 11px; }
.stim-card table.opts .unavail { color: var(--class-anti); font-size: 11px; font-weight: 600; }
.stim-card .fmt { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.stim-card .fmt img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; }
.stim-note { font-size: 12px; color: var(--faint); line-height: 1.5; }

/* effects registry cards */
.effect-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); padding: 16px 18px; }
.effect-card h3 { font-size: 15px; }
.effect-card .one-liner { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.55; }
.effect-card .rows { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.effect-card .row { font-size: 12px; line-height: 1.55; color: var(--muted); }
.effect-card .row b { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); margin-bottom: 1px; }

/* version log */
.vlog { border-left: 2px solid var(--border-strong); padding-left: 18px; display: flex; flex-direction: column; gap: 18px; }
.vlog .v { position: relative; }
.vlog .v::before { content: ""; position: absolute; left: -22.5px; top: 5px; width: 7px; height: 7px; border-radius: 999px; background: var(--border-strong); }
.vlog .v.current::before { background: var(--accent); }
.vlog .v .v-tag { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink); }
.vlog .v .v-date { font-size: 11.5px; color: var(--faint); margin-left: 8px; }
.vlog .v p { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.55; }

/* hero (index beat 1) */
.hero { padding: 88px 0 64px; }
.hero .kicker { margin-bottom: 14px; }
.hero h1 { max-width: 21ch; }
.hero .lead { max-width: 62ch; margin-top: 20px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 24px; font-size: 12.5px; color: var(--faint); }
.hero .meta b { color: var(--muted); font-weight: 600; }
@media (max-width: 640px) { .hero { padding: 56px 0 40px; } }

/* quiet cross-page CTA row */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.cta {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--background); color: var(--ink);
  font-size: 13px; font-weight: 500; padding: 7px 13px;
  transition: border-color 0.15s, background 0.15s;
}
.cta:hover { border-color: var(--border-strong); background: var(--surface); text-decoration: none; }
.cta.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.cta.primary:hover { background: #000; }
