/* ==========================================================================
   base.css: reset, typography, page layout, site chrome, page templates
   (PLAN §5.3.1, §5.3.3). Components live in components.css, sims in sims.css.
   ========================================================================== */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, svg, canvas, video { display: block; max-width: 100%; }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:where(cs-callout, cs-def, cs-formula, cs-figure, cs-check, cs-cite, cs-sources, cs-case-card, cs-dimice, cs-quiz, cs-sim) { display: block; }
:where(cs-def, cs-cite) { display: inline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
}

/* ---------- body type ---------- */
body {
  font-family: var(--font-body);
  font-size: var(--fs-0);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  font-variation-settings: normal;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body > .layout, body > main { flex: 1 0 auto; }

::selection { background: var(--accent-soft); color: var(--ink); }

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  color: var(--ink);
  font-optical-sizing: auto;
  text-wrap: balance;
}
h1 { font-size: var(--fs-4); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-2); font-weight: 600; line-height: 1.2; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-1); font-weight: 600; line-height: 1.3; }
h4 { font-size: var(--fs-0); font-weight: 600; line-height: 1.35; }

p, li, dd { text-wrap: pretty; }
strong, b { font-weight: 600; }
em, i { font-style: italic; }
small { font-size: var(--fs--1); }
sub, sup { font-size: .7em; line-height: 0; }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:visited { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; color: var(--accent-hover); }

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

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-7) 0; }

abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; }

code, kbd {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .86em;
  background: var(--surface-2);
  border-radius: 3px;
  padding: .08em .3em;
}
kbd { border: 1px solid var(--line); border-bottom-width: 2px; }

.num, .tabular { font-variant-numeric: tabular-nums lining-nums; }

.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--s-4); top: -100px;
  z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-ui); font-weight: 600;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-1);
  text-decoration: none;
}
.skip:visited { color: var(--accent-ink); }
.skip:focus { top: var(--s-3); }

/* ---------- prose rhythm ---------- */
.prose > * + *,
article > * + *,
article section > * + * { margin-top: 1.1em; }
article section { margin-top: var(--s-8); }
article section:first-of-type { margin-top: var(--s-7); }
article h2 { margin-top: 0; }
article section > h2 + * { margin-top: .8em; }
article h3 { margin-top: 1.8em; }
article section > h3 + * { margin-top: .5em; }
article :is(ul, ol):not([role="list"]) { padding-left: 1.3em; }
article li + li { margin-top: .35em; }
article li::marker { color: var(--ink-3); }

.prose p, article p, article li, article dd, article blockquote { max-width: var(--measure); }

blockquote {
  border-left: 3px solid var(--line-strong);
  padding: .1em 0 .1em 1.1em;
  color: var(--ink-2);
  font-style: italic;
}
blockquote cite, blockquote footer { display: block; font-style: normal; font-family: var(--font-ui); font-size: var(--fs--1); margin-top: .4em; color: var(--ink-3); }

/* ==========================================================================
   Site header
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
}
@supports (backdrop-filter: blur(8px)) {
  .site-header { backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); }
}
@media (min-width: 960px) {
  .site-header { position: sticky; top: 0; }
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-5);
  min-height: var(--header-h);
  padding: var(--s-2) var(--gutter);
  max-width: 1440px;
  margin: 0 auto;
}
/* the no-JS fallback link */
.site-header > a:only-child, [data-site-header] > a:only-child {
  display: inline-block; padding: var(--s-4) var(--gutter); font-family: var(--font-ui); font-weight: 700;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
}
.wordmark:visited, .wordmark:hover { color: var(--ink); }
.wordmark__glyph { width: 30px; height: 22px; flex: none; }
.wordmark__glyph circle { fill: var(--ink); }
.wordmark__glyph .tick { stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.wordmark__glyph .lead { fill: var(--hivis); }
.wordmark__glyph .lead-tick { stroke: var(--hivis); }

.crumbs { min-width: 0; flex: 1 1 0; font-size: var(--fs--1); color: var(--ink-2); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: 0 .5em; min-width: 0; }
.crumbs--site ol { flex-wrap: wrap; }
.crumbs li { display: inline-flex; align-items: center; gap: .5em; flex: none; white-space: nowrap; }
.crumbs li[aria-current] { flex: 0 1 auto; min-width: 0; }
.crumbs li + li::before {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--ink-3); border-top: 1.5px solid var(--ink-3);
  transform: rotate(45deg);
  margin-right: .25em;
  flex: none;
}
.crumbs--site ol { gap: 0 var(--s-5); }
.crumbs--site li + li::before { display: none; }
.crumbs--site a, .crumbs--site [aria-current] { display: inline-block; padding: .55em 0; }
.crumbs--site [aria-current] { color: var(--ink); font-weight: 600; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 500; min-width: 0; }
.crumb-cur { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; min-width: 0; }

