/* ============================================================
   The International Skool of Forecasting — student portal
   Single consolidated stylesheet. Organised top-down:
     1. Tokens
     2. Reset + base typography
     3. Shell — masthead, subnav, school footer
     4. Component primitives — buttons, fields, cards, badges, progress
     5. Screen + page-header + utilities
     6. Auth + verify + error shells
     7. Dashboard
     8. Course landing
     9. Lesson page (outline + content blocks)
    10. Exam + result
    11. Certificate display
    12. Admin (panel, learner detail, builder, composer, exam editor)
    13. Settings
    14. Empty states
    15. Responsive
   Print certificate styles live in cert-print.css.
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  /* Brand */
  --ink:        #1a1916;
  --paper:      #f6f2e9;
  --paper-alt:  #ede7d8;
  --paper-deep: #e3dbc8;
  --muted:      #7a7468;
  --accent:     #7a1f1c;
  --red:        #7a1f1c;
  --pass:       #2d6a4f;
  --serif:      'EB Garamond', Georgia, serif;
  --mono:       'Courier Prime', monospace;

  /* Spacing — 4px grid. Small units stay fixed (touch targets, inline
     gaps). Large units use clamp() so heroes and section breaks feel
     proportional on giant canvases without looking cavernous on
     phones. Min/max anchored to ~360px phone and ~3840px 4K. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: clamp(18px, 0.4vw + 14px, 28px);
  --s5: clamp(28px, 0.8vw + 18px, 44px);
  --s6: clamp(40px, 1.2vw + 24px, 68px);
  --s7: clamp(56px, 1.8vw + 32px, 104px);

  /* Type scale — every size scales fluidly via clamp() so the design
     stays "pixel perfect" on every display from a 360px phone to a
     3840px 4K monitor. The previous mix of fixed sizes and partial
     clamp() left body text looking tiny on big screens. Now mono,
     body and headings all expand smoothly with the viewport, with
     min/max chosen so phone legibility is preserved and 4K reading
     distance is respected.
     Reference anchors:
       360px  (smallest phone)        — values land at the `min` floor
       1366px (laptop)                — landed on the historical "default"
       1920px (typical desktop)       — visual rhythm matches old fixed values
       3840px (4K)                    — values approach the `max` ceiling
     The slope (the middle `Xvw + Ypx` term) is what carries the curve. */
  /* Restrained scale: maxes tuned so a 1080p/4K reader sees professional
     reading sizes (~17-19px body) rather than billboard text. Phone mins
     preserve legibility. Display sizes stay grand for editorial heros but
     no longer dominate the page. */
  --t-mono-xs: clamp(10px, 0.10vw + 9px,  13px);
  --t-mono-sm: clamp(12px, 0.11vw + 10.5px, 14px);
  --t-mono-md: clamp(13px, 0.13vw + 11.5px, 16px);
  --t-body-xs: clamp(13px, 0.10vw + 12px, 15px);
  --t-body-sm: clamp(14px, 0.12vw + 12.5px, 16px);
  --t-body:    clamp(16px, 0.16vw + 14px, 19px);
  --t-body-lg: clamp(18px, 0.22vw + 15px, 22px);
  --t-h4:      clamp(17px, 0.30vw + 15px, 22px);
  --t-h3:      clamp(20px, 0.55vw + 16px, 28px);
  --t-h2:      clamp(25px, 0.95vw + 19px, 37px);
  --t-h1:      clamp(31px, 1.50vw + 23px, 52px);
  --t-display: clamp(40px, 2.30vw + 27px, 70px);

  /* Surface */
  --hairline:        1px solid rgba(26,25,22,0.12);
  --hairline-strong: 1px solid rgba(26,25,22,0.22);
  --rule-ink:        1px solid var(--ink);
  --rule-ink-heavy:  2px solid var(--ink);

  /* Chrome */
  --card-radius:        4px;
  --btn-radius:         3px;
  --badge-radius:       2px;
  --surface-radius-sm:  3px;
  --shadow-sm:   0 1px 2px rgba(26,25,22,0.04);
  --shadow-md:   0 2px 8px rgba(26,25,22,0.06), 0 1px 2px rgba(26,25,22,0.04);
  --shadow-lg:   0 8px 28px rgba(26,25,22,0.10);

  /* Scrollbars */
  --scrollbar-track: rgba(26,25,22,0.06);
  --scrollbar-thumb: rgba(26,25,22,0.28);
  --scrollbar-thumb-hover: rgba(26,25,22,0.44);

  /* Motion */
  --t-fast: 0.12s ease-out;
  --t-slow: 0.20s ease-out;

  /* Layout — content widths scale with the viewport but body text
     widths are anchored in `ch` so line-length stays readable as the
     font grows. The shell widens on 4K so the page doesn't sit in a
     narrow ribbon flanked by empty gutters. */
  /* FLUID CENTRED WIDTH SYSTEM.
     One family, all centred (margin-inline: auto at the call sites). Each
     grows with the viewport via the middle `vw` term and caps so it never
     reaches the edges. Phone → ~90-92vw (full-bleed, no side dead-space);
     1080p → comfortable centred columns with balanced margins; 4K → caps
     hit and the column centres with elegant margins. Fully fluid between.
     The named roles below are the canonical set; the legacy aliases keep
     existing consumers working without per-rule edits. */
  --screen-gutter:        clamp(18px, 3vw, 56px);
  --measure-wide:         clamp(320px, 92vw, 1280px);  /* page column, chrome, lists, admin */
  --measure-media:        clamp(320px, 86vw, 940px);   /* lesson video / media column */
  --measure-read:         clamp(320px, 82vw, 820px);   /* prose / reading column */
  --measure-hero:         clamp(320px, 68vw, 680px);   /* centred hero text block */
  --measure-card:         clamp(300px, 92vw, 440px);   /* auth / single-card screens */
  --measure-exam:         clamp(320px, 92vw, 1080px);  /* exam focus column */
  /* Roles + legacy aliases → one fluid family; older selectors stay valid. */
  --measure-page:         var(--measure-wide);
  --measure-app:          var(--measure-wide);
  --measure-cap-wide:     var(--measure-wide);
  --measure-editorial:    var(--measure-read);
  --measure-narrow:       var(--measure-card);
  --measure-lesson:       var(--measure-read);
  --measure-lesson-media: var(--measure-media);
  --measure-lesson-bleed: var(--measure-media);
  /* admin shell shares the global 1280 column so its content aligns with the
     masthead; dense tables keep their own overflow-x wrappers. */
  --chrome-masthead:      124px;          /* legacy full-masthead height (mobile popovers) */
  --chrome-mh-compact:    73px;           /* compact masthead — slight buffer above actual rendered height (~71-72px) so the sticky breadcrumb doesn't slip behind */
  --chrome-context-strip: 38px;           /* breadcrumb / kind label band incl. heavy border */
  --chrome-lesson-subnav: var(--chrome-context-strip);
  --chrome-lesson-top:    calc(var(--chrome-mh-compact) + var(--chrome-context-strip));

  /* Breakpoints
     NOTE: CSS @media doesn't accept custom properties, so these tokens
     exist as documentation only — the actual @media queries below use
     the same literal values. If you change a value here, change every
     matching @media query in the file. The canonical set:

       --bp-phone-sm:  360px   smallest supported phone (iPhone SE)
       --bp-phone:     480px   typical phone, portrait
       --bp-tablet:    768px   iPad portrait / large phone landscape
       --bp-laptop:    1024px  iPad landscape / small laptop
       --bp-desktop:   1280px  standard desktop
       --bp-wide:      1600px  large desktop / 27" iMac
       --bp-ultrawide: 1920px  full HD desktop and up
       --bp-4k:        2560px  4K / ultrawide

     Convention: mobile-first. Base styles target the smallest phone;
     @media (min-width: ...) progressively layers desktop affordances on
     top. Avoid @media (max-width: ...) for new rules — it inverts the
     mental model and conflicts with the mobile-first cascade. */
  --bp-phone-sm:  360px;
  --bp-phone:     480px;
  --bp-tablet:    768px;
  --bp-laptop:    1024px;
  --bp-desktop:   1280px;
  --bp-wide:      1600px;
  --bp-ultrawide: 1920px;
  --bp-4k:        2560px;
}

.dark-mode {
  --ink:        #f6f2e9;
  --paper:      #1a1916;
  --paper-alt:  #252320;
  --paper-deep: #2e2b26;
  --muted:      #9a9088;
  /* Lightened from #c44340: that shade measured ~3.5:1 against --paper,
     below WCAG AA for the small accent-coloured labels used throughout.
     #da6b67 measures ~5.3:1 as text on dark paper AND as a button fill
     under dark (--paper) label text. */
  --accent:     #da6b67;
  --hairline:        1px solid rgba(246,242,233,0.10);
  --hairline-strong: 1px solid rgba(246,242,233,0.18);
  --rule-ink:        1px solid var(--ink);
  --rule-ink-heavy:  2px solid var(--ink);
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:   0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 28px rgba(0,0,0,0.6);
  --scrollbar-track: rgba(246,242,233,0.06);
  --scrollbar-thumb: rgba(246,242,233,0.24);
  --scrollbar-thumb-hover: rgba(246,242,233,0.38);
}

/* The fluid clamp() width tokens above already cap and centre on 4K — no
   per-breakpoint measure recalibration needed. */


/* ---------- 2. RESET + BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--chrome-lesson-top);
}
body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--t-body);
  line-height: 1.55;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background var(--t-slow), color var(--t-slow);
}
html {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}
body,
.mh-account-menu,
.masthead-mobile,
.lesson-outline {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 3px solid transparent;
  background-clip: padding-box;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin: 0 0 var(--s3);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); }
h4 { font-size: var(--t-body); }
p { margin: 0 0 var(--s3); line-height: 1.6; }


/* ---------- 3. SHELL ---------- */
/* Shell containers — mobile-first.
   .app-shell is the outermost wrap; .main holds the page content. Both
   use min-width: 0 so flex/grid children can shrink below their content
   size on narrow screens (without it, a long word or unbreakable URL
   would cause horizontal overflow). Background is set at the root level
   so empty page states still show the brand paper, not white. */
.app-shell { display: block; min-height: 100vh; min-width: 0; background: var(--paper); }
.main      { display: block; min-width: 0; background: var(--paper); overflow-wrap: anywhere; }

/* Masthead — brand + primary nav */
.masthead {
  position: sticky; top: 0; z-index: 200;
  background: var(--paper);
  border-bottom: var(--rule-ink-heavy);
  transition: background var(--t-slow), border-color var(--t-slow);
}
.masthead-brand {
  display: flex; justify-content: center;
  padding: 16px var(--screen-gutter) 10px;
}
.masthead-brand-link {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.masthead-logo--landscape { display: none; }
.masthead-logo--symbol    { height: 38px; width: 38px; display: block; }
.masthead-wordmark {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 12px;
  border-left: var(--hairline);
}
.masthead-wordmark__small {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}
.masthead-wordmark__name {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  line-height: 1;
  font-weight: 500;
}
.masthead-wordmark__masters {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}
.dark-mode .masthead-logo--symbol { filter: invert(1) hue-rotate(180deg); }
/* Login / forgot-password / device-bind inline the brand SVG with
   hardcoded #1a1916 ink strokes. Without this rule those strokes
   stay dark in dark mode and the entire emblem becomes nearly
   invisible against --paper. Same invert+hue trick the masthead
   uses; safe here because the SVGs use the same palette. */
.dark-mode .login-brand svg { filter: invert(1) hue-rotate(180deg); }

/* topbar back link — small uppercased "← Section" link that sits in the
   topbar_left block of full-bleed pages (exam, exam_result, every admin
   editor). Extracted here so the style lives in one place instead of
   ten inline copies that drift independently. The variables make it
   dark-mode-safe automatically. */
.topbar-back-link {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.topbar-back-link:hover { color: var(--ink); }

.masthead-nav-row { border-top: var(--hairline); }
.masthead-nav-row__inner {
  max-width: var(--measure-cap-wide); margin: 0 auto;
  padding: 8px var(--screen-gutter);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
}
.masthead-nav { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.mnav-link {
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
}
.mnav-link:hover           { color: var(--ink); }
.mnav-link--active         { color: var(--ink); border-bottom-color: var(--ink); }
.mnav-link--admin          { color: var(--accent); }
.mnav-link--admin.mnav-link--active { border-bottom-color: var(--accent); }

.masthead-end { display: flex; align-items: center; gap: var(--s2); }
.mh-icon {
  width: 38px; height: 38px;
  padding: 0;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: var(--hairline-strong);
  border-radius: var(--btn-radius);
  color: var(--muted);
  transition: all var(--t-fast);
  cursor: pointer;
  box-sizing: border-box;
}
.mh-icon svg {
  width: 16px; height: 16px;
}
.mh-icon:hover { color: var(--ink); border-color: var(--ink); background: var(--paper-alt); }

.mh-account {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.mh-account-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px;
  padding: 0 12px 0 6px;
  background: transparent;
  border: var(--hairline-strong);
  border-radius: var(--btn-radius);
  font-family: var(--serif);
  font-size: var(--t-body-sm);
  color: var(--ink);
  list-style: none; cursor: pointer;
  transition: all var(--t-fast);
  box-sizing: border-box;
}
.mh-account-trigger::-webkit-details-marker { display: none; }
.mh-account-trigger:hover { border-color: var(--ink); background: var(--paper-alt); }
.mh-account-initials {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper);
  border-radius: 50%;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  text-transform: uppercase;
}
.mh-account-name {
  font-size: var(--t-body-sm);
  max-width: 18ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mh-account-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 240px;
  background: var(--paper);
  border: var(--rule-ink);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 210;
}
.mh-account-menu__head {
  padding: 8px 12px;
  border-bottom: var(--hairline);
  margin-bottom: 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.mh-account-menu__name  { font-size: var(--t-body-sm); font-weight: 500; }
.mh-account-menu__email { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.08em; color: var(--muted); }
.mh-account-menu__item {
  display: flex; align-items: center;
  min-height: 44px; padding: 8px 12px;
  font-size: var(--t-body-sm); color: var(--ink);
  border-radius: 2px;
  transition: background var(--t-fast);
}
.mh-account-menu__item:hover { background: var(--paper-alt); }
.mh-account-menu__item--danger { color: var(--accent); }
.mh-account-menu hr { margin: 4px 0; border: 0; border-top: var(--hairline); }

.mh-mobile-toggle {
  display: none;
  width: 34px; height: 34px;
  background: transparent;
  border: var(--hairline-strong);
  border-radius: var(--btn-radius);
  color: var(--ink);
  align-items: center; justify-content: center;
}
.masthead-mobile {
  display: none;
  position: fixed;
  inset: 109px var(--s3) auto auto;
  width: min(340px, calc(100vw - (var(--s3) * 2)));
  z-index: 205;
}
.masthead-mobile.is-open { display: block; }
.masthead-mobile__panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--paper);
  border: var(--rule-ink);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
}
.masthead-mobile__label {
  padding: 8px 14px 10px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.masthead-mobile .mnav-link {
  padding: 12px 14px;
  border-bottom: 1px dotted rgba(26,25,22,0.14);
}
.masthead-mobile .mnav-link:last-child { border-bottom: 0; }
body.mobile-nav-open,
body.lesson-outline-open { overflow: hidden; }
body.mobile-nav-open::before,
body.lesson-outline-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(26,25,22,0.18);
  backdrop-filter: blur(2px);
  z-index: 190;
}

/* Subnav — contextual breadcrumb strip */
.subnav { background: var(--paper); border-bottom: var(--hairline); }
.subnav-inner {
  max-width: var(--measure-cap-wide); margin: 0 auto;
  padding: 8px var(--screen-gutter);
  min-height: 36px;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
}
.subnav-context {
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  flex-wrap: wrap;
}
.subnav-context a { color: var(--muted); transition: color var(--t-fast); }
.subnav-context a:hover { color: var(--ink); }
.subnav-actions { display: flex; align-items: center; gap: var(--s2); }

/* On the lesson page, drop the centred 1600px container so the curriculum
   toggle and breadcrumb sit flush with the outline panel below — matching
   its 16px content inset rather than the 64px wide-screen gutter. */
.main:has(> .lesson-shell) .subnav-inner {
  max-width: none;
  padding-left: var(--s3);
  padding-right: var(--s3);
  justify-content: flex-start;
  gap: var(--s3);
}

/* School footer */
.school-footer {
  border-top: var(--rule-ink-heavy);
  background: var(--paper);
  margin-top: var(--s7);
  padding: var(--s4) var(--screen-gutter);
}
.school-footer-inner {
  max-width: var(--measure-cap-wide); margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
}
.school-footer-brand { display: flex; align-items: center; min-width: 0; }
.school-footer-name { font-family: var(--serif); font-size: var(--t-body-lg); font-weight: 500; }
.school-footer-meta {
  display: flex; align-items: center; gap: var(--s3);
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}
.school-footer-meta a { display: inline-block; color: var(--muted); border-bottom: 1px solid transparent; }
.school-footer-meta a:hover { color: var(--ink); border-bottom-color: var(--ink); }
body:has(.login-shell) .school-footer,
body:has(.cert-shell)  .school-footer,
body:has(.error-shell) .school-footer { display: none; }


/* ---------- 4. COMPONENT PRIMITIVES ---------- */

/* Screen-reader-only text. Conveys state that is otherwise expressed only
   visually (e.g. the outline progress dots). */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Layout/control utilities shared by auth + interstitial pages. */
.bind-phase--centered { text-align: center; }
.login-links--split { display: flex; justify-content: space-between; align-items: center; }
.form-inline { margin: 0; display: inline; }
.btn-linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: inherit;
  color: var(--accent); text-decoration: underline;
}

/* Admin "view as student" banner — pinned above all chrome so the admin
   never forgets gating is being applied to their own browsing. */
.preview-banner {
  display: flex; align-items: center; justify-content: center; gap: var(--s3);
  flex-wrap: wrap;
  padding: 8px var(--s3);
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.preview-banner__btn {
  background: none; border: 1px solid var(--paper); border-radius: 3px;
  padding: 3px 10px; cursor: pointer;
  color: var(--paper); font-family: inherit; font-size: inherit;
  letter-spacing: inherit; text-transform: inherit;
}
.preview-banner__btn:hover { background: rgba(246,242,233,0.15); }

/* Buttons
   Touch target minimum 44x44 (WCAG 2.5.5) — applied via min-height. Desktop
   visually still looks compact because text + padding rarely exceeds 44px
   anyway; this just sets the floor for mobile/touch users where mis-taps
   were previously easy. .btn--sm relaxes to 36px (acceptable for dense
   admin tables where rows already separate the targets visually). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  padding: 12px 18px;
  font-family: var(--mono); font-size: var(--t-mono-md);
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--btn-radius);
  text-decoration: none;
  transition: all var(--t-fast);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover  { background: rgba(26,25,22,0.85); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.dark-mode .btn:hover { background: rgba(246,242,233,0.86); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mnav-link:focus-visible,
.mh-icon:focus-visible,
.mh-account-trigger:focus-visible,
.course-card:focus-visible,
.lesson-row:focus-visible,
.outline-lesson:focus-visible,
.lesson-nav-card:focus-visible,
.lesson-nav-submit:focus-visible,
.lblock-download-card:focus-visible,
.cert-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
 
.btn--outline {
  background: transparent; color: var(--ink); border-color: var(--ink); box-shadow: none;
}
.btn--outline:hover { background: var(--paper-alt); }
.dark-mode .btn--outline { color: var(--ink); border-color: var(--ink); }
.dark-mode .btn--outline:hover { background: var(--paper-alt); }
 
.btn--ghost { background: transparent; color: var(--ink); border-color: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--paper-alt); transform: translateY(-1px); }
 
.btn--accent { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.btn--accent:hover { background: rgba(122,31,28,0.88); }
.dark-mode .btn--accent:hover { background: rgba(218,107,103,0.88); }
 
.theme-icon--sun { display: none; }
.dark-mode .theme-icon--moon { display: none; }
.dark-mode .theme-icon--sun { display: block; }
 
.btn--danger { background: transparent; color: var(--accent); border-color: var(--accent); box-shadow: none; }
.btn--danger:hover { background: rgba(122,31,28,0.06); }
 
.btn--xs { min-height: 30px; padding: 6px 10px; font-size: var(--t-mono-xs); letter-spacing: 0.12em; }
.btn--sm { min-height: 36px; padding: 8px 14px; font-size: var(--t-mono-sm); letter-spacing: 0.12em; }
.btn--block { width: 100%; }

/* Form fields */
.field { margin-bottom: var(--s3); }
.field-label, .field label {
  display: block; margin-bottom: 6px;
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.field-input, .input {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--serif); font-size: var(--t-body);
  background: var(--paper);
  border: 1px solid rgba(26,25,22,0.22);
  border-radius: var(--btn-radius);
  color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field-input:hover, .input:hover { border-color: var(--ink); }
.field-input:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,31,28,0.15); }
.field-input--code { font-family: var(--mono); letter-spacing: 0.10em; text-transform: uppercase; }
.field-input--mono { font-family: var(--mono); font-size: var(--t-mono-md); }
.field-input--sm { padding: 6px 9px; font-size: var(--t-body-xs); }
.admin-grant-window {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s2);
  flex-wrap: wrap;
}
.admin-field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 140px;
}
.admin-field-inline__label {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
textarea.field-input { line-height: 1.55; padding: clamp(8px, 0.6vw, 14px) clamp(10px, 0.8vw, 18px); resize: vertical; }
select.field-input, select.input {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%231a1916' stroke-width='1.5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.dark-mode .field-input, .dark-mode .input { background: var(--paper-alt); border-color: rgba(246,242,233,0.20); }

/* Common label utility (kicker above headings) */
.label {
  display: block; margin-bottom: var(--s1);
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}

/* Rules / dividers */
.rule       { border: 0; border-top: var(--hairline); margin: var(--s4) 0; }
.rule--dot  { border-top: 1px dotted rgba(26,25,22,0.30); }
.rule--heavy{ border-top: var(--rule-ink-heavy); }

/* Badges */
.module-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px;
  background: var(--paper-alt);
  border: var(--hairline);
  border-radius: var(--badge-radius);
  white-space: nowrap;
}
.module-badge--pass { color: var(--accent); border-color: var(--accent); background: transparent; }

.group-badge {
  display: inline-block;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: var(--badge-radius);
}

/* Progress bar */
.progress-wrap {
  height: 4px;
  background: rgba(26,25,22,0.10);
  border-radius: 2px;
  overflow: hidden;
}
.dark-mode .progress-wrap { background: rgba(246,242,233,0.12); }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.3s ease-out; }
.progress-pct {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-top: 6px;
}
.progress-pct--complete { color: var(--accent); }

