/* =========================================================================
   QUM Brief — Plain English science explainer
   Same tactical brand as Partnership Deck: mono, monochrome, spotlight orange.
   ========================================================================= */

:root {
  /* Brand palette — QUM tactical (mirrored from Partnership Deck) */
  --bg:        #0E0D0A;
  --bg-1:      #14120E;
  --surface:   #161410;
  --surface-2: #1C1A14;
  --line-1:    rgba(232, 228, 219, 0.08);
  --line-2:    rgba(232, 228, 219, 0.14);
  --line-3:    rgba(232, 228, 219, 0.22);
  --ink:       #E8E4DB;
  --ink-dim:   #B6B0A2;
  --ink-mute:  #857F72;
  --ink-faint: #5B5648;
  --accent:    #FF6B1A;
  --accent-d:  #C8480B;
  --green:     #B8D4B0;
  --red:       #D4A8A0;

  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --font-am:   'Noto Sans Ethiopic', 'IBM Plex Mono', sans-serif;

  /* Reading scale (responsive — desktop default) */
  --type-display:  clamp(56px, 7.8vw, 132px);
  --type-title:    clamp(34px, 3.8vw, 56px);
  --type-eyebrow:  13px;
  --type-lede:     clamp(20px, 1.6vw, 26px);
  --type-body:     clamp(15px, 1.05vw, 17px);
  --type-mono:     13px;
  --type-small:    12px;
  --type-num-l:    clamp(96px, 11vw, 180px);

  --col-max:   720px;       /* reading column */
  --col-wide:  1100px;      /* diagrams break out to this */
  --rail:      120px;
  --gutter:    clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-mono);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
  font-feature-settings: "ss01" 1;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; }
img { max-width: 100%; display: block; }

/* =========================================================================
   Page chrome — top HUD, left section rail, right scroll progress, frame
   ========================================================================= */

.page-frame {
  position: fixed;
  inset: 24px;
  border: 1px solid var(--line-1);
  pointer-events: none;
  z-index: 1;
}
.page-frame::before, .page-frame::after,
.page-frame > i:nth-child(1), .page-frame > i:nth-child(2) {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid var(--ink-faint);
}
.page-frame::before  { top: -1px;    left: -1px;    border-right: 0; border-bottom: 0; }
.page-frame::after   { top: -1px;    right: -1px;   border-left: 0;  border-bottom: 0; }
.page-frame > i:nth-child(1) { bottom: -1px; left: -1px;  border-right: 0; border-top: 0; }
.page-frame > i:nth-child(2) { bottom: -1px; right: -1px; border-left: 0;  border-top: 0; }

.hud-top {
  position: fixed;
  top: 40px; left: 56px; right: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-faint);
  font-size: var(--type-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  z-index: 30;
  pointer-events: none;
  mix-blend-mode: normal;
}
.hud-top .dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  margin-right: 12px;
  vertical-align: 0px;
}
.hud-top .left { display: flex; align-items: center; gap: 24px; }
.hud-top .live { color: var(--accent); letter-spacing: 0.22em; }

.hud-bottom {
  position: fixed;
  bottom: 40px; left: 56px; right: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-faint);
  font-size: var(--type-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  z-index: 30;
  pointer-events: none;
}

/* Scroll progress bar — bottom edge of viewport */
.scroll-bar {
  position: fixed;
  left: 56px; right: 56px;
  bottom: 72px;
  height: 1px;
  background: var(--line-1);
  z-index: 29;
  pointer-events: none;
}
.scroll-bar .fill {
  position: absolute;
  left: 0; top: -1px; bottom: -1px;
  width: 0%;
  background: var(--accent);
  transition: width 80ms linear;
}
.scroll-bar .ticks {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  pointer-events: auto;
}
.scroll-bar .tick {
  position: relative;
  border-right: 1px solid var(--line-1);
  cursor: pointer;
}
.scroll-bar .tick:last-child { border-right: 0; }
.scroll-bar .tick::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -5px;
  height: 11px;
  background: transparent;
}
.scroll-bar .tick .lbl {
  position: absolute;
  bottom: 8px;
  left: 0;
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms;
}
.scroll-bar .tick:hover .lbl,
.scroll-bar .tick.active .lbl { opacity: 1; color: var(--accent); }
.scroll-bar .tick.active::before {
  content: '';
  position: absolute;
  left: -1px; bottom: -4px;
  width: 1px; height: 8px;
  background: var(--accent);
}

