/* ══════════════════════════════════════════════════════════════
   BashaByte · The Trail
   Design layer for every page built on courses/_layout.html.
   Loaded last. It (1) remaps the semantic --bb-* tokens inside
   .cx, so the existing course CSS follows the new palette and
   type, and (2) adds the dashboard and reader components (tr-*).
   Notes: docs/ui-redesign-notes.md.

   One idea: learning is a trail you can see yourself walking.
   Done stretches are success green, "you are here" is the single
   accent mark, what is ahead stays quiet (DD-29).
   Two radii only: --tr-r-control (8px), --tr-r-box (12px).
   ══════════════════════════════════════════════════════════════ */

/* ── 0. Fonts ────────────────────────────────────────────────────
   Interface type comes from the site (Inter, Manrope; loaded in
   courses/_layout.html). Two self-hosted families stay because they
   do a job nothing else does: Source Serif 4 for long-form lesson
   prose, JetBrains Mono for code. */
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/trail/source-serif-4.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("../fonts/trail/source-serif-4-italic.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/trail/jetbrains-mono.woff2") format("woff2");
}

/* ── 1. Tokens ───────────────────────────────────────────────────
   Courses use the site palette (tokens.css, DD-28 "Ink & Cobalt").
   Only course-specific roles are defined here, and every one of them
   points at a site token, so light and dark follow automatically.
     Trail meaning:  done = success green · you are here = accent
                     ahead = quiet grey   · streak = warning amber   */
.cx {
  --tr-r-control: 8px;
  --tr-r-box: 12px;

  --bb-font-display: "Manrope", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bb-font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bb-font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --tr-font-prose: "Source Serif 4", Georgia, "Times New Roman", serif;

  /* Type scale */
  --bb-fs-caption: 13px;
  --bb-fs-label: 13px;
  --bb-fs-body-sm: 13px;
  --bb-fs-body: 15px;
  --bb-fs-body-lg: 17px;
  --bb-fs-h4: 17px;
  --bb-fs-h3: 20px;
  --bb-fs-h2: clamp(21px, 1vw + 15px, 24px);
  --bb-fs-h1: clamp(26px, 1.6vw + 16px, 32px);
  --bb-fs-display: clamp(30px, 2.4vw + 16px, 44px);

  --bb-radius-xs: 4px;
  --bb-radius-sm: 6px;
  --bb-radius-md: var(--tr-r-control);
  --bb-radius-lg: var(--tr-r-box);
  --lx-radius: var(--tr-r-box);
  --lx-radius-sm: var(--tr-r-control);

  /* The ink band (continue panel, course hero): tokens.css --bb-band-* */
  --tr-forest: var(--bb-band-bg);
  --tr-forest-raise: var(--bb-band-raise);
  --tr-on-forest: var(--bb-band-text);
  --tr-on-forest-muted: var(--bb-band-muted);
  --tr-on-forest-line: var(--bb-band-line);
  --tr-forest-emerald: var(--bb-code-ok);     /* "done" on the band */
  --tr-saffron-on-forest: var(--bb-band-accent); /* "you are here" on the band */

  /* "You are here" on page surfaces */
  --tr-saffron: var(--bb-accent);
  --tr-saffron-text: var(--bb-accent-text);
  --tr-saffron-soft: var(--bb-accent-soft);
  --tr-link: var(--bb-accent-text);

  /* Streak and Premium keep a warm colour of their own */
  --tr-warm: var(--bb-warning);
  --tr-warm-soft: var(--bb-warning-soft);

  /* Code surfaces: black in both themes, like the main editor */
  --lx-code-bg: var(--bb-code-bg);
  --lx-code-bar: var(--bb-code-surface);
  --lx-code-line: var(--bb-code-line);
  --lx-code-text: var(--bb-code-text);
  --lx-code-muted: var(--bb-code-muted);
  --lx-canvas: var(--bb-bg);
}

/* ── 2. Base ─────────────────────────────────────────────────── */
body.cx { background: var(--bb-bg); color: var(--bb-text); font-family: var(--bb-font-sans); font-size: var(--bb-fs-body); font-optical-sizing: auto; }
body.cx .bbn, body.cx .bbn-inner { font-family: var(--bb-font-display); }
body.cx .bbn-soon small { font-family: var(--bb-font-mono); }
body.cx code, body.cx pre, body.cx kbd { font-family: var(--bb-font-mono); font-variant-ligatures: none; }
body.cx :focus-visible { outline: 2px solid var(--bb-focus-ring); outline-offset: 3px; border-radius: 4px; }
body.cx[class] .btn { border-radius: var(--tr-r-control); }

.tr-h2 { font: 700 var(--bb-fs-h2)/1.2 var(--bb-font-display); letter-spacing: -0.02em; }

/* Buttons: they say what happens; one height, one radius. */
.tr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--tr-r-control);
  font: 600 15px/1 var(--bb-font-display); text-decoration: none; cursor: pointer;
  transition: background-color var(--bb-dur-base) var(--bb-ease), border-color var(--bb-dur-base) var(--bb-ease), color var(--bb-dur-base) var(--bb-ease);
}
.tr-btn.is-primary { background: var(--bb-accent); color: var(--bb-text-on-accent); }
.tr-btn.is-primary:hover { background: var(--bb-accent-hover); }
.tr-btn.is-ghost { border-color: var(--bb-border-strong); background: var(--bb-surface); color: var(--bb-text); }
.tr-btn.is-ghost:hover { border-color: var(--bb-text-secondary); }
.tr-btn.is-quiet { padding: 0 12px; background: transparent; color: var(--bb-text-secondary); }
.tr-btn.is-quiet:hover { color: var(--bb-text); background: var(--bb-surface-subtle); }

/* Progress ring */
.tr-ring { position: relative; display: inline-grid; place-items: center; flex: none; width: 48px; height: 48px; }
.tr-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tr-ring circle { fill: none; stroke-width: 4; }
.tr-ring-track { stroke: var(--bb-border); }
.tr-ring-fill { stroke: var(--bb-accent); stroke-linecap: round; transition: stroke-dasharray .6s var(--bb-ease); }
.tr-ring-num { position: absolute; font: 700 13px/1 var(--bb-font-display); font-variant-numeric: tabular-nums; }
.tr-ring-num small { font-size: .6em; font-weight: 600; }
.tr-ring.is-lg { width: 116px; height: 116px; }
.tr-ring.is-lg circle { stroke-width: 3.2; }
.tr-ring.is-lg .tr-ring-num { font-size: 31px; letter-spacing: -0.03em; }

/* ── 3. Dashboard ────────────────────────────────────────────── */
.tr-dash .cx-main-region { padding-bottom: 72px; }

.tr-welcome { position: relative; padding: clamp(28px, 4vw, 48px) 0 clamp(18px, 2vw, 24px); }
.tr-welcome-title { font: 700 clamp(28px, 2.2vw + 16px, 41px)/1.1 var(--bb-font-display); letter-spacing: -0.03em; text-wrap: balance; overflow-wrap: anywhere; }
.lp .tr-welcome-line { max-width: 60ch; margin-top: 10px; color: var(--bb-text-secondary); font-size: 18px; line-height: 1.5; }
.tr-welcome-staff { position: absolute; top: clamp(28px, 4vw, 48px); right: 0; }

.tr-today { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: stretch; }
.tr-today.is-solo { grid-template-columns: minmax(0, 520px); }

/* Continue panel: the one dark object on the page, with the trail across it. */
.tr-continue {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: center;
  padding: clamp(22px, 2.6vw, 36px); overflow: hidden;
  border-radius: var(--tr-r-box); background: var(--tr-forest); color: var(--tr-on-forest);
}
/* Contour lines, like the map a trail is drawn on. */
/* (The decorative arcs behind the panel were removed in DD-29.) */
:root[data-theme="dark"] .tr-continue { box-shadow: inset 0 0 0 1px var(--bb-border); }
.tr-continue > * { position: relative; }
.tr-continue-main { display: grid; gap: 14px; min-width: 0; }
.lp .tr-continue-where { color: var(--tr-on-forest-muted); font: 500 15px/1.3 var(--bb-font-display); }
.tr-continue-title { font: 700 clamp(24px, 1.6vw + 15px, 34px)/1.12 var(--bb-font-display); letter-spacing: -0.025em; text-wrap: balance; overflow-wrap: anywhere; }
/* The dot sits in the gap to the left of each fact; a fact that wraps to a new line has its dot clipped away. */
.lp .tr-continue-facts { display: flex; flex-wrap: wrap; gap: 4px 23px; overflow: hidden; color: var(--tr-on-forest-muted); font-size: 14px; line-height: 1.5; }
.tr-continue-facts span { position: relative; }
.tr-continue-facts span + span::before { content: ""; position: absolute; left: -13px; top: 50%; width: 3px; height: 3px; margin-top: -1px; border-radius: 50%; background: currentColor; opacity: .7; }
.tr-continue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 6px; }
.tr-continue .tr-btn.is-primary { min-height: 48px; padding: 0 26px; background: var(--tr-on-forest); color: var(--tr-forest); font-size: 16px; font-weight: 700; }
.tr-continue .tr-btn.is-primary:hover { background: var(--bb-surface); }
.tr-continue .tr-btn:focus-visible { outline-color: var(--tr-saffron-on-forest); }
.lp .tr-continue-next { color: var(--tr-on-forest-muted); font-size: 14px; line-height: 1.4; }
.tr-continue-next b { color: var(--tr-on-forest); font-weight: 600; }
.tr-continue-side { display: grid; justify-items: center; gap: 8px; text-align: center; }
.tr-continue .tr-ring-track { stroke: var(--tr-on-forest-line); }
.tr-continue .tr-ring-fill { stroke: var(--tr-forest-emerald); }
.lp .tr-continue-ring-label { max-width: 12ch; color: var(--tr-on-forest-muted); font-size: 13px; line-height: 1.35; }