/* Stat grid (used in dashboard hero, course ledger).
   "Ledger" treatment: 1px-gap with the grid background showing through as
   hairline separators between cells — feels like a typographic record,
   not a row of tiles. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(26,25,22,0.14);
}
.dark-mode .stat-grid { background: rgba(246,242,233,0.10); }
.stat-cell {
  background: var(--paper-alt);
  padding: var(--s2) var(--s3);
  min-height: clamp(80px, 8vh, 140px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dark-mode .stat-cell { background: var(--paper-deep); }
.stat-cell strong {
  display: block;
  font-family: var(--serif); font-size: var(--t-h2); font-weight: 400;
  color: var(--ink);
  line-height: 1; margin-bottom: 4px;
}
.stat-cell span {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}

/* Status messages */
/* .login-error / .flash-ok are styled as live regions in markup via
   role="alert" so screen readers announce password failures, reset
   success, etc. Without that role, AT users get no feedback after
   submitting a form that returned an error. */
.login-error {
  background: rgba(122,31,28,0.08);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 14px;
  font-size: var(--t-body-sm); line-height: 1.5;
  margin-bottom: var(--s2);
  border-radius: var(--surface-radius-sm);
}
.flash-ok {
  background: rgba(45,106,79,0.08);
  border: 1px solid var(--pass);
  color: #1b4332;
  padding: 10px 14px;
  font-size: var(--t-body-sm); line-height: 1.5;
  margin-bottom: var(--s2);
  border-radius: var(--surface-radius-sm);
}
.code-block {
  font-family: var(--mono); font-size: var(--t-mono-md);
  word-break: break-all;
  padding: 14px 16px;
  border: var(--rule-ink);
  background: var(--paper-alt);
  border-radius: var(--surface-radius-sm);
}


/* ---------- 5. SCREEN + UTILITIES ---------- */
/* Screen — the standard page wrapper.
   Mobile-first: full-width on phone with --screen-gutter padding
   (clamp(20px, 4vw, 64px) gives 20px on phones, ~50px on laptops,
   capped 64px on wider). Inner content caps at --measure-app (1280px)
   so it doesn't stretch end-to-end on big screens. The --admin variant
   trades the editorial measure cap for a wider --measure-cap-wide
   (1600px) ceiling — admin tables need horizontal room, but they
   shouldn't sprawl across a 4K monitor. */
.screen {
  display: block;
  width: 100%;
  max-width: var(--measure-app);
  margin: 0 auto;
  padding: var(--s5) var(--screen-gutter) var(--s6);
  min-height: calc(100vh - 200px);
  min-width: 0;
}
.screen.screen--admin  { max-width: var(--measure-cap-wide); padding: var(--s4) var(--screen-gutter) var(--s6); }
.screen.screen--lesson { padding: 0; max-width: none; margin: 0; }
.screen.screen--full   { max-width: none; }
.screen-stack          { width: 100%; max-width: var(--measure-editorial); margin: 0 auto; }
.screen-stack--narrow  { max-width: var(--measure-narrow); }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--s3);
  padding-top: var(--s3);
  border-top: var(--hairline);
}
.section-head .label { margin-bottom: 0; }
.section-head__note {
  color: var(--muted);
  font-style: italic;
  font-size: var(--t-body-xs);
}
.section-head__note--mono {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-style: normal;
}

/* Page header */
.page-header {
  border-bottom: var(--rule-ink-heavy);
  padding: var(--s4) 0;
  margin-bottom: var(--s4);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) auto;
  gap: var(--s4);
  align-items: end;
}
.page-header h1 { font-size: clamp(28px, 3.6vw, var(--t-display)); line-height: 1.05; margin: 0; letter-spacing: -0.005em; }
.page-header__deck {
  color: var(--muted);
  font-style: italic;
  font-size: var(--t-body);
  line-height: 1.55;
  margin: var(--s2) 0 0;
  max-width: 60ch;
}

/* Utilities */
.muted   { color: var(--muted); }
.italic  { font-style: italic; }
.text-accent { color: var(--accent); }
.text-xs { font-size: var(--t-body-xs); }
.flex-row     { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.flex-center  { justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.grid-2up { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.grid-2up > .field { margin-bottom: 0; }
.mt-1 { margin-top: var(--s1); } .mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); } .mt-5 { margin-top: var(--s5); } .mt-6 { margin-top: var(--s6); }
.mb-1 { margin-bottom: var(--s1); } .mb-2 { margin-bottom: var(--s2); } .mb-3 { margin-bottom: var(--s3); }
.mb-4 { margin-bottom: var(--s4); } .mb-5 { margin-bottom: var(--s5); } .mb-6 { margin-bottom: var(--s6); }
.link-label {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.topbar-kicker,
.topbar-link {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.topbar-link:hover,
.topbar-current { color: var(--ink); }
.topbar-trail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-sep {
  color: var(--muted);
  font-size: var(--t-mono-md);
}
.topbar-current {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.topbar-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px; /* .btn--xs step of the button padding scale */
  border: var(--hairline-strong);
  border-radius: var(--btn-radius);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.topbar-tool:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--paper-alt);
}
.topbar-tool__label { white-space: nowrap; }

/* Curriculum toggle — sits inline at the start of the breadcrumb as a
   quiet borderless hamburger icon. No box, no label, just a tap target.
   Only visible when the sidebar is closed/collapsed and the user needs
   a way back in. */
.topbar-tool--outline {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-right: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 2px;
  transition: color var(--t-fast), background var(--t-fast);
}
.topbar-tool--outline:hover {
  color: var(--ink);
  background: rgba(26,25,22,0.06);
}
.dark-mode .topbar-tool--outline:hover { background: rgba(246,242,233,0.08); }
.topbar-tool--outline .topbar-tool__label { display: none; }

/* Desktop: sidebar is open by default; surface the toggle only after
   the user has collapsed it. */
@media (min-width: 981px) {
  #main:has(.lesson-outline.collapsed) .topbar-tool--outline,
  #main:has(.lesson-outline.is-collapsed) .topbar-tool--outline {
    display: inline-flex;
  }
}

/* Mobile: sidebar is closed by default (slides over). Show the toggle
   unless the sidebar is currently open. */
@media (max-width: 980px) {
  .topbar-tool--outline { display: inline-flex; }
  #main:has(.lesson-outline.open) .topbar-tool--outline { display: none; }
}
.topbar-link:hover,
.app-inline-link:hover { color: var(--ink); }
.app-inline-link {
  color: var(--muted);
  text-decoration: none;
}


/* ---------- 6. AUTH + VERIFY + ERROR ---------- */
/* Auth shell — mobile-first centered card.
   Mobile: vertically centered with --s4 padding. On phones where the
   keyboard rises (form focus), align-items: center can hide the form
   under the keyboard; the existing 720px override at the bottom of
   this file switches to align-items: flex-start to compensate. */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  padding: var(--s4);
  min-width: 0;
}
.login-box { width: 100%; max-width: 400px; min-width: 0; }
.login-spinner {
  display: flex; justify-content: center; align-items: center;
  height: 48px;
  margin-top: var(--s3);
}
.login-spinner__dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  animation: login-spinner-pulse 1s ease-in-out infinite;
}
@keyframes login-spinner-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.1); }
}
.login-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s2); margin-bottom: var(--s4);
}
.login-brand-title {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); text-align: center;
}
.login-brand-name {
  font-family: var(--serif); font-size: var(--t-h2); font-weight: 500;
  text-align: center;
}
.login-brand-name em { font-style: italic; font-weight: 400; }
.login-card {
  border: var(--rule-ink);
  background: var(--paper);
  border-radius: var(--card-radius);
  padding: var(--s5);
  box-shadow: var(--shadow-md);
}
.dark-mode .login-card { background: var(--paper-alt); }
.auth-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.2;
  margin: 6px 0 var(--s2);
}
.auth-copy {
  font-family: var(--serif);
  font-size: var(--t-body);
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
}
.auth-copy--compact { font-size: var(--t-body-sm); margin-bottom: var(--s3); }
.auth-note {
  font-family: var(--serif);
  font-size: var(--t-body-xs);
  font-style: italic;
  color: var(--muted);
}
.claim-name-note { margin-top: -6px; margin-bottom: var(--s3); }
.login-footer { display: flex; flex-direction: column; align-items: center; gap: var(--s2); margin-top: var(--s4); }
.login-footer-rule  { display: block; width: 60%; height: 1px; background: rgba(26,25,22,0.18); margin: 0 auto; }
.login-footer-mark  { color: var(--accent); }
.login-footer-line  { font-family: var(--serif); font-size: var(--t-body-xs); }
.login-footer-sub {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}
.login-footer-link {
  display: block; margin-top: var(--s2); text-align: center;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.login-footer-link:hover { color: var(--ink); }

/* Recovery codes screen */
.codes-shell { max-width: 680px; margin: var(--s5) auto; padding: 0 var(--s4); }
.codes-card {
  border: var(--rule-ink);
  background: var(--paper);
  border-radius: var(--card-radius);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
}
.codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); margin: var(--s3) 0; }
.codes-grid code { font-family: var(--mono); font-size: var(--t-mono-md); letter-spacing: 0.08em; padding: 8px 12px; background: var(--paper-alt); border: var(--hairline-strong); display: block; text-align: center; }
.codes-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); }
.codes-copy-status { min-height: 1.3em; margin-top: var(--s2); }
.codes-intro { margin-top: var(--s1); }
.codes-fineprint { margin-top: var(--s3); font-size: var(--t-body-xs); }

/* Error shell */
.error-shell {
  max-width: 540px;
  margin: 96px auto;
  padding: 0 var(--s4);
  text-align: center;
}
.error-code {
  font-family: var(--mono);
  font-size: var(--t-mono-md); letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  display: block; margin-bottom: var(--s3);
}
.error-shell h1 { font-style: italic; }
.error-actions { justify-content: center; }

/* Prerequisite-locked page: actionable rows under the error shell. */
.prereq-list { display: flex; flex-direction: column; gap: var(--s2); text-align: left; }
.prereq-list__row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3); border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; color: var(--ink); background: var(--paper);
  transition: border-color 0.15s ease;
}
.prereq-list__row:hover { border-color: var(--accent); }
.prereq-list__title { display: block; font-family: var(--serif); font-size: var(--t-body-lg); }
.prereq-list__status {
  display: block; margin-top: 2px;
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-xs); color: var(--muted);
}
.prereq-list__action {
  white-space: nowrap; font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
}
.account-back {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.account-back:hover { color: var(--ink); }


/* ---------- 7. DASHBOARD ---------- */
/* Hero: welcome heading on the left, study ledger panel on the right.
   Bottom rule separates the hero from the continue card below. */
.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(320px, 0.95fr);
  gap: var(--s6);
  align-items: center;
  padding-bottom: var(--s4);
  margin-bottom: var(--s4);
  border-bottom: 2px solid var(--ink);
}
.dash-hero__intro {
  min-width: 0;
}
.dash-hero h1 {
  font-size: clamp(34px, 5vw, 72px);
  line-height: 1.02;
  max-width: 16ch;
  margin: 0 0 var(--s2);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.dash-hero__deck {
  color: var(--muted);
  font-style: italic;
  max-width: 62ch;
  font-size: var(--t-body-lg);
  line-height: 1.65;
  text-wrap: pretty;
}
.dash-hero__panel {
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s3);
  box-shadow: none;
}
.dash-hero__panel-label { margin-bottom: var(--s2); }

/* Continue studying: 2-col grid — narrative copy on the left, action card on the right */
.dash-continue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 420px);
  gap: var(--s3);
  align-items: stretch;
  margin-bottom: var(--s5);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.dash-continue::before { content: none; }
.dash-continue-copy {
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s3);
  text-align: left;
}
.dash-continue-copy .label { margin-bottom: var(--s1); }
.dash-continue-copy h2 {
  font-size: var(--t-h3);
  margin: 0 0 var(--s1);
  letter-spacing: -0.01em;
}
.dash-continue-copy__meta {
  color: var(--muted);
  font-style: italic;
  font-size: var(--t-body);
}
.dash-continue-copy .progress-wrap {
  max-width: none;
  margin-inline: 0;
}
.dash-continue-action {
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: var(--ink);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.dash-continue-action:hover {
  background: var(--paper-deep);
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.dash-continue-action .label { margin-bottom: var(--s2); }
.dash-continue-action strong {
  display: block;
  font-family: var(--serif);
  font-size: var(--t-h3);
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
  margin: var(--s2) 0;
}
.dash-continue-action .link-label {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--s4);
}
.course-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s3) var(--s3) var(--s4);
  text-decoration: none;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  min-height: 100%;
}
.course-card:hover { border-color: var(--ink); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.course-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s2);
}
/* Course card thumbnail. The SVG itself is background-less and uses
   currentColor — this rule paints the background and ink color so the
   thumbnail looks at home in either light (parchment) or dark mode. */
.course-card__thumb {
  width: 100%; aspect-ratio: 16/10;
  margin-bottom: var(--s3);
  background:
    radial-gradient(circle at 72% 18%, rgba(122,31,28,0.10), transparent 38%),
    linear-gradient(145deg, var(--paper-alt), var(--paper-deep));
  color: rgba(26,25,22,0.82);
  border: var(--hairline);
  border-radius: 2px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.dark-mode .course-card__thumb {
  background:
    radial-gradient(circle at 70% 20%, rgba(122,31,28,0.26), transparent 32%),
    linear-gradient(145deg, rgba(26,25,22,0.98), rgba(26,25,22,0.76));
  color: #e8e2d4;
  border-color: rgba(246,242,233,0.08);
}
.course-card__thumb svg { width: 78%; height: 78%; opacity: 0.92; }
.course-card__kicker {
  display: block; margin: 0;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}
.course-card__title {
  width: 100%;
  max-width: 100%;
  font-size: clamp(18px, 1.55vw, 23px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: pretty;
}
.course-card__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s2);
  margin-top: var(--s3);
}
.course-card .progress-wrap { width: 100%; }

/* Program tag chip — sits between the thumbnail and the kicker on a course
   card, naming the program/curriculum the course belongs to. */
.program-tag {
  display: inline-block;
  align-self: flex-start;
  margin: 0 0 var(--s2);
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--badge-radius);
  background: transparent;
  line-height: 1;
}

/* Locked / not-yet-enrolled course card — used in the "More from the Skool"
   upsell row. Muted, with a CTA in place of the progress bar. */
.course-card--locked {
  opacity: 0.82;
  transition: opacity var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast);
}
.dark-mode .course-card--locked { opacity: 0.9; }
.course-card--locked:hover { opacity: 1; }
.course-card__desc {
  max-width: 42ch;
  font-style: italic;
  color: var(--muted);
  font-size: var(--t-body-sm);
  line-height: 1.6;
  margin: 0;
  text-wrap: pretty;
}
.course-card__cta {
  margin-top: 0;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  align-self: flex-start;
}


/* ---------- 8. COURSE LANDING ---------- */
.course-hero {
  border-bottom: var(--rule-ink-heavy);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) clamp(300px, 26vw, 420px);
  gap: var(--s5);
  padding-bottom: var(--s5);
  margin-bottom: var(--s5);
  align-items: start;
}
.course-hero > div:first-child {
  min-width: 0;
}
.course-hero h1 {
  font-size: var(--t-display);
  line-height: 1.05;
  max-width: 16ch;
  margin: 0 0 var(--s3);
  letter-spacing: -0.01em;
}
.course-hero__desc {
  color: var(--muted);
  font-size: var(--t-body); font-style: italic;
  line-height: 1.6;
  max-width: 52ch;
}
.course-ledger {
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s4);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 128px;
}
.course-ledger__note {
  margin: var(--s3) 0 0;
  color: var(--muted);
  font-size: var(--t-body-sm);
  line-height: 1.55;
  font-style: italic;
}

.module-list { display: grid; gap: var(--s4); }
.module-card {
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s4);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--ink);
  opacity: 0.14;
}
.dark-mode .module-card { background: var(--paper-alt); }
.module-card--locked {
  opacity: 0.72;
  background: var(--paper-alt);
}
.module-card--locked::before { background: var(--muted); opacity: 0.24; }
.module-card__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--s3); margin-bottom: var(--s3);
}
.module-card__kicker {
  display: block; margin: 0 0 4px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.module-card__kicker strong { color: var(--accent); font-weight: 700; }
.module-card h2 { font-size: var(--t-h3); font-weight: 500; margin: 0; }
.module-state {
  margin-top: var(--s3); padding-top: var(--s2);
  border-top: 1px dotted rgba(26,25,22,0.18);
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.module-state--pass { color: var(--accent); }

.lesson-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s3);
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-top: var(--hairline);
  text-decoration: none;
  color: var(--ink);
  transition: background var(--t-fast);
}
.lesson-row:hover  { background: var(--paper-alt); padding-left: 14px; }
.lesson-row--done  { opacity: 1; }
.lesson-row--locked { opacity: 0.5; pointer-events: none; }
.lesson-row--exam  { background: rgba(122,31,28,0.04); padding-left: 10px; padding-right: 10px; }
.lesson-row__title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--t-body); line-height: 1.35;
}
.lesson-row__title svg { opacity: 1 !important; flex-shrink: 0; }
.lesson-row__status {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.lesson-row__status--done {
  color: var(--paper);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--badge-radius);
  padding: 3px 8px;
}

.cert-earned-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--accent);
  background: rgba(122,31,28,0.04);
  border-radius: var(--card-radius);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.cert-earned-banner__icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--paper);
  border-radius: 50%;
}
.cert-earned-banner__title {
  display: block;
  font-family: var(--serif);
  font-size: var(--t-h2);
  line-height: 1.1;
}
.cert-earned-banner__deck {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: italic;
}
.cert-earned-banner a { justify-self: end; }


