/* ============================================================
   Christian Eternalism
   Editorial / letterpress system. Mobile-first.
   ------------------------------------------------------------
   Type   Fraunces (display, optical sizing) · Newsreader (prose)
          Archivo (uppercase micro-labels)
   Colour Warm paper + a single green accent, ochre for archive
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  --paper:        #f4f1e9;
  --paper-raised: #fbf9f4;
  --paper-sunk:   #ebe6da;

  --ink:       #1c1b17;
  --ink-soft:  #4a4739;
  --ink-mute:  #7c7767;

  --rule:       #ded7c5;
  --rule-solid: #c9c0a9;

  --green-deep:   #143f27;
  --green:        #1d6b39;
  --green-bright: #2b8f42;
  --green-wash:   #e4ecdf;

  --ochre:      #9c5f22;
  --ochre-wash: #f2e7d7;

  --focus: #1d6b39;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body:    'Newsreader', Georgia, 'Times New Roman', serif;
  --font-label:   'Archivo', -apple-system, 'Segoe UI', sans-serif;

  /* Fluid scale — clamp() so nothing needs a breakpoint to feel right. */
  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.34rem + 0.8vw, 2.1rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.4rem);
  --step-4:  clamp(2.8rem, 1.9rem + 4.4vw, 5.6rem);

  --gutter: clamp(1.15rem, 4vw, 3rem);
  --measure: 34rem;
  --shell: 68rem;

  --railbar-h: 3.5rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #12130f;
    --paper-raised: #1a1c16;
    --paper-sunk:   #0c0d0a;

    --ink:       #ece8db;
    --ink-soft:  #b6b1a0;
    --ink-mute:  #8a8676;

    --rule:       #2d3029;
    --rule-solid: #3d4137;

    --green-deep:   #b7e0bd;
    --green:        #6fc47f;
    --green-bright: #86d693;
    --green-wash:   #1a2a1c;

    --ochre:      #d9a45f;
    --ochre-wash: #2a2116;
  }
}

/* ---------- 2. Reset ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor jumps must clear the sticky rail. */
  scroll-padding-top: calc(var(--railbar-h) + 1.25rem);
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* Paper grain. Fixed so it reads as the surface, not as content. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  body::before { mix-blend-mode: screen; opacity: 0.18; }
}

img { max-width: 100%; height: auto; display: block; }

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

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--green-bright); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

button { font: inherit; color: inherit; }

.u-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 100;
  background: var(--green);
  color: var(--paper-raised);
  padding: 0.6rem 1.2rem;
  font-family: var(--font-label);
  font-size: var(--step--1);
  text-decoration: none;
}
.skip-link:focus { transform: translate(-50%, 0); color: var(--paper-raised); }

/* Shared layout shell */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

/* Small uppercase label — the connective tissue of the whole design */
.label {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------- 3. Masthead ---------- */

.masthead {
  position: relative;
  z-index: 1;
  padding-block: clamp(2.5rem, 8vw, 5rem) clamp(2rem, 6vw, 3.5rem);
  text-align: center;
  overflow: hidden;
}

/* A faint radial bloom behind the title so the page doesn't open flat. */
.masthead::after {
  content: '';
  position: absolute;
  top: -30%; left: 50%;
  width: min(120vw, 60rem);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--green-wash) 0%, transparent 62%);
  opacity: 0.75;
  z-index: -1;
  pointer-events: none;
}

.masthead__eyebrow { margin-bottom: 1.1rem; }

.masthead__title {
  font-size: var(--step-4);
  font-weight: 700;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
  color: var(--green-deep);
  line-height: 0.94;
  text-wrap: balance;
}
.masthead__title span { display: block; }
.masthead__title em {
  font-style: normal;
  display: block;
  color: var(--ink);
}

.masthead__lede {
  max-width: 30rem;
  margin: 1.5rem auto 0;
  font-size: var(--step-1);
  color: var(--ink-soft);
  text-wrap: pretty;
}

.masthead__stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.75rem;
}
.masthead__stats span { display: inline-flex; align-items: center; gap: 0.45rem; }
.masthead__stats b {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0;
}