/* =========================================================================
   Cover
   ========================================================================= */

.cover {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter);
}
.cover .grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-1) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-1) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
  opacity: 0.5;
  pointer-events: none;
}
.cover .glow {
  position: absolute;
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  width: min(900px, 80vw); height: min(900px, 80vw);
  background: radial-gradient(circle at center, rgba(255,107,26,0.22), rgba(255,107,26,0) 60%);
  filter: blur(20px);
  pointer-events: none;
}
.cover-inner {
  position: relative;
  z-index: 2;
  max-width: var(--col-wide);
  margin: 0 auto;
  width: 100%;
  display: grid;
  gap: 40px;
}
.cover .eyebrow-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--ink-mute);
  font-size: var(--type-mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.cover .eyebrow-bar .accent { color: var(--accent); }

.cover h1 {
  margin: 0;
  font-size: var(--type-display);
  line-height: 0.96;
  letter-spacing: -0.035em;
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}
.cover h1 em {
  font-style: normal;
  color: var(--accent);
}
.cover h1 .am {
  font-family: var(--font-am);
  color: var(--accent);
  font-weight: 600;
  display: inline-block;
  margin-right: 0.15em;
  letter-spacing: -0.02em;
}
.cover .deck {
  font-size: var(--type-lede);
  line-height: 1.32;
  color: var(--ink-dim);
  max-width: 760px;
  letter-spacing: -0.005em;
}
.cover .deck strong { color: var(--ink); font-weight: 500; }

.cover-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
  border-top: 1px solid var(--line-2);
  padding-top: 32px;
}
.cover-meta .cell .k {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.cover-meta .cell .v {
  font-size: var(--type-body);
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.4;
}

.cover .scroll-cue {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-mute);
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.cover .scroll-cue .arr {
  width: 1px; height: 28px;
  background: var(--ink-faint);
  position: relative;
}
.cover .scroll-cue .arr::after {
  content: '';
  position: absolute;
  bottom: 0; left: -3px;
  width: 7px; height: 7px;
  border-right: 1px solid var(--ink-faint);
  border-bottom: 1px solid var(--ink-faint);
  transform: rotate(45deg);
}

/* =========================================================================
   Section layout
   ========================================================================= */

main { position: relative; z-index: 2; }

.section {
  position: relative;
  padding: 140px var(--gutter) 100px;
  border-top: 1px solid var(--line-1);
}
.section-inner {
  max-width: var(--col-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 900px) {
  .section-inner { grid-template-columns: 1fr; gap: 24px; }
}

.section-mark {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: var(--type-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.section-mark .num {
  font-family: var(--font-mono);
  font-size: 64px;
  line-height: 0.9;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.04em;
}
.section-mark .num .of {
  font-size: 14px;
  color: var(--ink-faint);
  letter-spacing: 0;
}
.section-mark .tag {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.22em;
}
.section-mark .progress {
  width: 80px; height: 1px;
  background: var(--line-2);
  position: relative;
}
.section-mark .progress::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--p, 0%);
  background: var(--accent);
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: '→';
  color: var(--accent);
}
.eyebrow.dim { color: var(--ink-mute); }
.eyebrow.dim::before { color: var(--ink-mute); }
.eyebrow.warn { color: var(--red); }
.eyebrow.warn::before { content: '⚠'; }

h2.section-title {
  font-size: var(--type-title);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  max-width: 900px;
  text-wrap: balance;
}
h2.section-title em { font-style: normal; color: var(--accent); }
h2.section-title .strike {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  color: var(--ink-mute);
}

h3.sub {
  font-size: clamp(20px, 1.6vw, 26px);
  line-height: 1.18;
  font-weight: 600;
  color: var(--ink);
  margin: 16px 0 0;
  letter-spacing: -0.015em;
  max-width: 720px;
}

.lede {
  font-size: var(--type-lede);
  line-height: 1.36;
  color: var(--ink-dim);
  letter-spacing: -0.005em;
  max-width: var(--col-max);
  margin: 0;
}
.lede strong { color: var(--ink); font-weight: 500; }

p, .body-txt {
  font-size: var(--type-body);
  line-height: 1.62;
  color: var(--ink-dim);
  margin: 0;
  max-width: var(--col-max);
}
p strong, .body-txt strong { color: var(--ink); font-weight: 500; }
p em, .body-txt em { color: var(--accent); font-style: normal; }

ul.bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: var(--col-max);
}
ul.bullets li {
  font-size: var(--type-body);
  line-height: 1.55;
  color: var(--ink-dim);
  padding-left: 28px;
  position: relative;
}
ul.bullets li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.65em;
  width: 14px; height: 1px;
  background: var(--accent);
}
ul.bullets li strong { color: var(--ink); font-weight: 500; }
ul.bullets.dim li::before { background: var(--ink-mute); }