.mod-dots { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; }
.mod-dots a {
  display: grid; place-items: center;
  width: 22px; height: 30px;
  border-radius: 6px;
}
.mod-dots a::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
  background: transparent;
  transition: transform var(--dur) var(--ease);
}
.mod-dots a.is-done::before { background: var(--ink); border-color: var(--ink); }
.mod-dots a[aria-current]::before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mod-dots a.is-done[aria-current]::before { background: var(--accent); border-color: var(--accent); }
.mod-dots a:hover::before { transform: scale(1.25); }

.site-header__tools { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }

@media (max-width: 479.98px) {
  .btn--map .btn__lbl { display: none; }
  .btn--map { padding-inline: .7em; }
}
@media (max-width: 719.98px) {
  .site-header__inner { gap: 0 var(--s-3); }
  .crumbs--site { font-size: var(--fs--1); }
  .crumbs--site ol { gap: 0 var(--s-4); }
  .crumbs { order: 3; flex: 1 1 100%; min-width: 0; padding-bottom: var(--s-1); }
  .crumbs li:first-child:not(:only-child):not(:last-child) { display: none; }
  .crumbs li:nth-child(2)::before { display: none; }
  .crumbs li { flex-shrink: 1; }
  .crumb-cur { max-width: 100%; }
  .mod-dots { order: 4; margin-right: -4px; }
  .site-header__inner:has(.mod-dots) .crumbs { flex: 1 1 calc(100% - 9rem); }
}

/* ==========================================================================
   Course map (sidebar + drawer)
   ========================================================================== */
.course-nav { font-family: var(--font-ui); font-size: var(--fs--1); line-height: 1.35; }
.course-nav__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  padding: 0 var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-2);
}
.course-nav__head a { font-weight: 600; color: var(--ink); text-decoration: none; font-size: var(--fs-0); }
.course-nav__head a:hover { color: var(--accent); }
.course-nav__count { color: var(--ink-3); font-size: var(--fs--2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.course-nav ol { list-style: none; margin: 0; padding: 0; }
.course-nav details > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 1.6em 1fr auto;
  align-items: baseline;
  gap: .4em;
  padding: .55em var(--s-2);
  border-radius: var(--r-1);
  cursor: pointer;
  color: var(--ink);
  font-weight: 500;
}
.course-nav details > summary::-webkit-details-marker { display: none; }
.course-nav details > summary::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--dur) var(--ease);
}
.course-nav details[open] > summary::after { transform: translateY(1px) rotate(225deg); }
.course-nav summary:hover { background: var(--surface-2); }
.course-nav .mod-num { color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.course-nav .is-current-module > details > summary .mod-num { color: var(--accent); }
.course-nav__lessons { padding: 0 0 var(--s-2) 0 !important; }
.course-nav__lessons a, .course-nav__overview {
  display: grid;
  grid-template-columns: 1.6em 1fr;
  gap: .4em;
  align-items: baseline;
  padding: .42em var(--s-2);
  border-radius: var(--r-1);
  color: var(--ink-2);
  text-decoration: none;
}
.course-nav__lessons a:visited { color: var(--ink-2); }
.course-nav__lessons a:hover { background: var(--surface-2); color: var(--ink); }
.course-nav__lessons a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.course-nav__lessons .dot {
  justify-self: center;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
  transform: translateY(-1px);
}
.course-nav__lessons a.is-done .dot { background: var(--ink-2); border-color: var(--ink-2); }
.course-nav__lessons a[aria-current="page"] .dot { border-color: var(--accent); }
.course-nav__lessons a.is-done[aria-current="page"] .dot { background: var(--accent); }
.course-nav__overview .dot { border: 0; }

.map-drawer {
  margin: 0 0 0 auto;
  height: 100%; max-height: 100%;
  width: min(24rem, 92vw);
  max-width: 92vw;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  box-shadow: -24px 0 48px -24px rgb(0 0 0 / .35);
}
.map-drawer::backdrop { background: rgb(18 20 23 / .45); }
.map-drawer[open] { animation: drawer-in 180ms var(--ease); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.map-drawer__bar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui); font-weight: 600;
}
.map-drawer .course-nav { padding: var(--s-4) var(--s-3) var(--s-7); }

