/* Starter course progress bar — sticky bar under the site header.
   Shared by every Starter section page. Each page sets data-section on the
   #starterProgress element; the 5-lesson / 12-section structure lives in
   starter-progress.js. The current-section knob (.sp-current) and fill both
   read --progress, which starter-progress.js sets on .sp-track.

   ── TWO NAMES, ONE PREFIX. READ THIS BEFORE RENAMING ANYTHING ────────────
   --progress is a LENGTH: a percentage that starter-progress.js writes onto
   .sp-track and that .sp-fill (width) and .sp-current (left) read back.
   --progress-green, --progress-green-2, --progress-red and --progress-paper
   are COLOURS. The two share a prefix and nothing else. A blind rename, or a
   find-and-replace across "--progress", freezes the bar at 0%.

   ── Palette ──────────────────────────────────────────────────────────────
   Those four colour names used to carry their own deep green (#3b3026 /
   #a66329), their own red (#b64238) and a blue-tinted paper (#f2f7fe) lit by
   green-tinted shadows — while the lesson page immediately underneath
   resolved --green to navy #1e3a8a and tinted its own shadows blue. Two
   accent systems meeting at the top of the scroll. The four are now ALIASES
   of the brand green in theme.css; every usage below is untouched. */
.starter-progress {
  --progress-green: var(--t-green-deep);    /* TYPE: the label, the lesson
                                               line, the knob glyph, the page
                                               h1. 7.9:1 on white, 7.1:1 on
                                               --t-sand. */
  --progress-green-2: var(--t-green);       /* the light end of the fill and
                                               nothing else. 3.9:1 on
                                               --t-track — the floor for a
                                               graphic that carries a
                                               quantity, and too light to be
                                               type. */
  --progress-red: var(--t-vermilion);       /* the seal dot beside "Starter".
                                               A brand mark, not a verdict. */
  --progress-paper: var(--t-cream);         /* the paper under the bar */
  /* --t-vermilion as bare channels, for the two halo rings on that dot.
     theme.css publishes no --t-vermilion-rgb and the rings live at .18 / .10,
     so the alpha has to survive. Mirror of --t-vermilion (#a52a2a): move both
     or neither. */
  --progress-red-rgb: 165, 42, 42;
  position: sticky;
  /* Sits BELOW the site header, which is itself sticky at top:0 z-index:50
     (assets/site-nav.css). Same offset and the same z-index meant DOM order
     decided the paint, and this bar — being second — covered the nav the
     moment the page scrolled. --mw-header-h is published by site-nav.css and
     already carries the narrow-screen value, so no extra media query here. */
  top: var(--mw-header-h, 80px);
  /* Strictly under 50: .site-header is a stacking context, so the open
     dropdown (60) and mobile panel (55) are capped at the header's 50. */
  z-index: 40;
  min-height: 76px;
  display: flex;
  align-items: center;
  /* The two stops were rgba(255,255,255,.97) and rgba(234,239,248,.92) over an
     OPAQUE --progress-paper, so that alpha never reached the page behind: the
     composite was a near-white → tinted-surface ramp, which is exactly what
     these two opaque tokens are. (It also means the backdrop-filter below has
     nothing to show through and is already inert. Left as found — reported,
     not removed.) */
  background:
    linear-gradient(180deg, var(--t-white), var(--t-sand)),
    var(--progress-paper);
  border-bottom: 1px solid var(--t-line);
  box-shadow: 0 12px 34px rgba(var(--t-green-deep-rgb), 0.055);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.starter-progress .sp-inner {
  width: min(1120px, calc(100% - 56px));
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: 118px minmax(200px, 1fr) 138px;
  align-items: center;
  gap: 24px;
}

.starter-progress .sp-label,
.starter-progress .sp-count {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 13px;
}

.starter-progress .sp-label {
  gap: 10px;
  color: var(--progress-green);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.starter-progress .sp-label::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--progress-red);
  box-shadow:
    0 0 0 1px rgba(var(--progress-red-rgb), 0.18),
    0 0 0 7px rgba(var(--progress-red-rgb), 0.1);
}

/* Right-hand readout: the lesson (1–5) over the section (1–12) inside it. */
.starter-progress .sp-count {
  flex-direction: column;
  align-items: flex-end;
  justify-self: end;
  justify-content: center;
  gap: 1px;
  padding-left: 22px;
  border-left: 1px solid var(--t-line);
  color: var(--t-ink-2);
  font-weight: 850;
}