/* numeric list (1. / 2. / 3.) */
ol.steps {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: stp;
  display: flex; flex-direction: column;
  gap: 18px;
  max-width: var(--col-max);
}
ol.steps li {
  counter-increment: stp;
  font-size: var(--type-body);
  line-height: 1.55;
  color: var(--ink-dim);
  padding-left: 42px;
  position: relative;
}
ol.steps li::before {
  content: counter(stp, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 500;
}
ol.steps li strong { color: var(--ink); font-weight: 500; }

/* =========================================================================
   Citations (numeric superscripts) + reference list
   ========================================================================= */

sup.cite {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 500;
  vertical-align: 0.45em;
  line-height: 1;
  padding: 0 2px 0 1px;
  cursor: pointer;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
sup.cite::before { content: '['; opacity: 0.5; }
sup.cite::after  { content: ']'; opacity: 0.5; }
sup.cite:hover   { color: var(--ink); }
sup.cite:hover::before, sup.cite:hover::after { opacity: 0.9; }

body[data-citations="off"] sup.cite { display: none; }
body[data-citations="off"] .section.refs { display: none; }

.cite-pop {
  position: absolute;
  z-index: 50;
  max-width: 360px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line-3);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms, transform 120ms;
}
.cite-pop.on { opacity: 1; transform: translateY(0); }
.cite-pop .n {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}
.cite-pop .au { color: var(--ink); }

/* =========================================================================
   Callouts (the friendly emoji boxes from the PDF)
   ========================================================================= */

.callout {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 22px;
  align-items: start;
  padding: 28px 32px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255,107,26,0.04), rgba(255,107,26,0.01));
  max-width: var(--col-max);
  position: relative;
}
.callout::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 3px; height: 100%;
  background: var(--accent);
}
.callout .glyph {
  font-size: 32px;
  line-height: 1;
  color: var(--accent);
  font-weight: 500;
  font-feature-settings: "tnum" 1;
  padding-top: 2px;
  user-select: none;
}
.callout .body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.callout .lbl {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}
.callout h4 {
  margin: 0;
  font-size: 17px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.callout p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-dim);
  margin: 0;
}
.callout.warn::before { background: var(--red); }
.callout.warn .glyph,
.callout.warn .lbl { color: var(--red); }
.callout.insight::before { background: var(--accent); }

body[data-emoji="off"] .callout .glyph { display: none; }
body[data-emoji="off"] .callout {
  grid-template-columns: 1fr;
  padding-left: 32px;
}

/* =========================================================================
   Pull-quote and bigstat blocks
   ========================================================================= */

.pullquote {
  font-size: clamp(22px, 2.2vw, 36px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--ink);
  margin: 12px 0;
  max-width: 900px;
  text-wrap: balance;
}
.pullquote .strike {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  color: var(--ink-mute);
}
.pullquote em { font-style: normal; color: var(--accent); }
.pullquote .src {
  display: block;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  text-transform: uppercase;
  margin-top: 18px;
  font-weight: 400;
}