/* ==========================================================================
   Page layouts
   ========================================================================== */
.layout {
  width: 100%;
  padding: 0 var(--gutter);
  margin: 0 auto;
}
[data-site-sidebar], [data-site-margin] { display: none; }

main.lesson, main.page { padding-bottom: var(--s-8); min-width: 0; }
main.lesson > article, main.page > article { min-width: 0; }

@media (min-width: 960px) {
  .layout { max-width: calc(var(--wide) + 2 * var(--gutter)); }
  body:not([data-page="home"]) .layout { padding-top: var(--s-2); }
}

@media (min-width: 1200px) {
  :root { --gap: clamp(24px, 3vw, 48px); }
  body[data-lesson] .layout,
  body[data-page="module"] .layout {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, var(--content)) var(--margin-col);
    column-gap: var(--gap);
    max-width: calc(var(--sidebar) + var(--content) + var(--margin-col) + 2 * var(--gap) + 2 * var(--gutter));
    align-items: start;
  }
  body[data-lesson] [data-site-sidebar],
  body[data-page="module"] [data-site-sidebar] {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 1px);
    max-height: calc(100vh - var(--header-h) - 1px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--s-6) var(--s-1) var(--s-7) 0;
    scrollbar-width: thin;
  }
  body[data-lesson] [data-site-margin],
  body[data-page="module"] [data-site-margin] { display: block; position: relative; min-height: 1px; }
  body[data-lesson] [data-open-map],
  body[data-page="module"] [data-open-map] { display: none; }
}

/* Wide elements: extend across content + margin columns on lesson pages */
.breakout { width: 100%; max-width: var(--wide); }
@media (min-width: 1200px) {
  body[data-lesson] .breakout,
  body[data-page="module"] .breakout {
    width: calc(100% + var(--margin-col) + var(--gap));
    max-width: calc(100% + var(--margin-col) + var(--gap));
  }
}

/* ---------- lesson header ---------- */
.lesson-head { padding-top: var(--s-7); padding-bottom: var(--s-6); border-bottom: 1px solid var(--line); }
.lesson-kicker {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs--1);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: .6em;
}
.lesson-kicker::before {
  content: "";
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: var(--hivis);
  box-shadow: 10px 0 0 var(--ink-3), 20px 0 0 var(--ink-3);
  margin-right: 22px;
}
.lesson-head h1 { margin-top: var(--s-3); max-width: 20ch; }
.lesson-summary {
  margin-top: var(--s-4);
  font-size: var(--fs-1);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 38ch;
}
.objectives-label {
  margin-top: var(--s-5);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--fs--1);
  color: var(--ink);
}
.objectives { list-style: none; padding: 0 !important; margin-top: var(--s-2); display: grid; gap: .35em; }
.objectives li { position: relative; padding-left: 1.5em; max-width: var(--measure); margin: 0 !important; }
.objectives li::before {
  content: "";
  position: absolute; left: .15em; top: .62em;
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--accent);
}

/* margin notes */
.note[data-margin] {
  font-family: var(--font-ui);
  font-size: var(--fs--1);
  line-height: 1.45;
  color: var(--ink-2);
  border-left: 2px solid var(--line-strong);
  padding: .1em 0 .1em var(--s-3);
  max-width: var(--measure);
}
.note[data-margin] > * + * { margin-top: .5em; }
.note[data-margin] strong:first-child { color: var(--ink); display: block; }
[data-site-margin] .note[data-margin] {
  position: absolute; left: 0; right: 0;
  border-left: 0;
  border-top: 2px solid var(--line-strong);
  padding: var(--s-2) 0 0 0;
  margin: 0;
}
.margin-anchor { display: block; height: 0; }

