/* ============================================================
   The Mind Illuminated — shared stylesheet
   An interactive companion to Culadasa's ten stages of śamatha.
   Family skeleton copied verbatim from seeingThatFrees / categoryTheory;
   only the palette tokens are swapped (night sapphire + candle amber)
   and the code/card theme is LIGHT throughout (no dark surfaces).
   ============================================================ */

/* === TOKENS === */
:root {
  --bg: #FAFAF8;
  --bg-card: #FFFFFF;
  --bg-sunken: #F4F3F9;
  --text: #1A1A2E;
  --text-muted: #5C5C7A;

  --accent:                 #35548A;  /* night sapphire — primary */
  --accent-dark:            #263D66;
  --accent-light:           #E3E9F3;
  --accent-secondary:       #D08E2E;  /* candle amber — secondary */
  --accent-secondary-light: #F8EEDA;

  --warn: #D97706;
  --warn-light: #FDF1E0;
  --ok: #2D7D46;
  --ok-light: #E8F5EC;
  --err: #DC2626;
  --err-light: #FEE8E8;

  --grid-line: rgba(53, 84, 138, 0.07);
  --border: #E5E3EC;
  --shadow: rgba(40, 30, 90, 0.07);
  --radius: 0.75rem;
  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, Consolas, monospace;

  /* light code/card theme — the user finds dark code hard to read.
     EVERY card surface uses these; never dark. */
  --code-bg:       #EEF2F5;
  --code-bg-soft:  #E1E7EC;
  --code-border:   #D3DAE0;
  --code-fg:       #1F2533;
  --code-cm:       #7A8590;
  --code-kw:       #9C2D6E;
  --code-ty:       #2D6E78;
  --code-fn:       #2F5FA3;
  --code-op:       #B5552A;
  --code-st:       #3B7A4B;
}

/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LAYOUT === */
.container { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem; }
.wide { max-width: 1040px; }

/* === HEADER === */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}
header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 8px var(--shadow);
}
header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; max-width: 1040px;
}
.wordmark {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.95rem; color: var(--text);
}
.wordmark:hover { text-decoration: none; }
.wordmark .mk {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 0.85rem;
}
.wordmark span { opacity: 0.5; font-weight: 400; }
header nav { display: flex; gap: 1.2rem; }
header nav a {
  font-size: 0.85rem; color: var(--text-muted);
  transition: color 0.2s;
}
header nav a:hover { color: var(--accent); text-decoration: none; }
/* scroll progress */
.progress {
  position: absolute; left: 0; bottom: -1px; height: 2px;
  background: var(--accent); width: 0%;
  transition: width 0.1s linear;
}