.stat-row {
  display: grid;
  grid-template-columns: 180px 1fr 160px;
  align-items: baseline;
  gap: 28px;
  padding: 22px 0;
  border-top: 1px solid var(--line-2);
  max-width: var(--col-wide);
}
.stat-row:last-child { border-bottom: 1px solid var(--line-2); }
.stat-row .n {
  font-size: 56px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 0.9;
  font-feature-settings: "tnum" 1;
}
.stat-row .n.accent { color: var(--accent); }
.stat-row .l {
  font-size: var(--type-body);
  line-height: 1.5;
  color: var(--ink-dim);
}
.stat-row .l strong { color: var(--ink); font-weight: 500; }
.stat-row .src {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: right;
}

/* =========================================================================
   The diagram block (wide breakout)
   ========================================================================= */

.diagram {
  margin: 16px 0 8px;
  max-width: var(--col-wide);
  width: 100%;
  position: relative;
  border: 1px solid var(--line-2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005)),
    radial-gradient(circle at 30% 0%, rgba(255,107,26,0.04), transparent 50%);
}
.diagram .d-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-2);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.diagram .d-head .ttl { color: var(--accent); }
.diagram .d-stage {
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.diagram .d-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.12em;
}
.diagram .d-foot .controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.diagram .legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.diagram .legend .sw {
  display: inline-block;
  width: 10px; height: 10px;
  vertical-align: 0px;
  margin-right: 6px;
}

/* shared "tactical" button */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.btn:hover { color: var(--ink); border-color: var(--line-3); }
.btn.primary {
  color: var(--accent);
  border-color: rgba(255,107,26,0.4);
}
.btn.primary:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.btn .dot {
  width: 6px; height: 6px;
  background: currentColor;
  display: inline-block;
}
.btn[disabled] { opacity: 0.4; cursor: default; }

/* =========================================================================
   Phase-3 state machine card (reused on synthesis section)
   ========================================================================= */
.sm {
  display: grid;
  grid-template-columns: 1fr 48px 1fr 48px 1fr;
  gap: 0;
  margin: 8px 0 16px;
}
.sm .node {
  border: 1px solid var(--line-2);
  padding: 22px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 200px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.002));
}
.sm .node .ph {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
.sm .node h4 {
  font-size: 20px;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.sm .node p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-mute);
  margin: 0;
}
.sm .node .dur {
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.sm .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 22px;
  position: relative;
}
.sm .arrow::before {
  content: '';
  position: absolute;
  left: 4px; right: 4px;
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
}
.sm .arrow span {
  background: var(--bg);
  padding: 0 8px;
  line-height: 1;
  z-index: 1;
}
@media (max-width: 900px) {
  .sm {
    grid-template-columns: 1fr;
  }
  .sm .arrow {
    height: 40px;
    transform: rotate(90deg);
  }
}

/* two-up split for "what works / what doesn't" */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: var(--col-wide);
}
@media (max-width: 720px) {
  .split-2 { grid-template-columns: 1fr; }
}
.split-2 .col {
  border: 1px solid var(--line-2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.split-2 .col h4 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.split-2 .col.accent h4 { color: var(--accent); }
.split-2 .col p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-dim);
  margin: 0;
}

/* =========================================================================
   References list
   ========================================================================= */
.refs-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-mute);
  max-width: var(--col-wide);
  counter-reset: r;
}
.refs-list .ref {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-1);
}
.refs-list .ref .n {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.2em;
  font-feature-settings: "tnum" 1;
}
.refs-list .ref .au { color: var(--ink); }
.refs-list .ref a { color: var(--ink-dim); }
.refs-list .ref .src { color: var(--ink-dim); font-style: italic; }