/* Epigraph */
.epigraph {
  margin: clamp(2.25rem, 6vw, 3.25rem) auto 0;
  max-width: 40rem;
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}
.epigraph img {
  width: 74px; height: 74px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  border: 1px solid var(--rule-solid);
}
.epigraph blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 400;
  font-variation-settings: 'SOFT' 30;
  line-height: 1.35;
  color: var(--ink);
  text-wrap: pretty;
}
.epigraph blockquote a { color: inherit; text-decoration: none; }
.epigraph blockquote a:hover { text-decoration: underline; text-decoration-color: var(--green); }
.epigraph cite { font-style: normal; }

/* ---------- 4. Hero video ---------- */

.hero-video {
  margin: clamp(2rem, 6vw, 3rem) 0 0;
}
.hero-video .facade { box-shadow: 0 24px 60px -24px rgb(20 63 39 / 0.45); }

/* ---------- 5. Channel links ---------- */

.channels {
  margin-top: clamp(2rem, 5vw, 2.75rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--rule-solid);
  border-radius: 999px;
  background: var(--paper-raised);
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease),
              transform 0.18s var(--ease);
}
.chip:hover {
  color: var(--green);
  border-color: var(--green);
  transform: translateY(-1px);
}
/* Sized against the chip's own label, which is deliberately tiny — at 1em the
   YouTube mark read as a smudge, so it gets to be twice the cap height. */
.chip svg { width: 1.9em; height: 1.9em; fill: currentColor; }

/* ---------- 6. Sticky rail ---------- */

.railbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--railbar-h);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid var(--rule);
}

/* The scroll-progress hairline. Driven by scroll-timeline where supported,
   with a JS fallback that writes --rail-progress. */
.railbar__fill {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-bright));
  transform-origin: 0 50%;
  transform: scaleX(var(--rail-progress, 0));
}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .railbar__fill {
      animation: rail-grow linear both;
      animation-timeline: scroll(root block);
    }
    @keyframes rail-grow {
      from { transform: scaleX(0); }
      to   { transform: scaleX(1); }
    }
  }
}

.railbar__row {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.railbar__where {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.railbar__section {
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.railbar__count {
  font-family: var(--font-label);
  font-size: 0.7rem;
  color: var(--ink-mute);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.railbar__count b { color: var(--green); font-weight: 700; }

.railbar__toc {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--rule-solid);
  border-radius: 999px;
  background: var(--paper-raised);
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.railbar__toc:hover { border-color: var(--green); color: var(--green); }
.railbar__toc svg { width: 0.9em; height: 0.9em; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------- 7. Resume banner ---------- */

.resume {
  display: none;
  align-items: center;
  gap: 0.9rem;
  margin: 2rem auto 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--green);
  border-radius: 4px;
  background: var(--green-wash);
  text-align: left;
}
.resume[data-visible='true'] { display: flex; }
.resume__body { flex: 1 1 auto; min-width: 0; }
.resume__label {
  display: block;
  font-family: var(--font-label);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.15rem;
}
.resume__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.resume__go {
  flex: 0 0 auto;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.resume__go:hover { background: var(--green-deep); color: #fff; }
@media (prefers-color-scheme: dark) {
  .resume__go { color: var(--paper-sunk); }
  .resume__go:hover { color: var(--paper-sunk); }
}

/* ---------- 8. Branch sections ---------- */

.branch { padding-block: clamp(2.75rem, 8vw, 4.5rem) 0; }

.branch__head {
  display: grid;
  gap: 0.5rem;
  padding-bottom: clamp(1.5rem, 4vw, 2.25rem);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(1.75rem, 5vw, 2.75rem);
}

.branch__ordinal {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
/* Hairline that runs from the ordinal to the right edge — letterpress cue. */
.branch__ordinal::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule-solid);
}

.branch__title {
  font-size: var(--step-3);
  font-weight: 700;
  font-variation-settings: 'SOFT' 16, 'WONK' 1;
  color: var(--ink);
}

.branch__blurb {
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: var(--step-0);
  text-wrap: pretty;
}

.branch__optional {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--rule-solid);
  border-radius: 3px;
  font-family: var(--font-label);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  vertical-align: middle;
}

/* ---------- 9. Module plates ---------- */

.modules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(2rem, 6vw, 3rem);
}

@media (min-width: 60rem) {
  .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 2rem; }
  /* The first plate of each branch spans, so the eye has an anchor. */
  .modules > .module:first-child { grid-column: 1 / -1; }
  .modules > .module:first-child .facade { max-width: 46rem; }
}

.module { display: grid; gap: 0.85rem; scroll-margin-top: calc(var(--railbar-h) + 1.5rem); }

.module__head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.75rem;
}

/* The oversized plate numeral — the strongest recurring mark on the page. */
.module__num {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.15rem);
  font-weight: 700;
  font-variation-settings: 'opsz' 100, 'SOFT' 0, 'WONK' 0;
  line-height: 0.85;
  color: var(--rule-solid);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s var(--ease);
  user-select: none;
}
.module[data-done='true'] .module__num { color: var(--green); }