/* === HERO === */
.hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.hero::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 80px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent-dark);
  background: var(--accent-light);
  padding: 0.35rem 0.8rem; border-radius: 999px;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.6s ease-out both;
}
.hero-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 3rem; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.1;
  margin-bottom: 0.85rem;
  animation: fadeUp 0.6s ease-out 0.08s both;
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-subtitle {
  font-size: 1.15rem; color: var(--text-muted);
  max-width: 560px; margin: 0 auto 2rem;
  animation: fadeUp 0.6s ease-out 0.16s both;
}
.hero-arrows { animation: fadeUp 0.6s ease-out 0.28s both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === SECTIONS === */
section.lesson { padding: 1rem 0; }
.block { margin: 2.75rem 0; }
h2.sec {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.7rem; font-weight: 600; letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
  scroll-margin-top: 72px;
}
h2.sec .num {
  font-family: var(--mono); font-size: 0.95rem; font-weight: 500;
  color: var(--accent); margin-right: 0.5rem;
  vertical-align: 0.12em;
}
h3.sub { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
p.lead { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1rem; }
.prose p { margin-bottom: 0.9rem; }
.prose ul { margin: 0.4rem 0 1rem 1.3rem; }
.prose li { margin-bottom: 0.35rem; }

/* inline term/emphasis chips */
.m {
  font-family: var(--mono); font-size: 0.92em;
  background: var(--bg-sunken);
  padding: 0.08em 0.38em; border-radius: 4px;
  white-space: nowrap;
}
.m.obj { color: var(--accent-secondary); background: var(--accent-secondary-light); }
.m.mor { color: var(--accent-dark); background: var(--accent-light); }

/* === CALLOUT === */
.callout {
  display: flex; gap: 0.85rem;
  background: var(--accent-light);
  border: 1px solid #cbd6e8;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.callout .ic { font-size: 1.2rem; flex-shrink: 0; line-height: 1.5; }
.callout.warn { background: var(--warn-light); border-color: #f3dcb6; border-left-color: var(--warn); }
.callout strong { color: var(--accent-dark); }
.callout.warn strong { color: var(--warn); }

/* === FIGURE / WIDGET === */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  box-shadow: 0 1px 3px var(--shadow);
}
.widget-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.widget-title {
  font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 0.45rem;
}
.widget-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hint { font-size: 0.8rem; color: var(--text-muted); }

svg.diagram { width: 100%; height: auto; display: block; touch-action: none; user-select: none; }
.diagram-wrap { background: var(--bg-sunken); border-radius: 0.5rem; padding: 0.5rem; }

/* === BUTTONS / CONTROLS === */
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; align-items: center; }
.btn {
  font: inherit; font-size: 0.85rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); border-radius: 8px;
  padding: 0.45rem 0.85rem; cursor: pointer;
  transition: all 0.15s ease-out;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.readout {
  font-family: var(--mono); font-size: 0.85rem;
  color: var(--text-muted); margin-left: auto;
}
select.pick {
  font: inherit; font-family: var(--mono); font-size: 0.85rem;
  padding: 0.3rem 0.5rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  cursor: pointer;
}

/* === CODE / LANGUAGE TOGGLE (LIGHT THEME) === */
.code-card { border: 1px solid var(--code-border); border-radius: var(--radius); overflow: hidden; margin: 1.5rem 0; }
.code-tabs { display: flex; background: var(--code-bg-soft); border-bottom: 1px solid var(--code-border); }
.code-tab {
  font: inherit; font-size: 0.82rem; font-weight: 500;
  font-family: var(--mono);
  color: var(--text-muted); background: transparent; border: none;
  padding: 0.6rem 1.05rem; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.code-tab:hover { color: var(--text); }
.code-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.code-tab .lang-ic { opacity: 0.9; margin-right: 0.4rem; }
pre.code {
  margin: 0; padding: 1.1rem 1.2rem;
  background: var(--code-bg); color: var(--code-fg);
  font-family: var(--mono); font-size: 0.84rem; line-height: 1.7;
  overflow-x: auto;
}
pre.code .cm { color: var(--code-cm); font-style: italic; } /* comment / plain-English annotation */
pre.code .kw { color: var(--code-kw); }                     /* the action / cue */
pre.code .ty { color: var(--code-ty); }                     /* named thing */
pre.code .fn { color: var(--code-fn); }                     /* named thing */
pre.code .op { color: var(--code-op); }                     /* operator */
pre.code .st { color: var(--code-st); }                     /* literal */
pre.code .hl { color: var(--accent-dark); font-weight: 600; } /* hand-marked highlight */
.code-pane { display: none; }
.code-pane.active { display: block; }

/* === QUIZ === */
.quiz-q { margin-bottom: 1.4rem; }
.quiz-q:last-child { margin-bottom: 0; }
.quiz-q .q { font-weight: 600; margin-bottom: 0.6rem; }
.quiz-q .q .qn {
  font-family: var(--mono); color: var(--accent); font-size: 0.85rem; margin-right: 0.4rem;
}
.opt {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 0.92rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.6rem 0.85rem; margin-bottom: 0.5rem;
  cursor: pointer; transition: all 0.12s ease-out;
  display: flex; align-items: center; gap: 0.6rem;
}
.opt:hover:not(.locked) { border-color: var(--accent); background: var(--accent-light); }
.opt .mark { width: 18px; flex-shrink: 0; font-weight: 700; }
.opt.correct { border-color: var(--ok); background: var(--ok-light); color: #1b5e2e; }
.opt.wrong { border-color: var(--err); background: var(--err-light); color: #b91c1c; }
.opt.locked { cursor: default; }
.quiz-fb { font-size: 0.88rem; margin-top: 0.4rem; min-height: 1.2em; color: var(--text-muted); }
.quiz-fb.show.ok { color: var(--ok); }
.quiz-fb.show.no { color: var(--err); }

/* === NEXT / FOOTER === */
.next-card {
  display: flex; align-items: center; gap: 1rem;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-secondary-light));
  border: 1px solid #cbd6e8; border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin: 2.5rem 0 1rem;
}
.next-card .big { font-size: 1.6rem; }
.next-card .t1 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; }
.next-card .t2 { font-weight: 600; font-size: 1.05rem; }
.next-card .t3 { font-size: 0.88rem; color: var(--text-muted); }
.next-card .lock { margin-left: auto; font-size: 0.8rem; color: var(--text-muted); }
a.next-card { color: inherit; text-decoration: none; transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; }
a.next-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px var(--shadow); text-decoration: none; }
.next-card .arrow { margin-left: auto; font-size: 1.4rem; color: var(--accent-dark); transition: transform 0.2s ease-out; }
a.next-card:hover .arrow { transform: translateX(4px); }

footer {
  padding: 2.5rem 0; text-align: center;
  font-size: 0.8rem; color: var(--text-muted);
  border-top: 1px solid var(--border); margin-top: 1rem;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* === RESPONSIVE === */
@media (max-width: 767px) {
  .hero { padding: 3rem 0 2rem; }
  .hero-title { font-size: 2.1rem; }
  .hero-subtitle { font-size: 1rem; }
  h2.sec { font-size: 1.4rem; }
  header nav a:not(.nav-keep) { display: none; }
  .readout { margin-left: 0; width: 100%; }
}

/* ============================================================
   HUB MAP — the landing page's table of contents.
   A grid of chapter cards grouped into four "movements".
   All surfaces light; the cards lift gently on hover.
   ============================================================ */

/* --- movement / group heading --- */
.movement {
  display: flex; align-items: center; gap: 0.85rem;
  margin: 2.75rem 0 1.1rem;
}
.movement .mv-label {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  white-space: nowrap;
}
.movement .mv-label .mv-roman {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
  color: var(--accent); margin-right: 0.5rem;
  text-transform: none;
}
.movement .mv-rule {
  flex: 1; height: 1px; background: var(--border);
}

/* --- responsive card grid --- */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 600px) { .map-grid { grid-template-columns: 1fr; } }

/* --- a single chapter card --- */
.map-card {
  position: relative;
  display: flex; flex-direction: column; gap: 0.45rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: 0 1px 3px var(--shadow);
  color: inherit;
}
.map-card .num {
  font-family: var(--mono); font-weight: 700; font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.map-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.18rem; font-weight: 600; letter-spacing: -0.01em;
  line-height: 1.2;
}
.map-card p {
  font-size: 0.9rem; color: var(--text-muted); line-height: 1.5;
  margin: 0;
}

/* --- a live chapter card: accent edge + hover lift + "Start here" cue --- */
a.map-card {
  text-decoration: none;
  border-left: 3px solid var(--accent);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, border-color 0.2s ease-out;
}
a.map-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
a.map-card .num { color: var(--accent); }
.start-here {
  margin-top: 0.25rem;
  font-size: 0.82rem; font-weight: 600; color: var(--accent-dark);
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.start-here .arrow { transition: transform 0.2s ease-out; }
a.map-card:hover .start-here .arrow { transform: translateX(4px); }

/* --- "coming soon" cards: muted, dashed, no lift --- */
.map-card.soon {
  opacity: 0.72;
  border-style: dashed;
  background: var(--bg-sunken);
  box-shadow: none;
  cursor: default;
}
.badge-soon {
  align-self: flex-start;
  margin-top: 0.3rem;
  font-family: var(--mono); font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent-secondary);
  background: var(--accent-secondary-light);
  border: 1px solid #ebdcb2;
  padding: 0.18rem 0.5rem; border-radius: 999px;
}


/* ===== hub widget rules ===== */
/* ============================================================
   THE BEAM AND THE FIELD — hub signature widget. Prefix: bf-
   Two sliders over one lit room: how narrow the beam is, and how
   much total conscious power is available. All surfaces light;
   the "dusk" field is a low-opacity sapphire wash, never a dark
   card. Reduced motion kills the drift wobble and the tweens.
   ============================================================ */
.bf-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.bf-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.bf-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 11.5em;
}
.bf-range { flex: 1; min-width: 160px; accent-color: var(--accent); cursor: pointer; }
.bf-row:nth-child(2) .bf-range { accent-color: var(--accent-secondary); }
.bf-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.bf-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.bf-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.bf-stat .bf-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.bf-stat .bf-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  color: var(--accent-dark);
}
.bf-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.bf-caption strong { color: var(--accent-dark); }