/* ---------- 9. LESSON PAGE ---------- */
.lesson-shell {
  display: flex;
  min-height: max(600px, calc(100vh - 110px));
  overflow: visible;
}
.lesson-outline {
  flex: 0 0 300px;
  align-self: flex-start;
  position: sticky;
  top: var(--chrome-lesson-top);
  max-height: calc(100vh - var(--chrome-lesson-top) - var(--s2));
  background: var(--paper-alt);
  border-right: var(--hairline);
  overflow-y: auto;
  /* Soft-fade the bottom edge so a long curriculum dissolves into the
     gutter instead of being guillotined mid-row at the viewport edge.
     The fade only shows while there's more to scroll (the mask sits at the
     very bottom of the scroll content). */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent 100%);
  transition: flex-basis var(--t-slow), opacity var(--t-slow);
  scrollbar-width: thin;
  scrollbar-color: var(--rule-ink, rgba(0,0,0,0.1)) transparent;
}
.lesson-outline::-webkit-scrollbar {
  width: 6px;
}
.lesson-outline::-webkit-scrollbar-track {
  background: transparent;
}
.lesson-outline::-webkit-scrollbar-thumb {
  background: var(--rule-ink, rgba(0,0,0,0.1));
  border-radius: 3px;
}
.lesson-outline::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
/* Outline collapse — JS toggles .collapsed; we shrink the rail to 0 width
   and fade so the content column gets the reclaimed space. */
.lesson-outline.collapsed,
.lesson-outline.is-collapsed {
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  padding: 0;
  border-right: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.lesson-outline-head {
  padding: var(--s3);
  border-bottom: var(--hairline);
}
.lesson-outline-head-row { display: flex; justify-content: space-between; align-items: center; }
.lesson-outline-kicker { margin: 0; }
.lesson-outline-title { font-family: var(--serif); font-size: var(--t-body); font-weight: 500; margin-top: 4px; line-height: 1.3; }
.lesson-outline-list { padding: var(--s2) 0 var(--s4); }
.outline-collapse-btn {
  position: relative;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: var(--t-body-sm);
  margin-right: 6px;
  z-index: 10;
  flex-shrink: 0;
}
.outline-collapse-btn::before {
  content: ""; position: absolute;
  width: 28px; height: 28px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: var(--hairline-strong);
  border-radius: 999px;
  transition: border-color var(--t-fast), background var(--t-fast);
  z-index: 1;
}
.outline-collapse-btn svg {
  width: 12px; height: 12px;
  transition: transform var(--t-fast, 150ms) ease;
  position: relative;
  z-index: 2;
}
.outline-collapse-btn:hover { color: var(--paper); }
.outline-collapse-btn:hover::before { border-color: var(--ink); background: var(--ink); }

/* Rotates the inline SVG chevron 180 degrees when collapsed */
.lesson-outline.collapsed .outline-collapse-btn svg,
.lesson-outline.is-collapsed .outline-collapse-btn svg {
  transform: rotate(180deg);
}
.outline-module { padding-bottom: var(--s2); border-bottom: var(--hairline); }
.outline-module:last-child { border-bottom: 0; }
.outline-module-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: var(--s3) var(--s3) 8px;
}
.outline-module-num {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  padding: 3px 6px;
  border-radius: var(--badge-radius);
  font-weight: 700;
}
.outline-module-title {
  font-family: var(--serif);
  font-size: var(--t-body-sm);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}
.outline-module-count {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.10em;
  color: var(--muted);
}
.outline-lesson {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px var(--s3);
  font-family: var(--serif);
  font-size: var(--t-body-xs);
  color: var(--ink);
  border-left: 2px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
  line-height: 1.35;
}
.outline-lesson:hover { background: rgba(26,25,22,0.04); }
.outline-lesson--locked {
  color: var(--muted);
  cursor: default;
  opacity: 0.62;
}
.outline-lesson--locked:hover { background: transparent; }
.outline-lesson.active {
  background: rgba(122,31,28,0.10);
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--s3) - 1px);
  font-weight: 500;
  color: var(--ink);
}
.outline-lesson.active .outline-lesson-title { color: var(--ink); }
.outline-lesson.done .outline-lesson-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(26,25,22,0.20); }
.outline-lesson-title {
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.outline-dot {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(26,25,22,0.28);
  border-radius: 50%;
  font-size: var(--t-mono-xs);
  background: var(--paper);
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.outline-dot--active { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.outline-dot--done   { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.outline-dot--locked {
  background: transparent;
  color: var(--muted);
  border-color: color-mix(in srgb, var(--muted) 45%, transparent);
}

.lesson-main {
  flex: 1; min-width: 0;
  overflow: visible;
  display: flex; flex-direction: column;
}
/* Content fills the lesson column — no centered narrow column.
   Inner blocks (text, callouts) self-constrain to a readable measure;
   media blocks (video, image, pdf, download) span the full width so the
   page actually uses the screen instead of leaving 30–40% as dead paper. */
/* The lesson content column is CENTRED in the reading area (right of the
   curriculum rail), fluid width. Hero centred, prose centred at --measure-read,
   media centred at --measure-page — everything on one centred axis. */
.lesson-content-area {
  width: 100%;
  max-width: var(--measure-media);
  margin-inline: auto;
  padding: var(--s5) var(--s4) calc(var(--s5) + 76px);
}
@media (min-width: 981px) {
  .lesson-content-area { padding: var(--s6) var(--s5) calc(var(--s6) + 76px); }
}
.lesson-breadcrumb {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.lesson-breadcrumb a { color: var(--muted); }
.lesson-breadcrumb a:hover { color: var(--ink); }
.lesson-title {
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.1; letter-spacing: -0.01em;
  margin: var(--s2) 0 var(--s4);
}

/* Lesson hero — chapter opening, not a webform header */
.lesson-hero {
  padding-bottom: var(--s4);
  margin-bottom: var(--s5);
  border-bottom: var(--rule-ink-heavy);
}
.lesson-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s3);
  flex-wrap: wrap;
}
.lesson-hero-course { color: var(--accent); border-bottom: 1px solid currentColor; }
.lesson-hero-sep { opacity: 0.5; }
.lesson-hero-kind { color: var(--ink); font-weight: 700; }
.lesson-hero-title {
  font-family: var(--serif);
  /* Lesson titles are sub-headers under the course/module hierarchy —
     not the page's primary brand mark. Previous clamp topped out at
     56px which read as a billboard. 38px keeps it editorial, sits
     comfortably under the course title, and stops eating two lines on
     longer lesson names. */
  font-size: clamp(24px, 2.6vw, 38px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
  max-width: 32ch;
}
.lblock-section-h {
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s2);
}

/* Essay + reflections: prose-first typography. Built for the v2 content
   format where each lesson has a written companion that reads on its
   own. Type is slightly larger than baseline lesson text, line-height
   loosened, paragraph rhythm given proper space. <h4> inside an essay
   marks a section break — handled with a mono kicker style, not a
   second big serif heading, so it sits below the lesson title without
   competing. */
.lesson-essay {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  line-height: 1.75;
  color: var(--ink);
}
.lesson-essay p { margin: 0 0 1.1em; }
.lesson-essay p:last-child { margin-bottom: 0; }
.lesson-essay h4 {
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1.8em 0 0.6em;
  font-weight: 500;
}
.lesson-essay blockquote {
  margin: 1.2em 0;
  padding-left: var(--s4);
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}
.lesson-essay em { font-style: italic; }
.lesson-essay strong { font-weight: 600; }

.lesson-reflections {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  line-height: 1.7;
  color: var(--ink);
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: var(--hairline);
}
.lesson-reflections p { margin: 0 0 1.1em; }
.lesson-reflections p:last-child { margin-bottom: 0; }
.lesson-reflections em { font-style: italic; color: var(--muted); }
.lblock--text details.transcript > summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--s2) 0;
  list-style: none;
}
.lblock--text details.transcript > summary::before {
  content: "▸ ";
  display: inline-block;
  margin-right: 6px;
  transition: transform var(--t-fast);
}
.lblock--text details.transcript[open] > summary::before {
  transform: rotate(90deg);
}
.lblock--text details.transcript[open] > summary { color: var(--ink); }
.lblock--text details.transcript > p {
  margin-top: var(--s3);
  color: var(--muted);
  font-size: var(--t-body);
  line-height: 1.65;
}

/* Composed content blocks */
.lesson-blocks { display: flex; flex-direction: column; gap: var(--s5); margin-top: var(--s4); }
.lblock { width: 100%; }
.lblock-kicker {
  display: block; margin-bottom: 6px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
/* Text / media width split. Text-bearing blocks read at an editorial
   measure (--measure-lesson, ch-anchored) and centre inside the content
   area; media blocks span the full --measure-lesson-bleed width so the
   page still uses the screen. Inline (non-full) images sit in the
   editorial column with the text they illustrate.
   .lblock--bleed is the explicit override — any block carrying it
   escapes the editorial column to full content-area width. */
.lblock--text,
.lblock--heading,
.lblock--callout,
.lblock--image {
  width: 100%;
  max-width: var(--measure-read);   /* prose reading measure */
  margin-inline: auto;              /* centred column */
}

/* Media columns: centred at the lesson media measure. */
.lblock--bleed,
.lblock--video,
.lblock--pdf,
.lblock--image-full,
.lblock--download {
  width: 100%;
  max-width: var(--measure-media) !important;
  margin-inline: auto !important;
}

/* Editorial sub-blocks render as standalone sections — pin them to the
   prose measure, centred to match the column. */
.lesson-objectives,
.lesson-flashback,
.lesson-mistakes,
.lesson-objection {
  max-width: var(--measure-read);
  margin-inline: auto;
}
.lblock--heading h2 { font-size: var(--t-h2); margin: 0; font-weight: 500; }
.lblock--heading h3 { font-size: var(--t-h3); margin: 0; font-weight: 500; }
.lblock--text { font-size: var(--t-body-lg); line-height: 1.7; }
.lblock--text p { margin: 0 0 var(--s3); }
.lblock--text p:last-child { margin-bottom: 0; }
.lesson-lead {
  font-size: var(--t-body-lg);
  line-height: 1.55;
  color: var(--ink);
}
.transcript {
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--ink);
}
.transcript p {
  margin: 0 0 var(--s3);
}
.lblock--text ul,
.lblock--text ol { margin: 0 0 var(--s3); padding-left: var(--s4); }
.lblock--text blockquote {
  margin: var(--s4) 0;
  padding: 0 var(--s4);
  border-left: 2px solid var(--ink);
  font-style: italic; color: var(--muted);
}
.lblock--text a { color: var(--accent); border-bottom: 1px solid currentColor; }
.lblock--text table { width: 100%; border-collapse: collapse; margin: var(--s4) 0; font-size: var(--t-body-sm); }

/* Media blocks fill the content column — no negative margins needed
   because the column itself fills available width now. */
.lblock--video {
  width: 100%;
  background: #0f0e0c;
  border-radius: var(--card-radius);
  overflow: hidden;
}
.lblock-video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.lblock-video-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.lblock-video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s2);
  color: rgba(246,242,233,0.85);
}
.video-meta { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.20em; text-transform: uppercase; color: rgba(246,242,233,0.55); }
.video-title { font-family: var(--serif); font-size: var(--t-h2); }
.video-source-badge { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.20em; text-transform: uppercase; color: rgba(246,242,233,0.55); margin-top: var(--s2); }
.lblock--video .lblock-caption {
  text-align: center; padding: var(--s2) var(--s4);
  background: rgba(15,14,12,0.04);
  font-style: italic; font-size: var(--t-body-sm); color: var(--muted);
}

.lblock--pdf {
  border: var(--hairline-strong);
  background: var(--paper);
  border-radius: var(--card-radius);
  padding: var(--s2);
}
.lblock-pdf-title {
  padding: 6px 8px 8px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.lblock-pdf-frame {
  width: 100%; height: 70vh;
  border: var(--hairline);
  background: #fff;
}

.lblock--download { width: 100%; }
.lblock-download-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: var(--s4); align-items: center;
  padding: 18px var(--s4);
  border: 1px solid var(--ink);
  background: var(--paper);
  border-radius: var(--card-radius);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-md);
  transition: all var(--t-fast);
}
.lblock-download-card:hover {
  background: var(--paper-alt);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.lblock-download-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: var(--paper);
  border-radius: var(--card-radius);
  flex-shrink: 0;
}
.lblock-download-meta { display: flex; flex-direction: column; gap: 4px; }
.lblock-download-title {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  font-weight: 500;
  line-height: 1.25;
}
.lblock-download-sub {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.lblock-download-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  font-weight: 500;
}
.lblock-download-card:hover .lblock-download-cta { color: var(--accent); }
.lblock-download-card:hover .lblock-download-cta svg { transform: translateX(3px); }
.lblock-download-cta svg { transition: transform var(--t-fast); }

.lblock--image { width: 100%; }
.lblock--image img { width: 100%; height: auto; display: block; border-radius: var(--card-radius); }
.lblock--image:not(.lblock--image-full) img { border: var(--hairline); }
.lblock--image-full { max-width: none; }
.lblock-caption {
  margin-top: var(--s1);
  font-style: italic; font-size: var(--t-body-sm); color: var(--muted);
  text-align: center;
}

.lblock--callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s4); align-items: start;
  width: 100%;
  padding: var(--s4);
  border: var(--hairline);
  border-left: 5px solid var(--muted);
  background: var(--paper-alt);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}
.lblock--callout-tip { border-left-color: var(--pass); background: rgba(45,106,79,0.05); }
.lblock--callout-warning { border-left-color: var(--accent); background: rgba(122,31,28,0.06); }
.lblock-callout-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 4px 10px 4px 0;
  border-right: 1px solid rgba(26,25,22,0.18);
  align-self: stretch;
  white-space: nowrap;
}
.lblock--callout-tip     .lblock-callout-tag { color: var(--pass); }
.lblock--callout-warning .lblock-callout-tag { color: var(--accent); }
.lblock-callout-body { min-width: 0; font-size: var(--t-body); line-height: 1.65; }
.lblock-callout-body p:last-child { margin-bottom: 0; }

/* Video placeholder — proper film-still card, not raw text */
.lblock-video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--s2);
  background: linear-gradient(160deg, #1a1916 0%, #2a2722 100%);
  color: rgba(246,242,233,0.85);
}
.lblock-video-placeholder::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 60px, rgba(246,242,233,0.02) 60px 61px),
    repeating-linear-gradient(0deg,  transparent 0 60px, rgba(246,242,233,0.02) 60px 61px);
  pointer-events: none;
}
.lblock-video-placeholder svg { position: relative; }
.lblock-video-placeholder .video-title {
  position: relative;
  font-family: var(--serif); font-size: var(--t-h2);
  margin-top: var(--s2);
}
.lblock-video-placeholder .video-source-badge {
  position: relative;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.24em; text-transform: uppercase;
  color: rgba(246,242,233,0.45);
  margin-top: var(--s2);
  padding: 4px 10px;
  border: 1px solid rgba(246,242,233,0.20);
  border-radius: 2px;
}

/* End-of-lesson marker. A quiet, centred close to the reading column —
   the actual Complete/Next action is the sticky action bar, so this is
   confirmation, not a control. Replaces the old pair of giant nav cards. */
.lesson-endmark {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: var(--hairline);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.lesson-endmark--done { color: var(--pass); }
.lesson-endmark svg { flex-shrink: 0; }

/* Mark-complete moment — proper primary action */
.lesson-complete {
  margin-top: var(--s6);
  padding: var(--s4);
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.lesson-complete--done {
  width: 100%;
  margin-inline: auto;
  margin-top: var(--s5);
  padding: var(--s3) var(--s4);
  background: transparent;
  border: none;
  box-shadow: none;
}
.lesson-complete-form {
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
}
.lesson-complete-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-sm);
  color: var(--muted);
}
.lesson-complete-done {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--pass);
  font-weight: 700;
  border: 1px solid rgba(45, 106, 79, 0.25);
  padding: 6px 14px;
  border-radius: var(--badge-radius);
  background: rgba(45, 106, 79, 0.05);
}

/* Big primary button size */
.btn--lg {
  padding: 16px 28px;
  font-size: var(--t-mono-md);
  letter-spacing: 0.18em;
  border-radius: var(--btn-radius);
}

/* Prev / Next nav — substantial cards, not footnotes */
.lesson-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  margin-top: var(--s5);
}
.lesson-nav--single {
  grid-template-columns: minmax(320px, clamp(600px, 80vw, var(--measure-lesson-bleed)));
  justify-content: center;
}
.lesson-nav-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s4);
  align-items: center;
  padding: var(--s4) var(--s5);
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  min-height: 120px;
}
/* When the next-card is a submit button (lesson completion) we make the
   ENTIRE card surface one button so clicks anywhere submit the form, not
   just the arrow. The wrapping <form> is a layout-only inline element. */
button.lesson-nav-card {
  width: 100%;
  cursor: pointer;
  font: inherit;
  text-align: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.lesson-nav-card:hover {
  border-color: var(--ink);
  background: var(--paper-alt);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.lesson-nav-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--accent);
}