/* ---------- lesson end (prev/next, mark complete) ---------- */
.lesson-end {
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  font-family: var(--font-ui);
}
@media (min-width: 1200px) {
  .lesson-end {
    max-width: calc(var(--sidebar) + var(--content) + var(--margin-col) + 2 * var(--gap) + 2 * var(--gutter));
    padding-left: calc(var(--gutter) + var(--sidebar) + var(--gap));
  }
}
.lesson-end__inner {
  border-top: 1px solid var(--line);
  padding: var(--s-6) 0;
  display: grid;
  gap: var(--s-5);
}
.lesson-end__complete { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.lesson-end__status { color: var(--ink-2); font-size: var(--fs--1); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.pager a {
  display: block;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
  background: var(--surface);
  transition: border-color var(--dur) var(--ease);
}
.pager a:visited { color: var(--ink); }
.pager a:hover { border-color: var(--accent); color: var(--ink); }
.pager__dir { display: block; font-size: var(--fs--1); color: var(--ink-3); margin-bottom: .2em; }
.pager__title { display: block; font-weight: 600; line-height: 1.3; }
.pager__next { text-align: right; grid-column: 2; }
@media (max-width: 559.98px) { .pager { grid-template-columns: 1fr; } .pager__next { grid-column: 1; } }

/* ---------- site footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: var(--fs--1);
  color: var(--ink-2);
  background: var(--bg);
}
.site-footer__inner {
  max-width: 1440px; margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-7);
  display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-6);
  align-items: baseline;
  justify-content: space-between;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); }
.site-footer a { color: var(--ink-2); display: inline-block; padding: .35em 0; }
.site-footer a:hover { color: var(--accent); }
.site-footer__note { max-width: 46ch; color: var(--ink-3); }

/* ==========================================================================
   Generic content pages (course, glossary, sources, about, module)
   ========================================================================== */
.page-head { padding: var(--s-7) 0 var(--s-6); }
.page-head h1 { max-width: 18ch; }
.page-head .lede { margin-top: var(--s-4); font-size: var(--fs-1); line-height: 1.45; color: var(--ink-2); max-width: 44ch; }
.page-kicker { font-family: var(--font-ui); font-weight: 500; font-size: var(--fs--1); color: var(--ink-2); margin-bottom: var(--s-3); }
.page-section { margin-top: var(--s-8); }
.page-section > h2 + * { margin-top: var(--s-4); }

/* ---------- home ---------- */
body[data-page="home"] .layout { max-width: none; padding: 0; }
.home-hero { position: relative; border-bottom: 1px solid var(--line); background: var(--bg); }
.home-hero__grid {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--s-7) var(--gutter) var(--s-5);
  display: grid;
  gap: var(--s-6);
}
.home-hero__copy { max-width: 44rem; }
.home-hero h1 {
  font-size: var(--fs-5);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  font-variation-settings: "opsz" 96;
  max-width: 14ch;
}
.home-hero h1 em { font-style: normal; color: var(--accent); }
.home-hero .lede { margin-top: var(--s-5); font-size: var(--fs-1); line-height: 1.5; color: var(--ink-2); max-width: 40ch; }
.home-hero__actions { margin-top: var(--s-6); display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.home-hero__meta { margin-top: var(--s-4); font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-2); }
.home-hero__key {
  font-family: var(--font-ui);
  font-size: var(--fs--1);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 26rem;
  border-top: 2px solid var(--ink);
  padding-top: var(--s-3);
  align-self: end;
}
.home-hero__key h2 { font-size: var(--fs-0); margin-bottom: var(--s-2); }
.home-hero__key .los-legend { margin: var(--s-3) 0; }
.home-hero__fine { color: var(--ink-3); font-size: var(--fs--2); }
.home-hero__copy { grid-area: copy; }
.home-hero__key { grid-area: key; }
.home-hero__grid { grid-template-areas: "copy" "stage" "key"; padding-bottom: var(--s-6); }
.home-hero__stage { grid-area: stage; position: relative; margin: 0 calc(-1 * var(--gutter)); }
.home-hero__stage::before, .home-hero__stage::after {
  /* fade the corridor ends into the page */
  content: ""; position: absolute; top: 0; bottom: 0; width: 6%; z-index: 1; pointer-events: none;
}
.home-hero__stage::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.home-hero__stage::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.home-hero__stage .sim__overlay { z-index: 2; }
@media (min-width: 960px) {
  .home-hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); grid-template-areas: "copy key" "stage stage"; align-items: end; column-gap: var(--s-8); padding-top: var(--s-8); padding-bottom: 0; }
}
.sw--e { background-image: repeating-linear-gradient(45deg, transparent 0 3px, color-mix(in srgb, var(--los-e-ink) 45%, transparent) 3px 4.5px); }
.sw--f { background-image: repeating-linear-gradient(45deg, transparent 0 3px, color-mix(in srgb, var(--los-f-ink) 45%, transparent) 3px 4.5px), repeating-linear-gradient(-45deg, transparent 0 3px, color-mix(in srgb, var(--los-f-ink) 45%, transparent) 3px 4.5px); }