/* the lit room eases between states when motion is welcome */
#bf-field, #bf-amb, #bf-beam {
  transition: fill-opacity 0.25s ease-out, opacity 0.25s ease-out;
}
#bf-drift { transition: transform 0.35s ease-out; }

@media (max-width: 600px) {
  .bf-row label { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #bf-field, #bf-amb, #bf-beam, #bf-drift { transition: none !important; }
}


/* ===== ch01 widget rules ===== */
/* ============================================================
   Chapter 1 — "The Map". Widget-specific styles.
   Prefixes: mp- (the ten stages path), sh- (what śamatha is made
   of), nv- (novice / skilled / adept). Palette tokens reused from
   :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: the ten stages — focusable stops on the path --- */
.mp-stop { outline: none; cursor: pointer; }
.mp-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.mp-stop:hover circle { stroke: var(--accent-dark); }
.mp-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#mp-marker, #mp-meter { transition: opacity 0.25s ease-out, width 0.3s ease-out, fill 0.3s ease-out; }

/* --- Widget 2: what śamatha is made of — the ripening dial --- */
.sh-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.sh-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.sh-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.sh-range { flex: 1; min-width: 160px; accent-color: var(--accent); cursor: pointer; }
.sh-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.sh-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.sh-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.sh-stat .sh-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.sh-stat .sh-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.sh-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.sh-caption strong { color: var(--accent-dark); }

/* --- Widget 3: novice / skilled / adept — the same sit, three ways --- */
#nv-scene circle, #nv-scene path { transition: opacity 0.3s ease-out, fill-opacity 0.3s ease-out; }

/* --- Reduced motion: freeze every Ch.1 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  .mp-stop circle,
  #mp-marker, #mp-meter,
  #nv-scene circle, #nv-scene path {
    transition: none !important;
  }
}

/* ===== ch02 widget rules ===== */
/* ============================================================
   Chapter 2 — "Spotlight & Floodlight". Widget-specific styles.
   Prefixes: sf- (the street under a shared budget), am- (how
   attention really moves), mf- (three scenes, one mindfulness
   meter). Palette tokens reused from :root — never redefined.
   All surfaces light; no dark cards anywhere.
   ============================================================ */

/* --- Widget 1: the street, on a fixed budget (sf-) --- */
.sf-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.sf-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.sf-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 11.5em;
}
.sf-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.sf-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.sf-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.sf-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.sf-stat .sf-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.sf-stat .sf-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  color: var(--accent-dark);
}
.sf-stat.miss .sf-v { color: var(--warn); }
.sf-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.sf-caption strong { color: var(--accent-dark); }