/* Beautiful Premium Complete Lesson Button (CTA) */
.lesson-nav-card--form {
  border: 1px solid rgba(26, 25, 22, 0.2);
  background: linear-gradient(135deg, var(--accent) 0%, #5d1715 100%);
  color: var(--paper);
  box-shadow: 0 4px 12px rgba(122, 31, 28, 0.16), var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.dark-mode .lesson-nav-card--form {
  border: 1px solid rgba(246, 242, 233, 0.15);
  background: linear-gradient(135deg, var(--accent) 0%, #9e3230 100%);
  box-shadow: 0 4px 20px rgba(196, 67, 64, 0.25), var(--shadow-sm);
}
.lesson-nav-card--form .lesson-nav-kicker {
  color: var(--paper);
  opacity: 0.75;
  font-weight: 700;
  letter-spacing: 0.2em;
  transition: opacity var(--t-fast);
}
.lesson-nav-card--form .lesson-nav-title {
  color: var(--paper);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.lesson-nav-card--form .lesson-nav-arrow {
  color: var(--paper);
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.lesson-nav-card--form:hover {
  background: linear-gradient(135deg, #8c2320 0%, #511311 100%);
  border-color: rgba(26, 25, 22, 0.3);
  color: var(--paper);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(122, 31, 28, 0.28), var(--shadow-md);
}
.dark-mode .lesson-nav-card--form:hover {
  background: linear-gradient(135deg, #d34f4c 0%, #872826 100%);
  border-color: rgba(246, 242, 233, 0.25);
  box-shadow: 0 8px 30px rgba(196, 67, 64, 0.4), var(--shadow-md);
}
.lesson-nav-card--form:hover .lesson-nav-kicker {
  opacity: 0.95;
}
.lesson-nav-card--form:hover .lesson-nav-arrow {
  color: var(--paper);
  transform: translateX(6px);
  opacity: 1;
}
.lesson-nav-card--form:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--accent), 0 8px 24px rgba(122, 31, 28, 0.28);
}
.dark-mode .lesson-nav-card--form:focus-visible {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--accent), 0 8px 30px rgba(196, 67, 64, 0.4);
}
.lesson-nav-card--form:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(122, 31, 28, 0.2), var(--shadow-sm);
  transition: transform 0.05s ease-out;
}
.dark-mode .lesson-nav-card--form:active {
  box-shadow: 0 2px 10px rgba(196, 67, 64, 0.25), var(--shadow-sm);
}

.lesson-nav-card--next {
  grid-template-columns: 1fr auto;
  text-align: right;
}
/* Prev/Next hierarchy: the Prev card is the secondary action — quiet,
   transparent, hairline-ruled. Next (link variant) is the primary —
   accent left rule + a deeper tint so the forward path reads first.
   The submit variant (--form, below) carries its own filled treatment. */
.lesson-nav-card--prev {
  background: transparent;
  border: var(--hairline);
  box-shadow: none;
}
.lesson-nav-card--next:not(.lesson-nav-card--form) {
  border-color: rgba(122,31,28,0.35);
  background: rgba(122,31,28,0.07);
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
}
.dark-mode .lesson-nav-card--next:not(.lesson-nav-card--form) {
  border-color: rgba(218,107,103,0.40);
  background: rgba(218,107,103,0.10);
}
.lesson-nav-arrow {
  font-family: var(--serif);
  font-size: var(--t-h4);
  color: var(--muted);
  line-height: 1;
  transition: transform var(--t-fast), color var(--t-fast);
}
.lesson-nav-card:hover .lesson-nav-arrow { color: var(--accent); }
.lesson-nav-card--prev:hover .lesson-nav-arrow { transform: translateX(-4px); }
.lesson-nav-card--next:hover .lesson-nav-arrow { transform: translateX(4px); }
.lesson-nav-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lesson-nav-card--next .lesson-nav-meta { align-items: flex-end; }

/* Perfect centering for single card layout */
.lesson-nav--single .lesson-nav-card--next {
  grid-template-columns: 1fr auto 1fr;
  text-align: center;
}
.lesson-nav--single .lesson-nav-card--next::before {
  content: "";
  display: block;
}
.lesson-nav--single .lesson-nav-card--next .lesson-nav-meta {
  grid-column: 2;
  align-items: center;
}
.lesson-nav--single .lesson-nav-card--next .lesson-nav-arrow {
  grid-column: 3;
  text-align: right;
}

.lesson-nav-kicker {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.lesson-nav-title {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  font-weight: 500;
  line-height: 1.25;
}

/* ============================================================
   Lesson sticky action bar — always-visible primary action.
   Slim bar fixed to the viewport bottom on lesson pages: prev link
   left, primary action (Complete / Next / Exam / Back) right.
   Paper background, top hairline, subtle upward shadow. Mobile-first:
   compact labels by default, full titles from 600px up.
   ============================================================ */
.lesson-actionbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 180; /* under masthead (200) + context strip (199) */
  /* Distinct surface so the bar reads as chrome, not a button floating on
     the page (page bg is --paper; the bar steps to --paper-alt + a 2px ink
     top rule so it anchors visually even when the only control is on one
     side). */
  background: var(--paper-alt);
  border-top: var(--rule-ink-heavy);
  box-shadow: 0 -6px 20px rgba(26,25,22,0.10);
  transition: background var(--t-slow), border-color var(--t-slow);
}
.dark-mode .lesson-actionbar { box-shadow: 0 -6px 20px rgba(0,0,0,0.5); }
.lesson-actionbar__inner {
  max-width: var(--measure-media);
  /* Centre the bar's controls under the centred content column. The bar
     starts after the sidebar (≥981px) so "centred" lands under the column.
     Background stays full-width as bottom chrome. */
  margin-inline: auto;
  min-height: 60px;
  padding: 8px var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
@media (min-width: 981px) {
  /* Start the bar after the 300px curriculum rail so its centred inner sits
     under the centred reading column rather than under the whole viewport. */
  .lesson-actionbar { left: 300px; }
  .lesson-actionbar__inner { padding: 8px var(--s5); }
}
.lesson-actionbar__prev {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 4px;
  font-family: var(--serif);
  font-size: var(--t-body-sm);
  color: var(--muted);
  transition: color var(--t-fast);
}
.lesson-actionbar__prev:hover { color: var(--ink); }
.lesson-actionbar__prev:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lesson-actionbar__prev-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 32ch;
}
.lesson-actionbar__primary { display: flex; align-items: center; }
.lesson-actionbar__btn { max-width: min(70vw, 520px); }
.lesson-actionbar__next-title {
  display: inline-block;
  vertical-align: bottom;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 24ch;
}
/* Mobile-first label swap: compact by default, full titles from 600px. */
.lesson-actionbar__full { display: none; }
.lesson-actionbar__short { display: inline; }
@media (min-width: 600px) {
  .lesson-actionbar__full { display: inline; }
  .lesson-actionbar__prev .lesson-actionbar__full { display: inline-block; }
  .lesson-actionbar__short { display: none; }
}
/* Content never hides beneath the fixed bar: the lesson column carries
   matching bottom padding. The marketing school-footer is hidden inside the
   lesson player entirely — the action bar IS the bottom chrome here, like a
   real course player; showing both reads as a stray "large footer". */
.lesson-shell .lesson-content-area { padding-bottom: calc(var(--s5) + 76px); }
body:has(.lesson-shell) .school-footer { display: none; }
@media print {
  .lesson-actionbar { display: none !important; }
  /* keep parity with the print reset further down, which uses a
     lower-specificity selector and would otherwise lose to the
     padding rule above */
  .lesson-shell .lesson-content-area { padding-bottom: 0; }
}


/* ---------- 10. EXAM ---------- */
.exam-shell {
  width: 100%;
  max-width: var(--measure-exam);
  margin: 0 auto;
  padding: var(--s4) 0;
}
.exam-hero {
  padding-bottom: var(--s4);
  border-bottom: var(--rule-ink-heavy);
  text-align: center;
}
.exam-hero h1 {
  font-size: clamp(42px, 6vw, 72px);
  font-style: italic;
  line-height: 0.98;
  margin: var(--s2) 0 var(--s3);
}
.exam-hero p {
  max-width: 58ch;
  margin: 0 auto;
  color: var(--muted);
  font-style: italic;
  font-size: var(--t-body-lg);
  line-height: 1.6;
}
.exam-progress {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: var(--s4) 0;
  padding: var(--s3);
  background: rgba(246,242,233,0.94);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.dark-mode .exam-progress { background: rgba(26,25,22,0.92); }
.exam-progress-pips { display: flex; gap: 6px; margin-bottom: var(--s2); }
.exam-progress-pips span,
.exam-pip {
  flex: 1;
  height: 6px;
  background: rgba(26,25,22,0.12);
  border-radius: 999px;
  transition: background var(--t-fast), transform var(--t-fast);
}
.exam-pip.is-complete { background: rgba(122,31,28,0.42); }
.exam-pip.is-active { background: var(--accent); transform: scaleY(1.5); }
.exam-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
}
.exam-progress-label,
.exam-progress-meta strong {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.exam-progress-meta strong { color: var(--ink); }
.hidden { display: none !important; }
.exam-card {
  background:
    linear-gradient(180deg, rgba(122,31,28,0.035), transparent 34%),
    var(--paper);
  border: var(--rule-ink);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.exam-card__kicker {
  padding: var(--s3) var(--s4);
  border-bottom: var(--hairline);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.exam-question-text {
  padding: var(--s4) var(--s5) var(--s3);
  font-size: clamp(20px, 1.55vw, 27px);
  line-height: 1.25;
}
.exam-options,
.opts {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.exam-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: var(--s3);
  align-items: center;
  padding: var(--s3) var(--s5);
  border-top: var(--hairline);
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.exam-option:hover { background: var(--paper-alt); }
.exam-option.is-selected {
  background: rgba(122,31,28,0.08);
  box-shadow: inset 4px 0 0 var(--accent);
}
.exam-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.exam-option-key {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper);
  border-radius: 50%;
  font-family: var(--mono); font-size: var(--t-mono-md);
}
.exam-option.is-selected .exam-option-key { background: var(--accent); }
.exam-option-text { font-size: var(--t-body); line-height: 1.4; }
.exam-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: var(--hairline);
}
.exam-foot .btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}
.exam-attempt-note {
  margin-top: var(--s3);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}
.qnum { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* Question screen (wide): question and answers side-by-side so they share one
   screen; scoped to .exam-question-block so the overview card is unaffected. */
@media (min-width: 880px) {
  .exam-question-block .exam-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "kick kick" "question options";
  }
  .exam-question-block .exam-card__kicker  { grid-area: kick; }
  .exam-question-block .exam-question-text { grid-area: question; border-right: var(--hairline); display: flex; align-items: center; }
  .exam-question-block .exam-options       { grid-area: options; }
  .exam-question-block .exam-options .exam-option:first-child { border-top: none; }
}

/* Exam overview panel — course-hero pattern: de-boxed, ink-ruled ledger, single CTA. */
.exam-overview .exam-card {
  background: none; border: none; box-shadow: none; border-radius: 0; overflow: visible;
  max-width: 760px; margin-inline: auto; padding: 0; text-align: center;
}
.exam-overview .exam-card__kicker {
  border: none; padding: 0; margin-bottom: var(--s4); text-align: center;
}
.exam-overview__facts {
  display: inline-flex; justify-content: center; flex-wrap: nowrap; gap: 0; margin: 0 auto;
  border-top: var(--rule-ink); border-bottom: var(--rule-ink);
}
.exam-overview__facts > div {
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--s3) var(--s5); border-right: var(--hairline);
}
.exam-overview__facts > div:last-child { border-right: none; }
.exam-overview__facts dd {
  order: 1; margin: 0; font-family: var(--serif); font-size: var(--t-h2); line-height: 1;
}
.exam-overview__facts dt {
  order: 2; margin-top: 7px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.exam-fact-qual {
  display: block; margin-top: 5px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.exam-overview__note {
  text-align: center; max-width: 52ch; margin: var(--s4) auto 0;
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-sm); color: var(--muted);
}
.exam-overview .exam-foot {
  display: flex; flex-direction: column-reverse; align-items: center; gap: var(--s3);
  border-top: none; margin-top: var(--s5); padding-top: 0;
}
.exam-overview .exam-foot .btn--accent { padding: 13px 30px; }
.exam-overview .exam-foot .btn--outline {
  border: none; background: none; padding: 2px 4px;
  font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.exam-overview .exam-foot .btn--outline:hover { background: none; color: var(--ink); }

.exam-result {
  max-width: clamp(680px, 60vw, 1100px); margin: var(--s4) auto 0;
  padding: clamp(40px, 5vw, 72px);
  background: var(--paper-alt);
  border: var(--rule-ink);
  border-radius: var(--card-radius);
  text-align: center;
  box-shadow: var(--shadow-md);
}
.exam-result-shell {
  width: 100%;
  max-width: var(--measure-exam);
  margin: 0 auto;
  padding: var(--s4) 0 var(--s6);
}
.exam-result-heading {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.04;
  margin-top: var(--s1);
}
.exam-result-copy {
  font-family: var(--serif);
  font-style: italic;
  line-height: 1.6;
  color: var(--muted);
  margin: var(--s4) auto 0;
  max-width: 54ch;
}
.exam-result-actions {
  display: flex;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s5);
  flex-wrap: wrap;
}
.exam-result--pass {
  border-color: var(--pass);
  box-shadow: inset 0 4px 0 var(--pass), var(--shadow-md);
}
.exam-result-icon { color: var(--accent); margin-bottom: var(--s3); }
.exam-result--pass .exam-result-icon { color: var(--pass); }
.exam-result-title { font-size: var(--t-h2); margin-bottom: var(--s2); }
.exam-result-text  { color: var(--muted); font-size: var(--t-body); line-height: 1.6; }
.exam-result-sub   { font-family: var(--mono); font-size: var(--t-mono-sm); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: var(--s3); }
.exam-score {
  font-family: var(--serif); font-size: clamp(72px, 13vw, 118px); font-weight: 500;
  line-height: 0.9; margin: var(--s4) 0 var(--s4);
}
.exam-score__pct { font-size: 36px; color: var(--muted); }

/* Attempt-limit page — neutral procedural state, not an error. */
.exam-limit-shell { max-width: 760px; margin: 0 auto; }
.exam-limit__heading { font-family: var(--serif); font-weight: 400; }
.exam-result--limit { border-color: var(--line); }
.exam-limit__note {
  font-family: var(--serif); font-style: italic; line-height: 1.6;
  color: var(--muted); margin-top: var(--s3);
}
.exam-limit__actions { justify-content: center; gap: var(--s2); }
.exam-score-label { display: block; font-family: var(--mono); font-size: var(--t-mono-sm); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.exam-required {
  display: inline-flex;
  justify-content: center;
  padding: 7px 12px;
  border-top: var(--hairline);
  border-bottom: var(--hairline);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.cert-ready-panel {
  margin-top: var(--s4);
  padding: var(--s4);
  background: var(--paper);
  border: 1px solid var(--accent);
  border-radius: var(--card-radius);
  text-align: left;
}
.cert-ready-panel strong {
  display: block;
  font-family: var(--serif);
  font-size: var(--t-h3);
  line-height: 1.1;
  margin-bottom: 4px;
}
.cert-ready-panel span {
  display: block;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}
.cert-ready-panel .btn {
  margin-top: var(--s3);
  transform: scale(1.12);
  transform-origin: left center;
}


/* ---------- 11. CERTIFICATE (display) ---------- */
.cert-shell {
  max-width: none;
  padding: var(--s5) var(--screen-gutter);
  background: var(--paper);
}
.cert-card {
  background: var(--paper);
  border: 1px solid rgba(26,25,22,0.30);
  padding: clamp(40px, 6vw, 80px);
  position: relative;
  box-shadow: var(--shadow-lg);
  max-width: 1100px;
  margin: 0 auto;
  border-radius: var(--card-radius);
  overflow: hidden;
}
.cert-watermark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 1;
  pointer-events: none;
}
.cert-watermark img,
.cert-watermark svg {
  width: 240px;
  height: auto;
  opacity: 0.08;
  mix-blend-mode: multiply;
}
.cert-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--s6);
  align-items: start;
}
.cert-left {}
.cert-right {
  display: flex; flex-direction: column; gap: var(--s4);
  align-items: end; text-align: right;
}
.cert-meta { display: flex; flex-direction: column; gap: var(--s3); }
.cert-meta-item {
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.cert-meta-item strong { color: var(--ink); font-family: var(--serif); font-size: var(--t-body-sm); font-weight: 500; letter-spacing: 0; text-transform: none; }
.cert-right-stat {
  display: block;
  padding-bottom: var(--s2);
  margin-bottom: var(--s2);
  border-bottom: 1px solid rgba(26,25,22,0.1);
}
.dark-mode .cert-right-stat { border-bottom-color: rgba(246,242,233,0.1); }
.cert-right-stat:last-of-type { border-bottom: none; margin-bottom: 0; }
.cert-right-stat strong { font-size: var(--t-h2); font-weight: 400; font-family: var(--serif); display: block; line-height: 1; margin-bottom: 4px; }
.cert-right-stat span { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.cert-name { font-size: clamp(34px, 5vw, 56px); line-height: 1.05; margin-bottom: var(--s4); letter-spacing: -0.01em; }
.cert-title { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.1; max-width: 14ch; margin-bottom: var(--s3); }
.cert-copy { color: var(--muted); font-style: italic; font-size: var(--t-body-lg); line-height: 1.6; max-width: 52ch; }
.cert-seal {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: var(--t-mono-md);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 var(--s4);
  font-weight: 500;
  line-height: 1.35;
  max-width: 42ch;
}
.cert-action-bar {
  max-width: 1100px;
  margin: var(--s3) auto 0;
  padding: var(--s3) var(--s4);
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
}
.cert-action-bar__actions {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}
.cert-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}
.cert-footer a {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.cert-record-meta {
  justify-content: flex-start;
  align-items: center;
  gap: 10px 18px;
}
.cert-record-id {
  font-size: var(--t-body);
  color: var(--muted);
}
.cert-record-id strong {
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 500;
}
.cert-record-link {
  display: inline-flex;
  align-items: center;
  padding-top: 2px;
  letter-spacing: 0.22em;
}
.cert-record-label { margin-bottom: var(--s3); }
.cert-authority__name {
  font-size: var(--t-body-lg);
  font-family: var(--serif);
  font-style: italic;
}
.cert-authority__org {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.cert-index__list {
  display: grid;
  gap: 1px;
  background: rgba(26,25,22,0.12);
}
.cert-index__item {
  background: var(--paper);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  color: inherit;
}
.cert-index__item:hover { background: var(--paper-alt); }
.cert-index__item--pending {
  background: var(--paper-alt);
  opacity: 0.72;
}
.cert-index__item--pending:hover { opacity: 0.9; }
.cert-index__title {
  font-size: var(--t-body-lg);
  margin-bottom: 2px;
}
.cert-index__meta {
  font-size: var(--t-body-xs);
  color: var(--muted);
}

/* Public certificate verification */
.verify-shell {
  align-items: flex-start;
  padding-top: 0;
}
.verify-page {
  width: 100%;
  max-width: 100%;
}
.verify-header {
  border-bottom: var(--hairline);
  padding: 20px var(--screen-gutter);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--paper);
}
.verify-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}
.verify-brand__eyebrow,
.verify-header__meta,
.verify-kicker,
.verify-field-label,
.verify-signature {
  font-family: var(--mono);
  text-transform: uppercase;
}
.verify-brand__eyebrow {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.3em;
  color: var(--muted);
  line-height: 1;
  margin-bottom: 2px;
}
.verify-brand__name {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  font-weight: 500;
  line-height: 1;
}
.verify-header__meta {
  margin-left: auto;
  font-size: var(--t-mono-xs);
  letter-spacing: 0.25em;
  color: var(--muted);
}
.verify-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}
.verify-kicker {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.35em;
  color: var(--accent);
  margin-bottom: 14px;
}
.verify-title {
  font-family: var(--serif);
  font-size: var(--t-h2);
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 40px;
}
.verify-form {
  display: flex;
  gap: 0;
  margin-bottom: 52px;
  border: 1px solid var(--ink);
}
.verify-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: var(--paper);
  font-family: var(--mono);
  font-size: var(--t-mono-md);
  letter-spacing: 0.1em;
  padding: 14px 18px;
  color: var(--ink);
  outline: none;
  text-transform: uppercase;
}
.verify-submit {
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 14px 24px;
  cursor: pointer;
}
.verify-result {
  border: 1px solid var(--ink);
  background: var(--paper);
  padding: 40px;
}
.verify-result--invalid { border-color: var(--accent); }
.verify-result__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: var(--hairline);
}
.verify-result--invalid .verify-result__head {
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: 0;
}
.verify-field-label {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.35em;
  color: var(--muted);
  margin-bottom: 5px;
}
.verify-status {
  font-family: var(--serif);
  font-size: var(--t-h2);
  font-weight: 500;
}
.verify-status--valid,
.verify-signature { color: var(--pass); }
.verify-status--invalid { color: var(--accent); }
.verify-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 40px;
  margin-bottom: 32px;
}
.verify-value {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  font-weight: 500;
  line-height: 1.35;
}
/* Course title + Issued By stay italic for editorial flavour but at the same
   size as the other two cells — visual rhythm of the 2x2 grid is preserved. */
.verify-value--course {
  font-style: italic;
}
.verify-record {
  border-top: var(--hairline);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
}
.verify-cert-id {
  font-family: var(--mono);
  font-size: var(--t-mono-md);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.verify-signature {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-mono-xs);
  letter-spacing: 0.25em;
}
.verify-copy {
  font-family: var(--serif);
  font-size: var(--t-body);
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
}
.verify-footer {
  border-top: var(--hairline);
  padding: 24px var(--screen-gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}


/* ---------- 12. ADMIN ---------- */
.admin-card {
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s4);
  box-shadow: var(--shadow-sm);
}
.dark-mode .admin-card { background: var(--paper-alt); }
.admin-card--danger {
  border-color: rgba(122, 31, 28, 0.55);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow-sm);
}
.admin-card--danger .label { color: var(--accent); }
.admin-tab-panel {
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s3);
  box-shadow: var(--shadow-sm);
}
.dark-mode .admin-tab-panel { background: var(--paper-alt); }
.admin-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--s3);
  padding: 0 0 var(--s3);
  border-bottom: var(--hairline);
  margin-bottom: var(--s2);
}
.admin-panel-deck {
  margin: 5px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: var(--t-body-sm);
  font-style: italic;
  line-height: 1.5;
}
.admin-note {
  color: var(--muted);
  font-style: italic;
  font-size: var(--t-body-sm);
  line-height: 1.6;
}
.admin-note--compact { font-size: var(--t-body-xs); }
.admin-field { margin-bottom: 0; }
.admin-stack {
  display: grid;
  gap: var(--s2);
}
.admin-stack--roomy { gap: var(--s4); }

.admin-search-form { display: flex; gap: var(--s2); align-items: center; flex-wrap: nowrap; }
.admin-search-input { min-width: 200px; max-width: min(560px, 40vw); flex: 1 1 280px; }
.admin-pager { display: flex; gap: var(--s3); align-items: center; justify-content: flex-end; }

.admin-course-row--archived { opacity: 0.65; }
.admin-course-row--archived:hover { opacity: 1; }

/* Inline tickbox + label + helper-text pattern used for course-level
   "issues a certificate" and per-learner "block cert" toggles. */
.builder-toggle { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 8px 0; }
.builder-toggle input { margin-top: 4px; accent-color: var(--accent); }
.builder-toggle strong { display: block; font-family: var(--serif); font-weight: 500; font-size: var(--t-body-sm); }
.builder-toggle__hint { display: block; color: var(--muted); font-size: var(--t-body-xs); line-height: 1.5; font-style: italic; margin-top: 2px; }

/* Announcement audience picker — radio for "all vs specific" + a checkbox
   list of courses that toggles in when "specific" is chosen. */