/* The trail */
.lp .tr-trail { display: flex; max-width: 780px; margin: 10px 0 2px; padding: 0; list-style: none; }
.tr-stop { position: relative; flex: 1 1 0; min-width: 0; padding: 32px 12px 0 0; color: var(--tr-on-forest-muted); }
.tr-stop:last-child { padding-right: 0; }
.tr-stop::before {
  content: ""; position: absolute; top: 10px; left: 22px; right: 0; height: 2px;
  background: repeating-linear-gradient(90deg, var(--tr-on-forest-line) 0 6px, transparent 6px 12px);
}
.tr-stop:last-child::before { display: none; }
.tr-stop.is-done::before { background: var(--tr-forest-emerald); transform-origin: 0 50%; }
.tr-stop-mark {
  position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 22px; height: 22px;
  border: 2px solid var(--tr-on-forest-line); border-radius: 50%; background: var(--tr-forest); color: var(--tr-forest); font-size: 13px;
}
.tr-stop.is-done .tr-stop-mark { border-color: var(--tr-forest-emerald); background: var(--tr-forest-emerald); }
.tr-stop.is-started .tr-stop-mark { border-color: var(--tr-forest-emerald); }
.tr-stop.is-here .tr-stop-mark { border-color: var(--tr-saffron-on-forest); background: var(--tr-forest); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tr-saffron-on-forest) 25%, transparent); }
.tr-stop.is-here .tr-stop-mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tr-saffron-on-forest); }
.tr-stop.is-here.is-done .tr-stop-mark::after { display: none; }
.tr-stop-text { display: grid; gap: 2px; font-size: 13px; line-height: 1.3; }
.tr-stop-no { font-weight: 600; font-variant-numeric: tabular-nums; }
.tr-stop-title { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tr-stop.is-here { color: var(--tr-on-forest); }
.tr-stop.is-here .tr-stop-no { color: var(--tr-saffron-on-forest); }
.tr-stop.is-here { flex-grow: 1.5; }
.tr-stop.is-here .tr-stop-title { font-weight: 600; -webkit-line-clamp: 3; }

/* The one orchestrated moment: the trail draws itself up to where you are. */
@media (prefers-reduced-motion: no-preference) {
  .tr-stop.is-done::before { animation: tr-draw .42s var(--bb-ease) both; animation-delay: calc(.25s + var(--i) * .16s); }
  .tr-stop.is-here .tr-stop-mark { animation: tr-arrive .5s var(--bb-ease) both; animation-delay: calc(.3s + var(--i) * .16s); }
  .tr-continue .tr-ring-fill { animation: tr-ring .9s var(--bb-ease) both; animation-delay: .2s; }
}
@keyframes tr-draw { from { transform: scaleX(0); } to { transform: none; } }
@keyframes tr-arrive { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes tr-ring { from { stroke-dasharray: 0 100; } }

/* Learning days */
.tr-today .cx-act.is-wide {
  display: grid; grid-template: none; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: space-between;
  padding: 24px; border: 1px solid var(--bb-border); border-radius: var(--tr-r-box); background: var(--bb-surface); box-shadow: none;
}
.tr-today .cx-act.is-wide > * { grid-area: auto; align-self: auto; }
.cx .tr-act-title { color: var(--bb-text); font: 700 18px/1.2 var(--bb-font-display); letter-spacing: -0.01em; text-transform: none; }
.cx .tr-act-title::before { display: none; }
.cx .cx-act.is-wide .cx-act-stats, .cx .cx-act-stats { gap: 12px; }
.cx .cx-act-stats dt { color: var(--bb-text-secondary); font: 500 13px/1.3 var(--bb-font-sans); }
.cx .cx-act-stats dd { font: 700 26px/1 var(--bb-font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cx .cx-act-stats dd small { font-size: 13px; font-weight: 500; }
.cx .cx-act-stats .is-streak dd { color: var(--tr-warm); }
.cx .cx-act-stats .is-streak i { color: var(--tr-warm); font-size: 18px; }
.cx .cx-act-stats .is-streak dd small { color: var(--bb-text-secondary); }
.tr-today .cx-act-dots, .tr-today .cx-act.is-wide .cx-act-dots { grid-template-columns: repeat(7, 1fr); gap: 6px; width: auto; max-width: 240px; }
.cx .cx-act-dots li { border-radius: 4px; background: var(--bb-surface-subtle); box-shadow: inset 0 0 0 1px var(--bb-border); }
.cx .cx-act-dots li.is-on { background: var(--bb-accent); box-shadow: none; }
.cx .cx-act-dots li.is-today { box-shadow: 0 0 0 2px var(--bb-surface), 0 0 0 4px var(--tr-saffron); }
.cx .cx-act-note { color: var(--bb-text-secondary); font-size: 14px; }
.cx .cx-act-note i { color: var(--bb-accent-text); }

/* Library */
.tr-library { margin-top: clamp(40px, 5vw, 64px); }
.tr-library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.lp .tr-library-count { color: var(--bb-text-secondary); font-size: 14px; font-variant-numeric: tabular-nums; }

.tr-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--bb-border); }
.tr-field { display: grid; gap: 6px; flex: 0 1 180px; min-width: 0; }
.tr-field.is-grow { flex: 1 1 240px; }
.tr-field label { color: var(--bb-text-secondary); font: 500 13px/1.2 var(--bb-font-sans); }
.tr-field input, .tr-field select {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--bb-border-control, var(--bb-border-strong)); border-radius: var(--tr-r-control);
  background: var(--bb-surface); color: var(--bb-text); font: 500 15px/1 var(--bb-font-sans);
}
.tr-field input::placeholder { color: var(--bb-text-secondary); opacity: 1; }
.tr-field input:focus-visible, .tr-field select:focus-visible { outline: 2px solid var(--bb-focus-ring); outline-offset: 1px; border-radius: var(--tr-r-control); }

.tr-shelves { display: grid; gap: 40px; margin-top: 28px; }
.tr-shelf-head { display: grid; gap: 4px; margin-bottom: 16px; }
.tr-shelf-head h3 { font: 700 21.6px/1.2 var(--bb-font-display); letter-spacing: -0.015em; }
.lp .tr-shelf-head p { max-width: 70ch; color: var(--bb-text-secondary); font-size: 15px; line-height: 1.5; }

.lp .tr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.tr-card[hidden] { display: none; }
.tr-card.is-dim { opacity: .5; }
.lp .tr-card-link {
  display: grid; grid-template-rows: auto 1fr; height: 100%; overflow: hidden;
  border: 1px solid var(--bb-border); border-radius: var(--tr-r-box); background: var(--bb-surface); color: var(--bb-text);
  transition: border-color var(--bb-dur-base) var(--bb-ease);
}
.lp .tr-card-link:hover { border-color: var(--bb-text-secondary); }
.tr-card-link:focus-visible { border-radius: var(--tr-r-box); }
.tr-card-body { display: grid; align-content: start; gap: 8px; padding: 20px; }
.tr-card-kicker { display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--bb-text-secondary); font-size: 13px; line-height: 1.4; }
.tr-card-kicker > span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 8px 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.tr-card-flag { display: inline-flex; align-items: center; gap: 5px; color: var(--tr-warm); font-weight: 600; }
.tr-card-flag.is-draft { color: var(--bb-text-secondary); }
.tr-card-title { font: 700 21.6px/1.2 var(--bb-font-display); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.tr-card-link:hover .tr-card-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--bb-accent); }
.tr-card-sub { display: -webkit-box; overflow: hidden; color: var(--bb-text-secondary); font-size: 15px; line-height: 1.5; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tr-card-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--bb-text-secondary); font-size: 14px; font-variant-numeric: tabular-nums; }
.tr-card-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--bb-border); }
.tr-card-prog { grid-column: 1 / -1; display: grid; gap: 8px; }
.tr-card-prog-text { color: var(--bb-text-secondary); font-size: 14px; font-variant-numeric: tabular-nums; }
.tr-card-prog-text b { color: var(--bb-text); font-weight: 700; }
.tr-card-state { display: inline-flex; align-items: center; gap: 7px; color: var(--bb-text-secondary); font-size: 14px; font-weight: 500; }
.tr-card-state.is-completed { color: var(--bb-success); }
.tr-card-state.is-in-progress i { color: var(--tr-saffron); }
.tr-card-go { color: var(--bb-accent-text); font: 600 15px/1 var(--bb-font-display); }