#sf-field, #sf-amb, #sf-beam {
  transition: fill-opacity 0.25s ease-out, opacity 0.25s ease-out;
}

/* --- Widget 2: how attention really moves (am-) --- */
.am-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.am-caption strong { color: var(--accent-dark); }
#am-marks circle, #am-marks rect { transition: opacity 0.2s ease-out; }
#am-ring { transition: cx 0.12s linear, cy 0.12s linear; }

/* --- Widget 3: three scenes, one meter (mf-) --- */
.mf-stop { outline: none; cursor: pointer; }
.mf-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.mf-stop:hover circle { stroke: var(--accent-dark); }
.mf-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#mf-beam, #mf-field, #mf-mind {
  transition: width 0.32s ease-out, fill 0.32s ease-out;
}
#mf-read strong { color: var(--accent-dark); }
#mf-read em { color: var(--text-muted); }

@media (max-width: 600px) {
  .sf-row label { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #sf-field, #sf-amb, #sf-beam,
  #am-marks circle, #am-marks rect, #am-ring,
  .mf-stop circle, #mf-beam, #mf-field, #mf-mind {
    transition: none !important;
  }
}

/* ===== ch03 widget rules ===== */
/* ============================================================
   Chapter 3 — "Just Sit Down". Widget-specific styles.
   Prefixes: pp- (the six-point preparation wheel), ft- (the
   four-step funnel into the breath), ah- (scold vs savor, two
   breath timelines). Palette tokens reused from :root — never
   redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: the six-point preparation — focusable points --- */
.pp-point { outline: none; cursor: pointer; }
.pp-point circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.pp-point:hover circle { stroke: var(--accent-dark); }
.pp-point:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#pp-glow, #pp-hub { transition: r 0.25s ease-out, fill-opacity 0.25s ease-out; }

/* --- Widget 2: the four-step funnel — the narrowing dial --- */
.ft-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.ft-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.ft-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 10.5em;
}
.ft-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.ft-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 4.2em; text-align: right;
}
.ft-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.ft-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.ft-stat .ft-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.ft-stat .ft-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.ft-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.ft-caption strong { color: var(--accent-dark); }
#ft-scope { transition: rx 0.18s ease-out, ry 0.18s ease-out; }

/* --- Widget 3: scold vs savor — two breath timelines --- */
#ah-tracks rect, #ah-tracks circle { transition: fill-opacity 0.25s ease-out; }

/* --- Reduced motion: freeze every Ch.3 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  .pp-point circle,
  #pp-glow, #pp-hub,
  #ft-scope,
  #ah-tracks rect, #ah-tracks circle {
    transition: none !important;
  }
}

@media (max-width: 600px) {
  .ft-row label { min-width: 100%; }
}

/* ===== ch04 widget rules ===== */
/* ============================================================
   Chapter 4 — "The Forgetting Bug". Widget-specific styles.
   Prefixes: fc- (the forgetting cascade), cl- (connecting &
   labeling), hd- (the five hindrances). Palette tokens reused
   from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: the forgetting cascade — four clickable phases --- */
.fc-stop { outline: none; cursor: pointer; }
.fc-stop circle,
.fc-stop rect { transition: fill 0.18s ease-out, stroke 0.18s ease-out, stroke-width 0.18s ease-out; }
.fc-stop:hover circle { stroke: var(--accent-dark); }
.fc-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
.fc-card { transition: fill 0.2s ease-out, stroke 0.2s ease-out, stroke-width 0.2s ease-out; }

.fc-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.fc-caption strong { color: var(--accent-dark); }