/* anchored highlight when a citation is clicked */
.refs-list .ref.target {
  background: rgba(255,107,26,0.06);
  outline: 1px solid rgba(255,107,26,0.4);
  outline-offset: -1px;
  padding: 8px 12px;
  margin: -8px -12px;
  transition: background 600ms, outline 600ms;
}

/* =========================================================================
   Tone toggle (layperson vs clinical wording)
   ========================================================================= */
.tone-lay  { display: inline; }
.tone-clin { display: none; }
body[data-tone="clinical"] .tone-lay  { display: none; }
body[data-tone="clinical"] .tone-clin { display: inline; }

/* Density (executive vs detailed) */
body[data-density="exec"] .detail { display: none !important; }

/* Motion */
body[data-motion="off"] .anim-on,
body[data-motion="off"] [data-animated] * {
  animation-play-state: paused !important;
}
body[data-motion="off"] .breath-circle { animation: none !important; }
body[data-motion="off"] .wave-svg .live-path { transition: none !important; }

/* =========================================================================
   Closing CTA
   ========================================================================= */

.cta-box {
  border: 1px solid var(--line-3);
  padding: 36px 40px;
  background: linear-gradient(180deg, rgba(255,107,26,0.05), rgba(255,107,26,0.01));
  max-width: var(--col-wide);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.cta-box .cta-line {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}
.cta-box .cta-line em { font-style: normal; color: var(--accent); }
.cta-box .cta-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 16px;
}
.cta-box .cta-foot .mail {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

/* small phone polish */
@media (max-width: 600px) {
  .hud-top, .hud-bottom { left: 24px; right: 24px; top: 24px; }
  .hud-bottom { bottom: 24px; top: auto; }
  .scroll-bar { left: 24px; right: 24px; bottom: 60px; }
  .page-frame { inset: 14px; }
  .section { padding: 80px var(--gutter) 60px; }
  .stat-row { grid-template-columns: 120px 1fr; gap: 16px; }
  .stat-row .src { grid-column: 1 / -1; text-align: left; }
  .cover-meta { grid-template-columns: 1fr 1fr; }
}


/* =========================================================================
   Diagram-specific styles
   ========================================================================= */

/* Wave */
.wave-svg, .wantlike-svg, .hrv {
  width: 100%;
  height: auto;
  display: block;
}
.wave-svg .axis-x,
.wantlike-svg .axis-x,
.hrv .axis-x {
  stroke: var(--line-1);
  stroke-width: 1;
}
.wave-svg .grid-line,
.wantlike-svg .grid-line {
  stroke: var(--line-1);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}
.wave-svg .ghost-path { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; }
.wave-svg .live-path  { fill: none; stroke: var(--accent); stroke-width: 2; transition: d 600ms ease; }
.wave-svg .live-fill  { fill: rgba(255,107,26,0.08); }
.wave-svg .playhead   { stroke: var(--accent); stroke-width: 1; opacity: 0.6; }
.wave-svg .head-dot   { fill: var(--accent); }
.wave-svg .axis-lbl   { fill: var(--ink-faint); font: 10px var(--font-mono); letter-spacing: 0.18em; }

.diagram .readout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid var(--line-2);
  border-bottom: 0;
}
.diagram .readout > div {
  padding: 14px 18px;
  border-right: 1px solid var(--line-2);
}
.diagram .readout > div:last-child { border-right: 0; }
.diagram .readout .l {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.diagram .readout .v {
  font-size: 22px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-feature-settings: "tnum" 1;
}
.diagram .readout .v.accent { color: var(--accent); }

/* Wanting/Liking */
.wantlike-svg .want-path { fill: none; stroke: var(--accent); stroke-width: 2; }
.wantlike-svg .like-path { fill: none; stroke: var(--ink-mute); stroke-width: 2; stroke-dasharray: 4 4; }
.wantlike-svg .playhead { stroke: var(--ink-faint); stroke-width: 1; }
.wantlike-svg .head-want { fill: var(--accent); }
.wantlike-svg .head-like { fill: var(--ink-mute); }
.wantlike-svg text { fill: var(--ink-faint); font: 10px var(--font-mono); letter-spacing: 0.16em; }

.scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1px;
  background: var(--line-2);
  outline: none;
}
.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 0;
  background: var(--accent);
  border: 0;
  cursor: pointer;
}
.scrubber::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border: 0;
  cursor: pointer;
}

