/* ============================================================
   THE AI KITCHEN — warm editorial, kitchen-at-night
   ============================================================ */

:root {
  --bg: #161210;
  --bg-alt: #1c1714;
  --bg-card: #221c18;
  --bg-card-2: #28211c;
  --line: #3a302a;
  --cream: #f3ecdf;
  --cream-dim: #c9bfae;
  --cream-faint: #948a7b;
  --amber: #e8a33d;
  --amber-soft: rgba(232, 163, 61, .14);
  --tomato: #d96846;
  --sage: #8fb586;
  --sage-soft: rgba(143, 181, 134, .12);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--sans);
  font-size: clamp(1rem, .95rem + .3vw, 1.125rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--amber); color: #161210; }

a { color: var(--amber); }

/* ---------- progress bar ---------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,.05); z-index: 100;
}
.progress__fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--amber), var(--tomato));
  transition: width .1s linear;
}

/* ---------- side menu nav ---------- */
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.menu-nav {
  position: fixed; right: 22px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 20px; z-index: 90;
}
.menu-nav a {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); position: relative;
  transition: background .25s, transform .25s;
}
/* invisible hit area: ~29px targets around the 9px dots */
.menu-nav a::after { content: ""; position: absolute; inset: -10px; }
.menu-nav a span {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: .72rem; letter-spacing: .04em;
  color: var(--cream-dim); background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.menu-nav a:hover span,
.menu-nav a:focus-visible span { opacity: 1; }
.menu-nav a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.menu-nav a.is-active { background: var(--amber); transform: scale(1.35); }

/* tablet/phone: compact bottom dot-rail instead of removing navigation */
@media (max-width: 960px) {
  .menu-nav {
    top: auto; right: auto; left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    flex-direction: row; gap: 16px; padding: 10px 16px;
    background: rgba(22, 18, 16, .85);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid var(--line); border-radius: 999px;
  }
  .menu-nav a::after { inset: -8px; }
  /* keep the labels in the accessibility tree; show them above the dots */
  .menu-nav a span {
    right: auto; top: auto; left: 50%; bottom: 26px;
    transform: translateX(-50%);
  }
}

/* ---------- reveal animation (JS-gated: without the .js class on <html>,
   content stays fully visible — the page must never be blank if JS fails) ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 96px 24px 72px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(232,163,61,.10), transparent 60%),
    radial-gradient(800px 500px at 85% 110%, rgba(217,104,70,.07), transparent 60%),
    var(--bg);
}
.hero__kicker {
  font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 28px;
}
.hero__title {
  font-family: var(--serif); font-weight: 560;
  font-size: clamp(2.6rem, 1.6rem + 5.4vw, 5.4rem);
  line-height: 1.05; letter-spacing: -.015em; margin-bottom: 28px;
}
.hero__title em { font-style: italic; color: var(--amber); }
.hero__sub { max-width: 620px; color: var(--cream-dim); margin-bottom: 18px; font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); }

.hero__menu {
  margin: 44px 0 36px; padding: 30px 34px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  max-width: 560px; width: 100%; text-align: left;
}
.hero__menu-title {
  font-family: var(--serif); font-style: italic; color: var(--amber);
  text-align: center; margin-bottom: 18px; font-size: 1.05rem;
}
.hero__menu ol { list-style: none; counter-reset: course; }
.hero__menu li { counter-increment: course; }
.hero__menu li + li { border-top: 1px dashed var(--line); }
.hero__menu a {
  display: flex; align-items: baseline; gap: 14px; padding: 10px 4px;
  text-decoration: none; color: var(--cream); transition: background .2s;
  border-radius: 8px;
}
.hero__menu a:hover { background: var(--amber-soft); }
.hero__menu a::before {
  content: counter(course, decimal-leading-zero);
  font-family: var(--mono); font-size: .75rem; color: var(--amber);
}
.hero__menu a strong { font-weight: 600; font-size: .95rem; }
.hero__menu a span { margin-left: auto; color: var(--cream-faint); font-size: .78rem; text-align: right; }

.hero__film { width: 100%; max-width: 780px; margin-bottom: 40px; }
.hero__film-label {
  font-family: var(--serif); font-style: italic; color: var(--cream-dim);
  margin-bottom: 14px; font-size: 1.02rem;
}
.hero__film-player {
  width: 100%; display: block; border-radius: 16px;
  border: 1px solid var(--line); background: #0e0c0a;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

.scroll-cue {
  text-decoration: none; color: var(--cream-dim); font-size: .9rem;
  border: 1px solid var(--line); border-radius: 999px; padding: 12px 26px;
  transition: border-color .25s, color .25s, background .25s;
}
.scroll-cue:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }

/* ---------- course sections ---------- */
.course { padding: 110px 24px; }
.course--alt { background: var(--bg-alt); }
.course > * { max-width: 860px; margin-left: auto; margin-right: auto; }

.course__head { text-align: center; margin-bottom: 52px; }
.course__no {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--amber);
}
.course__head h2 {
  font-family: var(--serif); font-weight: 560;
  font-size: clamp(2.1rem, 1.5rem + 3vw, 3.6rem);
  line-height: 1.1; margin: 10px 0 8px; letter-spacing: -.01em;
}
.course__tag { color: var(--cream-faint); font-style: italic; font-family: var(--serif); font-size: 1.05rem; }