/* --- Widget 2: labeling off / on — the breath timeline --- */
#cl-bands, #cl-marks, #cl-wave { transition: opacity 0.25s ease-out; }
.cl-legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.75rem;
}
.cl-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.cl-stat .cl-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.cl-stat .cl-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  color: var(--accent-dark);
}

/* --- Widget 3: the five hindrances — five clickable nodes --- */
.hd-stop { outline: none; cursor: pointer; }
.hd-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.hd-stop:hover circle { stroke: var(--accent-dark); }
.hd-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }

.hd-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.hd-caption strong { color: var(--accent-dark); }

/* --- Reduced motion: freeze every Ch.4 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  .fc-stop circle, .fc-stop rect, .fc-card,
  #cl-bands, #cl-marks, #cl-wave,
  .hd-stop circle {
    transition: none !important;
  }
}

/* ===== ch05 widget rules ===== */
/* ============================================================
   Chapter 5 — "Frames Per Second". Widget-specific styles.
   Prefixes: fr- (the film strip of mind-moments), gd- (the
   foreground swap), sd- (the dullness spiral). Palette tokens
   reused from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: frames per second — the dropped-frames dial --- */
.fr-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.fr-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.fr-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 11.5em;
}
.fr-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.fr-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.fr-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.fr-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.fr-stat .fr-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.fr-stat .fr-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.fr-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.fr-caption strong { color: var(--accent-dark); }
#fr-dim { transition: fill-opacity 0.25s ease-out; }

/* --- Widget 2: the foreground swap --- */
#gd-scene circle { transition: opacity 0.2s ease-out; }
.gd-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.gd-caption strong { color: var(--accent-dark); }

/* --- Widget 3: the dullness spiral --- */
.sd-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.sd-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.sd-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 11.5em;
}
.sd-range { flex: 1; min-width: 160px; accent-color: var(--accent); cursor: pointer; }
.sd-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 7.5em; text-align: right;
}
.sd-readout {
  display: grid; grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr);
  gap: 0.55rem; margin-top: 0.6rem;
}
.sd-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.sd-stat .sd-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.sd-stat .sd-v {
  font-family: var(--mono); font-size: 0.86rem; font-weight: 700;
  color: var(--accent-dark); line-height: 1.45;
}
.sd-anti {
  display: flex; gap: 0.7rem; align-items: baseline; flex-wrap: wrap;
  border: 1px solid #ebdcb2; border-radius: 8px;
  background: var(--accent-secondary-light);
  padding: 0.55rem 0.75rem;
}
.sd-anti-k {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--accent-secondary); white-space: nowrap;
}
.sd-anti-v { font-size: 0.9rem; color: var(--text); flex: 1; min-width: 180px; }
.sd-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.sd-caption strong { color: var(--accent-dark); }
#sd-marker, #sd-dim, #sd-clarity, #sd-zzz {
  transition: cx 0.3s ease-out, cy 0.3s ease-out, fill-opacity 0.3s ease-out,
              width 0.3s ease-out, fill 0.3s ease-out, opacity 0.3s ease-out;
}

@media (max-width: 600px) {
  .fr-row label, .sd-row label { min-width: 100%; }
  .sd-readout { grid-template-columns: 1fr; }
}

/* --- Reduced motion: freeze every Ch.5 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  #fr-dim, #gd-scene circle,
  #sd-marker, #sd-dim, #sd-clarity, #sd-zzz {
    transition: none !important;
  }
}

/* ===== ch06 widget rules ===== */
/* ============================================================
   Chapter 6 — "The Sneaky Plateau". Widget-specific styles.
   Prefixes: pl- (the plateau illusion), bs- (the body-scan
   circuit), vv- (complacent sit vs probing sit). Palette tokens
   reused from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: pl- — the plateau illusion (slider + reveal) --- */
.pl-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.pl-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.pl-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 12.5em;
}
.pl-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.pl-wk {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 5.4em; text-align: right;
}
.pl-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.pl-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.pl-stat .pl-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.pl-stat .pl-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  color: var(--accent-dark);
}
.pl-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.pl-caption strong { color: var(--accent-dark); }
#pl-plot polyline, #pl-plot circle, #pl-plot line { transition: opacity 0.25s ease-out; }

/* --- Widget 2: bs- — the body-scan circuit (click-a-region) --- */
.bs-region { cursor: pointer; outline: none; }
.bs-region .bs-sh { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.bs-region:hover .bs-sh { stroke: var(--accent-dark); }
.bs-region:focus-visible .bs-sh { stroke: var(--accent-secondary); stroke-width: 4; }
.bs-lab { font-family: ui-monospace, monospace; font-size: 11px; }
.bs-region:hover .bs-lab { fill: var(--accent-dark); }
#bs-power { transition: width 0.3s ease-out; }
#bs-ticks line { transition: opacity 0.25s ease-out; }

/* --- Widget 3: vv- — complacent sit vs probing sit --- */
#vv-scene polyline, #vv-scene circle, #vv-scene line, #vv-scene text {
  transition: opacity 0.25s ease-out;
}
#vv-detail { transition: width 0.3s ease-out, fill 0.3s ease-out; }

