:root {
  color-scheme: light;
  --paper: oklch(97.5% 0.014 91);
  --paper-deep: oklch(94% 0.023 88);
  --ink: oklch(20% 0.035 176);
  --ink-soft: oklch(38% 0.035 185);
  --muted: oklch(52% 0.028 192);
  --line: oklch(84% 0.025 182);
  --surface: oklch(99% 0.008 92);
  --surface-cool: oklch(96% 0.025 184);
  --teal: oklch(46% 0.09 190);
  --teal-deep: oklch(33% 0.08 191);
  --coral: oklch(62% 0.16 35);
  --saffron: oklch(76% 0.14 78);
  --violet: oklch(55% 0.12 295);
  --green: oklch(52% 0.11 147);
  --shadow: 0 24px 70px color-mix(in oklch, var(--ink) 12%, transparent);
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --radius: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Aptos, "Gill Sans", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, color-mix(in oklch, var(--line) 32%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in oklch, var(--line) 30%, transparent) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--teal-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

canvas {
  display: block;
  max-width: 100%;
  border-radius: var(--radius);
}

.course-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 76px;
  padding: var(--space-sm) clamp(var(--space-md), 4vw, var(--space-2xl));
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--paper) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--teal);
  border-radius: 50%;
  background:
    conic-gradient(from 20deg, var(--teal), var(--saffron), var(--coral), var(--violet), var(--teal));
  box-shadow: inset 0 0 0 9px var(--paper), inset 0 0 0 12px color-mix(in oklch, var(--teal) 45%, transparent);
}

.brand strong,
.brand em {
  display: block;
}

.brand strong {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
}

.brand em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.2;
}

.top-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-xs);
}

.top-nav a,
.top-nav button,
.primary-action,
.text-action,
.complete-btn,
.network-choice {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.top-nav a,
.top-nav button {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-sm);
  font-size: 14px;
}

.top-nav a:hover,
.top-nav button:hover,
.text-action:hover,
.complete-btn:hover,
.network-choice:hover {
  border-color: var(--teal);
}

.course-shell {
  display: grid;
  grid-template-columns: minmax(230px, 292px) minmax(0, 1fr);
  gap: clamp(var(--space-lg), 3vw, var(--space-2xl));
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: var(--space-lg) clamp(var(--space-md), 3vw, var(--space-2xl)) var(--space-3xl);
}

.course-rail {
  position: sticky;
  top: 100px;
  align-self: start;
  display: grid;
  gap: var(--space-md);
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: var(--space-xs);
}

