/* Lesson pager (Lesson Revamp Playbook): one idea per page, moving left to right.
   One slim header with the page dropdown, no side panel, no footer. Uses the lesson's own tokens
   (--ink, --line, --paper, --paper-2, --paper-3, --hero, --ok, --I) so it matches Electric Ink lessons. */
:root { --pgr-head: 56px; }
html.pgr-on { scroll-behavior: auto; scroll-padding-top: calc(var(--pgr-head) + 8px); }
html.pgr-on body { background: var(--ink, #0a0b0d); }

/* ---- the one header ---- */
.pgr-head { position: sticky; top: 0; z-index: 60; height: var(--pgr-head); display: flex; align-items: center; gap: 12px;
  padding: 0 14px 0 8px; background: rgba(10,11,13,.96); border-bottom: 1px solid var(--line, #262b34);
  backdrop-filter: saturate(1.2) blur(12px); }
.pgr-ident { appearance: none; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 10px; padding: 4px 8px; margin: 0 -8px; display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.15; gap: 2px; }
.pgr-ident:hover { background: var(--ink-3, #171a21); }
.pgr-ident:focus-visible, .pgr-count:focus-visible { outline: 2px solid var(--I, #39d7ff); outline-offset: 1px; }
.pgr-ident .n { font: 500 11px/1.2 "IBM Plex Mono", monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--hero, #b48cff); }
.pgr-ident .t { font: 600 17px/1.2 "Space Grotesk", sans-serif; letter-spacing: -.02em; color: var(--paper, #eef1f4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgr-count { appearance: none; border: 1px solid var(--line, #262b34); background: transparent; cursor: pointer; border-radius: 999px; padding: 8px 10px 8px 14px; min-height: 40px; margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1.2 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--paper-3, #a3abba); white-space: nowrap; }
.pgr-count:hover, .pgr-count[aria-expanded="true"] { background: var(--ink-3, #171a21); color: var(--paper, #eef1f4); border-color: #3a414d; }
.pgr-count .chev { width: 16px; height: 16px; flex: none; transition: transform .18s ease; }
.pgr-count[aria-expanded="true"] .chev { transform: rotate(180deg); }
.pgr-count b { color: var(--hero, #b48cff); font-weight: 600; }
.pgr-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; pointer-events: none; }
.pgr-bar i { display: block; height: 100%; width: 0; background: var(--hero, #b48cff); transition: width .3s ease; }

/* ---- the page area (the lesson side panel is gone, 2026-10-13: the header's Page n / N dropdown is the only page list) ---- */
.pgr-shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--pgr-head)); }


.pgr-stage { flex: 1 1 auto; min-width: 0; position: relative; overflow-x: clip; }

/* ---- pages: one visible at a time. The others stay in the page (so a host can still list them and
   a page's script still finds its parts) but take no room and cannot be reached. ---- */
.pgr-stage > .pgr-page { border-top: 0; padding: clamp(28px, 5vw, 56px) 0 clamp(40px, 6vw, 72px); }
.pgr-stage > .pgr-page:not(.is-current) { position: absolute; left: 0; top: 0; width: 100%; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
.pgr-stage > .pgr-page.is-current { position: relative; animation: lpInR .3s ease both; }
.pgr-stage.is-back > .pgr-page.is-current { animation-name: lpInL; }
@keyframes lpInR { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes lpInL { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pgr-stage > .pgr-page.is-current { animation: none; } .pgr-bar i { transition: none; } }

/* ---- Continue, at the end of each page ---- */
.pgr-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line, #262b34); }
.pgr-next { min-height: 48px; padding: 12px 26px; border: 0; border-radius: 10px; cursor: pointer; background: var(--I, #39d7ff); color: #04222b;
  font: 600 15px/1 "IBM Plex Mono", monospace; letter-spacing: .02em; }
.pgr-next:hover { filter: brightness(1.08); }
.pgr-next:focus-visible, .pgr-back:focus-visible, .pgr-skip:focus-visible { outline: 2.5px solid var(--hero, #b48cff); outline-offset: 3px; }
.pgr-next[hidden] { display: none !important; }
.pgr-back, .pgr-skip { border: 0; background: transparent; cursor: pointer; color: var(--paper-2, #d3d8e0); font: 500 15px/1 "IBM Plex Mono", monospace; padding: 12px 6px; min-height: 44px; text-decoration: underline; text-underline-offset: 4px; }
.pgr-back:hover, .pgr-skip:hover { color: var(--paper, #eef1f4); }

/* ---- phones ---- */
@media (max-width: 720px) {
  .pgr-count .lab-short { display: none; }
  .pgr-ident .t { font-size: 16px; }
}
.pgr-page:focus, .pgr-page:focus-visible { outline: none; }
/* New paged lessons use the native hidden attribute; the older player contract stays intact. */
html[data-lesson-mode="paged"] .pgr-stage > .pgr-page[hidden] { display: none !important; }
html[data-lesson-mode="paged"] .pgr-skip[hidden] { display: none !important; }
/* lesson-flow.js adds 40vh of empty room under a lesson that has a knowledge check, so text below the check never
   moves it. A paged lesson shows one page at a time, so that room is an empty gap under every page: gone, and only the
   check page keeps some. */
html.pgr-on body::after { display: none !important; content: none !important; }
.pgr-stage > .pgr-page.pgr-keeproom { padding-bottom: 26vh; }


/* ---- the page menu: drops from the header (a full-width sheet on a phone) ---- */
.pgr-pm { --pm-acc: var(--R, var(--hero, #b48cff)); --pm-tick: var(--I, #39d7ff);
  position: fixed; z-index: 70; right: 8px; top: calc(var(--pgr-head) + 6px); width: min(460px, calc(100vw - 16px)); max-height: calc(100vh - var(--pgr-head) - 20px); max-height: calc(100dvh - var(--pgr-head) - 20px);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid #2f3643; border-radius: 14px; background: #0f1218; color: var(--paper, #eef1f4);
  box-shadow: 0 22px 60px rgba(0,0,0,.6), 0 2px 0 rgba(255,255,255,.03) inset; animation: pmIn .16s ease both; }
.pgr-pm[hidden], .pgr-pm-scrim[hidden] { display: none !important; }
@keyframes pmIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pm-prog { flex: none; height: 3px; background: #1b2029; }
.pm-prog i { display: block; height: 100%; width: 0; background: var(--pm-acc); transition: width .3s ease; }
.pm-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 8px 8px 18px; }
.pm-h { font: 500 11px/1.2 "IBM Plex Mono", monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--pm-acc); }
.pm-s { margin-left: auto; font: 500 12px/1.2 "IBM Plex Mono", monospace; letter-spacing: .06em; color: var(--paper-3, #a3abba); }
.pm-x { appearance: none; flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; cursor: pointer; background: transparent; color: var(--paper-3, #a3abba); }
.pm-x:hover { background: var(--ink-3, #171a21); color: var(--paper, #eef1f4); }
.pm-x svg { width: 18px; height: 18px; }
.pm-list { list-style: none; margin: 0; padding: 2px 8px 10px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pm-list li { margin: 0; padding: 0; }
.pm-row { appearance: none; width: 100%; min-height: 48px; display: flex; align-items: center; gap: 14px; padding: 8px 12px; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
  background: transparent; color: var(--paper-2, #c6ccd6); font: 500 15px/1.3 "IBM Plex Sans", system-ui, sans-serif; }
.pm-row:hover { background: var(--ink-3, #171a21); color: var(--paper, #eef1f4); }
.pm-row:focus-visible { outline: 2px solid var(--I, #39d7ff); outline-offset: -2px; background: var(--ink-3, #171a21); }
.pm-n { flex: none; width: 26px; font: 500 12px/1 "IBM Plex Mono", monospace; letter-spacing: .06em; color: var(--paper-3, #a3abba); }
.pm-t { flex: 1 1 auto; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.pm-m { flex: none; width: 16px; height: 16px; position: relative; }
.pm-row.is-seen .pm-n { color: var(--pm-tick); }
.pm-row.is-seen .pm-m::after { content: ""; position: absolute; left: 3px; top: 2px; width: 9px; height: 5px; border-left: 2px solid var(--pm-tick); border-bottom: 2px solid var(--pm-tick); transform: rotate(-45deg); opacity: .8; }
.pm-row.is-here { background: color-mix(in srgb, var(--pm-acc) 14%, #0f1218); color: var(--paper, #eef1f4); font-weight: 600; box-shadow: inset 3px 0 0 var(--pm-acc); }
.pm-row.is-here .pm-n { color: var(--pm-acc); }
.pm-row.is-here .pm-m::after { content: ""; position: absolute; left: 4px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--pm-acc); }
/* in progress / completed icons: a half-filled ring for a page opened but not finished, a check for one read through */
.pm-row.is-started .pm-m::after { content: ""; position: absolute; left: 1px; top: 1px; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--pm-acc); background: linear-gradient(90deg, var(--pm-acc) 50%, transparent 50%); transform: none; opacity: 1; }
.pm-row.is-done .pm-n { color: var(--pm-tick); }
.pm-row.is-done .pm-m::after { content: ""; position: absolute; left: 3px; top: 2px; width: 9px; height: 5px; border: 0; border-radius: 0; background: none; border-left: 2px solid var(--pm-tick); border-bottom: 2px solid var(--pm-tick); transform: rotate(-45deg); opacity: 1; }
.pgr-pm-scrim { display: none; }
@media (max-width: 720px) {
  .pgr-pm { left: 0; right: 0; top: var(--pgr-head); width: auto; max-height: calc(100vh - var(--pgr-head)); max-height: calc(100dvh - var(--pgr-head)); border-width: 0 0 1px; border-radius: 0 0 18px 18px; animation-name: pmInP; }
  .pm-list { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .pm-row { min-height: 52px; font-size: 16px; }
  .pgr-pm-scrim { display: block; position: fixed; inset: var(--pgr-head) 0 0 0; z-index: 65; background: rgba(0,0,0,.55); }
  .pgr-count { padding: 8px 2px 8px 6px; gap: 2px; border-color: transparent; letter-spacing: .04em; font-size: 11.5px; }
  .pgr-count .chev { width: 14px; height: 14px; }
}
@keyframes pmInP { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pgr-pm { animation: none; } .pm-prog i, .pgr-count .chev { transition: none; } }
@media print { .pgr-pm, .pgr-pm-scrim { display: none !important; } }

/* ---- inside the course player: its top bar carries the lesson title and the page list, so the lesson draws no header of its own ---- */
html.pgr-headless { --pgr-head: 0px; }
html.pgr-headless .pgr-head, html.pgr-headless .pgr-pm, html.pgr-headless .pgr-pm-scrim { display: none !important; }
/* inside the course map this header is the page's only one: the way back to the map sits at its left */
.pgr-home { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px 0 4px; margin-right: 4px; border-right: 1px solid var(--rule, #262b35);
  color: var(--paper-2, #c6ccd6); text-decoration: none; font: 500 12px/1 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.pgr-home:hover { color: var(--paper, #eef1f4); }
.pgr-home:focus-visible { outline: 2px solid var(--I, #39d7ff); outline-offset: -2px; }
.pgr-home svg { width: 18px; height: 18px; }
@media (max-width: 420px) { .pgr-home-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* Completion gating (2026-10-13): Continue waits until the page is complete; the note says what is left. */
.pgr-next.is-locked { background: var(--ink-3, #171a21); color: var(--paper-3, #a3abba); box-shadow: inset 0 0 0 1px var(--line, #262b34); cursor: not-allowed; filter: none; }
.pgr-need { flex: 1 1 100%; order: 3; margin: 0; font: 500 14px/1.45 "IBM Plex Mono", monospace; color: var(--paper-3, #a3abba); }
.pgr-need[hidden] { display: none; }
.pgr-need.is-nudge { color: var(--paper, #eef1f4); animation: pgrNudge .35s ease; }
@keyframes pgrNudge { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .pgr-need.is-nudge { animation: none; } }
/* page menus: a tick only for a completed page; opened but not complete is "in progress" (a hollow ring); past the first incomplete page is locked */
/* Not completed (viewed or skipped, not finished): a clear open warning ring, never a tick (Nick, 2026-10-15) */
.pm-row.is-progress .pm-m::after { content: "!"; position: absolute; left: 0; top: 0; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--pm-warn, #f2a33a); background: none; transform: none; opacity: 1; color: var(--pm-warn, #f2a33a); font: 800 10px/12px system-ui, sans-serif; text-align: center; }
.pm-row.is-progress .pm-n { color: var(--pm-warn, #f2a33a); }
.pm-row.is-locked { opacity: .5; cursor: not-allowed; }