@media (max-width: 600px) {
  .pl-row label { min-width: 100%; }
}

/* --- Reduced motion: freeze every Ch.6 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  #pl-plot polyline, #pl-plot circle, #pl-plot line,
  .bs-region .bs-sh, #bs-power, #bs-ticks line,
  #vv-scene polyline, #vv-scene circle, #vv-scene line, #vv-scene text,
  #vv-detail {
    transition: none !important;
  }
}

/* ===== ch07 widget rules ===== */
/* ============================================================
   Chapter 7 — "The Committee". Widget-specific styles.
   Prefixes: cm- (the mind-system diagram), bb- (the message bus),
   it- (repetition compiles). Palette tokens reused from :root —
   never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: the mind-system — focusable parts around the board --- */
.cm-node { outline: none; cursor: pointer; }
.cm-node circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out, stroke-width 0.18s ease-out; }
.cm-node:hover > circle:first-child { stroke: var(--accent-dark); }
.cm-node:focus-visible > circle:first-child { stroke: var(--accent-secondary); stroke-width: 4; }
#cm-links line { transition: stroke 0.22s ease-out, stroke-width 0.22s ease-out; }

/* --- Widget 2: the message bus — chips and arrows settling into place --- */
#bb-scene rect, #bb-scene line, #bb-scene polygon, #bb-scene circle {
  transition: fill 0.25s ease-out, fill-opacity 0.25s ease-out, stroke 0.25s ease-out;
}

/* --- Widget 3: repetition compiles — the reps dial --- */
.it-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.it-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.it-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 11.5em;
}
.it-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.it-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 5.2em; text-align: right;
}
.it-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.it-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.it-stat .it-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.it-stat .it-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.it-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.it-caption strong { color: var(--accent-dark); }

#it-effort, #it-auto { transition: width 0.28s ease-out; }
#it-dots circle { transition: fill 0.2s ease-out, stroke 0.2s ease-out, r 0.2s ease-out; }

@media (max-width: 600px) {
  .it-row label { min-width: 100%; }
}

/* --- Reduced motion: freeze every Ch.7 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  .cm-node circle,
  #cm-links line,
  #bb-scene rect, #bb-scene line, #bb-scene polygon, #bb-scene circle,
  #it-effort, #it-auto, #it-dots circle {
    transition: none !important;
  }
}

/* ===== ch08 widget rules ===== */
/* ============================================================
   Chapter 8 — "One Thing Only". Widget-specific styles.
   Prefixes: se- (stop feeding the background), wb- (setting the
   scope / whole-body breath), mt- (the watcher above). Palette
   tokens reused from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: stop feeding the background — the exclusivity dial --- */
.se-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.se-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.se-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.se-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.se-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.se-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.se-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.se-stat .se-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.se-stat .se-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
/* the key readout resolves to "exclusive ≠ dim" and warms when it does */
.se-stat.key { border-color: #ebdcb2; background: var(--accent-secondary-light); }
.se-stat.key .se-v { color: var(--accent-dark); transition: color 0.2s ease-out; }
.se-stat.key .se-v.won { color: #A86A14; }
.se-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.se-caption strong { color: var(--accent-dark); }
#se-beam { transition: opacity 0.25s ease-out; }
#se-chatter circle, #se-chatter line, #se-chatter text {
  transition: opacity 0.2s ease-out;
}

/* --- Widget 2: setting the scope — focusable stops + the scope ring --- */
.wb-stop { outline: none; cursor: pointer; }
.wb-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.wb-stop:hover circle { stroke: var(--accent-dark); }
.wb-stop:hover text { fill: var(--accent-dark); }
.wb-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#wb-scope {
  transition: cx 0.35s ease-out, cy 0.35s ease-out, rx 0.35s ease-out,
              ry 0.35s ease-out, fill-opacity 0.35s ease-out, stroke-width 0.2s ease-out;
}
#wb-marks circle { transition: fill 0.25s ease-out; }

/* --- Widget 3: the watcher above — the two vantages --- */
#mt-scene circle, #mt-scene polygon { transition: opacity 0.3s ease-out; }
#mt-gauges rect { shape-rendering: geometricPrecision; }

/* --- Reduced motion: freeze every Ch.8 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  #se-beam,
  #se-chatter circle, #se-chatter line, #se-chatter text,
  .wb-stop circle, #wb-scope, #wb-marks circle,
  .se-stat.key .se-v,
  #mt-scene circle, #mt-scene polygon {
    transition: none !important;
  }
}

/* ===== ch09 widget rules ===== */
/* ============================================================
   Chapter 9 — "Effortless". Widget-specific styles.
   Prefixes: ef- (the effort dial), pu- (the basement opens),
   un- (unification). Palette tokens reused from :root — never
   redefined. All surfaces light; no dark cards anywhere.
   ============================================================ */