.rail-status {
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rail-status span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.rail-status strong {
  display: block;
  margin: var(--space-xs) 0;
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 220ms ease-out;
}

.module-nav {
  display: grid;
  gap: var(--space-xs);
}

.module-nav a {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: var(--space-xs);
  align-items: center;
  min-height: 42px;
  padding: 0 var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.module-nav a::before {
  content: attr(data-step);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 11px;
}

.module-nav a.active,
.module-nav a.done {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.module-nav a.done::before {
  background: var(--green);
  color: var(--surface);
  content: "ok";
}

.course-body {
  min-width: 0;
}

.course-body.page-mode {
  display: grid;
  gap: var(--space-lg);
}

.course-body > section.page-hidden {
  display: none;
}

.active-page {
  animation: page-in 260ms ease-out both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.opening {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1fr);
  gap: clamp(var(--space-xl), 5vw, 88px);
  align-items: center;
  min-height: calc(100vh - 124px);
  padding: var(--space-2xl) 0 var(--space-3xl);
  border-bottom: 1px solid var(--line);
}

.page-mode .opening,
.page-mode .lesson,
.page-mode .sources {
  min-height: calc(100vh - 156px);
  border-bottom: 0;
}

.opening-copy {
  max-width: 720px;
  min-width: 0;
}

.eyebrow,
.lesson-kicker {
  margin: 0 0 var(--space-sm);
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h1 {
  max-width: 14ch;
  margin-bottom: var(--space-lg);
  font-size: clamp(50px, 5.2vw, 82px);
}

h2 {
  max-width: 13ch;
  margin-bottom: var(--space-lg);
  font-size: clamp(42px, 5vw, 78px);
}

h3 {
  margin-bottom: var(--space-sm);
  font-size: 20px;
  line-height: 1.2;
}

.lede {
  max-width: 66ch;
  color: var(--ink-soft);
  font-size: clamp(18px, 1.4vw, 22px);
}

.opening-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.primary-action,
.text-action,
.complete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-md);
}

.primary-action {
  border-color: var(--teal-deep);
  background: var(--teal-deep);
  color: var(--surface);
}

.text-action {
  background: transparent;
}

.scan-stage {
  margin: 0;
}

.scan-stage canvas,
.slice-lab,
.signal-lab,
.glm-lab,
.connectivity-lab,
.grid-lab {
  border: 1px solid color-mix(in oklch, var(--teal) 34%, var(--line));
  background: color-mix(in oklch, var(--surface-cool) 72%, var(--surface));
  box-shadow: var(--shadow);
}

.scan-stage canvas {
  width: 100%;
}

figcaption {
  max-width: 66ch;
  margin-top: var(--space-sm);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.lesson {
  padding: clamp(var(--space-2xl), 8vw, 112px) 0;
  border-bottom: 1px solid var(--line);
}

.lesson > p {
  max-width: 74ch;
  color: var(--ink-soft);
  font-size: 18px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.9fr);
  gap: var(--space-xl);
  align-items: start;
  margin-top: var(--space-xl);
}

.clean-list {
  display: grid;
  gap: var(--space-sm);
  max-width: 68ch;
  padding-left: 1.4rem;
}

.diagram-card,
.concept,
.dataset,
.qc-grid article,
.reading-grid article,
.final-note,
.takeaway {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagram-card {
  margin: 0;
  padding: var(--space-md);
}

.diagram-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.svg-surface {
  fill: oklch(96% 0.025 184);
  stroke: var(--line);
}

.svg-title {
  fill: var(--ink);
  font: 700 20px var(--sans);
}

.svg-note {
  fill: var(--muted);
  font: 14px var(--sans);
}

.svg-flow {
  fill: none;
  stroke: var(--teal);
  stroke-width: 5;
  stroke-linecap: round;
}

.bold-curve {
  fill: none;
  stroke: var(--coral);
  stroke-width: 6;
  stroke-linecap: round;
}

.axis {
  stroke: color-mix(in oklch, var(--ink) 42%, transparent);
  stroke-width: 2;
}

.takeaway {
  padding: var(--space-lg);
  color: var(--ink-soft);
}

.takeaway strong {
  color: var(--ink);
}

.starter-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.82fr);
  gap: var(--space-xl);
  align-items: start;
  margin-top: var(--space-xl);
}

.definition-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.definition-strip article,
.word-card,
.fluency-grid article,
.step-explainers article,
.analyst-flow article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.definition-strip article {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-md);
}

.definition-strip strong {
  color: var(--teal-deep);
  font-size: 13px;
  text-transform: uppercase;
}

.definition-strip span {
  color: var(--ink-soft);
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.word-card {
  padding: var(--space-lg);
}

.word-card h3,
.fluency-grid h3,
.step-explainers h3,
.analyst-flow h3 {
  margin-bottom: var(--space-xs);
}

.word-card p,
.fluency-grid p,
.step-explainers p,
.analyst-flow p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.fluency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.fluency-grid article {
  padding: var(--space-lg);
}

.step-explainers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.step-explainers article {
  padding: var(--space-lg);
}

.analyst-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.analyst-flow article {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-lg);
}

.analyst-flow span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in oklch, var(--saffron) 38%, var(--surface));
  color: var(--teal-deep);
  font-weight: 900;
}

.complete-btn {
  margin-top: var(--space-xl);
  background: var(--surface);
}

.complete-btn.done {
  border-color: var(--green);
  background: color-mix(in oklch, var(--green) 12%, var(--surface));
  color: color-mix(in oklch, var(--green) 55%, var(--ink));
}

.concept-grid,
.dataset-grid,
.qc-grid,
.reading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.concept,
.dataset,
.qc-grid article,
.reading-grid article {
  padding: var(--space-lg);
}

.concept p,
.dataset p,
.qc-grid p,
.reading-grid p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.slice-lab,
.grid-lab {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: center;
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  border-radius: var(--radius);
}

.lab-copy label,
.lab-toolbar label {
  display: grid;
  gap: var(--space-xs);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

input[type="checkbox"] {
  accent-color: var(--teal);
}

.lab-readout {
  display: grid;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  color: var(--ink-soft);
  font-size: 14px;
}

.signal-lab {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  border-radius: var(--radius);
}

.lab-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.lab-toolbar label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.term-list {
  display: grid;
  grid-template-columns: minmax(80px, 0.25fr) 1fr;
  gap: var(--space-sm) var(--space-md);
  max-width: 680px;
}

.term-list dt {
  color: var(--teal-deep);
  font-weight: 900;
}

.term-list dd {
  margin: 0;
  color: var(--ink-soft);
}

.glossary-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) minmax(0, 1fr);
  gap: 0;
  margin: var(--space-xl) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.glossary-list dt,