.ann-audience { display: flex; flex-direction: column; gap: 6px; }
.ann-audience__opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  border: var(--hairline-strong); border-radius: var(--card-radius);
  cursor: pointer;
  font-family: var(--serif); font-size: var(--t-body-sm); line-height: 1.4;
}
.ann-audience__opt:hover { background: var(--paper-alt); }
.ann-audience__opt input { margin-top: 3px; accent-color: var(--accent); }
.ann-audience__opt strong { font-weight: 500; }

.ann-audience-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: var(--s2);
  padding: var(--s2);
  border: var(--hairline);
  border-radius: var(--card-radius);
  max-height: 260px; overflow-y: auto;
}
.ann-audience-list__row {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 4px;
  border-radius: var(--badge-radius);
  font-family: var(--serif); font-size: var(--t-body-sm);
  cursor: pointer;
}
.ann-audience-list__row:hover { background: var(--paper-alt); }
.ann-audience-list__row input { accent-color: var(--accent); }
.admin-warning { border-color: rgba(122,31,28,0.40); }
.admin-warning__head { cursor: pointer; display: flex; gap: var(--s2); align-items: center; }
.admin-warning__head::-webkit-details-marker { display: none; }

.admin-export-menu { position: relative; }
.admin-export-menu summary { list-style: none; cursor: pointer; }
.admin-export-menu summary::-webkit-details-marker { display: none; }
.admin-export-menu__panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--paper); border: var(--hairline-strong);
  border-radius: var(--card-radius); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; min-width: 220px; z-index: 10;
  padding: var(--s1) 0;
}
.admin-export-menu__panel a {
  display: block; padding: 8px 12px; color: var(--ink);
  text-decoration: none; font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.admin-export-menu__panel a:hover { background: var(--paper-alt); }

/* Student announcement banners on dashboard */
.dash-announcements { display: flex; flex-direction: column; gap: var(--s2); }
.dash-announcement {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s2) var(--s3);
  border: var(--hairline-strong); border-left-width: 4px;
  border-radius: var(--card-radius); background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.dash-announcement__body { flex: 1; }
.dash-announcement__title { font-family: var(--serif); font-size: var(--t-body); font-weight: 500; }
.dash-announcement__copy { color: var(--muted); font-size: var(--t-body-xs); line-height: 1.5; margin-top: 4px; }
.dash-announcement__dismiss button {
  background: transparent; border: 0; cursor: pointer;
  font-size: var(--t-h2); line-height: 1; color: var(--muted); padding: 0 6px;
}
.dash-announcement__dismiss button:hover { color: var(--ink); }
.dash-announcement--note    { border-left-color: var(--ink); }
.dash-announcement--tip     { border-left-color: #2f7a4a; }
.dash-announcement--warning { border-left-color: #7a1f1c; background: rgba(122,31,28,0.04); }

.admin-code {
  background: var(--paper-alt); border: var(--hairline);
  padding: var(--s2) var(--s3); border-radius: var(--card-radius);
  font-family: var(--mono); font-size: var(--t-mono-md); line-height: 1.6;
  overflow-x: auto; white-space: pre;
}

/* Admin two-column layout — mobile-first.
   Base: single column (phone). At 768px we switch to a 2-column grid
   where the left column gets ~60% (course/access content) and the
   right column gets a 280px-min sidebar (cards). The `minmax(0, ...)`
   on the first track lets long content (cert IDs, course titles) wrap
   instead of forcing horizontal scroll on tablets. */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
  align-items: start;
}
@media (min-width: 768px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    gap: var(--s4);
  }
}
@media (min-width: 1280px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: var(--s5);
  }
}
.admin-main { min-width: 0; }
.admin-side { display: flex; flex-direction: column; gap: var(--s3); }
/* Onboard form layout — mobile-first stack, then progressively widens.
   Phone: each field on its own row. Tablet: 2-up. Laptop+: full 4-col
   inline layout. The legacy 980/720 overrides further below become
   redundant once this base is in place (cleared in Phase 8). */
.admin-onboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
  align-items: end;
}
@media (min-width: 768px) {
  .admin-onboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .admin-onboard-grid { grid-template-columns: 1.4fr 1fr 1.2fr auto; }
}

/* Admin summary tiles — mobile-first scaling.
   Phone: 2x2 grid (fits 4 tiles in viewable area without crushing).
   Tablet+: 4-up inline row. The single hairline border wraps the whole
   block, so on phone the internal dividers naturally form a 2x2 grid. */
.admin-summary-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  overflow: hidden;
  margin-bottom: var(--s4);
}
@media (min-width: 768px) {
  /* auto-fit lets the tile count grow with the viewport (4-up on a
     laptop, more on 4K) instead of stretching 4 tiles to ~450px each. */
  .admin-summary-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .admin-summary-grid.admin-summary-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

/* Drip release timeline card (course builder sidebar). */
.drip-timeline { display: flex; flex-direction: column; }
.drip-timeline__row {
  display: grid; grid-template-columns: 56px 1fr; gap: 2px var(--s2);
  padding: 8px 0; border-top: var(--hairline);
  text-decoration: none; color: var(--ink);
}
.drip-timeline__row:hover .drip-timeline__title { text-decoration: underline; }
.drip-timeline__day {
  grid-row: span 2;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
  align-self: start; padding-top: 2px;
}
.drip-timeline__title { font-size: var(--t-body-sm); line-height: 1.3; }
.drip-timeline__mod { font-size: 11px; color: var(--muted); font-style: italic; }

/* Bulk action bar on the learner roster. */
.bulk-bar {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  padding: var(--s2) var(--s3);
  border: var(--hairline-strong); border-radius: var(--card-radius);
  margin-bottom: var(--s3);
  background: var(--paper-alt);
}
.bulk-bar__all { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-body-sm); cursor: pointer; }
.bulk-bar__count {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  min-width: 90px;
}
.bulk-bar__select { max-width: 260px; }
.bulk-col { width: 32px; text-align: center; }

/* Analytics table: horizontal scroll on narrow screens instead of overflow. */
.analytics-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.analytics-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.analytics-dropoff--warn { color: var(--accent); }
.admin-stat-card {
  padding: var(--s4);
  text-align: center;
  border-right: var(--hairline);
  background: var(--paper);
}
.admin-stat-card:last-child { border-right: 0; }
.admin-stat-num   { font-family: var(--serif); font-size: var(--t-h2); font-weight: 500; line-height: 1; }
.admin-stat-label { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.admin-stat-value { font-family: var(--serif); font-size: var(--t-h2); font-weight: 500; }

/* ─── Admin audit filter grid ─────────────────────────────────────── */
.admin-audit-filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 0.8fr 0.8fr auto;
  gap: var(--s3);
  align-items: end;
}
.admin-audit-filters__actions {
  display: flex;
  gap: var(--s2);
}
@media (max-width: 1100px) {
  .admin-audit-filters { grid-template-columns: 1fr 1fr 1fr; }
  .admin-audit-filters__actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 640px) {
  .admin-audit-filters { grid-template-columns: 1fr; }
}

/* ─── Admin filter row (status pills + search) ────────────────────── */
.admin-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s3);
  flex-wrap: wrap;
}
.admin-filter-pills {
  display: inline-flex;
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--paper);
}
.admin-filter-pill {
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-decoration: none;
  border-right: var(--hairline);
  transition: background 0.12s ease, color 0.12s ease;
}
.admin-filter-pill:last-child { border-right: 0; }
.admin-filter-pill:hover { background: var(--paper-alt); color: var(--ink); }
.admin-filter-pill--on {
  background: var(--ink);
  color: var(--paper);
}
.admin-filter-pill--on:hover { background: var(--ink); color: var(--paper); }

@media (max-width: 720px) {
  .admin-filter-row { flex-direction: column; align-items: stretch; }
  .admin-filter-pills { justify-content: flex-start; }
}

/* ─── Admin control desks (dashboard tiles) ───────────────────────── */
.admin-desk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s3);
}
.admin-desk-grid--small { gap: var(--s3); }

.admin-desk {
  display: flex;
  flex-direction: column;
  padding: var(--s4);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  position: relative;
  min-height: 220px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.admin-desk:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
  background: var(--paper-alt);
  box-shadow: 0 6px 16px rgba(26,25,22,0.08);
}
.admin-desk:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.admin-desk__num {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-mono-md);
  color: var(--muted);
  letter-spacing: 0.06em;
}
.admin-desk__title {
  font-family: var(--serif);
  font-size: var(--t-h2);
  font-weight: 400;
  margin: 0 0 var(--s2);
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.admin-desk__title em { font-style: italic; }
.admin-desk__title-sm {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  font-weight: 500;
  margin: 0 0 var(--s2);
  letter-spacing: 0.01em;
}
.admin-desk__stat {
  font-family: var(--serif);
  font-size: var(--t-h1);
  font-weight: 300;
  line-height: 1;
  color: var(--ink);
  margin: var(--s2) 0 var(--s3);
}
.admin-desk__deck {
  font-size: var(--t-body-sm);
  color: var(--muted);
  margin: 0;
  flex-grow: 1;
  line-height: 1.5;
}
.admin-desk__cta {
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
  margin-top: var(--s4);
  padding-top: var(--s2);
  border-top: var(--hairline);
}
.admin-desk--small {
  min-height: 130px;
}
.admin-desk--small .admin-desk__deck { font-size: var(--t-body-xs); }
.admin-desk--small .admin-desk__cta { margin-top: var(--s3); }

.dark-mode .admin-desk { background: var(--paper-alt); }
.dark-mode .admin-desk:hover { background: var(--paper-deep); }

/* Alert strip — single-line warning at the top of dashboard */
.admin-alert-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: #fbf2d9;
  border: 1px solid #c79a2a;
  border-left-width: 4px;
  border-radius: var(--card-radius);
  text-decoration: none;
  color: var(--ink);
  font-size: var(--t-body-sm);
}
.admin-alert-strip:hover { background: #f5e7bb; }
.admin-alert-strip__lead {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.admin-alert-strip__pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #c79a2a;
  flex: 0 0 8px;
}
.admin-alert-strip__cta {
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Reports strip */
.admin-reports-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3);
}
.admin-report-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s3) var(--s4);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.admin-report-pill:hover {
  background: var(--paper-alt);
  border-color: var(--ink);
}
.admin-report-pill__lbl {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  letter-spacing: 0.01em;
}
.admin-report-pill__hint {
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .admin-desk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-reports-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .admin-desk-grid { grid-template-columns: 1fr; }
  .admin-reports-strip { grid-template-columns: 1fr; }
}

.admin-tab-strip {
  display: flex; gap: 0;
  margin-bottom: var(--s3);
  border-bottom: var(--rule-ink);
}
.admin-tab-btn {
  padding: 10px 16px;
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.admin-tab-btn:hover { color: var(--ink); background: var(--paper-alt); }
.admin-tab-btn.active { color: var(--ink); border-bottom-color: var(--ink); }

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: calc(var(--card-radius) - 2px);
}
.admin-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: var(--t-body-sm); }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: var(--hairline); }
.admin-table th { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.admin-table tbody tr:hover { background: var(--paper-alt); }

.admin-search {
  width: 100%; max-width: min(560px, 40vw);
  padding: 8px 12px;
  font-family: var(--serif); font-size: var(--t-body-sm);
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--btn-radius);
  outline: none;
  transition: border-color var(--t-fast);
}
.admin-search:focus { border-color: var(--accent); }

.admin-course-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--s3); align-items: center;
  padding: var(--s3);
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
}
.admin-course-thumb {
  width: 64px; height: 48px;
  background:
    radial-gradient(circle at 72% 18%, rgba(122,31,28,0.14), transparent 38%),
    linear-gradient(145deg, var(--paper-alt), var(--paper-deep));
  color: rgba(26,25,22,0.82);
  border: 1px solid rgba(26,25,22,0.10);
  border-radius: var(--surface-radius-sm);
  overflow: hidden;
}
.dark-mode .admin-course-thumb {
  background:
    radial-gradient(circle at 70% 20%, rgba(122,31,28,0.26), transparent 32%),
    linear-gradient(145deg, rgba(26,25,22,0.98), rgba(26,25,22,0.76));
  color: #e8e2d4;
  border-color: rgba(246,242,233,0.08);
}
.admin-course-info {}
.admin-course-title { font-family: var(--serif); font-size: var(--t-body); font-weight: 500; }
.admin-course-meta  { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.14em; color: var(--muted); margin-top: 2px; }
.admin-course-actions { display: flex; align-items: center; gap: var(--s2); }
.admin-row-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.admin-package-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s3);
  align-items: start;
}
.admin-package-title {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  font-weight: 500;
}
.admin-package-desc {
  margin-top: 2px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: var(--t-body-sm);
}
.admin-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--s2);
}
.admin-chip-row__empty,
.admin-row-note,
.admin-group-label,
.admin-cert-id,
.admin-contact-line,
.admin-device-row__meta,
.admin-issued-link,
.admin-learner-course__meta {
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
}
.admin-chip-row__empty {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.15em;
}
.admin-package-action { flex-shrink: 0; }
.admin-cell-meta {
  font-size: var(--t-body-xs);
  color: var(--muted);
}
.admin-cert-id {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.08em;
}
.admin-status--revoked {
  color: #7a4a1c;
  border-color: #7a4a1c;
}
.admin-status--inactive {
  color: var(--accent);
  border-color: var(--accent);
}
.admin-cell-actions { text-align: right; }
.admin-cell-actions__row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.admin-cell-actions__row--tight { flex-shrink: 0; }
.admin-inline-form { display: inline; }
.admin-activity-text {
  font-size: var(--t-body-sm);
  line-height: 1.4;
}
.admin-subsection {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px dotted rgba(26,25,22,0.18);
}
.admin-grant-form {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.admin-grant-form .admin-note { margin: 0; }
.admin-grant-form button[type="submit"] { align-self: stretch; }
.admin-contact-line {
  font-size: var(--t-mono-sm);
  letter-spacing: 0.12em;
}
.admin-contact-line--spaced { margin-bottom: var(--s2); }
.admin-recovery-count {
  font-size: var(--t-h2);
  font-family: var(--serif);
  color: var(--ink);
}
.admin-group-label {
  margin-top: var(--s1);
  padding-top: var(--s1);
  border-top: 1px dotted rgba(26,25,22,0.14);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.15em;
}
.admin-learner-course {
  border: var(--hairline);
  padding: var(--s2) var(--s3);
  border-radius: var(--card-radius);
  background: var(--paper);
}
.dark-mode .admin-learner-course,
.dark-mode .admin-device-row { background: var(--paper); }
.admin-learner-course__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s2);
}
.admin-learner-course__body {
  flex: 1;
  min-width: 0;
}
.admin-learner-course__title {
  font-family: var(--serif);
  font-size: var(--t-body);
  font-weight: 500;
}
.admin-learner-course__meta {
  margin-top: 2px;
  font-size: var(--t-mono-xs);
  letter-spacing: 0.15em;
}
.admin-learner-course__meta--body {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.1em;
  text-transform: none;
}
.admin-learner-course__progress { max-width: 200px; }
.admin-issued-link {
  font-size: var(--t-mono-xs);
  letter-spacing: 0.15em;
  color: var(--accent);
}
.admin-issued-link:hover { color: var(--ink); }
.admin-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: var(--hairline);
  border-radius: var(--card-radius);
  background: var(--paper);
  font-size: var(--t-body-xs);
}
.admin-device-row__meta {
  margin-top: 2px;
  font-size: var(--t-mono-xs);
  letter-spacing: 0.1em;
}

.learner-row {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: var(--hairline);
}
.learner-row:last-child { border-bottom: 0; }
.learner-row-name { display: flex; flex-direction: column; gap: 2px; }
.learner-avatar {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper);
  border-radius: 50%;
  font-family: var(--mono); font-size: var(--t-mono-sm);
  flex-shrink: 0;
}

/* Course analytics */
.analytics-table { width: 100%; border-collapse: collapse; font-size: var(--t-body-sm); }
.analytics-th, .analytics-td {
  padding: 10px 12px; text-align: left;
  border-bottom: var(--hairline);
  vertical-align: middle;
}
.analytics-th { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.analytics-mod-row td { background: var(--paper-alt); font-family: var(--mono); font-size: var(--t-mono-sm); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.analytics-bar-wrap { width: 100%; height: 4px; background: rgba(26,25,22,0.10); border-radius: 2px; overflow: hidden; }
.analytics-bar { height: 100%; background: var(--ink); }


/* ---------- 12b. COURSE BUILDER ---------- */
.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--s5);
  align-items: start;
}
.builder-card {
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s4);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow-sm);
}
.dark-mode .builder-card { background: var(--paper-alt); }
.builder-card--danger { border-color: rgba(122,31,28,0.40); }
.builder-side { display: flex; flex-direction: column; gap: var(--s3); }
.builder-side .builder-card { margin-bottom: 0; }