/* --- Widget 1: the effort dial (ef-) --- */
.ef-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.ef-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.ef-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; min-width: 11.5em;
}
.ef-range { flex: 1; min-width: 160px; accent-color: var(--accent); cursor: pointer; }
.ef-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.ef-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.ef-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.ef-stat .ef-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.ef-stat .ef-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.ef-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.ef-caption strong { color: var(--accent-dark); }
#ef-beam, #ef-stab, #ef-tens, #ef-lamp, #ef-lampglow {
  transition: opacity 0.25s ease-out, width 0.25s ease-out, fill 0.25s ease-out, stroke 0.25s ease-out;
}

/* --- Widget 2: the basement opens (pu-) --- */
.pu-legend {
  display: flex; flex-wrap: wrap; gap: 0.9rem;
  margin-top: 0.7rem; font-size: 0.78rem; color: var(--text-muted);
}
.pu-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.pu-legend i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  background: var(--accent-secondary); font-style: normal;
}
.pu-legend .stuck i { background: var(--warn); }
.pu-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.pu-caption strong { color: var(--accent-dark); }
#pu-press, #pu-uni { transition: width 0.3s ease-out; }

/* --- Widget 3: unification (un-) --- */
.un-lab {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.un-range {
  flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer;
}
.un-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.un-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.un-caption strong { color: var(--accent-dark); }

/* --- narrow screens --- */
@media (max-width: 600px) {
  .ef-row label { min-width: 100%; }
  .un-lab { min-width: 100%; }
}

/* --- Reduced motion: freeze every Ch.9 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  #ef-beam, #ef-stab, #ef-tens, #ef-lamp, #ef-lampglow,
  #pu-press, #pu-uni {
    transition: none !important;
  }
}

/* ===== ch10 widget rules ===== */
/* ============================================================
   Chapter 10 — "Lit From Within". Widget-specific styles.
   Prefixes: pj- (mental vs physical pliancy), ps- (pacifying the
   senses), pt- (the five grades of meditative joy). Palette
   tokens reused from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: pj- — the two panels fade between states --- */
.pj-panel { transition: opacity 0.3s ease-out; }
#pj-scene rect, #pj-scene circle, #pj-scene path, #pj-scene polygon, #pj-scene line {
  transition: fill 0.25s ease-out, stroke 0.25s ease-out, opacity 0.25s ease-out;
}

/* --- Widget 2: ps- — the unification dial --- */
.ps-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.ps-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.ps-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.ps-range { flex: 1; min-width: 160px; accent-color: var(--accent); cursor: pointer; }
.ps-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.ps-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.ps-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.ps-stat .ps-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.ps-stat .ps-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.ps-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.ps-caption strong { color: var(--accent-dark); }

#ps-glow { transition: opacity 0.3s ease-out; }
#ps-fig path, #ps-fig circle { transition: fill 0.3s ease-out, stroke 0.3s ease-out; }
#ps-currents path { transition: opacity 0.3s ease-out; }

/* --- Widget 3: pt- — focusable grade stops under the figure --- */
.pt-stop { outline: none; cursor: pointer; }
.pt-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.pt-stop:hover circle { stroke: var(--accent-dark); }
.pt-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#pt-glow-c { transition: opacity 0.3s ease-out; }
#pt-fig path, #pt-fig circle { transition: fill 0.3s ease-out, stroke 0.3s ease-out; }
#pt-pips circle { transition: fill 0.25s ease-out, stroke 0.25s ease-out; }

@media (max-width: 600px) {
  .ps-row label { min-width: 100%; }
}

/* --- Reduced motion: freeze every Ch.10 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  .pj-panel,
  #pj-scene rect, #pj-scene circle, #pj-scene path, #pj-scene polygon, #pj-scene line,
  #ps-glow, #ps-fig path, #ps-fig circle, #ps-currents path,
  .pt-stop circle, #pt-glow-c, #pt-fig path, #pt-fig circle, #pt-pips circle {
    transition: none !important;
  }
}

/* ===== ch11 widget rules ===== */
/* ============================================================
   Chapter 11 — "Still Water". Widget-specific styles.
   Prefixes: tq- (calming the intensity of joy), eq- (still water
   / equanimity), pd- (śamatha through the day). Palette tokens
   reused from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: calming the intensity — the maturation dial --- */
.tq-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.tq-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.tq-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.tq-range { flex: 1; min-width: 160px; accent-color: var(--accent-secondary); cursor: pointer; }
.tq-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 3.2em; text-align: right;
}
.tq-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.tq-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.tq-stat .tq-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.tq-stat .tq-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.tq-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.tq-caption strong { color: var(--accent-dark); }