.home-band { max-width: 1440px; margin: 0 auto; padding: var(--s-9) var(--gutter) 0; }
.home-band:last-child { padding-bottom: var(--s-9); }
.home-band__head { max-width: 40rem; }
.home-band__head h2, .home-band__title { font-size: var(--fs-3); letter-spacing: -0.015em; line-height: 1.1; }
.home-band__head p { margin-top: var(--s-4); color: var(--ink-2); max-width: var(--measure); }
.home-band__head p + p { margin-top: var(--s-3); }

/* key numbers strip */
.numbers {
  margin-top: var(--s-6);
  display: grid;
  grid-template-columns: 1fr;
  border-top: 2px solid var(--ink);
}
.numbers > div { padding: var(--s-5) 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
@media (min-width: 560px) {
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .numbers > div { padding-right: var(--s-5); }
  .numbers > div:nth-child(even) { padding-left: var(--s-5); border-left: 1px solid var(--line); }
}
@media (min-width: 1040px) {
  .numbers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .numbers > div + div { padding-left: var(--s-5); border-left: 1px solid var(--line); }
}
.numbers .figure-num { order: -1; margin: 0; }
.numbers .figure-num {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
  white-space: nowrap;
}
.numbers .figure-num small { font-size: .42em; font-weight: 600; letter-spacing: 0; color: var(--ink-2); margin-left: .2em; }
.numbers .figure-label { margin-top: var(--s-3); font-family: var(--font-ui); font-size: var(--fs--1); line-height: 1.5; color: var(--ink-2); max-width: 32ch; }
.numbers .figure-label a { display: inline-block; margin-top: .35em; }

/* the course arc */
.arc { list-style: none; padding: 0; margin: var(--s-7) 0 0; counter-reset: arc; position: relative; }
.arc__item {
  position: relative;
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 0 var(--s-4);
  padding-bottom: var(--s-6);
}
.arc__item::before {
  content: "";
  position: absolute;
  left: calc(1.6rem - 1px); top: 3.4rem; bottom: 0;
  border-left: 2px dotted var(--line-strong);
}
.arc__item:last-child::before { display: none; }
.arc__glyph { width: 3.2rem; height: 3.2rem; display: block; }
.arc__glyph circle { fill: var(--dot); }
.arc__glyph .ring { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.arc__item.is-started .arc__glyph .ring { stroke: var(--accent); }
.arc__item.is-done .arc__glyph .ring { stroke: var(--ok); stroke-width: 2; }
.arc__body { padding-top: .35rem; min-width: 0; }
.arc__num { font-family: var(--font-ui); font-size: var(--fs--1); font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.arc__title { font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-1); line-height: 1.25; margin-top: .1em; }
.arc__title a { color: var(--ink); text-decoration: none; }
.arc__title a:visited { color: var(--ink); }
.arc__title a:hover { color: var(--accent); text-decoration: underline; }
.arc__blurb { margin-top: var(--s-2); color: var(--ink-2); max-width: var(--measure); }
.arc__meta { margin-top: var(--s-2); font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.arc__phase {
  font-family: var(--font-ui); font-weight: 600; font-size: var(--fs--1); color: var(--ink-2);
  margin: 0 0 var(--s-4) calc(3.2rem + var(--s-4));
  padding-top: var(--s-2);
}
@media (min-width: 900px) {
  .arc-wrap { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: var(--s-8); align-items: start; }
  .arc-wrap .home-band__head { position: sticky; top: calc(var(--header-h) + var(--s-6)); }
  .arc { margin-top: 0; }
}

.first-step {
  margin-top: var(--s-6);
  display: grid;
  gap: var(--s-5);
  padding: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-2);
}
.first-step h3 { font-size: var(--fs-2); line-height: 1.2; }
.first-step p { color: var(--ink-2); max-width: var(--measure); }
@media (min-width: 820px) { .first-step { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }

.pattern-list { list-style: none; padding: 0; margin: var(--s-6) 0 0; display: grid; gap: var(--s-5); counter-reset: pat; }
@media (min-width: 760px) { .pattern-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--s-7); } }
.pattern-list li { counter-increment: pat; position: relative; padding-left: 2.6rem; max-width: 34rem; }
.pattern-list li::before {
  content: counter(pat);
  position: absolute; left: 0; top: -.05em;
  font-family: var(--font-ui); font-weight: 700; font-size: var(--fs-1);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.pattern-list strong { font-family: var(--font-ui); display: block; font-size: var(--fs-0); margin-bottom: .2em; }
.pattern-list span { color: var(--ink-2); }

.hook-block { display: grid; gap: var(--s-6); align-items: start; }
@media (min-width: 900px) { .hook-block { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-8); } }
.hook-block .prose p { max-width: var(--measure); }
.pull-number {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 5.4rem);
  line-height: .95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}
