/* ============================================================
   The Power User's Path — design system
   A warm, editorial "field guide" look: cream paper, deep ink,
   terracotta accent, serif display type, generous rhythm.
   ============================================================ */

:root {
  /* palette */
  --paper: #FBF8F1;
  --paper-2: #F4EDE0;
  --paper-3: #ECE3D2;
  --ink: #221F1A;
  --ink-soft: #5E574B;
  --ink-faint: #8A8272;
  --line: #E3DAC8;
  --line-strong: #CfC4AD;
  --accent: #C25A32;        /* terracotta — the guide's voice */
  --accent-deep: #96401F;
  --accent-wash: #F7E5DC;
  --pine: #33684B;          /* practice / success */
  --pine-wash: #E2EEE6;
  --gold: #9A7A22;          /* caution */
  --gold-wash: #F5ECD4;
  --sky: #33586E;           /* information / systems */
  --sky-wash: #E1EAF0;
  --night: #211E29;         /* terminal + dark panels */
  --night-2: #2C2837;
  --night-ink: #EDE8DF;
  --night-faint: #9A93A8;

  /* type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* layout */
  --measure: 44rem;
  --wide: 60rem;
  --rail-w: 15.5rem;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(34, 31, 26, 0.06), 0 8px 24px -12px rgba(34, 31, 26, 0.18);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }

code, pre, kbd { font-family: var(--mono); }
code {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.35em;
  font-size: 0.86em;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }

kbd {
  display: inline-block;
  min-width: 1.4em;
  text-align: center;
  padding: 0.1em 0.4em;
  font-size: 0.8em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  color: var(--ink-soft);
}

/* ---------- top progress bar ---------- */
.progressbar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 60;
  transition: width 0.1s linear;
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- layout: rail + content ---------- */
.layout { display: block; }

.rail {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  padding: 1.5rem 1.1rem 1.5rem 1.4rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 85%, #fff);
  overflow-y: auto;
  z-index: 40;
  scrollbar-width: thin;
}

.rail-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.rail-sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin-bottom: 1.2rem;
}

.rail nav { display: flex; flex-direction: column; gap: 0.1rem; }

.rail .rail-part {
  margin: 0.9rem 0 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-deep);
}

.rail a.rail-link {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.28rem 0.5rem;
  border-radius: 7px;
  font-size: 0.84rem;
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.3;
}
.rail a.rail-link:hover { background: var(--paper-2); color: var(--ink); }
.rail a.rail-link .n {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
  min-width: 1.3em;
}
.rail a.rail-link.active {
  background: var(--accent-wash);
  color: var(--accent-deep);
  font-weight: 600;
}
.rail a.rail-link.active .n { color: var(--accent); }
.rail a.rail-link.done .n { color: var(--pine); }
.rail a.rail-link.done .n::after { content: " ✓"; }

.rail-hint {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--ink-faint);
  line-height: 1.9;
}

@media (min-width: 1100px) {
  .rail { display: block; }
  .content { margin-left: var(--rail-w); }
}

/* ---------- mobile top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: color-mix(in srgb, var(--paper) 88%, #fff);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.topbar .t-title { font-family: var(--serif); font-weight: 700; font-size: 0.95rem; }
.topbar select {
  max-width: 55%;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
@media (min-width: 1100px) { .topbar { display: none; } }

/* ---------- content column ---------- */
.content { padding: 0 1.25rem 6rem; }
.col { max-width: var(--measure); margin: 0 auto; }
.col-wide { max-width: var(--wide); margin: 0 auto; }