.glossary-list dd {
  margin: 0;
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
}

.glossary-list dt {
  color: var(--teal-deep);
  font-weight: 900;
}

.glossary-list dd {
  color: var(--ink-soft);
}

.glossary-list dt:last-of-type,
.glossary-list dd:last-of-type {
  border-bottom: 0;
}

.file-tree {
  display: grid;
  gap: var(--space-xs);
  max-width: 100%;
  min-width: 0;
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: "Cascadia Mono", "Lucida Console", monospace;
  font-size: 14px;
  overflow: auto;
}

.file-tree span {
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.file-tree span::before {
  content: "/";
  color: var(--coral);
  margin-right: var(--space-xs);
}

.dataset-section {
  padding-top: clamp(var(--space-2xl), 7vw, 96px);
}

.dataset a {
  display: inline-flex;
  margin-top: var(--space-md);
  font-weight: 800;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.pipeline div,
.biomarker-stack div {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.pipeline strong {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal-deep);
  color: var(--surface);
}

.pipeline span,
.biomarker-stack span {
  color: var(--ink-soft);
}

.glm-lab {
  display: grid;
  grid-template-columns: minmax(240px, 0.55fr) minmax(0, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  border-radius: var(--radius);
}

.design-matrix {
  display: grid;
  grid-template-columns: repeat(5, minmax(30px, 1fr));
  gap: 3px;
  max-width: 320px;
}

.design-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 4px;
  background: var(--paper-deep);
}

.design-cell.hot {
  background: var(--teal);
}

.design-cell.warm {
  background: var(--saffron);
}

.design-cell.motion {
  background: var(--coral);
}

.reading-grid article span {
  display: inline-flex;
  margin-bottom: var(--space-sm);
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.connectivity-lab {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  border-radius: var(--radius);
}

.network-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.network-choice {
  padding: 0 var(--space-md);
}

.network-choice.active {
  border-color: var(--teal-deep);
  background: var(--teal-deep);
  color: var(--surface);
}

.mistake-table {
  display: grid;
  margin-top: var(--space-xl);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.mistake-table [role="row"] {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(0, 1fr);
}

.mistake-table [role="cell"] {
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mistake-table [role="row"]:last-child [role="cell"] {
  border-bottom: 0;
}

.mistake-table [role="cell"] + [role="cell"] {
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
}

.biomarker-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.advanced {
  background: color-mix(in oklch, var(--surface-cool) 34%, transparent);
}

.checklist {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.checklist label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-sm);
  align-items: start;
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
}

.final-note {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
}

.sources {
  padding: var(--space-2xl) 0 0;
}

.page-controls {
  position: sticky;
  bottom: var(--space-md);
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr minmax(110px, auto);
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.page-controls button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--teal-deep);
  color: var(--surface);
  font-weight: 900;
}

.page-controls button:hover {
  background: color-mix(in oklch, var(--teal-deep) 90%, var(--ink));
}

.page-controls button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: var(--paper-deep);
  color: var(--muted);
}

.page-status {
  display: grid;
  justify-items: center;
  gap: var(--space-2xs);
  min-width: 0;
  text-align: center;
}

.page-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.page-status strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sources h2 {
  max-width: none;
  font-size: clamp(32px, 4vw, 52px);
}

.sources ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-sm);
  padding: 0;
  list-style: none;
}

.sources li {
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

@media (max-width: 1120px) {
  .course-shell {
    grid-template-columns: 1fr;
  }

  .course-rail {
    position: static;
    max-height: none;
    padding-right: 0;
  }

  .module-nav {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .opening {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  h1 {
    max-width: 13ch;
  }
}

@media (max-width: 780px) {
  .course-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .split,
  .starter-panel,
  .slice-lab,
  .grid-lab,
  .glm-lab {
    grid-template-columns: 1fr;
  }

  .mistake-table [role="row"] {
    grid-template-columns: 1fr;
  }

  .mistake-table [role="cell"] + [role="cell"] {
    border-left: 0;
  }

  .term-list,
  .glossary-list {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(46px, 14vw, 74px);
  }

  h2 {
    max-width: 100%;
    font-size: clamp(36px, 11vw, 58px);
  }

  .page-controls {
    position: static;
    grid-template-columns: 1fr 1fr;
  }

  .page-status {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