.builder-stickybar {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  padding: 10px var(--s4);
  background: var(--paper);
  border-bottom: var(--hairline);
  z-index: 30;
}
.builder-stickybar__title { display: flex; align-items: center; gap: var(--s2); font-family: var(--mono); font-size: var(--t-mono-sm); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.builder-stickybar__title strong { color: var(--ink); font-family: var(--serif); font-size: var(--t-body-sm); letter-spacing: 0; text-transform: none; }

.builder-section-head { display: flex; align-items: center; justify-content: space-between; margin: var(--s5) 0 var(--s3); }
.builder-section-head .label { margin: 0; }
.builder-section-meta { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.builder-empty {
  text-align: center;
  padding: var(--s6) var(--s4);
  border-top: var(--hairline-strong);
  border-bottom: var(--hairline-strong);
  margin-bottom: var(--s4);
}
.builder-empty__icon { display: inline-flex; color: var(--muted); margin-bottom: var(--s3); }
.builder-empty__title { font-family: var(--serif); font-size: var(--t-h3); font-weight: 500; line-height: 1.2; margin: 0 0 var(--s2); }
.builder-empty__deck { font-family: var(--serif); font-style: italic; font-size: var(--t-body); color: var(--muted); max-width: 56ch; margin: 0 auto; line-height: 1.6; }

.builder-module-list { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.builder-module {
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.dark-mode .builder-module { background: var(--paper-alt); }
.builder-module__head {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px var(--s3);
  background: var(--paper-alt);
  border-bottom: var(--hairline);
}
.dark-mode .builder-module__head { background: var(--paper-deep); }
.builder-module__kicker { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.builder-module__title {
  flex: 1;
  background: transparent;
  border: 0; outline: none;
  padding: 4px 6px;
  font-family: var(--serif); font-size: var(--t-body); font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast);
}
.builder-module__title:hover, .builder-module__title:focus { border-bottom-color: var(--ink); }
.builder-module__body { padding: var(--s3) var(--s4); }

.builder-handle {
  display: inline-flex;
  cursor: grab;
  color: var(--muted);
  user-select: none;
  font-family: var(--mono);
  letter-spacing: 0.05em;
}
/* Up/down reorder controls (replaced the stubbed drag handles). */
.builder-reorder { display: inline-flex; flex-direction: column; gap: 1px; }
.builder-reorder form { margin: 0; display: flex; }
.builder-reorder__btn {
  width: 18px; height: 13px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: 8px; line-height: 1;
}
.builder-reorder__btn:hover:not(:disabled) { color: var(--ink); }
.builder-reorder__btn:disabled { opacity: 0.25; cursor: default; }
.builder-x {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: var(--hairline-strong);
  border-radius: var(--surface-radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: var(--t-body); line-height: 1;
  transition: all var(--t-fast);
}
.builder-x:hover { color: var(--accent); border-color: var(--accent); background: rgba(122,31,28,0.05); }

.builder-lesson-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: var(--s2); align-items: center;
  padding: 8px 4px;
  border-bottom: 1px dotted rgba(26,25,22,0.14);
  font-size: var(--t-body-sm);
}
.builder-lesson-row:last-of-type { border-bottom: 0; }
.builder-lesson-row__title { font-family: var(--serif); font-size: var(--t-body); }
.builder-lesson-tag {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--ink);
  border-radius: var(--badge-radius);
  color: var(--ink);
}
.builder-lesson-tag--video    { color: var(--ink); border-color: var(--ink); }
.builder-lesson-tag--pdf      { color: #7a4a1c; border-color: #c9a063; background: rgba(201,160,99,0.10); }
.builder-lesson-tag--text     { color: var(--accent); border-color: var(--accent); background: rgba(122,31,28,0.04); }
.builder-lesson-edit {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: all var(--t-fast);
}
.builder-lesson-edit:hover { color: var(--ink); border-color: var(--ink); }

.builder-lesson-add {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--s2); align-items: center;
  padding: 10px 4px;
  margin-top: var(--s2);
  border-top: 1px dashed rgba(26,25,22,0.20);
}
.builder-lesson-add__title {
  background: transparent;
  border: 0; outline: none;
  border-bottom: 1px solid rgba(26,25,22,0.20);
  padding: 4px 6px;
  font-family: var(--serif); font-size: var(--t-body);
  transition: border-color var(--t-fast);
}
.builder-lesson-add__title:focus { border-bottom-color: var(--ink); }
.builder-lesson-add__kind {
  padding: 4px 24px 4px 8px;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: 2px;
}

.builder-module-settings { margin-top: var(--s3); border-top: 1px dotted rgba(26,25,22,0.14); padding-top: var(--s2); }
.builder-module-settings > summary {
  cursor: pointer;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}
.builder-module-settings > summary::-webkit-details-marker { display: none; }
.builder-module-settings > summary::before { content: '▸ '; margin-right: 4px; transition: transform var(--t-fast); display: inline-block; }
.builder-module-settings[open] > summary::before { transform: rotate(90deg); }

.builder-add-card {
  border: 1px dashed rgba(26,25,22,0.30);
  background: var(--paper-alt);
  border-radius: var(--card-radius);
  padding: var(--s4);
  margin-top: var(--s3);
}
.builder-add-row { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr) 110px 110px auto; gap: var(--s2); align-items: end; }

/* "At a glance" stat tiles in the course-builder right rail. Each tile is a
   small card with the number stacked above its uppercase label — same
   typographic rhythm as the certificate stats and admin summary cards. */
.builder-glance {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s2);
}
.builder-glance > div {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--s3) var(--s2);
  min-height: 56px;
  justify-content: center;
  border: var(--hairline);
  border-radius: var(--card-radius);
  background: var(--paper);
}
.dark-mode .builder-glance > div { background: var(--paper-alt); }
.builder-glance strong {
  font-family: var(--serif);
  font-size: var(--t-h2);
  font-weight: 500;
  font-style: italic;
  line-height: 1;
  color: var(--ink);
}
.builder-glance span {
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.builder-radio {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px 12px;
  border: var(--hairline-strong);
  border-radius: var(--btn-radius);
  font-family: var(--serif); font-size: var(--t-body-sm);
  cursor: pointer;
}
.builder-radio--on  { border-color: var(--ink); background: var(--paper-alt); font-weight: 500; }
.builder-radio--off { color: var(--muted); cursor: not-allowed; }
.builder-radio input { accent-color: var(--accent); width: 14px; height: 14px; }
.builder-radio-tag { margin-left: auto; font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.builder-radio--on .builder-radio-tag { color: var(--accent); }

.builder-prereq-list {
  display: grid; gap: 4px;
  max-height: 240px; overflow-y: auto;
  padding: 6px 0;
  border-top: 1px dotted rgba(26,25,22,0.18);
  border-bottom: 1px dotted rgba(26,25,22,0.18);
}
.builder-prereq-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 8px 6px;
  border-radius: 2px;
  font-family: var(--serif);
  font-size: var(--t-body-sm);
  cursor: pointer;
}
.builder-prereq-row:hover { background: var(--paper-alt); }
.builder-prereq-row input { grid-row: 1 / span 2; align-self: center; accent-color: var(--accent); }
.builder-prereq-row__title { grid-column: 2; grid-row: 1; line-height: 1.3; }
.builder-prereq-row__slug {
  grid-column: 2; grid-row: 2;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.10em;
  color: var(--muted);
  word-break: break-all;
}

.builder-pkg-list { list-style: none; margin: 0; padding: 0; }
.builder-pkg-list li { padding: 6px 0; border-top: 1px dotted rgba(26,25,22,0.18); }
.builder-pkg-list li:first-child { border-top: 0; }
.builder-pkg-link { display: block; font-family: var(--serif); font-size: var(--t-body-sm); }
.builder-pkg-link:hover { color: var(--accent); }


/* ---------- 12c. COMPOSER (admin lesson editor) ---------- */
.composer-list { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s3); }
.composer-block {
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--card-radius);
  padding: var(--s4);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.composer-block:focus-within { border-color: rgba(26,25,22,0.42); box-shadow: var(--shadow-md); }
.composer-block.is-collapsed > :not(.composer-block__head):not(input[type="hidden"]) { display: none; }
.dark-mode .composer-block { background: var(--paper-alt); }
.composer-block__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s2);
  align-items: center;
  margin-bottom: var(--s3); padding-bottom: var(--s2);
  border-bottom: 1px dotted rgba(26,25,22,0.18);
}
.composer-block__tag {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.20em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  border-radius: var(--badge-radius);
}
.composer-block[data-kind="heading"] .composer-block__tag { color: var(--ink); border-color: var(--ink); background: var(--paper-alt); }
.composer-block[data-kind="text"] .composer-block__tag { color: var(--accent); border-color: var(--accent); background: rgba(122,31,28,0.04); }
.composer-block[data-kind="video"] .composer-block__tag { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.composer-block[data-kind="pdf"] .composer-block__tag,
.composer-block[data-kind="download"] .composer-block__tag { color: #7a4a1c; border-color: #c9a063; background: rgba(201,160,99,0.10); }
.composer-block[data-kind="image"] .composer-block__tag { color: var(--pass); border-color: var(--pass); background: rgba(45,106,79,0.08); }
.composer-block[data-kind="callout"] .composer-block__tag { color: var(--accent); border-color: var(--accent); background: rgba(122,31,28,0.08); }
.composer-block__summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: var(--t-body-sm);
  font-style: italic;
}
.composer-block__handles { display: flex; gap: 4px; }
.composer-block__handles button {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper);
  border: var(--hairline-strong);
  border-radius: var(--surface-radius-sm);
  color: var(--ink);
  font-size: var(--t-body-xs);
  cursor: pointer;
  transition: all var(--t-fast);
}
.composer-block__handles button:hover { background: var(--paper-alt); border-color: var(--ink); }
.composer-block__handles button:last-child:hover { color: var(--accent); border-color: var(--accent); }
.dirty-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--badge-radius);
  padding: 6px 10px;
}
.dirty-pill[hidden] { display: none; }

.composer-add {
  border: 1px dashed rgba(26,25,22,0.26);
  border-radius: var(--card-radius);
  background: var(--paper-alt);
  padding: var(--s3);
  margin-top: var(--s3);
}
.composer-add-row { display: flex; flex-wrap: wrap; gap: var(--s2); }


/* ---------- 13. SETTINGS ---------- */
.settings-section { padding-top: var(--s4); border-top: var(--hairline); }
.settings-section__head { margin-bottom: var(--s3); }
.settings-section__title { font-family: var(--serif); font-size: var(--t-h3); font-weight: 400; font-style: italic; margin: 4px 0 0; }
.settings-section__deck { color: var(--muted); font-style: italic; font-size: var(--t-body-sm); line-height: 1.55; max-width: 56ch; margin: 4px 0 0; }
.settings-section__empty { color: var(--muted); font-style: italic; font-size: var(--t-body-sm); }
.settings-section__required { color: var(--accent); }
.recovery-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
.recovery-count {
  font-family: var(--serif);
  font-size: var(--t-h1);
  line-height: 1;
  margin-top: 6px;
}
.recovery-count__total { font-size: var(--t-body-lg); }
.recovery-status__copy { margin-top: var(--s2); font-size: var(--t-body-sm); }
.recovery-steps {
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--ink);
  margin-top: var(--s2);
  padding-left: 20px;
}
.inline-link { color: var(--accent); border-bottom: 1px solid currentColor; }
.inline-link:hover { color: var(--ink); }

.device-list { list-style: none; margin: 0; padding: 0; border-top: 1px dotted rgba(26,25,22,0.18); }
.device-list__item {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px dotted rgba(26,25,22,0.18);
}
.device-list__label { font-family: var(--serif); font-size: var(--t-body); font-weight: 500; }
.device-list__meta {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  margin-top: 2px;
}


/* ---------- 14. EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: var(--s6) var(--s4);
  border: var(--hairline-strong);
  background: var(--paper);
  border-radius: var(--card-radius);
}
.empty-state-mark { color: var(--muted); margin: 0 auto var(--s4); }
.empty-state__actions { gap: var(--s2); }
.empty-state-title { font-family: var(--serif); font-size: var(--t-h2); font-weight: 500; margin-bottom: var(--s2); }
.empty-state-body { color: var(--muted); font-style: italic; font-size: var(--t-body); line-height: 1.6; max-width: 56ch; margin: 0 auto; }
.empty-state-fineprint { font-family: var(--mono); font-size: var(--t-mono-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: var(--s4); }
.empty-state-link { color: var(--accent); border-bottom: 1px solid currentColor; }

/* ---------- cohort group cards on the dashboard ---------- */
.dash-cohorts { display: flex; flex-direction: column; gap: var(--s2); }
.dash-cohort-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s2);
}
.dash-cohort-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: var(--s2) var(--s3);
  border: var(--hairline-strong);
  background: var(--paper);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}
.dark-mode .dash-cohort-card { background: var(--paper-alt); }
.dash-cohort-card__title { font-family: var(--serif); font-size: var(--t-body-lg); font-weight: 500; }
.dash-cohort-card__sub   { color: var(--muted); font-size: var(--t-body-xs); text-transform: capitalize; }
.dash-cohort-card__meta  { color: var(--muted); font-size: var(--t-body-xs); font-style: italic; }
.dash-cohort-card__meta strong { color: var(--ink); font-style: normal; font-weight: 500; }

/* Access expiry line on the course hero */
.course-hero__access {
  margin-top: var(--s2);
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.course-hero__access strong { color: var(--ink); font-weight: 500; letter-spacing: 0.04em; text-transform: none; font-family: var(--serif); font-size: var(--t-body-sm); }

/* Access expiry chip on course cards */
.course-card__access {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}


/* ---------- 15. RESPONSIVE ---------- */
@media (max-width: 980px) {
  .screen       { max-width: none; padding: var(--s4) var(--s3) var(--s5); }
  .screen.screen--admin { padding: var(--s3) var(--s3) var(--s5); }
  .masthead-nav { display: none; }
  .mh-mobile-toggle { display: inline-flex; }
  .mh-account-name { display: none; }
  .masthead-nav-row__inner  { justify-content: flex-end; }
  .masthead-end             { margin-left: auto; }
  .mh-account               { position: static; }
  .mh-account-menu          { position: fixed; top: calc(var(--chrome-masthead) + var(--s2)); right: var(--s3); left: auto; min-width: 0; width: min(320px, calc(100vw - (var(--s3) * 2))); max-width: calc(100vw - (var(--s3) * 2)); }
  .masthead-mobile          { inset: calc(var(--chrome-masthead) + var(--s2)) var(--s3) auto auto; }
  .section-head             { margin-inline: var(--s2); }
  .school-footer-inner      { align-items: center; flex-direction: column; text-align: center; }
  .school-footer-brand      { justify-content: center; }
  .school-footer-meta       { justify-content: center; flex-wrap: wrap; gap: var(--s2); }
  .subnav-context           { width: 100%; }
  .topbar-tool--outline     { order: 2; margin-left: auto; }
  .topbar-trail             { order: 1; min-width: 0; }
  .builder-grid { grid-template-columns: 1fr; }
  .admin-grid   { grid-template-columns: 1fr; }
  .dash-hero    { grid-template-columns: 1fr; gap: var(--s4); }
  .dash-hero__intro,
  .dash-hero__deck { max-width: none; }
  .dash-hero h1 { max-width: none; }
  .course-hero  { grid-template-columns: 1fr; }
  /* Course ledger panel becomes inline (not sticky) on mobile so it
     doesn't pin to the top of the viewport and obscure the lesson list. */
  .course-ledger { position: relative; top: auto; }
  /* Lesson breadcrumb + curriculum link can wrap onto a 2nd line if the
     lesson title is long, instead of truncating to 20 characters. */
  .topbar-link, .topbar-current {
    max-width: 100%;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .dash-continue { grid-template-columns: 1fr; text-align: left; }
  .dash-continue-action { width: 100%; }
  .lesson-shell { flex-direction: column; height: auto; min-height: 0; }
  .lesson-outline {
    display: block;
    position: fixed;
    top: calc(var(--chrome-lesson-top) + var(--s2));
    right: var(--s3);
    bottom: auto;
    left: auto;
    flex: 0 0 auto;
    width: min(320px, calc(100vw - (var(--s3) * 2)));
    /* Size to content (most courses list ~10 modules) instead of pinning
       to the bottom edge — lets the lesson stay visible behind the panel. */
    max-height: calc(100vh - var(--chrome-lesson-top) - var(--s4));
    height: auto;
    border: var(--rule-ink);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-lg);
    z-index: 205;
    transform: translateX(16px);
    opacity: 0;
    pointer-events: none;
  }
  .lesson-outline.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  .lesson-main             { width: 100%; }
  .topbar-tool__label { display: none; }
}
@media (max-width: 700px) {
  .screen                    { padding: var(--s4) var(--s2) var(--s5); }
  .screen.screen--admin      { padding: var(--s3) var(--s2) var(--s5); }
  .masthead-brand { padding: 12px var(--s3) 10px; }
  .masthead-wordmark__small { font-size: var(--t-mono-xs); letter-spacing: 0.20em; }
  .masthead-wordmark__name  { font-size: var(--t-body); }
  .masthead-wordmark__masters { font-size: var(--t-mono-xs); letter-spacing: 0.18em; }
  .masthead-nav-row__inner  { padding: 8px var(--s3); }
  .mh-account-menu          { position: fixed; top: calc(var(--chrome-masthead) + var(--s2)); right: var(--s2); left: auto; min-width: 0; width: min(300px, calc(100vw - (var(--s2) * 2))); max-width: calc(100vw - (var(--s2) * 2)); }
  .masthead-mobile          { inset: calc(var(--chrome-masthead) + var(--s2)) var(--s2) auto auto; width: min(300px, calc(100vw - (var(--s2) * 2))); }
  .subnav-inner             { padding: 8px var(--s3); }
  .subnav-context           { gap: 6px; }
  .grid-2up                 { grid-template-columns: 1fr; gap: var(--s2); }
  .login-shell              { padding: var(--s5) var(--s3); align-items: flex-start; }
  .login-card               { padding: var(--s4); }
  .login-brand              { justify-content: flex-start; }
  .auth-title               { font-size: var(--t-h2); }
  .codes-shell              { padding: 0 var(--s3); }
  .codes-actions .btn       { width: 100%; }
  .error-shell              { margin: var(--s6) auto; }
  .error-actions .btn       { width: 100%; }
  .recovery-status          { align-items: flex-start; flex-direction: column; }
  .recovery-status form,
  .recovery-status .btn     { width: 100%; }
  .device-list__item        { align-items: flex-start; flex-direction: column; }
  .device-list__item form,
  .device-list__item .btn   { width: 100%; }
  .builder-add-row          { grid-template-columns: 1fr 1fr; }
  .builder-add-row > button { grid-column: 1 / -1; }
  .lesson-content-area      { padding: var(--s4) var(--s3); }
  .lesson-outline          { top: calc(var(--chrome-lesson-top) + var(--s2)); right: var(--s2); bottom: auto; left: auto; width: min(320px, calc(100vw - (var(--s2) * 2))); }
  .topbar-tool__label      { display: none; }
  .topbar-trail            { min-width: 0; overflow: hidden; }
  .topbar-link,
  .topbar-current          { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lblock--callout          { grid-template-columns: 1fr; gap: var(--s2); }
  .lblock-callout-tag       { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid rgba(26,25,22,0.18); }
  .admin-summary-grid       { grid-template-columns: 1fr 1fr; }
  .admin-onboard-grid       { grid-template-columns: 1fr; }
  .admin-panel-head         { align-items: stretch; flex-direction: column; }
  .admin-search             { max-width: none; }
  .codes-grid               { grid-template-columns: 1fr; }
  .lesson-hero-title        { max-width: none; }
  .lesson-nav               { grid-template-columns: 1fr; }
  .cert-inner               { grid-template-columns: 1fr; gap: var(--s4); }
  .cert-right               { align-items: start; text-align: left; }
  .cert-earned-banner       { grid-template-columns: 1fr; }
  .cert-earned-banner a     { justify-self: stretch; }
  .cert-action-bar          { align-items: stretch; }
  .cert-action-bar__actions { width: 100%; }
  .exam-question-text       { padding: var(--s4); max-width: none; }
  .exam-option              { padding: var(--s3); grid-template-columns: auto auto 1fr; }
  .exam-foot                { flex-direction: column-reverse; }
  .exam-foot .btn           { width: 100%; }
  .verify-header,
  .verify-footer,
  .verify-record            { flex-direction: column; align-items: flex-start; }
  .verify-header__meta      { margin-left: 0; }
  .verify-form              { flex-direction: column; }
  .verify-submit            { width: 100%; }
  .verify-grid              { grid-template-columns: 1fr; }
  .verify-result            { padding: var(--s4); }
  /* Admin features added in v2: search, pager, export menu, warnings */
  .admin-search-form        { width: 100%; }
  .admin-search-input       { flex: 1; min-width: 0; }
  .admin-pager              { justify-content: space-between; }
  .admin-export-menu__panel { right: auto; left: 0; min-width: 200px; }
  .admin-warning__head      { flex-wrap: wrap; }
  /* Dashboard announcements */
  .dash-announcement        { flex-direction: column; align-items: stretch; }
  .dash-announcement__dismiss { align-self: flex-end; margin-top: -28px; }
  /* Group edit / cert preview compact buttons */
  .admin-cell-actions__row  { flex-wrap: wrap; }
  /* Bulk onboard CSV example overflow */
  .admin-code               { font-size: var(--t-mono-sm); }
  /* Page header buttons wrap on phones */
  .page-header              { flex-wrap: wrap; gap: var(--s2); }
  /* Stack the action buttons in a 2-up grid on phones — full-width row
     stops them from wrapping into a single misaligned column. */
  .page-header > div:last-child { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
  .page-header > div:last-child > * { width: 100%; }
  .page-header > div:last-child > details { grid-column: 1 / -1; } /* export menu spans both cells */
}

/* Tablet-and-down: collapse heavy admin grids one level earlier */
@media (max-width: 980px) {
  .admin-search-form        { width: 100%; margin-top: var(--s2); }
  .admin-onboard-grid       { grid-template-columns: 1fr 1fr; }
  .pcert-foot               { gap: 6mm; }
}

/* ============================================================
   17. RESPONSIVE FRAME — final mobile-first polish layer.

   After the Phase 1–7 refactor, most components handle their own
   breakpoints inline (mobile-first base + @media min-width
   additions). This section is for cross-cutting concerns that
   don't belong to any single component:

     - Form-pair stacking on phones (date input pairs)
     - Small-phone (≤540px) full-width buttons in dense rows
     - Admin table horizontal scroll affordance
     - Tiny-phone iframe overflow guard

   Anything that became redundant after the mobile-first refactor
   was removed in Phase 8. Pre-refactor this section was 90+ lines;
   it's now 35.
   ============================================================ */

/* Form date pair: side-by-side on tablet+, stacked below. */
@media (max-width: 540px) {
  .admin-grant-window  { flex-direction: column; gap: var(--s2); }
  .admin-field-inline  { flex: 1 1 100%; }

  /* Full-width buttons in dense admin rows on tiny phones so
     stacked taps don't miss. */
  .admin-cell-actions__row .btn,
  .admin-inline-form .btn { width: 100%; }
  .admin-cell-actions__row,
  .admin-inline-form      { width: 100%; }
}

/* Admin table horizontal-scroll affordance. The table itself has
   min-width: 680px so on phones the parent overflows; we add a
   gradient hint at the right edge so users see content extends
   past the viewport. iOS momentum scroll enabled. */
.admin-table-wrap {
  position: relative;
  overflow-x: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
  .admin-table-wrap::after {
    content: "";
    position: sticky;
    top: 0; right: 0;
    width: 24px; height: 100%;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.08));
    pointer-events: none;
    display: block;
  }
}

/* Iframe video keeps its 16:9 across every width. The
   .lblock-video-wrap aspect-ratio rule handles it; this just guards
   against parent shrinking too much on tiny phones. */
@media (max-width: 360px) {
  .lblock-video-wrap        { min-width: 0; }
}

/* Print — hide the chrome */
@media print {
  body:has(.codes-shell) * { visibility: hidden; }
  .codes-shell, .codes-shell * { visibility: visible; }
  .codes-shell { position: absolute; top: 0; left: 0; }
  .codes-actions { display: none; }
  .masthead, .subnav, .school-footer, .lesson-outline,
  .mh--full, .mh--compact, .context-strip { display: none !important; }
  .lesson-shell { display: block; height: auto; }
  .lesson-content-area { max-width: none; padding: 0; }
}

/* ============================================================
   16. EDITORIAL CHROME — published-edition treatment
   Layered on top of the existing masthead/sub-nav system. Pages
   pick a variant via {{define "masthead_variant"}}full{{end}}
   (default is compact). Reuses --ink/--paper/--accent tokens.
   ============================================================ */

/* ============================================================
   Masthead nav links — shared between compact band and any future
   variants. The compact band uses .mh-band__nav as container.
   ============================================================ */
.mh-nav__link {
  font-family: var(--mono); font-size: var(--t-mono-md);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
}
.mh-nav__link:hover { color: var(--ink); }
.mh-nav__link--active { color: var(--ink); border-bottom-color: var(--ink); }
.mh-nav__link--admin { color: var(--accent); }
.mh-nav__link--admin.mh-nav__link--active { border-bottom-color: var(--accent); }

/* ============================================================
   Masthead — compact (inner pages: course landing, lesson, admin)
   Single band: brand left · nav centre · account right.
   Sits below a dark volume strip.
   ============================================================ */
.mh--compact {
  position: sticky; top: 0; z-index: 200;
  background: var(--paper);
  transition: background var(--t-slow), border-color var(--t-slow);
}

/* Dark lineage strip — sits atop the compact band. The names of the
   tradition the school stands in. Static; not chrome for chrome's sake. */
.lineage-strip {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  padding-block: 5px;
  padding-inline: max(var(--screen-gutter), calc((100% - var(--measure-wide)) / 2 + var(--screen-gutter)));
  background: var(--ink);
  color: rgba(246,242,233,0.78);
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.lineage-strip__kicker { color: rgba(246,242,233,0.5); flex-shrink: 0; }
.lineage-strip__roll {
  display: inline-flex; align-items: center; gap: 10px;
  flex: 1 1 auto; min-width: 0;
  justify-content: center;
  overflow: hidden;
}
.lineage-strip__name { color: var(--paper); }
.lineage-strip__sep  { color: #c44340; }
.lineage-strip__stamp { color: rgba(246,242,233,0.5); flex-shrink: 0; }
.dark-mode .lineage-strip {
  background: var(--paper-alt); color: var(--muted);
}
/* Reclaim header height on study pages — the strip stays on dashboard,
   login and admin. Same body:has() pattern as the .school-footer hides
   above (.error-shell etc.). .lesson-shell exists only on lesson pages;
   .crs-modules only on the course landing. */
body:has(.lesson-shell) .lineage-strip,
body:has(.crs-modules) .lineage-strip { display: none; }
.dark-mode .lineage-strip__kicker,
.dark-mode .lineage-strip__stamp { color: var(--muted); }
.dark-mode .lineage-strip__name { color: var(--ink); }
.dark-mode .lineage-strip__sep  { color: var(--accent); }
.mh-band {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s4);
  /* Full-bleed background, but content padded to the centred body column so
     the brand/nav/account align with the page content beneath. The trailing
     + screen-gutter matches .screen's own inner padding so the brand lines up
     with the body text, not merely the container edge. */
  padding-block: 9px;
  padding-inline: max(var(--screen-gutter), calc((100% - var(--measure-wide)) / 2 + var(--screen-gutter)));
  border-bottom: var(--rule-ink-heavy);
  background: var(--paper);
}
/* No nav (non-admin students) — collapse middle column so brand and
   account sit at the two ends without an empty centre. */
.mh-band--no-nav { grid-template-columns: auto 1fr; }
.mh-band__brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
}
.mh-band__emblem { width: 30px; height: 30px; flex-shrink: 0; }
.dark-mode .mh-band__emblem { filter: invert(1) hue-rotate(180deg); }
.mh-band__words { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mh-band__name {
  font-family: var(--serif); font-size: var(--t-body-lg); font-weight: 500;
  line-height: 1.05; letter-spacing: 0.005em;
  white-space: nowrap;
}
.mh-band__name em { font-style: italic; font-weight: 400; }
.mh-band__tag {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--accent);
}
.mh-band__nav {
  display: flex; align-items: center; justify-content: center;
  gap: var(--s5);
}
.mh-band__end {
  display: flex; align-items: center; gap: var(--s2);
  justify-self: end;
}
.mh-band .mh-icon,
.mh-band .mh-account-trigger {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 0 12px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  border: var(--hairline-strong) !important;
  border-radius: var(--btn-radius) !important;
  list-style: none !important;
  vertical-align: middle !important;
  line-height: 1 !important;
}
.mh-band .mh-account {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ============================================================
   Context strip — breadcrumb / kind label below compact masthead
   Replaces the older .subnav block on inner pages.
   ============================================================ */
.context-strip {
  position: sticky;
  top: var(--chrome-mh-compact);
  z-index: 199;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  height: var(--chrome-context-strip);
  padding-block: 0;
  padding-inline: max(var(--screen-gutter), calc((100% - var(--measure-wide)) / 2 + var(--screen-gutter)));
  /* inset shadow keeps the 2px rule inside the locked box — border-bottom
     is painted outside the compositing layer when sticky engages and can
     cause a 1-2px visual shift. */
  box-shadow: inset 0 -2px 0 0 var(--ink);
  background: var(--paper-alt);
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  transform: translateZ(0);
}
/* Crumb stays on ONE line — never wraps. The parent .context-strip has
   height: 38px + overflow: hidden, so wrapping clipped the second line
   under the chrome. nowrap + min-width: 0 lets the current page name
   ellipsis-truncate when the trail is too long for the viewport. */
.context-strip__crumb {
  display: inline-flex; align-items: center; gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}
.context-strip a { color: var(--muted); transition: color var(--t-fast); text-decoration: none; white-space: nowrap; }
.context-strip a:hover { color: var(--ink); }
.context-strip__sep { color: var(--muted); opacity: 0.55; padding: 0 2px; flex-shrink: 0; }
.context-strip__current {
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-sm);
  color: var(--ink); text-transform: none; letter-spacing: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.context-strip__kind {
  font-family: var(--serif); font-style: italic; color: var(--muted);
  text-transform: none; letter-spacing: 0; font-size: var(--t-body-sm);
  white-space: nowrap;
}

/* Phone collapse — hide the parent breadcrumb chain so only the
   current page name shows. The course title (typical 'parent' link)
   becomes a back-arrow chip on the left. The hamburger menu in the
   masthead already provides "My Study Hall" navigation, and browser
   back works, so dropping the rest of the trail isn't a usability
   loss — it's a clarity gain.
   Markup convention (lesson, exam, certificate pages):
     <a>My Study Hall</a>  <sep>  <a>Course title</a>  <sep>  <span current>
     [child 1]            [child 2] [child 3]         [child 4] [child 5] */
@media (max-width: 540px) {
  /* Hide grand-parent link ('My Study Hall') + the separator after it. */
  .context-strip__crumb > a:first-child,
  .context-strip__crumb > a:first-child + .context-strip__sep { display: none; }
  /* The course link is now the leading visible element — prefix with
     a back arrow to read as a chip. */
  .context-strip__crumb > a:not(:first-child)::before {
    content: "← ";
    color: var(--muted);
    padding-right: 2px;
  }
  .context-strip__crumb > a:not(:first-child) {
    flex-shrink: 0;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Hide the kind label ('Video lesson') — page title is enough. */
  .context-strip__kind { display: none; }
}

/* ============================================================
   Folio header — centred kicker with flanking rules.
   Sits above an editorial hero.
   ============================================================ */
.folio {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-bottom: var(--s3);
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted);
}
.folio__rule { flex: 1; max-width: 80px; height: 1px; background: rgba(26,25,22,0.18); }
.dark-mode .folio__rule { background: rgba(246,242,233,0.18); }

/* ============================================================
   Editorial hero — centred, italic display h1 + ledger band
   ============================================================ */
.ed-hero {
  padding: var(--s6) 0 var(--s5);
  text-align: center;   /* centred editorial hero — one centred axis app-wide */
  border-bottom: 3px double var(--ink);
  background: var(--paper);
}
/* Compact hero — course landing. Curriculum-first: ~40% less vertical
   padding so the study path and the primary CTA land above the fold. */
.ed-hero--compact { padding: var(--s5) 0 var(--s4); }
.ed-hero--compact .ed-hero__progress { margin-top: var(--s3); }
.ed-hero--compact .ed-hero__cta { margin-top: var(--s3); }
.ed-hero__h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 5.4vw, 52px);
  font-weight: 400; line-height: 1.05; margin: 0;
  letter-spacing: -0.005em;
}
.ed-hero__h1 em, .ed-hero__h1 i { font-style: italic; font-weight: 500; }
.ed-hero__deck {
  font-family: var(--serif); font-style: italic;
  font-size: var(--t-body); color: var(--muted);
  margin: var(--s2) auto 0; line-height: 1.55;
  max-width: var(--measure-hero);
}
.ed-hero__progress { margin: var(--s4) auto 0; max-width: clamp(280px, 26vw, 420px); }
.ed-hero__progress-pct {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin-top: 6px;
}
.ed-hero__cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  max-width: 100%;               /* never exceed its container — was overflowing on mobile */
  margin-top: var(--s4);
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--btn-radius);
  padding: clamp(12px, 1vw, 18px) clamp(20px, 2vw, 32px);
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.22em; text-transform: uppercase;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  white-space: nowrap;
}
/* The lesson-title portion of the CTA truncates so "Continue …→" always
   fits the viewport; the verb and arrow stay pinned and legible. */