/* A featured course (first of a shelf with three or more) lies flat and spans two columns. */
@media (min-width: 760px) {
  .tr-card.is-featured { grid-column: span 2; }
  .lp .tr-card.is-featured .tr-card-link { grid-template: 1fr / minmax(220px, 42%) 1fr; }
  .tr-card.is-featured .tr-cover { aspect-ratio: auto; height: 100%; }
}

/* Course cover (DD-29): typographic. The course code is set large in monospace on the ink band,
   over a faint 24px grid, with a cursor block in the accent. Uploaded thumbnails replace it. */
.tr-cover { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bb-band-bg); }
.tr-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tr-cover-art {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(16px, 2.4vw, 24px); color: var(--bb-band-text);
  background-image:
    linear-gradient(var(--bb-band-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--bb-band-line) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
}
.tr-cover-art::after {
  /* Fade the grid towards the code so the type stays the subject. */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, var(--bb-band-bg) 18%, transparent 75%);
}
.tr-cover-top, .tr-cover-code, .tr-cover-name { position: relative; z-index: 1; }
.tr-cover-top { display: flex; justify-content: space-between; gap: 12px; color: var(--bb-band-muted); font: 500 12.5px/1.2 var(--bb-font-sans); }
.tr-cover-code {
  display: flex; align-items: flex-end; gap: 6px; margin-top: auto;
  font: 600 clamp(48px, 7vw, 76px)/.9 var(--bb-font-mono); letter-spacing: -0.04em;
}
.tr-cover-caret { display: inline-block; width: .42em; height: .78em; margin-bottom: .04em; background: var(--bb-band-accent); }
.tr-cover-name { margin-top: 10px; color: var(--bb-band-muted); font: 500 13px/1.3 var(--bb-font-sans); }

.lp .tr-no-results { margin-top: 24px; color: var(--bb-text-secondary); font-size: 15px; }
.tr-empty .tr-btn { margin-top: 8px; }

/* Learning paths keep their markup; only the label style changes. */
.tr-paths { margin-top: clamp(32px, 4vw, 48px); }

/* ── 9. Responsive: dashboard ────────────────────────────────── */
@media (max-width: 1100px) {
  .tr-today { grid-template-columns: minmax(0, 1fr); }
  .tr-today .cx-act.is-wide { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .tr-today .cx-act.is-wide > h2, .tr-today .cx-act.is-wide > .cx-act-stats { grid-column: 1; }
  .tr-today .cx-act.is-wide > .cx-act-cal { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 720px) {
  .tr-continue { grid-template-columns: minmax(0, 1fr); }
  .tr-continue-side { grid-auto-flow: column; justify-content: start; align-items: center; gap: 14px; text-align: left; order: -1; }
  .tr-ring.is-lg { width: 72px; height: 72px; }
  .tr-ring.is-lg .tr-ring-num { font-size: 21.6px; }
  .lp .tr-continue-ring-label { max-width: none; }
  .tr-continue .tr-btn.is-primary { width: 100%; }
  /* On a phone the trail keeps every checkpoint but names only the one you are on. */
  .tr-stop { padding-right: 4px; }
  .tr-stop:not(.is-here) .tr-stop-title { display: none; }
  .tr-stop.is-here { flex: 3 1 0; }
  .tr-stop:last-child { flex: 1 1 0; }
  .tr-stop.is-here:last-child { flex: 3 1 0; }
  .tr-today .cx-act.is-wide { grid-template-columns: minmax(0, 1fr); }
  .tr-today .cx-act.is-wide > .cx-act-cal { grid-column: 1; grid-row: auto; }
  .tr-welcome-staff { position: static; display: inline-flex; margin-top: 12px; }
  .tr-field, .tr-field.is-grow { flex: 1 1 100%; }
  .tr-filters .tr-btn { width: 100%; }
  .tr-card-foot { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .tr-stop:not(.is-here) .tr-stop-no { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   4. Reader (lesson player)
   Three regions on a wide screen: the trail outline, one reading
   column, and "On this page". The reading column is the surface
   itself, not a card on a desk; only things that are separate
   objects (code, a check, a callout) get their own treatment.
   ══════════════════════════════════════════════════════════════ */
.px-page { --px-top: 60px; --px-rail: 272px; --px-side: 256px; --px-read: 720px; background: var(--bb-surface); }

/* ── Top bar ── */
.px-page .px-top {
  gap: 16px; min-height: var(--px-top); padding: 8px clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--bb-border);
  background: color-mix(in srgb, var(--bb-surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(12px); backdrop-filter: saturate(1.3) blur(12px);
}
.px-page .px-crumbs ol { font: 500 13px/1.4 var(--bb-font-sans); color: var(--bb-text-secondary); }
.px-page .px-crumbs li[aria-current] { font-family: var(--bb-font-sans); font-size: 13px; font-variant-numeric: tabular-nums; }
.px-page .px-crumbs a:hover { color: var(--bb-text); text-decoration: underline; text-underline-offset: 3px; }
.px-page .px-lesson-title { font: 700 16px/1.3 var(--bb-font-display); letter-spacing: -0.01em; }
.px-page .px-drawer-btn { border-radius: var(--tr-r-control); border-color: var(--bb-border-strong); background: var(--bb-surface); }
.px-page .px-seg.is-current::before { box-shadow: 0 0 0 2px var(--bb-surface), 0 0 0 4px var(--tr-saffron); }
.px-page .px-top-count { font: 500 13px/1 var(--bb-font-sans); font-variant-numeric: tabular-nums; }

.px-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.px-prefs { position: relative; }
.px-bartool {
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--tr-r-control);
  background: transparent; color: var(--bb-text-secondary); font-size: 17px; cursor: pointer;
  transition: background-color var(--bb-dur-fast) var(--bb-ease), color var(--bb-dur-fast) var(--bb-ease);
}
.px-bartool:hover, .px-bartool[aria-expanded="true"], .px-bartool[aria-pressed="true"] { background: var(--bb-surface-subtle); color: var(--bb-text); }
.px-bartool-aa { font: 700 16px/1 var(--bb-font-display); letter-spacing: -0.02em; }
.px-prefs-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 40; display: grid; gap: 16px; width: min(300px, calc(100vw - 24px));
  padding: 18px; border: 1px solid var(--bb-border-strong); border-radius: var(--tr-r-box); background: var(--bb-surface); box-shadow: var(--bb-shadow-2);
}
.px-pref { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.px-pref legend { padding: 0; color: var(--bb-text-secondary); font: 500 13px/1.2 var(--bb-font-sans); }
.px-seg-group { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-top: 8px; }
.px-seg-group label { position: relative; display: block; cursor: pointer; }
.px-seg-group input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.px-seg-group span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 8px;
  border: 1px solid var(--bb-border-strong); border-radius: var(--tr-r-control); color: var(--bb-text-secondary); font: 500 14px/1 var(--bb-font-sans);
}
.px-seg-group span.is-serif { font-family: var(--tr-font-prose); font-size: 15px; }
.px-seg-group input:checked + span { border-color: var(--bb-accent); background: var(--bb-accent-soft); color: var(--bb-text); font-weight: 700; box-shadow: inset 0 0 0 1px var(--bb-accent); }
.px-seg-group input:focus-visible + span { outline: 2px solid var(--bb-focus-ring); outline-offset: 2px; }
.lp .px-prefs-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 14px; border-top: 1px solid var(--bb-border); color: var(--bb-text-secondary); font-size: 13px; }
.px-prefs-keys kbd { padding: 2px 7px; border: 1px solid var(--bb-border-strong); border-radius: 4px; background: var(--bb-surface-subtle); font-size: 12px; }

/* ── Body grid: explicit columns, so a hidden panel never shifts the others ── */
.px-page .px-body { grid-template-columns: var(--px-rail) minmax(0, 1fr); }
.px-page .px-rail { grid-column: 1; top: calc(64px + var(--px-top)); height: calc(100vh - 64px - var(--px-top)); background: var(--bb-bg); border-right: 1px solid var(--bb-border); }
.px-page .px-stage { grid-column: 2; padding: clamp(28px, 3.4vw, 48px) clamp(20px, 4vw, 56px) 64px; }
.px-side { display: none; }
@media (min-width: 1280px) {
  .px[data-kind="TEXT"] .px-body, .px[data-kind="VIDEO"] .px-body { grid-template-columns: var(--px-rail) minmax(0, 1fr) var(--px-side); }
  .px[data-kind="TEXT"] .px-side, .px[data-kind="VIDEO"] .px-side {
    grid-column: 3; display: grid; align-content: start; gap: 28px;
    position: sticky; top: calc(64px + var(--px-top)); align-self: start;
    max-height: calc(100vh - 64px - var(--px-top)); overflow-y: auto; padding: clamp(28px, 3.4vw, 48px) 24px 32px 8px;
    scrollbar-width: thin; scrollbar-color: var(--bb-border-strong) transparent;
  }
}
@media (min-width: 960px) {
  .px.is-rail-closed .px-rail, .px.is-focus .px-rail { display: none; }
  .px.is-rail-closed .px-body, .px.is-focus .px-body { grid-template-columns: 0 minmax(0, 1fr); }
  .px.is-focus .px-side { display: none; }
}
@media (min-width: 1280px) {
  .px.is-rail-closed:not(.is-focus)[data-kind="TEXT"] .px-body, .px.is-rail-closed:not(.is-focus)[data-kind="VIDEO"] .px-body { grid-template-columns: 0 minmax(0, 1fr) var(--px-side); }
}

/* ── The trail in the outline ── */
.px-page .co { font-size: 14px; }
.cx .co-progress { margin: 0 18px 12px; padding: 0 0 16px; border: 0; border-bottom: 1px solid var(--bb-border); border-radius: 0; background: none; box-shadow: none; }
.cx .co-progress b { font: 700 18px/1 var(--bb-font-display); }
.cx .co-title { font-size: 18px; }
.cx .co-h { color: var(--bb-text-secondary); font: 600 13px/1.2 var(--bb-font-sans); letter-spacing: 0; text-transform: none; }
.cx .co-mod-label { color: var(--bb-text-secondary); font: 500 13px/1.3 var(--bb-font-sans); letter-spacing: 0; text-transform: none; }
.cx .co-mod.is-done .co-mod-label { color: var(--bb-success); }
.cx .co-mod.is-started .co-mod-label { color: var(--bb-text-secondary); }
.cx .co-mod-title { font-size: 15px; }
.cx .co-mod-btn, .cx .co-les-btn, .cx .co-topic { border-radius: var(--tr-r-control); }
.cx .co-count { border-radius: 4px; background: var(--bb-surface-subtle); font: 500 12px/1 var(--bb-font-sans); font-variant-numeric: tabular-nums; }
.cx .co-mod-bar { display: none; }

.cx .co .co-lessons { margin: 2px 0 10px 12px; padding-left: 0; border-left: 0; }
.cx .co-les { position: relative; }
/* The line runs through every lesson's marker; a finished lesson fills its stretch. */
.cx .co-les::before { content: ""; position: absolute; top: 0; bottom: 0; left: 17px; width: 2px; background: var(--bb-border-strong); }
.cx .co-les:first-child::before { top: 18px; }
.cx .co-les:last-child::before { bottom: auto; height: 18px; }
.cx .co-les:only-child::before { display: none; }
.cx .co-les.is-done::before { background: var(--bb-success); }
.cx .co-les-btn { position: relative; grid-template-columns: 20px minmax(0, 1fr) 12px; padding: 8px 8px; font-size: 14px; font-weight: 500; }
.cx .co-les-btn > .co-mark:first-child { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: var(--bb-bg); font-size: 15px; }
.cx .co-les.is-current > .co-les-btn { background: none; font-weight: 700; }
.cx .co-les.is-current > .co-les-btn::before { display: none; }
/* A finished lesson keeps its tick after the name; on the line it is a filled stop. */
.cx .co-les .co-les-btn > .co-mark-spacer { visibility: visible; }
.cx .co-les .co-les-btn > .co-mark-spacer::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--bb-accent); }
/* You are here: the one saffron mark. */
.cx .co-les.is-current > .co-les-btn > .co-mark:first-child { color: var(--tr-saffron); box-shadow: 0 0 0 2px var(--tr-saffron); }
.cx .co-les.is-current > .co-les-btn > .co-mark:first-child i { display: none; }
.cx .co-les.is-current > .co-les-btn > .co-mark:first-child::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tr-saffron); }
.cx .co-les-no { color: var(--bb-text-secondary); font: 500 13px/1 var(--bb-font-sans); font-variant-numeric: tabular-nums; }
.cx .co-mark.is-started, .cx .co-mark[data-status="seen"] { color: var(--bb-accent); }
.px-page .co-mark, .px-page .co-topic .co-mark { background: var(--bb-bg); }
.cx .co .co-topics { margin: 2px 0 8px 30px; padding-left: 0; }
.cx .co-topic { padding: 7px 8px; font-size: 13px; }
.cx .co-topic.is-current { background: var(--bb-surface-selected); box-shadow: none; font-weight: 600; }
.cx .co-topic .co-mark { background: none; }
.cx .co-all { color: var(--bb-accent-text); font: 600 13px/1 var(--bb-font-sans); }