.module__titles { min-width: 0; }
.module__kicker {
  display: block;
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.25rem;
}
.module__title {
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}

.tag {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  background: var(--ochre-wash);
  color: var(--ochre);
  font-family: var(--font-label);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- 10. Video facade ---------- */
/* An <img> + button stands in for the iframe until the visitor asks for it.
   43 live iframes would cost several megabytes and a lot of main-thread time. */

.facade {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  margin: 0;
  border: 1px solid var(--rule-solid);
  border-radius: 3px;
  overflow: hidden;
  background: var(--paper-sunk);
}

.facade img {
  width: 100%; height: 100%;
  /* hqdefault is 480x360. Covering a 16:9 box crops exactly the 12.5% top and
     bottom that YouTube's letterbox occupies — so no extra scale is needed,
     and adding one would eat into the frame's actual content. */
  object-fit: cover;
  transition: transform 0.5s var(--ease), filter 0.4s var(--ease);
  filter: saturate(0.92);
}

/* Rendered as an <a> to YouTube so the course still works with JS disabled;
   the script intercepts the click and swaps in an inline player instead. */
.facade__btn {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, rgb(12 20 14 / 0.05) 0%, rgb(12 20 14 / 0.42) 100%);
  transition: background 0.3s var(--ease);
}

.facade__glyph {
  width: 3.75rem; height: 3.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(244 241 233 / 0.94);
  box-shadow: 0 6px 22px rgb(12 20 14 / 0.35);
  transition: transform 0.28s var(--ease), background 0.28s var(--ease);
}
.facade__glyph svg { width: 1.3rem; height: 1.3rem; fill: var(--green-deep); margin-left: 3px; }
@media (prefers-color-scheme: dark) {
  .facade__glyph svg { fill: #12130f; }
}

.facade__btn:hover .facade__glyph,
.facade__btn:focus-visible .facade__glyph { transform: scale(1.08); background: #fff; }
/* The poster precedes the control in source order, so :has() is what lets the
   image react to the control's hover. Browsers without :has() simply don't
   animate the poster — the play affordance is unaffected. */
.facade:has(.facade__btn:hover) img,
.facade:has(.facade__btn:focus-visible) img { transform: scale(1.05); filter: saturate(1); }

.facade iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .facade img { transition: none; }
  .facade:has(.facade__btn:hover) img { transform: scale(1.35); }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- 11. Module actions ---------- */

.module__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem 0.45rem 0.6rem;
  border: 1px solid var(--rule-solid);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
              background 0.2s var(--ease);
}
.done-toggle:hover { border-color: var(--green); color: var(--green); }

.done-toggle__box {
  width: 1.05rem; height: 1.05rem;
  flex: 0 0 auto;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
/* Hidden via opacity rather than dash-offset alone: a round linecap on a
   fully-offset polyline still paints a dot in Chrome and WebKit. */
.done-toggle__box svg {
  width: 0.62rem; height: 0.62rem;
  stroke: currentColor;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset 0.32s var(--ease), opacity 0.12s var(--ease);
}

.done-toggle[aria-pressed='true'] {
  border-color: var(--green);
  background: var(--green-wash);
  color: var(--green);
}
.done-toggle[aria-pressed='true'] .done-toggle__box { background: var(--green); border-color: var(--green); }
.done-toggle[aria-pressed='true'] .done-toggle__box svg { stroke: var(--paper-raised); stroke-dashoffset: 0; opacity: 1; }
@media (prefers-color-scheme: dark) {
  .done-toggle[aria-pressed='true'] .done-toggle__box svg { stroke: #12130f; }
}
.done-toggle__on { display: none; }
.done-toggle[aria-pressed='true'] .done-toggle__off { display: none; }
.done-toggle[aria-pressed='true'] .done-toggle__on { display: inline; }

.watch-link {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-decoration: none;
}
.watch-link:hover { color: var(--green); text-decoration: underline; }

/* ---------- 12. Contents overlay ---------- */

.toc[hidden] { display: none; }
.toc {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--paper);
}
@media (prefers-reduced-motion: no-preference) {
  .toc { animation: toc-in 0.24s var(--ease) both; }
  @keyframes toc-in { from { opacity: 0; transform: translateY(1.25rem); } }
}

.toc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.toc__title { font-size: var(--step-1); font-weight: 700; }
.toc__close {
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  border: 1px solid var(--rule-solid);
  border-radius: 50%;
  background: var(--paper-raised);
  cursor: pointer;
}
.toc__close svg { width: 1rem; height: 1rem; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.toc__close:hover { border-color: var(--green); color: var(--green); }

.toc__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem var(--gutter) 3rem;
}

.toc__group { margin-bottom: 1.75rem; }
.toc__grouphead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.toc__groupname {
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
}
.toc__groupcount {
  font-family: var(--font-label);
  font-size: 0.66rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.toc__list { list-style: none; margin: 0; padding: 0; }
.toc__link {
  display: grid;
  grid-template-columns: 2.1rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.25rem;
  border-radius: 3px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
}
.toc__link:hover { background: var(--paper-raised); color: var(--green); }
.toc__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}
.toc__name { font-size: 0.98rem; line-height: 1.3; }
.toc__tick {
  width: 1.05rem; height: 1.05rem;
  border: 1.5px solid var(--rule-solid);
  border-radius: 50%;
  display: grid; place-items: center;
}
.toc__tick svg { width: 0.6rem; height: 0.6rem; stroke: var(--paper-raised); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.toc__link[data-done='true'] .toc__tick { background: var(--green); border-color: var(--green); }
.toc__link[data-done='true'] .toc__tick svg { opacity: 1; }
.toc__link[data-done='true'] .toc__num { color: var(--green); }
.toc__link[data-done='true'] .toc__name { color: var(--ink-mute); }

.toc__reset {
  margin-top: 0.5rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--rule-solid);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.toc__reset:hover { border-color: var(--ochre); color: var(--ochre); }

/* ---------- 13. Books ---------- */

.books { padding-block: clamp(3rem, 9vw, 5.5rem) 0; }

.section-head {
  display: grid;
  gap: 0.5rem;
  padding-bottom: clamp(1.5rem, 4vw, 2rem);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(1.75rem, 5vw, 2.5rem);
}
.section-head__eyebrow {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.section-head__eyebrow::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule-solid);
}
.section-head__title { font-size: var(--step-3); font-weight: 700; font-variation-settings: 'SOFT' 16, 'WONK' 1; }
.section-head__blurb { max-width: var(--measure); color: var(--ink-soft); text-wrap: pretty; }

.book-grid { display: grid; gap: clamp(2rem, 6vw, 3rem); }
@media (min-width: 48rem) { .book-grid { grid-template-columns: 1fr 1fr; } }

.book {
  display: grid;
  grid-template-columns: minmax(0, 8.5rem) 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 30rem) { .book { grid-template-columns: minmax(0, 10.5rem) 1fr; gap: 1.6rem; } }

.book__cover {
  display: block;
  transition: transform 0.3s var(--ease);
  filter: drop-shadow(0 14px 28px rgb(20 30 22 / 0.28));
}
.book__cover:hover { transform: translateY(-4px) rotate(-1deg); }

.book__title { font-size: var(--step-2); font-weight: 700; margin-bottom: 0.4rem; }
.book__blurb { color: var(--ink-soft); font-size: 0.98rem; margin-bottom: 0.9rem; }

.book__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.book__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.book__links a:hover { color: var(--green); text-decoration: underline; }
.book__links a::before {
  content: '→';
  color: var(--green);
  font-family: var(--font-body);
  transition: transform 0.2s var(--ease);
}
.book__links a:hover::before { transform: translateX(3px); }
.free-flag {
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: var(--green-wash);
  color: var(--green);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

/* ---------- 14. Handouts ---------- */

.handouts { padding-block: clamp(3rem, 9vw, 5.5rem) 0; }
.handout-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 40rem) { .handout-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64rem) { .handout-grid { grid-template-columns: repeat(3, 1fr); } }

.handout {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule-solid);
  border-radius: 3px;
  background: var(--paper-raised);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.handout:hover { border-color: var(--green); color: var(--green); transform: translateY(-2px); }
.handout svg { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; stroke: var(--green); fill: none; stroke-width: 1.6; }
.handout__name { font-size: 0.98rem; line-height: 1.25; }
.handout__ext {
  margin-left: auto;
  font-family: var(--font-label);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}

/* ---------- 15. Footer ---------- */

.site-footer {
  margin-top: clamp(3.5rem, 10vw, 6rem);
  border-top: 1px solid var(--rule);
  background: var(--paper-sunk);
  padding-block: clamp(2.5rem, 7vw, 3.5rem);
  position: relative;
  z-index: 1;
}

.contact { text-align: center; margin-bottom: 2.25rem; }
.contact__label { display: block; margin-bottom: 0.5rem; }
.contact a {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  text-decoration: none;
  color: var(--green);
}
.contact a:hover { text-decoration: underline; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.6rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}
.footer-nav a {
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
}
.footer-nav a:hover { color: var(--green); }

.colophon {
  margin-top: 1.5rem;
  text-align: center;
  font-family: var(--font-label);
  font-size: 0.68rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

/* ---------- 16. Back to top ---------- */

.to-top {
  position: fixed;
  right: clamp(1rem, 4vw, 2rem);
  bottom: clamp(1rem, 4vw, 2rem);
  z-index: 30;
  width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center;
  border: 1px solid var(--rule-solid);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper-raised) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease),
              visibility 0.25s var(--ease), border-color 0.2s var(--ease);
}
.to-top[data-visible='true'] { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--green); color: var(--green); }
.to-top svg { width: 1rem; height: 1rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 17. Touch targets ---------- */
/* The pills are deliberately delicate for mouse users. On a touch screen that
   delicacy becomes a 34px target, so grow them past the 44px minimum there
   only — gated on pointer type rather than width, since a small window on a
   laptop is still a mouse. */

@media (pointer: coarse) {
  .done-toggle,
  .railbar__toc,
  .chip,
  .toc__reset,
  .watch-link {
    min-height: 44px;
  }

  .done-toggle,
  .railbar__toc,
  .chip,
  .toc__reset {
    padding-block: 0.5rem;
  }

  .watch-link { display: inline-flex; align-items: center; }

  .toc__link { padding-block: 0.75rem; }
  .to-top { width: 3rem; height: 3rem; }
}

/* ---------- 18. Micro-type floor ---------- */
/* The uppercase micro-labels run from 0.6rem to 0.68rem, which is 9.6-10.9px.
   That is legible on a desktop monitor and is not legible on a phone held at
   arm's length, so every one of them is floored at 11px — Apple's HIG
   minimum — on touch screens. Gated on pointer type for the same reason the
   touch targets above are: a narrow window on a laptop is still a laptop.
   Anything already at 0.7rem (11.2px) or above clears the floor and is left
   alone, which is why it is a fixed list rather than a blanket rule. */

@media (pointer: coarse) {
  .label,                  /* incl. the masthead stats: videos / branches / ebooks */
  .resume__label,
  .branch__ordinal,
  .branch__optional,
  .module__kicker,
  .tag,
  .done-toggle,
  .watch-link,
  .toc__groupcount,
  .toc__reset,
  .section-head__eyebrow,
  .free-flag,
  .handout__ext,
  .colophon {
    font-size: 0.6875rem; /* 11px */
  }
}

/* ---------- 19. No-JS ---------- */
/* Progress UI is meaningless without JS; hide it rather than show dead controls.
   The facades stay as plain links to YouTube (see markup). */

html.no-js .done-toggle,
html.no-js .railbar__count,
html.no-js .railbar__toc,
html.no-js .to-top,
html.no-js .resume { display: none !important; }