/* the well-being band eases as it thickens and widens */
#tq-band { transition: x 0.2s ease-out, y 0.2s ease-out, width 0.2s ease-out, height 0.2s ease-out; }

/* --- Widget 2: still water — the pond, its events and its churn --- */
.eq-strip {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  align-items: center; margin-top: 0.6rem;
}
.eq-strip .eq-lab {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-right: 0.15rem;
}
.eq-strip .btn.pleasant { border-color: #e2cf9f; }
.eq-strip .btn.pleasant:hover { border-color: var(--accent-secondary); color: var(--accent-dark); }
.eq-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-light); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem; line-height: 1.5;
}
.eq-caption strong { color: var(--accent-dark); }
#eq-clarity { transition: width 0.25s ease-out, fill 0.25s ease-out; }

/* --- Widget 3: śamatha through the day — focusable stops --- */
.pd-stop { outline: none; cursor: pointer; }
.pd-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.pd-stop:hover circle { stroke: var(--accent-dark); }
.pd-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#pd-bars rect { transition: width 0.28s ease-out, fill 0.28s ease-out; }
.pd-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.pd-caption strong { color: var(--accent-dark); }

/* --- Reduced motion: freeze every Ch.11 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  #tq-band, #eq-clarity, #pd-bars rect, .pd-stop circle { transition: none !important; }
}

/* ===== ch12 widget rules ===== */
/* ============================================================
   Chapter 12 — "After the Summit". Widget-specific styles.
   Prefixes: sv- (two lenses on the same mind), aw- (the road past
   śamatha), su- (the ecology of practice). Plus the one-off
   .next-card.finale that closes the series. Palette tokens reused
   from :root — never redefined. All surfaces light.
   ============================================================ */

/* --- Widget 1: two lenses — the scene eases between lenses --- */
#sv-scene circle,
#sv-scene path,
#sv-scene line { transition: opacity 0.25s ease-out, fill-opacity 0.25s ease-out; }

/* --- Widget 2: the road past śamatha — focusable stops --- */
.aw-stop { outline: none; cursor: pointer; }
.aw-stop circle { transition: fill 0.18s ease-out, stroke 0.18s ease-out; }
.aw-stop:hover circle { stroke: var(--accent-dark); }
.aw-stop:focus-visible circle { stroke: var(--accent-secondary); stroke-width: 4; }
#aw-marker, #aw-meter {
  transition: opacity 0.25s ease-out, cx 0.3s ease-out, cy 0.3s ease-out,
              width 0.35s ease-out, fill 0.35s ease-out;
}

/* --- Widget 3: the ecology of practice — the time dial --- */
.su-dial { display: flex; flex-direction: column; gap: 0.6rem; }
.su-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.su-row label {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.su-range { flex: 1; min-width: 160px; accent-color: var(--accent); cursor: pointer; }
.su-pct {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--accent-dark); min-width: 4em; text-align: right;
}
.su-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.55rem; margin-top: 0.6rem;
}
.su-stat {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); padding: 0.55rem 0.7rem;
}
.su-stat .su-k {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.12rem;
}
.su-stat .su-v {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700; color: var(--accent-dark);
}
.su-caption {
  margin-top: 0.85rem; padding: 0.7rem 0.85rem;
  background: var(--accent-secondary-light); border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
  font-size: 0.9rem; line-height: 1.5;
}
.su-caption strong { color: var(--accent-dark); }
#su-plot path { transition: d 0.2s linear; }

/* --- The finale card: last page of the series, so it gets weight --- */
.next-card.finale {
  align-items: flex-start;
  background: linear-gradient(135deg, var(--accent-secondary-light), var(--accent-light));
  border-color: #ebdcb2;
  border-left: 3px solid var(--accent-secondary);
  padding: 1.4rem 1.5rem;
}
.next-card.finale .big {
  font-size: 1.5rem; line-height: 1.2;
  width: 2.2rem; height: 2.2rem; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--accent-secondary);
  border: 1px solid #ebdcb2;
}
.next-card.finale .t1 { color: var(--accent-secondary); }
.next-card.finale .t2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.25rem; letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}
.next-card.finale .t3 { line-height: 1.55; max-width: 84ch; }
.next-card.finale .t3 em { color: var(--accent-dark); font-style: italic; }
.next-card.finale .arrow { align-self: center; }

@media (max-width: 600px) {
  .su-row label { min-width: 100%; }
  .next-card.finale { flex-direction: column; gap: 0.75rem; }
  .next-card.finale .arrow { align-self: flex-end; margin-left: 0; }
}

/* --- Reduced motion: freeze every Ch.12 widget transition --- */
@media (prefers-reduced-motion: reduce) {
  #sv-scene circle, #sv-scene path, #sv-scene line,
  .aw-stop circle, #aw-marker, #aw-meter, #su-plot path {
    transition: none !important;
  }
}