/* ── Step: no sheet, the column is the page ── */
.px-page .px-step, .px-page .px-empty { max-width: var(--px-read); }
.px-page .px-step.is-coding, .px-page .px-step.is-fix_bug, .px-page .px-step.is-playground { max-width: 960px; }
.px-page .px-step[class] {
  --kind: var(--bb-accent-text); --kind-soft: var(--bb-accent-soft);
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
}
.px-page .px-step.is-entering { animation: tr-step .28s var(--bb-ease) both; }
@keyframes tr-step { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.px-page .px-step-head { gap: 12px; padding-bottom: 24px; border-bottom: 1px solid var(--bb-border); }
.px-page .px-step-label { gap: 0; color: var(--bb-text-secondary); font: 500 14px/1.3 var(--bb-font-sans); }
.px-page .px-step-label i { width: auto; height: auto; margin-right: 8px; border-radius: 0; background: none; color: var(--bb-accent-text); font-size: 16px; }
.px-page .px-step-kind { color: var(--bb-text); font-weight: 600; }
.px-page .px-step-no { color: var(--bb-text-secondary); font-weight: 500; font-variant-numeric: tabular-nums; }
.px-page .px-step-no::before { width: 3px; height: 3px; margin: 0 10px 3px; background: currentColor; opacity: .7; }
.px-page .px-step-title { font: 700 clamp(28px, 1.6vw + 18px, 37px)/1.12 var(--bb-font-display); letter-spacing: -0.025em; }
.lp .px-lesson-intro { max-width: 62ch; color: var(--bb-text-secondary); font-size: 18px; line-height: 1.55; }
.px-page .px-step-status { padding: 0; border-radius: 0; background: none; color: var(--bb-text-secondary); font: 500 14px/1.3 var(--bb-font-sans); }
.px-page .px-step-status[data-status="completed"] { background: none; color: var(--bb-success); font-weight: 600; }
.px-page .px-step-status.is-fresh { animation: none; }
.px-page .px-step-status.is-fresh i { animation: tr-tick .5s var(--bb-ease); }
@keyframes tr-tick { 0% { transform: scale(.3); } 60% { transform: scale(1.25); } 100% { transform: none; } }

/* ── Notes: reading typography ── */
.px-page .px-prose {
  max-width: 66ch; font: 400 18px/1.7 var(--tr-font-prose); color: var(--bb-text);
  font-variant-numeric: oldstyle-nums proportional-nums; hanging-punctuation: first;
}
:root[data-read-size="s"] .px-page .px-prose { font-size: 16.5px; }
:root[data-read-size="l"] .px-page .px-prose { font-size: 20px; }
:root[data-read-face="sans"] .px-page .px-prose { font-family: var(--bb-font-sans); font-size: 17px; line-height: 1.65; font-variant-numeric: normal; }
:root[data-read-face="sans"][data-read-size="s"] .px-page .px-prose { font-size: 15.5px; }
:root[data-read-face="sans"][data-read-size="l"] .px-page .px-prose { font-size: 19px; }
.px-page .cx-prose p, .px-page .cx-prose li { color: var(--bb-text); }
.px-page .cx-prose > * + * { margin-top: 1.1em !important; }
.px-page .cx-prose h2, .px-page .cx-prose h3, .px-page .cx-prose h4 { position: relative; font-family: var(--bb-font-display); font-variant-numeric: lining-nums; scroll-margin-top: 152px; text-wrap: balance; }
.px-page .cx-prose h2 { margin-top: 2.2em !important; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.px-page .cx-prose h3 { margin-top: 1.8em !important; font-size: 21.6px; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }
.px-page .cx-prose h4 { font-size: 18px; font-weight: 700; line-height: 1.3; }
.px-page .cx-prose h2:first-child, .px-page .cx-prose h3:first-child { margin-top: 0 !important; }
.px-page .cx-prose strong { font-weight: 650; }
.px-page .cx-prose a:not(.cx-anchor) { color: var(--tr-link); text-decoration-color: color-mix(in srgb, var(--tr-link) 45%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.px-page .cx-prose li::marker { color: var(--bb-accent-text); font-family: var(--bb-font-sans); font-weight: 600; font-variant-numeric: lining-nums; }
.px-page .cx-prose :not(pre) > code {
  padding: .1em .36em; border: 1px solid var(--bb-border); border-radius: 4px; background: var(--bb-surface-subtle); color: var(--bb-text);
  font: 500 .84em/1.4 var(--bb-font-mono);
}

/* Section link: appears beside the heading on hover or keyboard focus. */
.cx-anchor { display: inline-block; margin-left: 8px; color: var(--bb-text-secondary); font-weight: 500; text-decoration: none; opacity: 0; transition: opacity var(--bb-dur-fast) var(--bb-ease); }
.cx-anchor::before { content: "\0023"; }
h2:hover > .cx-anchor, h3:hover > .cx-anchor, .cx-anchor:focus-visible { opacity: 1; }
.cx-anchor:hover { color: var(--bb-accent-text); }
@media (hover: none) { .cx-anchor { opacity: .55; } }

/* Important observation (a Markdown quote): no box, a saffron rule and a larger voice. */
.px-page .cx-prose blockquote {
  padding: 2px 0 2px 20px; border: 0; border-left: 3px solid var(--bb-border-strong); border-radius: 0; background: none; box-shadow: none;
  color: var(--bb-text); font-size: 1.12em; font-style: italic; line-height: 1.55;
}

/* Tables: for scanning, so sans and tabular. */
.px-page .cx-table { border-radius: var(--tr-r-control); border-color: var(--bb-border); background: var(--bb-surface); }
.px-page .cx-prose table { font: 400 15px/1.5 var(--bb-font-sans); font-variant-numeric: tabular-nums lining-nums; }
.px-page .cx-prose th { background: var(--bb-surface-subtle); font: 600 13px/1.4 var(--bb-font-sans); }
.px-page .cx-prose th, .px-page .cx-prose td { padding: 11px 14px; border-color: var(--bb-border); }
.px-page .cx-prose tbody tr:hover { background: none; }

/* Code: one dark panel, a label bar with the language and the copy button. */
.px-page .cx-prose .cx-hl { overflow: hidden; border: 1px solid var(--lx-code-line); border-radius: var(--tr-r-control); background: var(--lx-code-bg); }
.px-page .cx-prose .cx-hl[data-lang]::before {
  content: attr(data-lang); display: block; padding: 10px 16px; border-bottom: 1px solid var(--lx-code-line);
  background: var(--lx-code-bar); color: var(--lx-code-muted); font: 500 13px/1.2 var(--bb-font-sans);
}
.px-page .cx-prose .cx-hl pre, .px-page .cx-prose pre {
  margin: 0; padding: 16px; border: 0; border-radius: 0; background: var(--lx-code-bg); color: var(--lx-code-text);
  font: 400 14.5px/1.65 var(--bb-font-mono); font-variant-ligatures: none; font-variant-numeric: normal; tab-size: 4;
}
.px-page .cx-prose > pre, .px-page .cx-prose > .px-codewrap > pre { border: 1px solid var(--lx-code-line); border-radius: var(--tr-r-control); }
.px-page .px-codewrap pre { padding-right: 96px; }
.px-page .px-copy {
  top: 8px; right: 8px; height: 30px; padding: 0 10px; border: 1px solid var(--lx-code-line); border-radius: 4px;
  background: var(--lx-code-bar); color: var(--lx-code-text); font: 500 13px/1 var(--bb-font-sans); opacity: 1;
}
.px-page .cx-hl[data-lang] .px-copy { top: -34px; right: 6px; height: 28px; border-color: transparent; background: transparent; color: var(--lx-code-muted); }
.px-page .cx-hl[data-lang] .px-codewrap pre { padding-right: 16px; }
.px-page .px-copy:hover { color: var(--lx-code-text); background: var(--lx-code-line); }
.px-page .px-copy.is-done { color: var(--tr-forest-emerald); }
.px-page .px-copy:focus-visible { outline: 2px solid var(--tr-saffron-on-forest); outline-offset: 1px; }

/* Program output: a different surface, joined to the code that produced it. */
.px-page .cx-prose .cx-output { border: 1px solid var(--bb-border-strong); border-radius: var(--tr-r-control); background: var(--bb-surface-subtle); overflow: hidden; }
.px-page .cx-prose .cx-hl + .cx-output, .px-page .cx-prose .px-codewrap + .cx-output { margin-top: 0 !important; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.px-page .cx-prose .cx-hl:has(+ .cx-output) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.lp .cx-output-label { padding: 8px 16px 0; color: var(--bb-text-secondary); font: 600 13px/1.2 var(--bb-font-sans); }
.px-page .cx-prose .cx-output .cx-hl { margin-top: 0 !important; border: 0; border-radius: 0; background: none; }
.px-page .cx-prose .cx-output pre { padding: 6px 16px 14px; background: none; color: var(--bb-text); }
.px-page .cx-prose .cx-output .px-copy { display: none; }
.px-page .cx-prose .cx-output .px-codewrap pre { padding-right: 16px; }

/* Teaching components: each has its own form, and only the warning is a tinted box. */
.px-page .cx-callout { padding: 0; border: 0; border-radius: 0; background: none; font-size: 1em; line-height: inherit; }
.px-page .cx-callout > * + * { margin-top: .5em !important; }
.px-page .cx-callout-title { display: block; margin: 0 !important; font: 700 15px/1.3 var(--bb-font-display); letter-spacing: 0; color: var(--bb-text); }
/* Trainer tip, note, interview angle: a coloured rule and a named voice. */
.px-page .cx-callout.is-tip, .px-page .cx-callout.is-note, .px-page .cx-callout.is-interview { padding: 2px 0 2px 18px; border-left: 3px solid var(--bb-accent); background: none; }
.px-page .cx-callout.is-tip .cx-callout-title { color: var(--bb-accent-text); }
.px-page .cx-callout.is-note { border-left-color: var(--bb-border-strong); }
.px-page .cx-callout.is-note .cx-callout-title { color: var(--bb-text-secondary); }
.px-page .cx-callout.is-interview { border-left-color: var(--tr-link); }
.px-page .cx-callout.is-interview .cx-callout-title { color: var(--tr-link); }
/* Real-world example: said aloud, in a speech-bubble shape. */
.px-page .cx-callout.is-analogy { padding: 16px 20px; border-radius: var(--tr-r-box) var(--tr-r-box) var(--tr-r-box) 4px; background: var(--bb-surface-subtle); font-style: italic; }
.px-page .cx-callout.is-analogy .cx-callout-title { color: var(--bb-text-secondary); font-style: normal; font-weight: 600; }
.px-page .cx-callout.is-analogy .cx-callout-title + p::first-letter { text-transform: uppercase; }
.cx .co-all { min-height: 24px; }
/* Common mistake: the only tinted warning box. */
.px-page .cx-callout.is-mistake { padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--bb-warning) 40%, transparent); border-radius: var(--tr-r-control); background: var(--bb-warning-soft); }
.px-page .cx-callout.is-mistake .cx-callout-title { color: var(--bb-warning); }
.px-page .cx-callout.is-mistake li::marker { color: var(--bb-warning); }
/* Key points: an outlined card to come back to. */
.px-page .cx-callout.is-key { padding: 18px 20px; border: 1.5px solid var(--bb-accent); border-radius: var(--tr-r-box); background: none; }
.px-page .cx-callout.is-key .cx-callout-title { color: var(--bb-accent-text); }
/* Sources: quiet reference list. */
.px-page .cx-sources { margin-top: 2.4em !important; padding-top: 16px; border-top: 1px solid var(--bb-border); color: var(--bb-text-secondary); font: 400 14px/1.6 var(--bb-font-sans); font-variant-numeric: normal; }
.lp .cx-sources-title { margin-bottom: 6px; color: var(--bb-text-secondary); font: 600 13px/1.2 var(--bb-font-sans); }
.px-page .cx-prose .cx-sources li { color: var(--bb-text-secondary); overflow-wrap: anywhere; }
.px-page .cx-prose .cx-sources li + li { margin-top: .2em; }
.px-page .px-step > .cx-callout { max-width: 66ch; font: 400 18px/1.7 var(--tr-font-prose); }

.px-page .px-read-end { max-width: 66ch; color: var(--bb-text-secondary); font: 500 13px/1 var(--bb-font-sans); }
.px-page .px-read-end i { color: var(--bb-accent-text); }

/* Section list inside the notes, for screens without the right-hand panel. */
.px-toc-inline { max-width: 66ch; border: 1px solid var(--bb-border); border-radius: var(--tr-r-control); background: var(--bb-surface); }
.px-toc-inline summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; font: 600 15px/1.2 var(--bb-font-sans); cursor: pointer; }
.px-toc-inline summary span { color: var(--bb-text-secondary); font-weight: 500; font-size: 13px; }
.lp .px-toc-inline ol { display: grid; gap: 2px; padding: 0 8px 10px; }
.px-toc-inline a { display: block; padding: 9px 8px; border-radius: 4px; color: var(--bb-text-secondary); font-size: 15px; line-height: 1.35; }
.px-toc-inline a:hover { color: var(--bb-text); background: var(--bb-surface-subtle); }
.px-toc-inline li.is-l3 a { padding-left: 22px; }
@media (min-width: 1280px) { .px-toc-inline { display: none; } }

/* ── Right-hand panel ── */
.lp .px-side-h { margin-bottom: 12px; color: var(--bb-text); font: 700 14px/1.2 var(--bb-font-display); }
/* The trail again: a line that fills to the section being read. */
.lp .px-toc ol { position: relative; display: grid; gap: 2px; padding-left: 16px; }
.px-toc ol::before, .px-toc ol::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 3px; width: 2px; border-radius: 1px; background: var(--bb-border-strong); }
.px-toc ol::after { background: var(--bb-accent); transform: scaleY(var(--toc-at, 0)); transform-origin: 50% 0; transition: transform var(--bb-dur-slow) var(--bb-ease); }
.px-toc li { position: relative; }
.px-toc a { display: block; padding: 6px 4px; border-radius: 4px; color: var(--bb-text-secondary); font-size: 14px; line-height: 1.35; }
.px-toc a:hover { color: var(--bb-text); }
.px-toc li.is-l3 a { padding-left: 16px; font-size: 13px; }
.px-toc li.is-passed a { color: var(--bb-text); }
.px-toc li.is-active a { color: var(--bb-text); font-weight: 700; }
.px-toc li.is-active::before {
  content: ""; position: absolute; top: 50%; left: -18px; z-index: 1; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--bb-surface); box-shadow: inset 0 0 0 3px var(--tr-saffron);
}
.lp .px-learn ul { display: grid; gap: 10px; }
.px-learn li { position: relative; padding-left: 20px; color: var(--bb-text-secondary); font-size: 14px; line-height: 1.45; }
.px-learn li::before { content: ""; position: absolute; top: .5em; left: 2px; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--bb-accent); }
.lp .px-side-fact { display: flex; align-items: center; gap: 8px; color: var(--bb-text-secondary); font-size: 13px; }