.starter-progress .sp-lesson {
  color: var(--progress-green);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.starter-progress .sp-section {
  color: var(--t-muted);   /* 4.9:1 on --t-sand, at 11px */
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.starter-progress .sp-track {
  /* LENGTH, overwritten by starter-progress.js. Shares a prefix with the four
     colours at the top of this file and nothing else. */
  --progress: 0%;
  position: relative;
  height: 10px;
  overflow: visible;
  border-radius: var(--t-r-pill);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.08)),
    var(--t-track);
  box-shadow:
    inset 0 1px 2px rgba(var(--t-green-deep-rgb), 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.75);
}

.starter-progress .sp-fill {
  position: relative;
  width: var(--progress);
  height: 100%;
  min-width: 18px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 56%),
    linear-gradient(90deg, var(--progress-green-2), var(--progress-green));
  box-shadow:
    0 0 0 1px rgba(var(--t-green-deep-rgb), 0.06),
    0 6px 16px rgba(var(--t-green-deep-rgb), 0.16);
  transition: width 0.55s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.starter-progress .sp-current {
  position: absolute;
  left: var(--progress);
  top: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--t-green-deep-rgb), 0.28);
  border-radius: 50%;
  color: var(--progress-green);
  background: radial-gradient(circle at 50% 36%, var(--t-white) 0 34%, var(--t-sunk) 100%);
  font-size: 14px;
  font-weight: 900;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 6px rgba(var(--t-green-deep-rgb), 0.08),
    0 12px 24px rgba(var(--t-green-deep-rgb), 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: left 0.55s cubic-bezier(0.2, 0.8, 0.25, 1);
}

/* Section-page title block (injected by starter-progress.js): the lesson name on
   top as the largest line, the page's own title under it. Every section page
   styles .lesson-head itself as a flex row, so the doubled class here wins on
   specificity without !important. */
/* Pull the title block up towards the progress bar — the pages' own top padding
   (up to 64px) left a large empty band under the bar. */
body.lesson-page .lesson-main { padding-top: 26px; }

.lesson-head.lesson-head-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 0;
  text-align: left;
}

/* Eyebrow: names the lesson this section belongs to. */
.lesson-head.lesson-head-stack .lesson-kicker {
  order: -1;
  margin: 0;
  color: var(--t-ink);
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* The page's own title — the largest line. Pinned here because several pages
   set their own h1 size and colour.
   This h1 sits in the page's own .lesson-head, OUTSIDE .starter-progress, so
   --progress-green was never in scope on it: the old fallback (#3b3026) was
   doing all the work. It names the token directly now. */
.lesson-head.lesson-head-stack h1 {
  margin: 0;
  color: var(--t-green-deep);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

@media (max-width: 760px) {
  .starter-progress { min-height: 68px; }
  .starter-progress .sp-inner {
    width: min(100% - 28px, 720px);
    grid-template-columns: 1fr auto;
    gap: 16px;
  }
  .starter-progress .sp-label { display: none; }
  .starter-progress .sp-count {
    min-height: 30px;
    padding-left: 14px;
  }
  .starter-progress .sp-lesson { font-size: 12px; }
  .starter-progress .sp-section { font-size: 10px; }
  .starter-progress .sp-current { width: 30px; height: 30px; font-size: 13px; }
  /* leave room for the floating score chip, which spans the width up here */
  body.lesson-page .lesson-main { padding-top: 52px; }
  .lesson-head.lesson-head-stack { gap: 8px; }
  .lesson-head.lesson-head-stack .lesson-kicker { font-size: 11.5px; letter-spacing: 0.06em; }
  .lesson-head.lesson-head-stack h1 { font-size: 28px; }
}

/* Sound-effects switch — added by assets/starter-sfx.js, which also puts the
   has-sound class on .sp-inner so the grid gets a fourth column for it. */
.starter-progress .sp-inner.has-sound {
  grid-template-columns: 118px minmax(200px, 1fr) 138px 34px;
}
.starter-progress .sp-sound {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(var(--t-green-deep-rgb), 0.2);
  border-radius: 50%;
  background: var(--t-white);
  color: var(--progress-green);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--t-green-deep-rgb), 0.1);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.starter-progress .sp-sound:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(var(--t-green-deep-rgb), 0.16);
}
.starter-progress .sp-sound:focus-visible {
  outline: 2px solid var(--progress-green);
  outline-offset: 2px;
}
.starter-progress .sp-sound svg { width: 18px; height: 18px; }
.starter-progress .sp-sound .spk { fill: currentColor; }
.starter-progress .sp-sound .wav {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.starter-progress .sp-sound.is-off {
  color: var(--t-muted);
  background: var(--t-sand);
  box-shadow: none;
}
@media (max-width: 760px) {
  .starter-progress .sp-inner.has-sound { grid-template-columns: 1fr auto auto; }
  .starter-progress .sp-sound { width: 30px; height: 30px; }
}