.pull-number span { color: var(--ink-3); font-weight: 300; }
.pull-caption { margin-top: var(--s-4); font-family: var(--font-ui); color: var(--ink-2); max-width: 30ch; }

/* ---------- module overview ---------- */
.module-head { padding: var(--s-7) 0 var(--s-6); border-bottom: 1px solid var(--line); }
.module-head h1 { margin-top: var(--s-3); max-width: 20ch; }
.module-head .lede { margin-top: var(--s-4); font-size: var(--fs-1); line-height: 1.45; color: var(--ink-2); max-width: 40ch; }
.module-stats { margin-top: var(--s-5); display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.module-actions { margin-top: var(--s-5); display: flex; flex-wrap: wrap; gap: var(--s-3); }

.lesson-list { list-style: none; padding: 0 !important; margin: var(--s-5) 0 0; border-top: 1px solid var(--line); }
.lesson-list > li { border-bottom: 1px solid var(--line); margin: 0 !important; max-width: none !important; }
.lesson-list a {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  gap: var(--s-1) var(--s-4);
  align-items: baseline;
  padding: var(--s-4) var(--s-2);
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--r-1);
}
.lesson-list a:visited { color: var(--ink); }
.lesson-list a:hover { background: var(--surface); }
.lesson-list a:hover .lesson-list__title { color: var(--accent); }
.lesson-list__n { font-family: var(--font-ui); font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lesson-list__title { font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-0); line-height: 1.3; }
.lesson-list__meta { grid-column: 2; font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0 var(--s-4); }
.lesson-list__state { grid-row: 1 / span 2; grid-column: 3; align-self: center; font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); display: inline-flex; align-items: center; gap: .45em; white-space: nowrap; }
.lesson-list__state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.lesson-list__state.is-done { color: var(--ok); }
.lesson-list__state.is-done::before { background: var(--ok); border-color: var(--ok); }
.lesson-list__interactive::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--hivis); margin-right: .4em; transform: translateY(-1px);
}