.prose { margin-bottom: 36px; }
.prose p + p { margin-top: 16px; }
.prose strong { color: var(--cream); }
.prose em { color: var(--cream-dim); }
.prose__h3 {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 600;
  margin-bottom: 12px; margin-top: 10px;
}

/* ---------- punch quotes ---------- */
.punch {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.3rem); line-height: 1.3;
  text-align: center; color: var(--cream);
  padding: 52px 20px 8px; max-width: 760px;
}
.punch em { color: var(--amber); }

/* ---------- duo cards ---------- */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 36px; }
@media (max-width: 720px) { .duo { grid-template-columns: 1fr; } }
.duo__card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px;
}
.duo__card h3 { font-family: var(--serif); font-size: 1.25rem; margin-bottom: 14px; font-weight: 600; }
.duo__card ul { list-style: none; }
.duo__card li { padding-left: 22px; position: relative; margin-bottom: 9px; color: var(--cream-dim); font-size: .95rem; }
.duo__card--yes li::before { content: "✦"; position: absolute; left: 0; color: var(--sage); }
.duo__card--no li::before { content: "✦"; position: absolute; left: 0; color: var(--tomato); }
.duo__card:not(.duo__card--yes):not(.duo__card--no) li::before { content: "→"; position: absolute; left: 0; color: var(--amber); }
.duo__card--yes { border-color: rgba(143,181,134,.35); }
.duo__card--no { border-color: rgba(217,104,70,.35); }
.duo__card p { color: var(--cream-dim); font-size: .95rem; }
.duo__card p + p { margin-top: 12px; }

/* ---------- callout ---------- */
.callout {
  background: var(--bg-card); border: 1px solid var(--line);
  border-left: 3px solid var(--amber); border-radius: 14px;
  padding: 30px 32px; margin-bottom: 36px;
}
.callout h3 { font-family: var(--serif); font-size: 1.3rem; margin-bottom: 12px; font-weight: 600; }
.callout__sub { font-size: .85rem; color: var(--cream-faint); font-weight: 400; font-family: var(--sans); }
.callout p + p { margin-top: 12px; }
.callout p { color: var(--cream-dim); }
.callout strong { color: var(--cream); }