/* ── Step pager: a floating control, so blur is allowed here ── */
.px-page .px-pager { width: min(100%, 520px); border-color: var(--bb-border-strong); border-radius: var(--tr-r-box); background: color-mix(in srgb, var(--bb-surface) 90%, transparent); box-shadow: var(--bb-shadow-1); }
.px-page .px-keys { font: 500 13px/1 var(--bb-font-sans); color: var(--bb-text-secondary); }
.px-page .px-keys kbd { border-radius: 4px; border-color: var(--bb-border-strong); background: var(--bb-surface-subtle); }

/* ── End of the lesson ── */
.px-page .px-end { gap: 24px; margin: 48px 0 0 !important; padding: 32px 0 0; border-top: 1px solid var(--bb-border); border-radius: 0; background: none; }
.px-page .px-end-state { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.px-page .px-end-state[hidden] { display: none; }
.px-end-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--bb-accent); color: var(--bb-text-on-accent); font-size: 26px; }
.px-end-state.is-todo .px-end-mark { background: var(--tr-saffron-soft); color: var(--tr-saffron-text); }
.px-page .px-end-state h2 { font: 700 26px/1.2 var(--bb-font-display); letter-spacing: -0.02em; }
.px-page .px-end-state p { margin-top: 6px !important; color: var(--bb-text-secondary); font-size: 15px; line-height: 1.5; }
.lp .px-page .px-end-learned-h, .px-page .px-end-state p.px-end-learned-h { margin-top: 18px !important; color: var(--bb-text); font: 700 15px/1.3 var(--bb-font-display); }
.lp .px-end-learned { display: grid; gap: 8px; margin-top: 10px; }
.px-end-learned li { position: relative; padding-left: 26px; font-size: 15px; line-height: 1.45; }
.px-end-learned li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--bb-success); font-weight: 700; }
/* Earned once, in this visit: the mark settles and a ring opens. Under 1.2s; off for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .px.is-just-done .px-end-state:not(.is-todo) .px-end-mark { animation: tr-earned .9s var(--bb-ease) both; }
  .px.is-just-done .px-end-state:not(.is-todo) .px-end-mark i { animation: tr-tick .6s var(--bb-ease) .15s both; }
}
@keyframes tr-earned {
  0% { transform: scale(.5); box-shadow: 0 0 0 0 color-mix(in srgb, var(--bb-accent) 50%, transparent); }
  55% { transform: scale(1.08); }
  100% { transform: none; box-shadow: 0 0 0 22px transparent; }
}
.px-end-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
.px-end-link { display: grid; align-content: center; gap: 4px; min-height: 76px; padding: 14px 18px; border: 1px solid var(--bb-border-strong); border-radius: var(--tr-r-box); background: var(--bb-surface); color: var(--bb-text); text-decoration: none; }
.px-end-link span { color: var(--bb-text-secondary); font: 500 13px/1.3 var(--bb-font-sans); }
.px-end-link b { font: 700 17px/1.3 var(--bb-font-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.px-end-link small { color: var(--bb-text-secondary); font-size: 13px; }
a.px-end-link.is-prev:hover { border-color: var(--bb-text-secondary); }
.px-end-link.is-next { grid-column: 2; position: relative; padding-right: 56px; border-color: var(--bb-accent); background: var(--bb-accent); color: var(--bb-text-on-accent); }
.px-end-link.is-next span { color: inherit; opacity: .86; }
a.px-end-link.is-next::after { content: "\2192"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font: 600 22px/1 var(--bb-font-sans); }
a.px-end-link.is-next:hover { background: var(--bb-accent-hover); border-color: var(--bb-accent-hover); }
.px-end-link.is-next.is-locked { padding-right: 18px; border-color: var(--bb-border); background: var(--bb-surface-subtle); color: var(--bb-text); }
.px-end-link.is-next.is-locked span { opacity: 1; color: var(--bb-text-secondary); }
.px-end-link:only-child { grid-column: 1 / -1; }

/* ── Reader: smaller screens ── */
@media (max-width: 959px) {
  .px-page .px-body { grid-template-columns: minmax(0, 1fr); }
  .px-page .px-stage { grid-column: 1; }
  .px-page .px-rail { background: var(--bb-bg); height: auto; top: 0; }
  .px-page .px-step[class] { padding-inline: 0; }
  .px-page .px-end { margin-inline: 0 !important; padding-inline: 0; }
  .px-tools [data-focus-toggle] { display: none; }
}
@media (max-width: 639px) {
  .px-page .px-stage { padding: 24px 16px 48px; }
  .px-page .px-step[class] { padding: 0; border-radius: 0; }
  .px-page .px-step-title { font-size: 28px; }
  .px-page .px-step-label i { width: auto; height: auto; }
  .px-page .px-prose { font-size: 17px; }
  :root[data-read-size="l"] .px-page .px-prose { font-size: 19px; }
  .px-page .cx-prose h2 { font-size: 23px; }
  .px-page .cx-prose .cx-hl pre, .px-page .cx-prose pre { font-size: 13.5px; }
  .px-page .px-end { margin-inline: 0 !important; padding-inline: 0; }
  .px-end-nav { grid-template-columns: minmax(0, 1fr); }
  .px-end-link.is-next { grid-column: 1; grid-row: 1; }
  .px-page .px-top-progress { display: none; }
  .px-bartool { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .px-page .px-step.is-entering, .px-page .px-step-status.is-fresh i { animation: none; }
  .px-toc ol::after, .tr-ring-fill { transition: none; }
}
@media print {
  .px-side, .px-tools, .px-toc-inline { display: none !important; }
}

/* ── DD-29 · Course page: each lesson's steps fold away ───────────
   A module page used to list every step of every lesson (about 80
   rows). Lessons now show their title, summary and action; the steps
   open on demand, and the lesson you are on starts open. */
.cx .cw-steps { margin-top: 4px; }
.cx .cw-steps > summary {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 0;
  color: var(--bb-text-secondary); font-size: 13.5px; font-weight: 500;
  cursor: pointer; list-style: none;
}
.cx .cw-steps > summary::-webkit-details-marker { display: none; }
.cx .cw-steps > summary::before {
  content: ""; width: 6px; height: 6px; margin: 0 4px 0 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--bb-dur-fast) var(--bb-ease);
}
.cx .cw-steps[open] > summary::before { transform: rotate(45deg); }
.cx .cw-steps > summary:hover { color: var(--bb-text); }
.cx .cw-steps-hide, .cx .cw-steps[open] .cw-steps-show { display: none; }
.cx .cw-steps[open] .cw-steps-hide { display: inline; }
.cx .cw-steps[open] > .cw-topics { margin-top: 8px; }