/* Sketchpad */
.sk-grid {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-2);
  padding: 8px;
  background: var(--bg-1);
}
.sk-cell {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--line-1);
  transition: background 150ms, border-color 150ms;
}
.sk-cell.craving {
  background: rgba(255,107,26,0.55);
  border-color: rgba(255,107,26,0.8);
}
.sk-cell.tetris {
  background: var(--ink);
  border-color: var(--ink);
}
.vivid-none { color: var(--ink-mute) !important; }
.vivid-faint { color: var(--ink-dim) !important; }
.vivid-fuzzy { color: var(--accent) !important; }
.vivid-vivid { color: var(--accent) !important; }

/* Slot machine feed */
.feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 240px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  padding: 8px;
  background: var(--bg-1);
}
.feed .tile {
  flex: 0 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--line-1);
  background: var(--surface);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  animation: tile-in 280ms ease;
}
.feed .tile.hit {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
  letter-spacing: 0.28em;
}
@keyframes tile-in {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Breathing */
.breath-stage {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 720px) { .breath-stage { grid-template-columns: 1fr; } }
.breath-pad {
  aspect-ratio: 1;
  border: 1px solid var(--line-2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(255,107,26,0.05), transparent 70%);
}
.breath-circle {
  width: 80%;
  aspect-ratio: 1;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(255,107,26,0.15), rgba(255,107,26,0.03));
  transition: transform 80ms linear;
  transform-origin: center;
  position: absolute;
  left: 10%;
  top: 10%;
}
.breath-readout {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.breath-phase {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--accent);
  text-transform: uppercase;
}
.breath-count {
  font-size: 48px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.9;
  font-feature-settings: "tnum" 1;
}
.breath-info { display: flex; flex-direction: column; gap: 16px; }
.breath-info .row { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line-2); font-size: 12px; }
.breath-info .row .l { color: var(--ink-faint); letter-spacing: 0.2em; text-transform: uppercase; }
.breath-info .row .v { color: var(--ink); }
.hrv .hrv-line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.hrv .baseline { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 4; }

/* Extinction bars */
.bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  align-items: end;
  height: 200px;
  padding: 14px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
}
.ex-bar {
  background: var(--line-1);
  border: 1px solid var(--line-2);
  position: relative;
  min-height: 4px;
  transition: background 200ms, border-color 200ms, height 280ms cubic-bezier(.2,.7,.2,1);
}
.ex-bar.done {
  background: rgba(255,107,26,0.55);
  border-color: var(--accent);
}
.ex-bar.next {
  background: rgba(255,107,26,0.18);
  border-color: var(--accent);
  animation: pulse 1400ms ease-in-out infinite;
}
.ex-bar.future {
  background: var(--surface);
  border-color: var(--line-1);
}
.ex-bar[data-lbl]::after {
  content: attr(data-lbl);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--accent);
  white-space: nowrap;
}
@keyframes pulse {
  0%, 100% { background: rgba(255,107,26,0.10); }
  50% { background: rgba(255,107,26,0.30); }
}



/* =========================================================================
   MOBILE — tighten chrome, stack diagrams, never break the reading flow
   ========================================================================= */

/* Tablet ≤ 900px: collapse two-column section layout (already done), but
   neutralize the now-pointless sticky behaviour on the section mark so it
   doesn't float over text. */
@media (max-width: 900px) {
  .section-mark {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 22px;
    padding: 14px 16px;
    border: 1px solid var(--line-2);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  }
  .section-mark .num {
    font-size: 36px;
    margin-right: 4px;
  }
  .section-mark .tag {
    font-size: 11px;
  }
  .section-mark > div:last-child { display: none; }   /* short tagline duplicates the eyebrow */
  .section-mark .progress { display: none; }

  /* Section padding a touch tighter */
  .section { padding: 96px var(--gutter) 72px; }

  /* HUD top: trim the live-title (it'll wrap awkwardly otherwise) */
  .hud-top .live-title { display: none; }
}