/* ---------- course page ---------- */
.course-summary { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-7); align-items: flex-end; margin-top: var(--s-5); }
.course-summary .pull-number { font-size: clamp(2.6rem, 6vw, 4rem); }
.course-modules { list-style: none; padding: 0; margin: var(--s-6) 0 0; border-top: 2px solid var(--ink); }
.course-module { border-bottom: 1px solid var(--line); padding: var(--s-5) 0; display: grid; gap: var(--s-3) var(--s-6); }
@media (min-width: 820px) { .course-module { grid-template-columns: 15rem minmax(0, 1fr); } }
.course-module__head h2 { font-size: var(--fs-1); line-height: 1.25; }
.course-module__head h2 a { color: var(--ink); text-decoration: none; }
.course-module__head h2 a:hover { color: var(--accent); text-decoration: underline; }
.course-module__num { font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); font-weight: 500; }
.course-module__bar { margin-top: var(--s-3); display: flex; gap: 4px; flex-wrap: wrap; }
.course-module__bar span { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.course-module__bar span.is-done { background: var(--ink); border-color: var(--ink); }
.course-module__count { margin-top: var(--s-2); font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.course-module .lesson-list { margin-top: 0; border-top: 0; }
.course-module .lesson-list > li:last-child { border-bottom: 0; }
.course-module .lesson-list a { padding: var(--s-2) var(--s-2); }

.notice {
  font-family: var(--font-ui);
  font-size: var(--fs--1);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-1);
  background: var(--warn-soft);
  color: var(--ink);
  border-left: 3px solid var(--warn);
}
.tools-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: var(--s-4); }

/* ---------- glossary / sources ---------- */
.filter-bar { position: sticky; top: 0; z-index: 2; padding: var(--s-3) 0; background: var(--bg); display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
@media (min-width: 960px) { .filter-bar { top: var(--header-h); } }
.filter-bar input[type="search"] {
  flex: 1 1 18rem;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: var(--surface);
  font-family: var(--font-ui);
}
.filter-bar input[type="search"]:focus-visible { outline-offset: 0; }
.filter-count { font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.letter-index { display: flex; flex-wrap: wrap; gap: 2px; font-family: var(--font-ui); font-size: var(--fs--1); margin-top: var(--s-3); }
.letter-index a { display: grid; place-items: center; min-width: 32px; min-height: 36px; border-radius: var(--r-1); text-decoration: none; font-weight: 600; }
.letter-index a:hover { background: var(--surface-2); }

.glossary-list { margin-top: var(--s-5); }
.glossary-letter { font-size: var(--fs-2); margin-top: var(--s-7); padding-bottom: var(--s-2); border-bottom: 2px solid var(--ink); }
.glossary-entry { padding: var(--s-4) 0; border-bottom: 1px solid var(--line); display: grid; gap: var(--s-1) var(--s-6); }
@media (min-width: 760px) { .glossary-entry { grid-template-columns: 14rem minmax(0, 1fr); } }
.glossary-entry dt { font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-0); }
.glossary-entry dt .aka { display: block; font-weight: 400; font-size: var(--fs--1); color: var(--ink-3); }
.glossary-entry dd p { max-width: var(--measure); }
.glossary-entry dd .see { margin-top: var(--s-2); font-family: var(--font-ui); font-size: var(--fs--1); color: var(--ink-3); }
.glossary-entry:target { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); border-radius: 2px; }

.source-list { list-style: none; padding: 0; margin: var(--s-5) 0 0; }
.source-list li { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.source-list li:target { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); }
.source-key { font-family: var(--font-ui); font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.source-title { overflow-wrap: anywhere; }
.source-links { margin-top: .2em; font-family: var(--font-ui); font-size: var(--fs--1); display: flex; flex-wrap: wrap; gap: 0 var(--s-4); }
.source-links a { overflow-wrap: anywhere; }
.source-note { margin-top: .2em; font-family: var(--font-ui); font-size: var(--fs--1); color: var(--warn); }

/* about */
.policy-tags { display: grid; gap: var(--s-3); margin-top: var(--s-4); }
.policy-tags div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s-4); align-items: baseline; }
.policy-tags dt { font-family: var(--font-ui); font-weight: 600; }
@media (max-width: 559.98px) { .policy-tags div { grid-template-columns: 1fr; gap: 0; } }

/* Integration fix: the margin column must not swallow clicks on breakout figures/sims. */
[data-site-margin] { pointer-events: none; }
[data-site-margin] .note, [data-site-margin] a, [data-site-margin] button { pointer-events: auto; }