/* Cover grid: quieter lines so the code stays the subject. */
.tr-cover-art {
  background-image:
    linear-gradient(var(--bb-band-raise) 1px, transparent 1px),
    linear-gradient(90deg, var(--bb-band-raise) 1px, transparent 1px);
}

/* Current lesson: a white card with an accent edge, not a tinted block. */
.cx .cw-lesson { border-radius: var(--tr-r-box); box-shadow: none; }
.cx .cw-lesson.is-current {
  border-color: var(--bb-accent-line);
  background: var(--bb-surface);
  box-shadow: inset 3px 0 0 var(--bb-accent);
}

/* ── DD-29 · Quiz cards ───────────────────────────────────────────
   A <legend> sits on its fieldset's border, so the card's top edge
   used to cut through the question's code block. Floating the legend
   makes it an ordinary first row inside the card. */
.px-page .px-q { display: flow-root; background: var(--bb-surface); }
.px-page .px-q > .px-q-head { float: left; width: 100%; margin: 0 0 14px; }
.px-page .px-q > .px-q-head + * { clear: both; }
.px-page .px-q > .cx-code { margin: 0 0 16px; }
.px-page .px-q-no { background: var(--bb-surface-subtle); color: var(--bb-text-secondary); border: 1px solid var(--bb-border); }