/* Phone ≤ 720px */
@media (max-width: 720px) {
  :root {
    --gutter: 22px;
    --rail:   0;
    --type-title: clamp(28px, 6.4vw, 38px);
    --type-display: clamp(56px, 14vw, 92px);
    --type-lede: clamp(17px, 4.4vw, 20px);
    --type-body: 15px;
  }

  /* Outer frame tighter (24 -> 10) so we don't waste a quarter of the screen */
  .page-frame { inset: 10px; }

  /* HUD: compact single row above content (no more 56px side gutters), and
     bring the bottom hud in line with the scroll bar */
  .hud-top {
    top: 22px; left: 22px; right: 22px;
    font-size: 10px;
    letter-spacing: 0.14em;
    gap: 8px;
  }
  .hud-top .left { gap: 12px; flex-wrap: wrap; }
  .hud-top .live-section { font-size: 10px; }
  .hud-top > div:last-child { display: none; }      /* doc id is non-essential here */
  .hud-bottom {
    left: 22px; right: 22px; bottom: 22px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }
  .hud-bottom > div:first-child { display: none; }  /* show only the LIVE pip */

  .scroll-bar {
    left: 22px; right: 22px;
    bottom: 52px;
  }
  .scroll-bar .tick .lbl { display: none; }          /* no hover on touch */

  /* Cover — vertical breathing, smaller meta grid */
  .cover { min-height: 100svh; padding: 0 var(--gutter); }
  .cover .glow { filter: blur(28px); opacity: 0.7; }
  .cover-inner { gap: 28px; padding-top: 72px; padding-bottom: 96px; }
  .cover h1 br { display: none; }                    /* avoid forced single-glyph line */
  .cover h1 em { display: inline-block; }
  .cover .deck { font-size: var(--type-lede); }
  .cover-meta {
    grid-template-columns: 1fr 1fr;
    gap: 22px 18px;
    padding-top: 22px;
  }
  .cover-meta .cell .v { font-size: 14px; line-height: 1.4; }
  .cover .scroll-cue { bottom: 70px; }
  .cover .scroll-cue .arr { height: 18px; }

  /* Section internals */
  .section-inner { gap: 20px; }
  .section { padding: 72px var(--gutter) 56px; }
  h2.section-title { letter-spacing: -0.02em; }
  h3.sub { font-size: 19px; }
  p, .body-txt, ul.bullets li, ol.steps li { font-size: 15px; line-height: 1.6; }
  ol.steps li { padding-left: 36px; }
  ul.bullets li { padding-left: 22px; }

  /* Callouts: tighter padding, smaller glyph */
  .callout {
    padding: 20px 22px;
    grid-template-columns: 44px 1fr;
    gap: 16px;
  }
  .callout .glyph { font-size: 24px; }
  .callout h4 { font-size: 16px; }
  .callout p { font-size: 14px; }
  body[data-emoji="off"] .callout { padding-left: 22px; }

  /* Diagrams — chrome compresses, controls go full-width */
  .diagram .d-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 16px;
  }
  .diagram .d-stage  { padding: 22px 16px 18px; gap: 16px; }
  .diagram .d-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .diagram .d-foot .controls { width: 100%; }
  .diagram .d-foot .controls .btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 10px 8px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }
  .diagram .legend {
    gap: 12px;
    font-size: 9px;
    letter-spacing: 0.14em;
  }

  /* 3-up readouts stack to single column at phone widths */
  .diagram .readout { grid-template-columns: 1fr 1fr 1fr; }
  .diagram .readout > div { padding: 10px 12px; }
  .diagram .readout .l { font-size: 9px; letter-spacing: 0.16em; margin-bottom: 4px; }
  .diagram .readout .v { font-size: 16px; }
  .diagram .readout .v span { font-size: inherit !important; }

  /* Wave / wantlike SVGs taller for legibility */
  .wave-svg, .wantlike-svg { aspect-ratio: 16 / 7; }

  /* Sketchpad — 12 cols is fine on phones (still touch-friendly because it's
     a passive display, not tappable) */
  .sk-grid { gap: 3px; padding: 6px; }

  /* Slot feed: shorter */
  .feed { height: 180px; }
  .feed .tile { padding: 10px 12px; font-size: 10px; }

  /* Breathing: pad shrinks to comfortable square, info rows tighter */
  .breath-pad { max-width: 240px; margin: 0 auto; width: 100%; }
  .breath-count { font-size: 36px; }
  .breath-info .row { padding: 9px 0; font-size: 11px; }

  /* Extinction bars: shorter, gap tighter */
  .bars { height: 150px; gap: 4px; padding: 12px 10px; }
  .ex-bar[data-lbl]::after { font-size: 8px; letter-spacing: 0.18em; }

  /* Phase-3 state machine: stack with vertical arrows */
  .sm { gap: 8px; }
  .sm .node { min-height: 0; padding: 18px 18px; }
  .sm .node h4 { font-size: 17px; }
  .sm .arrow {
    height: 22px;
    transform: none;          /* arrow already vertical due to 1-col grid */
  }
  .sm .arrow::before {
    left: 50%; right: auto; top: 4px; bottom: 4px;
    width: 1px; height: auto;
  }

  /* Stats / split-2 */
  .stat-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 18px 0;
  }
  .stat-row .n { font-size: 40px; }
  .stat-row .src { text-align: left; grid-column: auto; }
  .split-2 .col { padding: 18px; }
  .split-2 .col p { font-size: 13px; }

  /* Pullquotes */
  .pullquote { font-size: clamp(20px, 5.4vw, 26px); }

  /* References */
  .refs-list .ref {
    grid-template-columns: 1fr;
    gap: 4px;
    padding-bottom: 14px;
  }
  .refs-list .ref .n { letter-spacing: 0.18em; }

  /* CTA box */
  .cta-box { padding: 24px 22px; gap: 18px; }
  .cta-box .cta-line { font-size: 18px; line-height: 1.3; }
  .cta-box .cta-foot { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Citation popover: never wider than the screen */
  .cite-pop {
    max-width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px;
    padding: 12px 14px;
    font-size: 12px;
  }

  /* Footer block in references section: stack */
  .section.refs .section-body > div:last-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* Very narrow phones (≤ 380px) — final squeeze */
@media (max-width: 380px) {
  :root {
    --gutter: 16px;
    --type-display: 56px;
  }
  .page-frame { inset: 6px; }
  .hud-top, .hud-bottom { left: 14px; right: 14px; }
  .hud-top { top: 14px; }
  .hud-bottom { bottom: 14px; }
  .scroll-bar { left: 14px; right: 14px; bottom: 44px; }
  .cover-meta { grid-template-columns: 1fr; }
  .diagram .readout { grid-template-columns: 1fr 1fr; }
  .diagram .readout > div:nth-child(3) {
    grid-column: 1 / -1;
    border-right: 0;
    border-top: 1px solid var(--line-2);
  }
  .feed { height: 150px; }
  .breath-pad { max-width: 200px; }
  .breath-count { font-size: 30px; }
  .bars { height: 120px; }
}

/* Touch device niceties — no hover lables, slightly larger tap targets */
@media (hover: none) and (pointer: coarse) {
  .btn { padding: 12px 14px; min-height: 40px; }
  .scrubber::-webkit-slider-thumb { width: 22px; height: 22px; }
  .scrubber::-moz-range-thumb     { width: 22px; height: 22px; }
  .scroll-bar { height: 2px; }
  .scroll-bar .tick { position: relative; }
  .scroll-bar .tick::after {
    top: -10px;
    height: 20px;            /* bigger hit zone */
  }
}

/* Respect users who'd rather not see motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ex-bar.next { animation: none; }
  .feed .tile { animation: none; }
  .breath-circle { transition: none; }
  .wave-svg .live-path { transition: none; }
}