/* ---------- labs (interactive blocks) ---------- */
.lab {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px; margin-bottom: 40px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.lab__head {
  font-family: var(--mono); font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.lab__icon { font-size: 1.1rem; }
.lab__hint { color: var(--cream-dim); font-size: .92rem; margin-bottom: 20px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.chip {
  font-family: var(--sans); font-size: .88rem; font-weight: 500;
  background: transparent; color: var(--cream-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px;
  cursor: pointer; transition: all .2s;
}
.chip:hover { border-color: var(--amber); color: var(--cream); }
.chip.is-on { background: var(--amber); border-color: var(--amber); color: #1d1610; font-weight: 600; }

.order-card {
  background: var(--bg); border: 1px dashed var(--line); border-radius: 12px;
  padding: 18px 22px; margin-bottom: 18px;
}
.order-card__label {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--cream-faint); margin-bottom: 8px;
}
.order-card__text { font-family: var(--serif); font-style: italic; font-size: 1.08rem; line-height: 1.6; }

.meter { height: 10px; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.meter__fill {
  height: 100%; border-radius: 999px;
  width: calc(var(--pct, 0) * 1%);
  /* gradient always spans the full track, so the fill's leading edge shows
     red→amber→green at exactly the right point — and never tiles */
  background: linear-gradient(90deg, var(--tomato), var(--amber), var(--sage)) no-repeat;
  background-size: calc(10000% / max(1, var(--pct, 1))) 100%;
  transition: width .6s cubic-bezier(.2,.8,.2,1), background-size .6s cubic-bezier(.2,.8,.2,1);
}
.meter__label { font-family: var(--mono); font-size: .78rem; color: var(--cream-dim); margin-bottom: 14px; }

.verdict {
  background: var(--bg); border-radius: 12px; padding: 16px 20px;
  color: var(--cream-dim); font-size: .95rem; border: 1px solid var(--line);
  transition: opacity .3s;
}
.verdict em { color: var(--cream); }

/* stock grid */
.stock-legend {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px;
  margin-bottom: 36px; font-size: .92rem; color: var(--cream-dim);
}
@media (max-width: 640px) { .stock-legend { grid-template-columns: 1fr; } }
.stock-legend div { display: flex; gap: 10px; align-items: baseline; }
.stock-legend strong { color: var(--cream); }
.stock-legend span { flex-shrink: 0; }

.stock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 760px) { .stock-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stock-grid { grid-template-columns: 1fr; } }
.stock-item {
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; text-align: left; cursor: pointer; color: var(--cream-dim);
  display: flex; flex-direction: column; gap: 5px;
  transition: all .2s; font-family: var(--sans);
}
.stock-item:hover { border-color: var(--amber); }
.stock-item.is-on { border-color: var(--amber); background: var(--amber-soft); }
.stock-item.is-on strong { color: var(--amber); }
.stock-item--junk.is-on { border-color: var(--tomato); background: rgba(217,104,70,.1); }
.stock-item--junk.is-on strong { color: var(--tomato); }
.stock-item__icon { font-size: 1.3rem; }
.stock-item strong { color: var(--cream); font-size: .92rem; }
.stock-item small { font-size: .78rem; line-height: 1.45; color: var(--cream-faint); }

.stock-output { background: var(--bg); border-radius: 14px; padding: 20px 22px; border: 1px solid var(--line); }
.stock-output__line { font-size: .95rem; color: var(--cream-dim); margin-bottom: 8px; line-height: 1.55; }
.stock-output__line strong { color: var(--cream); }
.stock-output .meter { margin-top: 16px; }
.stock-badge {
  display: inline-block; font-size: .72rem; font-family: var(--mono);
  color: var(--sage); border: 1px solid rgba(143,181,134,.4);
  border-radius: 6px; padding: 2px 8px; margin: 6px 6px 0 0;
}
.stock-warning {
  margin-top: 14px; padding: 12px 16px; border-radius: 10px;
  background: rgba(217,104,70,.1); border: 1px solid rgba(217,104,70,.35);
  color: var(--cream-dim); font-size: .9rem;
}
.stock-warning strong { color: var(--tomato); }

/* ---------- terminal ---------- */
.term {
  background: #0e0c0a; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; margin-bottom: 14px;
}
.term__bar {
  display: flex; align-items: center; gap: 7px; padding: 11px 14px;
  background: #1a1613; border-bottom: 1px solid var(--line);
}
.term__bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.term__bar span:nth-child(1) { background: #d96846; }
.term__bar span:nth-child(2) { background: #e8a33d; }
.term__bar span:nth-child(3) { background: #8fb586; }
.term__bar em { margin-left: 10px; font-style: normal; font-family: var(--mono); font-size: .72rem; color: var(--cream-faint); }
.term__body { padding: 18px; font-family: var(--mono); font-size: .85rem; line-height: 1.8; min-height: 150px; max-height: 320px; overflow-y: auto; }
.term__line { white-space: pre-wrap; word-break: break-word; }
.term__line--dim { color: var(--cream-faint); }
.term__line--cmd { color: var(--cream); }
.term__line--cmd::before { content: "$ "; color: var(--amber); }
.term__line--out { color: var(--sage); }
.term__line--note { color: var(--cream-faint); font-style: italic; }
.term-suggests { display: flex; flex-wrap: wrap; gap: 10px; }
.term-suggest {
  font-family: var(--mono); font-size: .82rem; cursor: pointer;
  background: var(--bg); color: var(--amber); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 16px; transition: all .2s;
}
.term-suggest:hover { border-color: var(--amber); background: var(--amber-soft); }

/* ---------- ide grid ---------- */
.ide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 36px; }
@media (max-width: 760px) { .ide-grid { grid-template-columns: repeat(2, 1fr); } }
.ide-grid div {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 16px; display: flex; flex-direction: column; gap: 4px;
}
.ide-grid span { font-size: 1.4rem; }
.ide-grid strong { font-size: .92rem; }
.ide-grid small { color: var(--cream-faint); font-size: .78rem; line-height: 1.45; }

/* ---------- ffmpeg example ---------- */
.ff-out { background: #0e0c0a; border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 36px; }
.ff-cmd {
  display: block; font-family: var(--mono); font-size: .92rem; line-height: 1.7;
  margin-bottom: 14px; word-break: break-all;
}
.ff-cmd .t-prog { color: var(--tomato); font-weight: 600; }
.ff-cmd .t-in { color: var(--sage); }
.ff-cmd .t-dial { color: var(--amber); }
.ff-cmd .t-out { color: #9ecbff; }
.ff-explain { color: var(--cream-dim); font-size: .92rem; margin-bottom: 16px; }
.ff-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .75rem; color: var(--cream-faint); font-family: var(--mono); }
.ff-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg--prog { background: var(--tomato); }
.lg--in { background: var(--sage); }
.lg--dial { background: var(--amber); }
.lg--out { background: #9ecbff; }

/* ---------- automation duo ---------- */
.auto-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 36px; }
@media (max-width: 760px) { .auto-duo { grid-template-columns: 1fr; } }
.auto-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.auto-card__head { display: flex; align-items: center; gap: 12px; }
.auto-card__icon { font-size: 1.9rem; }
.auto-card h3 { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.auto-card h3 small { display: block; font-family: var(--mono); font-size: .72rem; color: var(--amber); letter-spacing: .1em; margin-top: 3px; }
.auto-card__rule { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--amber); }
.auto-card > p { color: var(--cream-dim); font-size: .94rem; }
.auto-card__examples { list-style: none; font-size: .88rem; color: var(--cream-dim); }
.auto-card__examples li { padding: 7px 0 7px 4px; border-bottom: 1px dashed var(--line); }
.auto-card__examples li:last-child { border-bottom: 0; }
.auto-log { font-family: var(--mono); font-size: .78rem; line-height: 1.8; min-height: 66px; color: var(--sage); }
.auto-log p { animation: logIn .35s ease; }
.auto-log .log-time { color: var(--cream-faint); }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* buttons */
.btn {
  font-family: var(--sans); font-size: .92rem; font-weight: 600; cursor: pointer;
  background: var(--amber); color: #1d1610; border: 0; border-radius: 10px;
  padding: 13px 22px; transition: transform .15s, box-shadow .15s, opacity .2s;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(232,163,61,.25); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn--big { font-size: 1rem; padding: 16px 30px; }

/* ---------- quiz ---------- */
.quiz { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .quiz { grid-template-columns: 1fr; } }
.quiz__item {
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px;
}
.quiz__item > p:first-child { font-size: .95rem; margin-bottom: 12px; font-style: italic; font-family: var(--serif); }
.quiz__btns { display: flex; gap: 10px; margin-bottom: 8px; }
.quiz__btns button {
  flex: 1; font-family: var(--sans); font-size: .85rem; font-weight: 500; cursor: pointer;
  background: transparent; color: var(--cream-dim);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px; transition: all .2s;
}
.quiz__btns button:hover { border-color: var(--amber); color: var(--cream); }
.quiz__item.is-right .quiz__btns button.was-picked { background: var(--sage-soft); border-color: var(--sage); color: var(--sage); }
.quiz__item.is-wrong .quiz__btns button.was-picked { background: rgba(217,104,70,.12); border-color: var(--tomato); color: var(--tomato); }
.quiz__fb { font-size: .82rem; min-height: 1.4em; color: var(--cream-dim); }
.quiz__fb.is-right { color: var(--sage); }
.quiz__fb.is-wrong { color: var(--tomato); }

/* ---------- agent lab ---------- */
.agent-duo { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; margin-bottom: 36px; }
@media (max-width: 760px) { .agent-duo { grid-template-columns: 1fr; } }
.agent-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px;
}
.agent-card h3 { font-family: var(--serif); font-size: 1.25rem; margin-bottom: 16px; font-weight: 600; }
.agent-card .btn { width: 100%; margin-bottom: 16px; font-size: .85rem; }
.agent-flow { display: flex; flex-direction: column; gap: 10px; }
.agent-step {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; opacity: .45; transition: all .35s;
}
.agent-step strong { display: block; font-size: .88rem; }
.agent-step small { display: block; color: var(--cream-faint); font-size: .8rem; line-height: 1.5; margin-top: 3px; min-height: 0; }
.agent-step.is-done { opacity: 1; border-color: rgba(143,181,134,.4); }
.agent-step.is-active { opacity: 1; border-color: var(--amber); background: var(--amber-soft); }
.agent-step--end { opacity: 1; border-style: dashed; }

.crew-card__where { color: var(--cream-dim); font-size: .9rem; margin-bottom: 12px; }
.crew-card__for {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-family: var(--serif); font-style: italic; color: var(--amber) !important; font-size: .98rem !important;
}

/* ---------- ICM ---------- */
.icm-map {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px; margin-bottom: 40px;
}
.icm-map__title { font-family: var(--mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-bottom: 18px; }
.icm-map__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 26px; }
@media (max-width: 720px) { .icm-map__grid { grid-template-columns: 1fr; } }
.icm-map__grid div { font-size: .92rem; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.icm-map__grid strong { display: block; color: var(--cream); margin-bottom: 2px; }
.icm-map__grid span { color: var(--cream-dim); }
.icm-map__grid code { font-family: var(--mono); font-size: .82em; color: var(--amber); background: rgba(232,163,61,.08); border-radius: 4px; padding: 1px 5px; }

/* line runner */
.line-track { display: flex; align-items: stretch; gap: 8px; margin-bottom: 20px; }
@media (max-width: 720px) { .line-track { flex-direction: column; } .line-arrow { transform: rotate(90deg); align-self: center; } }
.station {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 6px; transition: all .35s;
}
.station__no { font-family: var(--mono); font-size: .72rem; color: var(--amber); letter-spacing: .15em; }
.station strong { font-size: 1.02rem; }
.station small { color: var(--cream-faint); font-size: .8rem; line-height: 1.45; }
.station__reads { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.station__reads em { font-size: .68rem; color: var(--cream-faint); width: 100%; font-style: normal; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.station__reads span {
  font-size: .7rem; color: var(--cream-dim); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px;
}
.station__status { font-family: var(--mono); font-size: .78rem; min-height: 1.6em; margin-top: 6px; }
.station.is-cooking { border-color: var(--amber); background: var(--amber-soft); }
.station.is-cooking .station__status { color: var(--amber); }
.station.is-done { border-color: rgba(143,181,134,.45); }
.station.is-done .station__status { color: var(--sage); }
.line-arrow { display: flex; align-items: center; color: var(--cream-faint); font-size: 1.3rem; }

.gate {
  background: var(--amber-soft); border: 1px solid var(--amber); border-radius: 14px;
  padding: 20px 24px; margin-bottom: 20px; animation: logIn .4s ease;
}
.gate__title { font-weight: 600; margin-bottom: 6px; }
.gate__sub { color: var(--cream-dim); font-size: .88rem; margin-bottom: 14px; }
.line-done {
  margin-top: 18px; padding: 18px 22px; border-radius: 12px;
  background: var(--sage-soft); border: 1px solid rgba(143,181,134,.4);
  color: var(--cream-dim); font-size: .95rem; animation: logIn .4s ease;
}
.line-done strong { color: var(--sage); }

/* tree explorer */
.icm-explorer { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; margin-bottom: 40px; }
@media (max-width: 720px) { .icm-explorer { grid-template-columns: 1fr; } }
.tree {
  background: #0e0c0a; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 12px; display: flex; flex-direction: column; gap: 2px;
}
.tree-item {
  font-family: var(--mono); font-size: .82rem; text-align: left; cursor: pointer;
  background: transparent; color: var(--cream-dim); border: 0; border-radius: 7px;
  padding: 7px 10px; padding-left: calc(10px + var(--ind) * 20px);
  transition: all .15s;
}
.tree-item:hover { background: rgba(255,255,255,.05); color: var(--cream); }
.tree-item.is-on { background: var(--amber-soft); color: var(--amber); }
.tree-panel {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px 26px;
}
.tree-panel h4 { font-family: var(--serif); font-size: 1.12rem; margin-bottom: 10px; font-weight: 600; }
.tree-panel p { color: var(--cream-dim); font-size: .93rem; line-height: 1.65; }

/* context compare bars */
.ctx-compare { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.ctx-compare span { font-size: .8rem; color: var(--cream-dim); display: block; margin-bottom: 5px; }
.ctx-compare small { font-family: var(--mono); font-size: .72rem; color: var(--cream-faint); display: block; margin-top: 4px; }
.ctx-bar { height: 12px; background: rgba(255,255,255,.05); border-radius: 999px; overflow: hidden; }
.ctx-bar div { height: 100%; background: var(--sage); border-radius: 999px; }
.ctx-bar--bad div { background: var(--tomato); opacity: .75; }

.credit {
  text-align: center; color: var(--cream-faint); font-size: .9rem;
  padding-top: 30px; max-width: 640px;
}

/* ---------- first day ---------- */
.firstday { list-style: none; counter-reset: step; margin-bottom: 44px; display: flex; flex-direction: column; gap: 16px; }
.firstday li {
  counter-increment: step; position: relative;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px 22px 74px; color: var(--cream-dim); font-size: .96rem;
}
.firstday li::before {
  content: counter(step);
  position: absolute; left: 24px; top: 22px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--amber); color: #1d1610;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem;
}
.firstday strong { color: var(--cream); }

.template {
  font-family: var(--mono); font-size: .82rem; line-height: 1.9;
  background: #0e0c0a; border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; white-space: pre-wrap; word-break: break-word;
  color: var(--cream-dim); margin-bottom: 16px;
}

/* glossary */
.glossary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 60px; }
@media (max-width: 980px) { .glossary { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 740px) { .glossary { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .glossary { grid-template-columns: 1fr; } }
.gcard {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px;
}
.gcard strong { display: block; font-size: .95rem; }
.gcard em { display: block; font-family: var(--serif); color: var(--amber); font-size: .85rem; margin: 3px 0 8px; }
.gcard p { font-size: .8rem; color: var(--cream-faint); line-height: 1.55; }

/* finale */
.finale { text-align: center; padding: 40px 0 20px; }
.finale__title {
  font-family: var(--serif); font-weight: 560;
  font-size: clamp(2rem, 1.4rem + 3.2vw, 3.6rem); line-height: 1.12; margin-bottom: 20px;
}
.finale__title em { font-style: italic; color: var(--amber); }
.finale p { max-width: 560px; margin: 0 auto 30px; color: var(--cream-dim); }

/* footer */
.footer {
  border-top: 1px solid var(--line); padding: 44px 24px 60px; text-align: center;
  color: var(--cream-faint); font-size: .85rem;
}
.footer p + p { margin-top: 8px; }
.footer__small { font-size: .75rem; opacity: .7; }
/* clear the fixed bottom nav rail on small screens */
@media (max-width: 960px) { .footer { padding-bottom: 120px; } }

/* ---------- touch targets ---------- */
@media (pointer: coarse) {
  .tree { gap: 4px; }
  .tree-item { min-height: 44px; padding-top: 12px; padding-bottom: 12px; }
  .quiz__btns button, .term-suggest, .chip { min-height: 44px; }
}

/* ---------- print: the cheat sheet must survive paper ---------- */
@media print {
  :root {
    --bg: #fff; --bg-alt: #fff; --bg-card: #fff; --bg-card-2: #fff;
    --line: #999;
    --cream: #111; --cream-dim: #333; --cream-faint: #555;
    --amber: #7a4d00; --amber-soft: transparent;
    --tomato: #9c3a1e; --sage: #3e5c38; --sage-soft: transparent;
  }

  /* the IntersectionObserver never fires for unscrolled content */
  .reveal { opacity: 1 !important; transform: none !important; }

  .progress, .menu-nav, .scroll-cue, .btn, .term-suggests, .chips { display: none !important; }

  body, .hero, .course, .course--alt { background: #fff !important; color: #111; }

  .term, .term__bar, .term__body, .template, .ff-out, .tree { background: #fff !important; border-color: #999; }
  .term__line--cmd, .term__line--out { color: #111; }
  .ff-cmd .t-out { color: #1d4ed8; }

  .lab, .duo__card, .callout, .gcard, .icm-map, .auto-card, .agent-card, .tree-panel, .station, .quiz__item, .stock-item, .stock-output, .order-card, .verdict, .firstday li { box-shadow: none !important; }

  a { color: #111; text-decoration: underline; }

  .course { padding: 24pt 0; }
  .lab, .callout, .duo__card, .gcard, .firstday li, .icm-map, .quiz__item { break-inside: avoid; }
  .firstday li::before { border: 1px solid #111; }
}