/* ── DD-29 · My learning ──────────────────────────────────────────
   The resume panel is a link; the page-wide link reset (.lp a) used to
   win and paint its title in body ink on the ink band. */
.lp .ml-resume { color: var(--bb-band-text); }
.lp .ml-resume .ml-ring b { color: var(--bb-band-text); }
.ml-resume .ml-resume-course { font-weight: 700; letter-spacing: -0.02em; }
.ml-title { font-weight: 700; letter-spacing: -0.03em; }
.ml-section-head h2, .ml-card-title { font-weight: 700; }
.ml-card .tr-cover { aspect-ratio: auto; height: 148px; }
.ml-card .tr-cover-code { font-size: 52px; }

/* Learning days beside the resume panel: heading, three even stats, then the calendar. */
.ml-top > .cx-act.is-wide { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: none; align-content: start; }
.ml-top > .cx-act.is-wide > * { grid-column: 1; grid-row: auto; }
.ml-top > .cx-act.is-wide .cx-act-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ml-top > .cx-act.is-wide .cx-act-stats dt { white-space: nowrap; }
.ml-top > .cx-act.is-wide .cx-act-cal { width: 100%; }


/* ══════════════════════════════════════════════════════════════
   DD-29 · Course page (templates/courses/course_detail.html)
   A calm, editorial syllabus: one ink header with the facts in a
   plain line and progress set into the band (not a floating card),
   modules introduced by a quiet header, lessons as rows in one panel.
   Loaded last, so these rules replace the earlier cw-/co- styling.
   ══════════════════════════════════════════════════════════════ */

/* ── Page frame ── */
.cx .cw-main { background: var(--bb-bg); padding: 32px clamp(20px, 4vw, 56px) 112px; }
.cx .cw-main > * { max-width: 1040px; }

/* ── Header band ── */
.cx .cw-hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--bb-band-line); border-radius: var(--tr-r-box);
  background: var(--bb-band-bg); color: var(--bb-band-text); box-shadow: none;
}
.cx .cw-hero::before, .cx .cw-hero::after, .cx .cw-hero-mark { display: none; }
.cx .cw-hero-main { padding: clamp(28px, 3.4vw, 44px); }
.cx .cw-hero .cx-crumbs ol { font-size: 13px; }
.cx .cw-hero .cx-title {
  max-width: 20ch; margin-top: 14px !important; color: var(--bb-band-text);
  font: 700 clamp(32px, 2.4vw + 16px, 46px)/1.08 var(--bb-font-display); letter-spacing: -0.03em;
}
.cx .cw-hero .cw-lede { max-width: 60ch; margin-top: 10px; color: var(--bb-band-muted); font-size: 16px; line-height: 1.55; }
.cx .cw-facts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0;
  margin: 24px 0 0; padding: 0; border: 0; list-style: none;
}
.cx .cw-facts li { display: inline-flex; align-items: center; gap: 4px; color: var(--bb-band-muted); font-size: 14px; }
.cx .cw-facts li + li::before {
  content: ""; width: 3px; height: 3px; margin: 0 12px; border-radius: 50%; background: var(--bb-band-muted); opacity: .7;
}
.cx .cw-facts li b { color: var(--bb-band-text); font-weight: 600; }
.cx .cw-facts i { display: none; }

/* Progress, set into the band */
.cx .cw-pcard, .cx .cw-enroll {
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: clamp(24px, 3vw, 36px); border: 0; border-left: 1px solid var(--bb-band-line); border-radius: 0;
  background: var(--bb-band-raise); color: var(--bb-band-text); box-shadow: none;
}
.cx .cw-p-label { margin: 0; color: var(--bb-band-muted); font: 500 13px/1.3 var(--bb-font-sans); }
.cx .cw-p-big { margin: 0; color: var(--bb-band-muted); font-size: 14px; }
.cx .cw-p-big b { color: var(--bb-band-text); font: 700 40px/1 var(--bb-font-display); letter-spacing: -0.03em; margin-right: 4px; }
.cx .cw-p-bar { height: 4px; overflow: hidden; border-radius: 999px; background: var(--bb-band-line); }
.cx .cw-p-bar i { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: var(--bb-band-accent); }
.cx .cw-p-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; color: var(--bb-band-muted); font-size: 13px; }
.cx .cw-streak { display: inline-flex; align-items: center; gap: 4px; }
.cx .cw-streak i { color: var(--bb-code-warn); }
.cx .cw-go {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 0; margin-top: 8px; padding: 12px 16px;
  border-radius: var(--tr-r-control); background: var(--bb-band-text); color: var(--bb-band-bg);
  text-decoration: none; transition: background var(--bb-dur-fast) var(--bb-ease);
}
.cx .cw-go:hover { background: var(--bb-surface); }
.cx .cw-go:focus-visible { outline: 2px solid var(--bb-band-accent); outline-offset: 2px; }
.cx .cw-go-text { display: grid; gap: 2px; min-width: 0; }
.cx .cw-go-label { font: 600 15px/1.2 var(--bb-font-sans); }
.cx .cw-go-next { overflow: hidden; color: color-mix(in srgb, var(--bb-band-bg) 70%, transparent); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.cx .cw-go i { flex: none; font-size: 16px; }
.cx .cw-enroll .btn { width: 100%; }
.cx .cw-enroll, .cx .cw-enroll p, .cx .cw-enroll b, .cx .cw-enroll span { color: var(--bb-band-text); }
.cx .cw-enroll .cx-muted, .cx .cw-enroll small { color: var(--bb-band-muted); }

/* ── View headers (Overview, Capstone, each module) ── */
.cx .cw-view-head { margin-top: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--bb-border); }
.cx .cw-kicker {
  display: flex; align-items: center; gap: 12px; margin: 0;
  color: var(--bb-text-tertiary); font: 600 13px/1.3 var(--bb-font-sans); letter-spacing: 0; text-transform: none;
}
.cx .cw-state {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none;
  color: var(--bb-text-secondary); font: 500 13px/1.3 var(--bb-font-sans);
}
.cx .cw-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bb-border-control); }
.cx .cw-state.is-started::before { background: var(--bb-accent); }
.cx .cw-state.is-done::before { background: var(--bb-success); }
.cx .cw-state.is-locked::before { display: none; }
.cx .cw-state i { font-size: 12px; }
.cx .cw-h2 { margin-top: 8px; font: 700 clamp(24px, 1.2vw + 16px, 30px)/1.2 var(--bb-font-display); letter-spacing: -0.02em; }
.cx .cw-mod-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; color: var(--bb-text-secondary); font-size: 14px; }
.cx .cw-mod-meta b { color: var(--bb-text); font-weight: 600; }
.cx .cw-mod-head .cx-bar { display: block; max-width: 360px; height: 4px; margin-top: 14px; border-radius: 999px; background: var(--bb-border); }
.cx .cw-mod-head .cx-bar > span { background: var(--bb-accent); border-radius: inherit; }
.cx .cw-mod-head .cx-bar.is-full > span { background: var(--bb-success); }
.cx .cw-mod-sum { max-width: 70ch; margin-top: 14px; color: var(--bb-text-secondary); font-size: 15.5px; line-height: 1.65; }

/* ── Lessons: rows in one panel ── */
.cx .cw-lessons {
  display: grid; gap: 0; margin-top: 20px; padding: 0; overflow: hidden;
  border: 1px solid var(--bb-border); border-radius: var(--tr-r-box); background: var(--bb-surface);
}
.cx .cw-lesson {
  margin: 0; padding: 22px 24px; border: 0; border-top: 1px solid var(--bb-border); border-radius: 0;
  background: var(--bb-surface); box-shadow: none;
}
.cx .cw-lesson:first-child { border-top: 0; }
.cx .cw-lesson.is-current { border-color: var(--bb-border); background: color-mix(in srgb, var(--bb-accent) 4%, var(--bb-surface)); box-shadow: inset 3px 0 0 var(--bb-accent); }
.cx .cw-lesson-head { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.cx .cw-lesson-head > .co-mark { width: 20px; height: 20px; margin-top: 2px; font-size: 18px; }
.cx .cw-lesson-no { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--bb-text-tertiary); font: 500 13px/1.4 var(--bb-font-sans); }
.cx .cw-lesson-no .cx-tag {
  padding: 0 7px; border-radius: var(--bb-radius-xs); border: 1px solid var(--bb-border-strong);
  background: none; color: var(--bb-text-secondary); font: 500 12px/18px var(--bb-font-sans);
}
.cx .cw-lesson-no .cx-tag.is-on { border-color: var(--bb-accent-line); background: var(--bb-accent-soft); color: var(--bb-accent-text); }
.cx .cw-lesson-title { margin-top: 3px; font: 600 17px/1.35 var(--bb-font-sans); letter-spacing: -0.01em; }
.cx .cw-lesson-min { display: inline-flex; align-items: center; gap: 6px; color: var(--bb-text-tertiary); font: 500 13px var(--bb-font-sans); white-space: nowrap; }
.cx .cw-lesson-sum { max-width: 70ch; margin: 8px 0 0 36px; color: var(--bb-text-secondary); font-size: 14.5px; line-height: 1.6; }
.cx .cw-steps { margin: 10px 0 0 36px; }
.cx .cw-lesson-foot { margin: 14px 0 0 36px; }
.cx .cw-lesson-foot .btn { min-height: 34px; padding: 0 14px; font-size: 13.5px; font-weight: 600; }