/* ---------- hero ---------- */
.hero {
  padding: 5rem 0 3.5rem;
  text-align: center;
}
.hero .kicker {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 1.2rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.9rem);
  max-width: 20ch;
  margin: 0 auto 1.2rem;
}
.hero h1 em { font-style: italic; color: var(--accent-deep); }
.hero .lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 38rem;
  margin: 0 auto 2rem;
}
.hero .hero-cta {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}
.hero .hero-cta:hover { background: var(--accent-deep); transform: translateY(-1px); color: var(--paper); }
.hero .hero-meta {
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ---------- path map ---------- */
.pathmap {
  margin: 2.5rem auto 0;
  padding: 1.8rem 1.4rem 1.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.pathmap-stages {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  counter-reset: stage;
}
.pathmap-stage {
  position: relative;
  text-align: center;
  padding: 0.4rem 0.3rem;
  font-size: 0.8rem;
}
.pathmap-stage .dot {
  counter-increment: stage;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem; height: 2.1rem;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--paper);
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ink-faint);
}
.pathmap-stage .dot::before { content: counter(stage); }
.pathmap-stage strong { display: block; font-size: 0.84rem; }
.pathmap-stage span { color: var(--ink-faint); font-size: 0.74rem; line-height: 1.35; display: block; }
.pathmap-stage:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.4rem;
  left: calc(50% + 1.3rem);
  width: calc(100% - 2.6rem);
  height: 2px;
  background: var(--line-strong);
}
.pathmap-stage.reached .dot { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-wash); }
@media (max-width: 720px) {
  .pathmap-stages { grid-template-columns: repeat(2, 1fr); gap: 1rem 0.6rem; }
  .pathmap-stage:not(:last-child)::after { display: none; }
}

/* ---------- chapters ---------- */
.chapter { padding: 4.5rem 0 2.5rem; }
.chapter + .chapter { border-top: 1px solid var(--line); }