.ed-hero__cta-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex: 0 1 auto;
}
.ed-hero__cta:hover {
  background: rgba(26,25,22,0.85);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  opacity: 1;
}
.dark-mode .ed-hero__cta:hover { background: rgba(246,242,233,0.86); }
.ed-hero__cta:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.ed-hero__cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-hero__cta em {
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-sm);
  letter-spacing: 0; text-transform: none; opacity: 0.75;
}
.ed-hero__bookstudy-uptodate {
  margin-top: var(--s4);
  font-family: var(--serif); font-style: italic;
  font-size: var(--t-body-sm); line-height: 1.55;
  color: var(--accent);
  max-width: 56ch; margin-left: auto; margin-right: auto;
}
.ed-hero__access {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin-top: var(--s3);
}
.ed-hero__access strong { color: var(--ink); font-weight: 500; }

/* Trimmed hero stat line — one quiet centred row of mono facts, replacing
   the heavy 4-cell ledger band (whose live-zero stats didn't earn the
   space; the progress bar already carries live state). */
.ed-hero__stats {
  margin: var(--s5) auto 0;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 6px var(--s3);
}
.ed-hero__stats .dot { opacity: 0.45; }
.ed-hero__stats strong { color: var(--ink); font-weight: 500; }

/* Ledger band — inline ruled stat row used in editorial heros */
.ledger-band {
  margin: var(--s4) auto 0;
  display: inline-flex;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.ledger-band__cell {
  padding: 12px 22px;
  border-right: var(--hairline);
  text-align: center;
}
.ledger-band__cell:last-child { border-right: 0; }
.ledger-band__num {
  font-family: var(--serif); font-size: var(--t-h1); font-weight: 400;
  line-height: 1; display: block;
}
.ledger-band__num em { font-style: italic; }
.ledger-band__lbl {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-top: 6px; display: block;
}
.ledger-band__note {
  margin-top: var(--s3);
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-sm);
  color: var(--muted); max-width: 52ch;
  margin-left: auto; margin-right: auto;
}
/* Compact ledger — smaller numerals + tighter padding for the
   curriculum-first course hero. */
.ledger-band--compact { margin-top: var(--s3); }
.ledger-band--compact .ledger-band__cell { padding: 8px 16px; }
.ledger-band--compact .ledger-band__num { font-size: var(--t-h3); }
.ledger-band--compact .ledger-band__lbl { margin-top: 4px; }
.ledger-band--compact + .ledger-band__note { font-size: var(--t-body-xs); }

/* ============================================================
   Editorial course overview — long-form body that sits between the
   hero and the Study Path. The hero deck stays the italic tagline
   vessel (56ch, centred); this is the essay vessel for courses that
   ship a multi-paragraph introduction. Rendered only when the
   .Course.Overview field is non-empty, so a course without one
   contributes zero extra rules, padding, or whitespace to the page.

   Typography mirrors the lesson-essay scale (18px / 1.75 serif) so
   the prose feels of-a-piece with the lesson reading rhythm. The
   column caps at --measure-editorial (880px, 76%) — the same measure
   the masthead and footer settle on — so the overview shares the
   page's deliberate left/right axis instead of running 100ch wide.
   The header is centred to echo the .folio / .ed-hero opening; the
   body switches to a left edge once the reader is past the title.
   ============================================================ */
.ed-overview {
  width: 100%;
  max-width: 100%;
  margin: var(--s6) auto var(--s5);
}
.ed-overview__head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: var(--s4);
}
.ed-overview__num {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.ed-overview__h {
  font-family: var(--serif); font-size: var(--t-body-lg); font-weight: 500;
  font-style: italic; margin: 0; white-space: nowrap; color: var(--ink);
}
.ed-overview__line {
  flex: 1; height: 1px; background: var(--ink); opacity: 0.85;
}
.ed-overview__body {
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  line-height: 1.75;
  color: var(--ink);
}
.ed-overview__body p { margin: 0 0 1.1em; }
.ed-overview__body p:last-child { margin-bottom: 0; }
.ed-overview__body em, .ed-overview__body i { font-style: italic; }
.ed-overview__body strong { font-weight: 600; }
/* Drop cap on the first paragraph — same construction as the
   .lblock--text dropcap on lesson pages, so the LMS uses one
   editorial dropcap, not two. */
.ed-overview__body > p:first-child::first-letter {
  font-size: 3.1em; line-height: 0.72;
  float: left; font-style: normal;
  color: var(--accent);
  margin: 0.08em 0.14em 0 0;
  font-weight: 500;
}

/* ============================================================
   Section-rule — § N. heading with flanking line and side note
   Replaces the older bare .section-head pattern on editorial pages.
   ============================================================ */
/* Centred section rule: flanking hairlines on both sides of a § kicker +
   italic label. Used for Study Path, dashboard "Your courses", etc. */
.section-rule {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: var(--s6) auto var(--s4);
}
.section-rule__num {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); white-space: nowrap;
}
.section-rule__h {
  font-family: var(--serif); font-size: var(--t-body-lg); font-weight: 500;
  font-style: italic; margin: 0; white-space: nowrap; color: var(--ink);
}
.section-rule__line { flex: 1; height: 1px; background: var(--ink); opacity: 0.3; }

/* Instruments — gated interactive tools surfaced on the course page (B) and
   in the persistent context strip (C). */
.crs-instruments { margin: 0 0 40px; }
.crs-instrument {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: var(--paper-alt);
  border-left: 3px solid var(--accent);
}
.crs-instrument + .crs-instrument { margin-top: 10px; }
.crs-instrument__mark { color: var(--accent); flex-shrink: 0; display: flex; }
.crs-instrument__text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.crs-instrument__title { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.crs-instrument__deck { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.02em; color: var(--muted); line-height: 1.5; }
.crs-instrument__cta { flex-shrink: 0; white-space: nowrap; }
.context-strip a.ctx-instruments { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.context-strip a.ctx-instruments:hover { color: var(--ink); }
@media (max-width: 540px) {
  .crs-instrument { flex-wrap: wrap; }
  .crs-instrument__cta { width: 100%; text-align: center; }
  .ctx-instruments__label { display: none; }
}
.dark-mode .section-rule__line { background: var(--ink); opacity: 0.35; }
.section-rule__note {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}

/* ============================================================
   Course list — replaces dashboard course-grid.
   Numbered chapter rows with thumbnail · title · progress.
   ============================================================ */
.course-list {
  border-top: var(--hairline);
  display: flex; flex-direction: column;
}
.course-list__row {
  position: relative; /* containing block for the stretched title link */
  display: grid;
  grid-template-columns: 48px 128px 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: 18px var(--s3);
  border-bottom: var(--hairline);
  text-decoration: none; color: var(--ink);
  transition: background var(--t-fast);
}
.course-list__row:hover { background: var(--paper-alt); }
.course-list__row:last-child { border-bottom: 0; }
/* Stretched-link pattern: enrolled rows are a <div> (a row can't be one
   big <a> any more — the Resume control would nest anchors). The title
   link's ::after covers the whole row; Resume stacks above it. */
.course-list__main { color: inherit; text-decoration: none; }
.course-list__main::after { content: ""; position: absolute; inset: 0; }
.course-list__main:focus-visible { outline: none; }
.course-list__main:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.course-list__resume {
  position: relative;
  z-index: 1;
  margin-top: var(--s2);
}
.course-list__row--locked { opacity: 0.7; }
.course-list__num {
  font-family: var(--serif); font-size: var(--t-h1);
  font-weight: 400; font-style: italic;
  color: var(--accent); line-height: 1; text-align: center;
}
.course-list__thumb {
  width: 128px; height: 72px;
  border-radius: 2px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  /* Locked to a dark background (and light cream foreground) regardless
     of light/dark mode — the SVG sigil + title text use currentColor and
     need the contrast to stay readable. */
  background: #1a1916;
  color: rgba(246,242,233,0.94);
}
.course-list__thumb svg { width: 100%; height: 100%; display: block; }
.course-list__info { min-width: 0; }
.course-list__kicker {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 4px; display: block;
}
.course-list__title {
  font-family: var(--serif); font-size: var(--t-h4); font-weight: 500;
  margin: 0; line-height: 1.2;
}
.course-list__title em, .course-list__title i { font-style: italic; font-weight: 400; }
.course-list__meta {
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-xs);
  color: var(--muted); margin-top: 4px;
}
.course-list__expiry-warn { color: var(--accent); font-weight: 600; }
.course-list__prog { text-align: right; min-width: 130px; }
.course-list__prog-num {
  font-family: var(--serif); font-size: var(--t-h2); font-weight: 400;
  line-height: 1; color: var(--ink);
}
.course-list__prog-num em { font-style: italic; }
.course-list__prog-bar {
  width: 120px; height: 2px;
  background: rgba(26,25,22,0.10);
  margin: 8px 0 0 auto; overflow: hidden;
}
.dark-mode .course-list__prog-bar { background: rgba(246,242,233,0.12); }
.course-list__prog-fill { height: 100%; background: var(--accent); }
.course-list__prog-fill--done { background: var(--pass); }
.course-list__prog-status {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-top: 6px;
}
.course-list__prog-status--complete { color: var(--pass); }
.course-list__prog-status--starting { color: var(--accent); }

/* ============================================================
   Course-landing modules — chapter cards with formal exam row
   ============================================================ */
.crs-modules { display: flex; flex-direction: column; }
.crs-module {
  border-top: var(--hairline);
  padding: var(--s5) 0;
}
.crs-module:first-child { border-top: 0; padding-top: var(--s4); }
.crs-module--locked .crs-module__num { opacity: 0.4; }
.crs-module--locked .crs-module__title { color: var(--muted); }
/* Module head — a real <button> so the accordion is keyboard operable
   (Enter/Space for free) without surrendering the editorial layout.
   Resets neutralise UA button chrome; the grid gains a 4th track for
   the chevron. */
.crs-module__head {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: baseline;
  gap: var(--s4);
  margin-bottom: var(--s3);
  /* button resets */
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--surface-radius-sm);
}
.crs-module__head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.crs-module__heading { min-width: 0; }
.crs-module__chev {
  align-self: center;
  color: var(--muted);
  transition: color var(--t-fast);
}
.crs-module__head:hover .crs-module__chev { color: var(--ink); }
.crs-module__chev svg { transition: transform var(--t-slow); }
.crs-module.is-collapsed .crs-module__chev svg { transform: rotate(-90deg); }

/* Collapsible body — grid-rows trick (0fr ↔ 1fr) so height animates
   without measuring. Transition only switches on after the initial
   state has painted (.crs-acc-ready, added by initCourseAccordions)
   so page load never animates. No-JS: everything stays open. */