/* Steps inside a lesson */
.cx .cw-topics { display: grid; gap: 0; margin: 0; padding: 0; border-top: 1px solid var(--bb-border); }
.cx .cw-topic { padding: 0; border: 0; border-bottom: 1px solid var(--bb-border); }
.cx .cw-topic > a, .cx .cw-topic > span {
  display: grid; grid-template-columns: 18px 120px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  min-height: 40px; padding: 8px 4px; color: var(--bb-text); font-size: 14px; text-decoration: none;
}
.cx .cw-topic > a:hover { background: var(--bb-surface-subtle); }
.cx .cw-topic > * > i:first-child { color: var(--bb-text-tertiary); font-size: 14px; }
.cx .cw-topic-kind { color: var(--bb-text-tertiary); font-size: 12.5px; }
.cx .cw-topic-title { font-weight: 500; }
.cx .cw-topic-seen { color: var(--bb-text-tertiary); font: 500 12px var(--bb-font-sans); letter-spacing: 0; text-transform: none; }
.cx .cw-subtopics { margin: -4px 0 8px 154px; color: var(--bb-text-tertiary); font-size: 12.5px; line-height: 1.5; }

.cx .cw-project { margin-top: 16px; color: var(--bb-text-secondary); font-size: 14px; }
.cx .cw-pager { margin-top: 28px; gap: 12px; }
.cx .cw-pager-link { border: 1px solid var(--bb-border); border-radius: var(--tr-r-box); background: var(--bb-surface); box-shadow: none; }
.cx .cw-pager-link:hover { border-color: var(--bb-border-control); }

/* ── Sidebar outline ── */
.cx .cw-side { background: var(--bb-surface); border-right: 1px solid var(--bb-border); }
.cx .co { font-size: 14px; }
.cx .co-kicker { color: var(--bb-text-tertiary); font: 500 12.5px/1.3 var(--bb-font-sans); letter-spacing: 0; text-transform: none; }
.cx .co-title { font: 600 16px/1.3 var(--bb-font-sans); letter-spacing: -0.01em; }
.cx .co-progress p { font-size: 13px; }
.cx .co-progress b { font-weight: 600; }
.cx .co-ring { width: 34px; height: 34px; }
.cx .co-pages a { gap: 10px; padding: 8px 10px; border-radius: var(--bb-radius-sm); font-size: 14px; font-weight: 500; }
.cx .co-h { color: var(--bb-text-tertiary); font: 600 12.5px/1.3 var(--bb-font-sans); letter-spacing: 0; text-transform: none; }
.cx .co-all { font-size: 12.5px; font-weight: 500; }
.cx .co-mod-btn { padding: 10px; border-radius: var(--tr-r-control); background: none; }
.cx .co-mod.is-viewing > .co-mod-btn { background: var(--bb-surface-subtle); }
.cx .co-mod-btn:hover { background: var(--bb-surface-subtle); }
.cx .co-mod-label { color: var(--bb-text-tertiary); font: 500 12px/1.3 var(--bb-font-sans); letter-spacing: 0; text-transform: none; }
.cx .co-mod-title { font: 600 14px/1.35 var(--bb-font-sans); letter-spacing: -0.005em; }
.cx .co-count { color: var(--bb-text-tertiary); font: 500 12px var(--bb-font-mono); }
.cx .co-les-btn { font-size: 13.5px; line-height: 1.4; }
.cx .co-les-no { color: var(--bb-text-tertiary); font: 500 12.5px var(--bb-font-mono); }
.cx .co-les.is-current > .co-les-btn { font-weight: 600; }
.cx .co-topic { font-size: 13px; line-height: 1.4; }
.cx .co-mark.is-started { color: var(--bb-accent); }

@media (max-width: 1100px) {
  .cx .cw-hero { grid-template-columns: minmax(0, 1fr); }
  .cx .cw-pcard, .cx .cw-enroll { border-left: 0; border-top: 1px solid var(--bb-band-line); }
}
@media (max-width: 640px) {
  .cx .cw-lesson { padding: 18px 16px; }
  .cx .cw-lesson-sum, .cx .cw-steps, .cx .cw-lesson-foot { margin-left: 0; }
  .cx .cw-topic > a, .cx .cw-topic > span { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .cx .cw-topic-kind { display: none; }
  .cx .cw-subtopics { margin-left: 30px; }
}
.cx .cw-module .cw-state, .cx .cw-module.is-started .cw-state, .cx .cw-module.is-done .cw-state { border: 0; background: none; color: var(--bb-text-secondary); }
.cx .cw-mod-meta span + span::before { margin: 0 10px 0 -6px; }
body.cx[class] .cw-lesson-foot .btn { min-height: 34px; padding: 0 14px; font: 600 13.5px/1 var(--bb-font-sans); letter-spacing: 0; }
body.cx[class] .cw-lesson-foot .btn-ghost { border: 1px solid var(--bb-border-strong); background: var(--bb-surface); color: var(--bb-text); }
body.cx[class] .cw-lesson-foot .btn-ghost:hover { border-color: var(--bb-border-control); background: var(--bb-surface-subtle); }
.cx .cw-steps > summary { gap: 0; }
.cx .cw-steps > summary::before { margin: 0 10px 0 2px; }

/* My learning, round 2 */
.ml-title { font: 700 clamp(28px, 2vw + 16px, 38px)/1.12 var(--bb-font-display); letter-spacing: -0.025em; }
.lp .ml-resume .ml-ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 1px; font: 700 24px/1 var(--bb-font-display); }
.lp .ml-resume .ml-ring b small { font-size: 12px; }
.lp .ml-resume .ml-go {
  display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-radius: var(--tr-r-control); background: var(--bb-band-text); color: var(--bb-band-bg);
  font: 600 14.5px/1 var(--bb-font-sans); box-shadow: none;
}
.lp .ml-resume:hover .ml-go { gap: 10px; background: var(--bb-surface); }
.ml-top .cx-act.is-wide { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 16px; align-content: start; padding: 24px; }
.ml-top .cx-act.is-wide > * { grid-column: 1; grid-row: auto; grid-area: auto; }
.ml-top .cx-act.is-wide .cx-act-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.ml-top .cx-act.is-wide .cx-act-stats dt { white-space: nowrap; }
.ml-top .cx-act.is-wide .cx-act-cal, .ml-top .cx-act.is-wide .cx-act-dots { width: 100%; max-width: none; }

/* ── DD-29 · Catalogue cards, compact ─────────────────────────────
   Ordinary course cards in a three-up grid: a short cover strip,
   then title, facts and progress at reading size. No "featured"
   card that spans two columns. */
.lp .tr-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; max-width: 1040px; }
.tr-card.is-featured { grid-column: auto; }
.lp .tr-card.is-featured .tr-card-link, .lp .tr-card-link { display: grid; grid-template: auto 1fr / minmax(0, 1fr); }
.tr-card.is-featured .tr-cover, .tr-card .tr-cover { aspect-ratio: auto; height: 120px; }
.tr-card .tr-cover-art { padding: 14px 16px; }
.tr-card .tr-cover-top { font-size: 12px; }
.tr-card .tr-cover-code { font-size: 40px; gap: 4px; }
.tr-card .tr-cover-name { display: none; }
.lp .tr-card-link { border-radius: var(--tr-r-box); }
.tr-card-body { gap: 6px; padding: 16px; }
.tr-card-kicker { font-size: 12.5px; }
.tr-card-title { font: 600 17px/1.3 var(--bb-font-sans); letter-spacing: -0.01em; }
.tr-card-sub { font-size: 14px; -webkit-line-clamp: 2; }
.tr-card-facts { gap: 2px 12px; font-size: 13px; }
.tr-card-foot { gap: 8px 12px; margin-top: 6px; padding-top: 12px; }
.tr-card-prog { gap: 6px; }
.tr-card .cx-bar { height: 4px; border-radius: 999px; background: var(--bb-border); }
.tr-card .cx-bar > span { background: var(--bb-accent); border-radius: inherit; }
.tr-card .cx-bar.is-full > span { background: var(--bb-success); }
.tr-card-prog-text { font-size: 13px; }
.tr-card-prog-text b { font-weight: 600; }
.tr-card-state { gap: 6px; font-size: 13px; }
.tr-card-state i { font-size: 12px; }
.tr-card-state.is-in-progress i { color: var(--bb-accent); }
.tr-card-go { font: 600 13.5px/1 var(--bb-font-sans); }
.tr-shelf-head h3 { font: 600 18px/1.3 var(--bb-font-sans); }