.ch-head { margin-bottom: 2.2rem; }
.ch-part {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.ch-head h2 {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}
.ch-head h2 .ch-num {
  font-family: var(--mono);
  font-size: 0.45em;
  font-weight: 400;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
}
.ch-lede {
  margin-top: 0.9rem;
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 40rem;
}

.chapter h3 {
  font-size: 1.45rem;
  margin: 2.6rem 0 0.9rem;
}
.chapter h4 { font-size: 1.1rem; margin: 1.8rem 0 0.6rem; }
.chapter p { margin: 0.9rem 0; }
.chapter ul, .chapter ol { margin: 0.9rem 0; padding-left: 1.4rem; }
.chapter li { margin: 0.4rem 0; }
.chapter li::marker { color: var(--accent); }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- generic cards ---------- */
.cards {
  display: grid;
  gap: 0.9rem;
  margin: 1.4rem 0;
}
.cards.two { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 2px rgba(34,31,26,0.04);
}
.card h4 { margin: 0 0 0.4rem; font-size: 1.02rem; }
.card p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }
.card .icon { font-size: 1.3rem; display: block; margin-bottom: 0.5rem; }
.card.tinted-pine { background: var(--pine-wash); border-color: color-mix(in srgb, var(--pine) 30%, var(--line)); }
.card.tinted-accent { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.card.tinted-sky { background: var(--sky-wash); border-color: color-mix(in srgb, var(--sky) 30%, var(--line)); }
.card.tinted-gold { background: var(--gold-wash); border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }

/* ---------- callouts ---------- */
.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  margin: 1.6rem 0;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.95rem;
}
.callout .co-icon { font-size: 1.2rem; line-height: 1.4; }
.callout p { margin: 0.3rem 0 0; }
.callout strong.co-title { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; }
.callout.note { background: var(--sky-wash); border-color: color-mix(in srgb, var(--sky) 30%, var(--line)); }
.callout.note .co-title { color: var(--sky); }
.callout.tip { background: var(--pine-wash); border-color: color-mix(in srgb, var(--pine) 30%, var(--line)); }
.callout.tip .co-title { color: var(--pine); }
.callout.warn { background: var(--gold-wash); border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.callout.warn .co-title { color: var(--gold); }
.callout.story { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.callout.story .co-title { color: var(--accent-deep); }

/* ---------- figures / diagrams ---------- */
.figure {
  margin: 2rem auto;
  padding: 1.6rem 1.4rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.figure svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
/* on narrow screens, keep diagram text legible: scroll inside the figure
   instead of shrinking below readability */
@media (max-width: 640px) {
  .figure svg { max-width: none; width: 36rem; }
}
.figure figcaption {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
  font-size: 0.84rem;
  color: var(--ink-faint);
  text-align: center;
}

/* SVG diagram type — inherits the page fonts */
svg .d-label { font-family: var(--sans); font-size: 13.5px; fill: var(--ink); }
svg .d-label.b { font-weight: 700; }
svg .d-small { font-family: var(--sans); font-size: 11.5px; fill: var(--ink-soft); }
svg .d-tiny { font-family: var(--sans); font-size: 10.5px; fill: var(--ink-faint); }
svg .d-mono { font-family: var(--mono); font-size: 11px; fill: var(--ink-soft); }
svg .d-kicker { font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; }
svg .d-box { fill: #fff; stroke: var(--line-strong); stroke-width: 1.5; }
svg .d-box.accent { fill: var(--accent-wash); stroke: var(--accent); }
svg .d-box.pine { fill: var(--pine-wash); stroke: var(--pine); }
svg .d-box.sky { fill: var(--sky-wash); stroke: var(--sky); }
svg .d-box.gold { fill: var(--gold-wash); stroke: var(--gold); }
svg .d-box.night { fill: var(--night); stroke: var(--night); }
svg .d-arrow { stroke: var(--ink-soft); stroke-width: 1.8; fill: none; }
svg .d-arrow.accent { stroke: var(--accent); }
svg .d-arrow.dashed { stroke-dasharray: 5 4; }

/* ---------- prompt before / after ---------- */
.ba {
  display: grid;
  gap: 1rem;
  margin: 1.6rem 0;
}
@media (min-width: 860px) { .ba { grid-template-columns: 1fr 1fr; } }
.ba-panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ba-panel .ba-head {
  padding: 0.55rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--line);
}
.ba-panel.before .ba-head { background: var(--paper-2); color: var(--ink-faint); }
.ba-panel.after .ba-head { background: var(--pine-wash); color: var(--pine); }
.ba-panel .ba-body { padding: 1rem 1.1rem; font-size: 0.92rem; }
.ba-panel .ba-body p { margin: 0 0 0.6rem; }
.ba-panel .ba-verdict {
  margin-top: auto;
  padding: 0.7rem 1.1rem;
  border-top: 1px dashed var(--line);
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.ba-panel.after { border-color: color-mix(in srgb, var(--pine) 35%, var(--line)); }

/* annotated prompt anatomy */
.anatomy {
  margin: 1.6rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.anatomy .an-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  border-bottom: 1px solid var(--line);
}
.anatomy .an-row:last-child { border-bottom: none; }
.anatomy .an-tag {
  padding: 0.85rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--paper-2);
  color: var(--accent-deep);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
}
.anatomy .an-text { padding: 0.75rem 1.1rem; font-size: 0.92rem; }
.anatomy .an-text em { color: var(--ink-faint); font-size: 0.85em; }
@media (max-width: 640px) {
  .anatomy .an-row { grid-template-columns: 1fr; }
  .anatomy .an-tag { border-right: none; padding: 0.5rem 1.1rem 0.2rem; background: none; }
  .anatomy .an-text { padding-top: 0.15rem; }
}

/* ---------- mock chat UI ---------- */
.mock {
  margin: 1.8rem 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 0.9rem;
}
.mock .mock-chrome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.mock .mock-chrome .dots { display: flex; gap: 5px; }
.mock .mock-chrome .dots i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line-strong); display: block;
}
.mock .mock-chrome .mock-title {
  font-size: 0.78rem; color: var(--ink-faint);
  font-family: var(--mono);
  margin-left: 0.3rem;
}
.mock .mock-body { padding: 1.1rem 1.2rem; }

.msg { display: flex; gap: 0.7rem; margin: 0.9rem 0; }
.msg .avatar {
  flex: none;
  width: 1.8rem; height: 1.8rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  color: #fff;
}
.msg.user .avatar { background: var(--sky); }
.msg.ai .avatar { background: var(--accent); }
.msg .bubble {
  background: var(--paper-2);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  max-width: 92%;
}
.msg.ai .bubble { background: var(--accent-wash); }
.msg .bubble p { margin: 0 0 0.45rem; }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble ul { margin: 0.3rem 0; padding-left: 1.1rem; }

/* project sidebar mock */
.mock-project { display: grid; grid-template-columns: 13rem 1fr; }
.mock-project .proj-side {
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  padding: 0.9rem;
  font-size: 0.8rem;
}
.mock-project .proj-side h5 { margin: 0 0 0.5rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-family: var(--sans); }
.mock-project .proj-side .pf {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  color: var(--ink-soft);
}
.mock-project .proj-side .pf:hover { background: #fff; }
.mock-project .proj-side .divider { margin: 0.8rem 0 0.5rem; border-top: 1px dashed var(--line-strong); }
@media (max-width: 680px) {
  .mock-project { grid-template-columns: 1fr; }
  .mock-project .proj-side { border-right: none; border-bottom: 1px solid var(--line); }
}

/* ---------- terminal ---------- */
.term {
  margin: 1.8rem 0;
  background: var(--night);
  color: var(--night-ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 0.84rem;
}
.term .term-chrome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: var(--night-2);
}
.term .term-chrome .dots { display: flex; gap: 5px; }
.term .term-chrome .dots i { width: 10px; height: 10px; border-radius: 50%; display: block; opacity: 0.85; }
.term .term-chrome .dots i:nth-child(1) { background: #E0604F; }
.term .term-chrome .dots i:nth-child(2) { background: #D9A036; }
.term .term-chrome .dots i:nth-child(3) { background: #57A662; }
.term .term-chrome .term-title { font-family: var(--mono); font-size: 0.72rem; color: var(--night-faint); margin-left: 0.3rem; }
.term pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.65;
  font-family: var(--mono);
}
.term .t-prompt { color: #8BC7A0; }
.term .t-cmd { color: #F0EAD8; font-weight: 600; }
.term .t-dim { color: var(--night-faint); }
.term .t-ai { color: #E8A87C; }
.term .t-ok { color: #8BC7A0; }
.term .t-warn { color: #D9A036; }
.term .t-path { color: #92B4D6; }

/* step-through session player */
.player .term pre { min-height: 17rem; }
.player-controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  background: var(--night-2);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.player-controls button {
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.player-controls button:hover { background: var(--accent-deep); }
.player-controls button.ghost {
  background: transparent;
  color: var(--night-faint);
  border-color: rgba(255,255,255,0.2);
}
.player-controls button.ghost:hover { color: var(--night-ink); }
.player-controls button:disabled { opacity: 0.35; cursor: default; }
.player-controls .step-note {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--night-faint);
}
.player-caption {
  padding: 0.8rem 1.2rem;
  background: var(--accent-wash);
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--ink);
}
.player-caption strong { color: var(--accent-deep); }

/* ---------- code blocks (light, annotated) ---------- */
.codeblock {
  margin: 1.6rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.codeblock .cb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-faint);
}
.codeblock pre {
  margin: 0;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
}
.codeblock .c-comment { color: var(--ink-faint); font-style: italic; }
.codeblock .c-key { color: var(--accent-deep); font-weight: 600; }
.codeblock .c-str { color: var(--pine); }
.codeblock .c-callout {
  background: var(--gold-wash);
  border-radius: 4px;
  padding: 0 0.25em;
}

/* ---------- comparison table ---------- */
.cmp-table {
  width: 100%;
  margin: 1.6rem 0;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cmp-table th, .cmp-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.cmp-table th {
  background: var(--paper-2);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table td:first-child { font-weight: 600; width: 11rem; }
.table-scroll { overflow-x: auto; }

/* ---------- model picker ---------- */
.picker {
  margin: 1.8rem 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem 1.5rem;
}
.picker h4 { margin: 0 0 1rem; }
.picker fieldset {
  border: none;
  margin: 0 0 1.1rem;
  padding: 0;
}
.picker legend {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
  padding: 0;
}
.picker .opts { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.picker label.opt {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.86rem;
  cursor: pointer;
  background: var(--paper);
  transition: border-color 0.12s, background 0.12s;
}
.picker label.opt:hover { border-color: var(--accent); }
.picker label.opt:has(input:checked) {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}
.picker label.opt input { accent-color: var(--accent); margin: 0; }
.picker-result {
  margin-top: 0.4rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--pine) 35%, var(--line));
  background: var(--pine-wash);
  font-size: 0.94rem;
}
.picker-result strong { color: var(--pine); }
.picker-result p { margin: 0.35rem 0 0; }

/* ---------- flip / toggle reveals ---------- */
details.reveal-box {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
details.reveal-box summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
details.reveal-box summary::before {
  content: "+";
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 700;
  width: 1.1em;
}
details.reveal-box[open] summary::before { content: "–"; }
details.reveal-box summary::-webkit-details-marker { display: none; }
details.reveal-box .rb-body {
  padding: 0 1.1rem 1rem;
  font-size: 0.93rem;
  color: var(--ink-soft);
}
details.reveal-box .rb-body p:first-child { margin-top: 0; }

/* ---------- checklists (persisted) ---------- */
.checklist { margin: 1.4rem 0; display: grid; gap: 0.55rem; }
.checklist label {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.94rem;
  transition: background 0.15s, border-color 0.15s;
}
.checklist label:hover { border-color: var(--accent); }
.checklist input {
  margin-top: 0.28rem;
  accent-color: var(--pine);
  width: 1rem; height: 1rem;
  flex: none;
}
.checklist label:has(input:checked) {
  background: var(--pine-wash);
  border-color: color-mix(in srgb, var(--pine) 35%, var(--line));
}
.checklist label:has(input:checked) .cl-text { color: var(--ink-soft); }
.checklist .cl-text strong { display: block; }
.checklist .cl-text span { font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- chapter footer / done button ---------- */
.ch-foot {
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.btn-done {
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 1.3rem;
  border-radius: 999px;
  border: 1.5px solid var(--pine);
  background: #fff;
  color: var(--pine);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-done:hover { background: var(--pine-wash); }
.btn-done.is-done { background: var(--pine); color: #fff; }
.ch-foot .next-link { font-size: 0.9rem; margin-left: auto; }

/* ---------- cheat sheet ---------- */
.cheat-grid {
  display: grid;
  gap: 1rem;
  margin: 1.6rem 0;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}
.cheat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cheat .cheat-head {
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--paper-2);
  color: var(--accent-deep);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cheat .cheat-body { padding: 0.8rem 1rem; font-size: 0.86rem; }
.cheat .cheat-body p { margin: 0 0 0.5rem; }
.cheat .cheat-body pre {
  margin: 0.4rem 0 0;
  padding: 0.6rem 0.8rem;
  background: var(--paper-2);
  border-radius: 7px;
  font-size: 0.78rem;
  overflow-x: auto;
  white-space: pre-wrap;
}
.btn-copy {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-copy.copied { background: var(--pine); border-color: var(--pine); color: #fff; }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 3rem 1.25rem 4rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.site-foot .foot-title { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); margin-bottom: 0.4rem; }

/* ---------- keyboard help overlay ---------- */
.kbd-help {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(34, 31, 26, 0.5);
  padding: 1rem;
}
.kbd-help.open { display: flex; }
.kbd-help .kh-panel {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  max-width: 22rem;
  width: 100%;
  box-shadow: var(--shadow);
}
.kbd-help h4 { margin: 0 0 1rem; }
.kbd-help table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.kbd-help td { padding: 0.35rem 0; }
.kbd-help td:first-child { width: 6rem; }

/* ---------- utility ---------- */
.small { font-size: 0.86rem; color: var(--ink-soft); }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media print {
  .rail, .topbar, .progressbar, .player-controls, .btn-done, .kbd-help { display: none !important; }
  .content { margin-left: 0; }
}