.crs-module__body {
  display: grid;
  grid-template-rows: 1fr;
}
.crs-acc-ready .crs-module__body {
  transition: grid-template-rows var(--t-slow), visibility var(--t-slow);
}
.crs-module__body-inner { min-height: 0; overflow: hidden; }
.crs-module.is-collapsed .crs-module__body {
  grid-template-rows: 0fr;
  visibility: hidden;
}
.crs-module.is-collapsed { padding-bottom: var(--s4); }
.crs-module.is-collapsed .crs-module__head { margin-bottom: 0; }
.crs-module__num {
  font-family: var(--serif); font-style: italic;
  font-size: var(--t-h2); font-weight: 400;
  color: var(--accent); line-height: 1; text-align: center;
}
.crs-module__kicker {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px; display: block;
}
.crs-module__kicker strong { color: var(--ink); }
.crs-module__title {
  display: block; /* renders as a <span> inside the head button */
  font-family: var(--serif); font-size: var(--t-h2); font-weight: 500;
  margin: 0; line-height: 1.18;
}
.crs-module__title em, .crs-module__title i { font-style: italic; font-weight: 400; }
.crs-module__badge {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--badge-radius);
  border: 1px solid; white-space: nowrap;
  color: var(--muted); border-color: rgba(26,25,22,0.22);
}
.dark-mode .crs-module__badge { border-color: rgba(246,242,233,0.22); }
.crs-module__badge--passed { color: var(--pass); border-color: var(--pass); }
.crs-module__badge--active { color: var(--accent); border-color: var(--accent); }
.crs-module__badge--locked { color: var(--muted); background: var(--paper-alt); }

/* Lesson rows inside a module */
.crs-lessons {
  display: flex; flex-direction: column;
  border-top: var(--hairline);
}
.crs-lesson {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: 11px 0;
  border-bottom: var(--hairline);
  text-decoration: none; color: var(--ink);
  transition: background var(--t-fast);
}
.crs-lesson:hover { background: var(--paper-alt); }
.crs-lesson:last-child { border-bottom: 0; }
.crs-lesson--done .crs-lesson__marker { color: var(--pass); }
.crs-lesson--active .crs-lesson__status { color: var(--accent); }
.crs-lesson--locked {
  opacity: 0.55; cursor: not-allowed;
  background: rgba(26,25,22,0.03);
}
.dark-mode .crs-lesson--locked { background: rgba(246,242,233,0.04); }
.crs-lesson__marker {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); text-align: center;
}
.crs-lesson__title {
  font-family: var(--serif); font-size: var(--t-body); font-weight: 400;
  line-height: 1.35;
}
.crs-lesson__title em { font-style: italic; }
.crs-lesson__type {
  display: inline-block;
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-left: 8px; opacity: 0.7;
}
.crs-lesson__status {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.crs-lesson--done .crs-lesson__status { color: var(--pass); }

/* Module exam row — set off with heavy rules above and below */
.crs-exam {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: 13px 0;
  border-top: var(--rule-ink-heavy);
  border-bottom: var(--rule-ink-heavy);
  margin-top: 6px;
  text-decoration: none; color: var(--ink);
  transition: background var(--t-fast);
}
.crs-exam:hover { background: var(--paper-alt); }
.crs-exam--locked { opacity: 0.55; cursor: not-allowed; }
.crs-exam__marker {
  font-family: var(--serif); font-style: italic;
  font-size: var(--t-body-lg); color: var(--accent);
  text-align: center;
}
.crs-exam__title {
  font-family: var(--serif); font-size: var(--t-body); font-weight: 500;
  font-style: italic; margin: 0;
}
.crs-exam__status {
  font-family: var(--mono); font-size: var(--t-mono-xs);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); white-space: nowrap;
}
.crs-exam--passed .crs-exam__status { color: var(--pass); }
.crs-exam--locked .crs-exam__status { color: var(--muted); }
.crs-module__state {
  font-family: var(--serif); font-style: italic; font-size: var(--t-body-xs);
  color: var(--muted); padding: 10px 0 0 76px;
}

/* ============================================================
   About this course — collapsible editorial section after the
   study path. The <summary> mirrors the .section-rule aesthetic
   (§ numeral · italic serif heading · flanking rule) with a
   rotating chevron; <details> keeps it functional without JS.
   ============================================================ */
.crs-about { margin: var(--s5) 0 var(--s6); }
.crs-about__summary {
  display: flex; align-items: center; gap: 14px;
  list-style: none;
  cursor: pointer;
  padding: var(--s2) 0;
  border-radius: var(--surface-radius-sm);
}
.crs-about__summary::-webkit-details-marker { display: none; }
.crs-about__summary::marker { content: ""; }
.crs-about__summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.crs-about__h {
  font-family: var(--serif); font-size: var(--t-body-lg); font-weight: 500;
  font-style: italic; margin: 0; white-space: nowrap; color: var(--ink);
}
.crs-about__line { flex: 1; height: 1px; background: var(--ink); opacity: 0.85; }
.crs-about__chev {
  color: var(--muted);
  transition: color var(--t-fast);
}
.crs-about__summary:hover .crs-about__chev { color: var(--ink); }
.crs-about__chev svg { transition: transform var(--t-slow); }
.crs-about[open] .crs-about__chev svg { transform: rotate(180deg); }
.crs-about__body {
  margin: var(--s3) 0 0;      /* full content width — edge to edge */
  text-align: justify;
  hyphens: auto;
}
.crs-about__deck {
  font-family: var(--serif); font-style: italic;
  font-size: var(--t-body); color: var(--muted);
  line-height: 1.65;
  margin: 0 0 var(--s3);
}
.crs-about__deck:last-child { margin-bottom: 0; }

/* ============================================================
   Lesson body — drop cap + editorial text treatment
   Applied to the first .lblock--text inside a lesson page.
   ============================================================ */
.lblock--text.lblock--dropcap > p:first-child::first-letter,
.lblock--text:first-of-type > p:first-child::first-letter {
  /* Upright roman, not italic: italic swash capitals (J, G, Q) carry
     descenders/tails that crash into the third line. Roman caps sit on the
     baseline cleanly. line-height ~0.72 + small top nudge spans exactly
     three lines without overlapping the prose. */
  font-size: 3.1em; line-height: 0.72;
  float: left; font-style: normal;
  color: var(--accent);
  margin: 0.08em 0.14em 0 0;
  font-weight: 500;
}

/* Editorial lesson hero — italic display + breadcrumb. Centred so it
   reads as a chapter opening rather than a left-aligned form header.
   Breadcrumb sits tight to the top of the article column; the title
   keeps a generous gap below it. */
/* Lesson hero is CENTRED — one centred axis with the prose column,
   media and journal beneath it. */
.lesson-hero--editorial {
  padding: 10px 0 var(--s4);
  text-align: center;
}
.lesson-hero--editorial .lesson-hero-meta {
  justify-content: center;
  font-family: var(--mono); font-size: var(--t-mono-sm);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--s3);
}
.lesson-hero--editorial .lesson-hero-meta a { color: var(--muted); }
.lesson-hero--editorial .lesson-hero-meta a:hover { color: var(--ink); }
.lesson-hero--editorial .lesson-hero-kind { color: var(--accent); }
.lesson-hero--editorial .lesson-hero-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 400; line-height: 1.1;
  letter-spacing: -0.01em; margin: 0 auto;
  max-width: 38ch;
  text-wrap: balance;
}
.lesson-hero--editorial .lesson-hero-title em,
.lesson-hero--editorial .lesson-hero-title i { font-style: italic; font-weight: 500; }

/* ============================================================
   Mobile responsive
   ============================================================ */
@media (max-width: 900px) {
  .mh-plate { padding: 12px var(--screen-gutter) 10px; }
  .mh-plate__name { font-size: var(--t-h2); }
  .mh-plate__emblem { width: 30px; height: 30px; }
  .mh-plate__tag { font-size: var(--t-mono-sm); }
  .mh-plate__ornament { font-size: var(--t-mono-xs); letter-spacing: 0.28em; margin-top: 6px; }
  .mh-plate__ornament-rule { width: 18px; }

  .mh-band { grid-template-columns: auto 1fr auto; gap: var(--s2); padding: 8px var(--s3); }
  .mh-band__name { font-size: var(--t-body-sm); }
  .mh-band__tag { display: none; }
  .mh-band__nav { gap: var(--s3); }
  .mh-band__nav .mh-nav__link { font-size: var(--t-mono-xs); letter-spacing: 0.18em; }

  /* Mobile: keep the lineage but trim to the four cornerstones — kicker
     and stamp would crowd it out. */
  .lineage-strip { font-size: var(--t-mono-xs); letter-spacing: 0.22em; padding: 5px var(--s3); gap: var(--s2); }
  .lineage-strip__kicker { display: none; }
  .lineage-strip__stamp { display: none; }
  .lineage-strip__roll { justify-content: flex-start; gap: 8px; }
  .lineage-strip__roll .lineage-strip__name:nth-of-type(n+5),
  .lineage-strip__roll .lineage-strip__sep:nth-of-type(n+5) { display: none; }

  .context-strip { padding: 6px var(--s3); font-size: var(--t-mono-xs); letter-spacing: 0.14em; }
  .context-strip__current { font-size: var(--t-body-xs); }
  .context-strip__kind { display: none; }

  .ed-hero { padding: var(--s4) var(--s3) var(--s4); }
  .ed-hero__deck { font-size: var(--t-body-sm); }

  .ed-overview { margin: var(--s5) auto var(--s4); }
  .ed-overview__head { gap: 10px; margin-bottom: var(--s3); }
  .ed-overview__h { font-size: var(--t-body-sm); }
  .ed-overview__body { font-size: var(--t-body); line-height: 1.7; }
  .ed-overview__body > p:first-child::first-letter { font-size: 3em; }

  .ledger-band {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
  }
  .ledger-band__cell { padding: 8px 4px; }
  .ledger-band__num { font-size: var(--t-body-lg); }
  .ledger-band__lbl { font-size: var(--t-mono-xs); letter-spacing: 0.16em; }

  .section-rule { gap: 10px; margin: var(--s4) 0 var(--s3); }
  .section-rule__h { font-size: var(--t-body-sm); }
  .section-rule__note { display: none; }

  .course-list__row { grid-template-columns: 28px 60px 1fr auto; gap: var(--s2); padding: 12px var(--s2); }
  .course-list__num { font-size: var(--t-body-lg); }
  .course-list__thumb { width: 60px; height: 36px; }
  .course-list__title { font-size: var(--t-body-sm); }
  .course-list__kicker { font-size: var(--t-mono-xs); letter-spacing: 0.16em; }
  .course-list__meta { font-size: var(--t-body-xs); }
  .course-list__prog { min-width: auto; }
  .course-list__prog-num { font-size: var(--t-body-sm); }
  .course-list__prog-bar { width: 44px; }
  .course-list__prog-status { display: none; }

  .crs-module__head { grid-template-columns: 32px 1fr auto auto; gap: var(--s2); }
  .crs-module__num { font-size: var(--t-h2); }
  .crs-module__title { font-size: var(--t-body-lg); }
  .crs-module__kicker { font-size: var(--t-mono-xs); letter-spacing: 0.18em; }
  .crs-lesson { grid-template-columns: 32px 1fr auto; gap: var(--s2); }
  .crs-lesson__title { font-size: var(--t-body-sm); }
  .crs-exam { grid-template-columns: 32px 1fr auto; gap: var(--s2); }
  .crs-exam__title { font-size: var(--t-body-sm); }
  .crs-module__state { padding-left: 38px; font-size: var(--t-body-xs); }
}

@media (max-width: 560px) {
  .mh-band__words { display: none; }
  .mh-band__brand { gap: 0; }
}

/* ============================================================
   Lesson augmentations — flashback recall, learning objectives,
   common objections, common mistakes. All four live inside the
   lesson_blocks text stack and render with editorial typography
   rather than chrome. No coloured boxes; no buttons; no badges.
   The pattern is kicker + body + rule, matching the rest of
   the lesson page.
   ============================================================ */

/* Flashback — opens a new module with a spaced-repetition recall
   prompt from the previous module. Set in italic so it reads as
   transitional, not new content. */
.lesson-flashback {
  margin: 0 0 var(--s4);
  max-width: 100%;
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule-ink, rgba(0,0,0,0.08));
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-lg);
  line-height: 1.65;
  color: var(--muted);
}
.lesson-flashback__label {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
  font-style: normal;
}
.lesson-flashback p { margin: 0 0 var(--s2) 0; }
.lesson-flashback p:last-child { margin-bottom: 0; }
.lesson-flashback em { color: var(--ink); font-weight: 500; }

/* Learning objectives — small italic block at the top of a lesson,
   inside a lblock--text section. The HTML wrapper is
   <section class="lesson-objectives">.  */
.lesson-objectives {
  margin: 0 0 var(--s4);
  max-width: 100%;
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule-ink, rgba(0,0,0,0.08));
}
.lesson-objectives__label {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
}
.lesson-objectives ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-lg);
  line-height: 1.6;
  color: var(--muted);
}
.lesson-objectives li {
  padding: 3px 0 3px 1.4em;
  position: relative;
}
.lesson-objectives li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent, currentColor);
  font-style: normal;
}

/* Common objection — pre-empts the skeptic's question; renders
   as an italicised aside with a rule on the left, woven into
   essay flow. */
.lesson-objection {
  margin: var(--s5) 0;
  max-width: 100%;
  padding: var(--s2) var(--s4);
  border-left: 2px solid var(--accent, currentColor);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-lg);
  line-height: 1.7;
  color: var(--muted);
}
.lesson-objection em {
  font-weight: 500;
  color: var(--ink);
}
.lesson-objection p { margin: 0; }
.lesson-objection p + p { margin-top: var(--s2); }

/* Common mistakes — small numbered section at the end of the
   essay, before reflections. Discrete, but distinct enough that
   a student can tell they're in a debrief, not a continuation. */
.lesson-mistakes {
  margin: var(--s5) 0 0;
  max-width: 100%;
  padding-top: var(--s3);
  border-top: 1px solid var(--rule-ink, rgba(0,0,0,0.08));
}
.lesson-mistakes__label {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: var(--s3);
}
.lesson-mistakes ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: lessonmistakes;
}
.lesson-mistakes li {
  counter-increment: lessonmistakes;
  position: relative;
  padding-left: 2.2em;
  margin-bottom: var(--s3);
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  line-height: 1.65;
}
.lesson-mistakes li::before {
  content: counter(lessonmistakes, lower-roman) ".";
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--mono);
  font-size: var(--t-mono-sm);
  letter-spacing: 0.05em;
  color: var(--accent, currentColor);
  font-weight: 500;
  text-transform: uppercase;
}
.lesson-mistakes li strong {
  font-family: var(--serif);
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
}

/* ============================================================
   Per-lesson private journal — designed as a writer's notebook,
   not a form. Sits directly below the video so the student can
   write while watching. Paper-tinted writing surface with quiet
   editorial chrome; the "Mark this moment" tool drops a [T+MM:SS]
   anchor at the cursor based on Publitio's `publitio_video_played`
   event (falls back to page-load elapsed if the event hasn't
   fired yet). All chrome is recessed so the focus is the writing.
   ============================================================ */
.lesson-notes {
  width: 100%;
  max-width: var(--measure-lesson-media);
  margin: 0;
  padding: 0;
}

/* Collapsed-by-default toggle row. The panel body (.lesson-notes__inner)
   is CSS-hidden, never conditionally rendered, so the autosave JS — which
   binds by element IDs — always finds its elements. .is-open comes from
   the server (note has content) or initJournalToggle (localStorage). */
.lesson-notes__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  /* Full hairline-strong box + 3px oxblood spine: reads unmistakably as an
     interactive control, flat-editorial (no floating-card shadow). Upright
     serif label, not italic — italic reads as a caption, not a button. */
  padding: 14px 18px;
  background: var(--paper-alt);
  border: var(--hairline-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--surface-radius-sm);
  font-family: var(--serif);
  font-style: normal;
  font-size: var(--t-body);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
  text-align: left;
  cursor: pointer;
  border-radius: var(--surface-radius-sm);
  transition: color var(--t-fast);
}
.lesson-notes__toggle:hover { background: var(--paper-deep); border-color: var(--ink); border-left-color: var(--accent); }
.lesson-notes__toggle:active { background: var(--paper-deep); }
.lesson-notes__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lesson-notes__toggle-icon { display: inline-flex; color: var(--accent); }
.lesson-notes__toggle-label { font-style: normal; color: var(--ink); }
.lesson-notes__toggle-label em {
  font-style: italic;
  font-size: var(--t-body-sm);
  color: var(--muted);
}
.lesson-notes__toggle-chev {
  margin-left: auto;
  display: inline-flex;
  color: var(--muted);
}
/* Explicit open/close hint so the affordance is unmistakable. */
.lesson-notes__toggle-chev::before {
  content: "Open";
  margin-right: 8px;
  font-family: var(--mono);
  font-style: normal;
  font-size: var(--t-mono-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.lesson-notes.is-open .lesson-notes__toggle-chev::before { content: "Close"; }
.lesson-notes__toggle-chev svg { transition: transform var(--t-slow); }
.lesson-notes.is-open .lesson-notes__toggle-chev svg { transform: rotate(180deg); }
.lesson-notes__inner { display: none; padding-top: var(--s3); }
.lesson-notes.is-open .lesson-notes__inner { display: block; }

/* Meta — italic serif title + a small "Private" badge. No mono
   uppercase noise; reads like a chapter header, not a form label. */
.lesson-notes__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: 14px;
}
.lesson-notes__title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.lesson-notes__privacy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: var(--t-mono-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.lesson-notes__privacy svg {
  display: block;
  opacity: 0.7;
}

.lesson-notes__form { margin: 0; }

/* The writing surface. Parchment background, generous padding,
   serif body, soft shadow rather than hard border — like a
   notebook page sitting on the table. */
.lesson-notes__body {
  width: 100%;
  min-height: clamp(280px, 24vh, 480px);
  font-family: var(--serif);
  font-size: var(--t-body-lg);
  line-height: 1.7;
  color: var(--ink);
  background: rgba(252, 246, 234, 0.55);
  border: 1px solid var(--rule-ink, rgba(0,0,0,0.10));
  border-radius: var(--badge-radius);
  padding: var(--s5);
  resize: vertical;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast, 150ms), background-color var(--t-fast, 150ms), box-shadow var(--t-fast, 150ms);
}
.lesson-notes__body:focus {
  outline: none;
  border-color: rgba(0,0,0,0.22);
  background: rgba(252, 246, 234, 0.85);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
}
.dark-mode .lesson-notes__body {
  background: rgba(37, 35, 32, 0.55);
  color: var(--ink);
  border-color: rgba(246, 242, 233, 0.15);
  box-shadow: 0 1px 2px rgba(0,0,0,0.20);
}
.dark-mode .lesson-notes__body:focus {
  background: rgba(37, 35, 32, 0.75);
  border-color: rgba(246, 242, 233, 0.35);
  box-shadow: 0 1px 3px rgba(0,0,0,0.30), 0 2px 4px rgba(0,0,0,0.25);
}
.lesson-notes__body::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* Footer — Mark button on the left, save indicator on the right.
   Both quiet. Button is text-style with a small icon, no pill or
   border ring; saved time is italic serif, not mono caps. */
.lesson-notes__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: 10px;
  padding: 0 2px;
}
.lesson-notes__mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 1px dotted transparent;
  padding: 2px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-sm);
  cursor: pointer;
  transition: color var(--t-fast, 150ms), border-color var(--t-fast, 150ms);
}
.lesson-notes__mark:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.lesson-notes__mark:active { color: var(--accent, var(--ink)); }
.lesson-notes__mark svg {
  display: block;
  opacity: 0.7;
}
.lesson-notes__mark:hover svg { opacity: 1; }
.lesson-notes__assurance {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-xs);
  color: var(--muted);
}
.lesson-notes__saved {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-body-xs);
  color: var(--muted);
  min-height: 1em;
  margin-left: auto;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .lesson-objectives ul,
  .lesson-objection,
  .lesson-mistakes li { font-size: var(--t-body); }
  .lesson-notes__meta { flex-direction: column; gap: 4px; align-items: flex-start; }
  .lesson-notes__foot { flex-direction: column; gap: 6px; align-items: flex-start; }
  .lesson-notes__body { min-height: clamp(220px, 30vh, 360px); }
}

.clipboard-poison {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
}

