:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --paper: #ffffff;
  --paper-muted: #f8faf6;
  --ink: #172033;
  --muted: #5c6570;
  --line: #d8ded7;
  --accent: #1f6f8b;
  --accent-2: #d1495b;
  --soft: color-mix(in srgb, var(--accent) 10%, white);
  --soft-2: color-mix(in srgb, var(--accent-2) 9%, white);
  --focus: color-mix(in srgb, var(--accent) 32%, white);
  --color-bg: var(--bg);
  --color-surface: var(--paper);
  --color-surface-muted: var(--paper-muted);
  --color-text: var(--ink);
  --color-muted: var(--muted);
  --color-border: var(--line);
  --color-brand: var(--accent);
  --color-brand-strong: color-mix(in srgb, var(--accent) 78%, black);
  --color-brand-soft: var(--soft);
  --color-accent: var(--accent-2);
  --color-accent-text: color-mix(in srgb, var(--accent-2) 76%, black);
  --color-focus: var(--focus);
  --color-success: #1f6f44;
  --color-warning: #8a5a00;
  --color-danger: #9b2f2f;
  --target-min: 44px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius-1: 6px;
  --radius-2: 8px;
  --shadow-1: 0 6px 18px rgba(23, 32, 51, 0.06);
  --shadow-2: 0 14px 34px rgba(23, 32, 51, 0.09);
  --page-max: 1440px;
  --measure: 76ch;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.56;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-underline-offset: 0.18em; }
button, input { font: inherit; }
button { touch-action: manipulation; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 40;
  transform: translateY(-160%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper);
  box-shadow: var(--shadow-1);
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 64px;
  padding: 12px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  font-weight: 850;
}
.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: var(--radius-2);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 900;
}
.top-nav {
  display: flex;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 0.94rem;
}
.top-nav a {
  min-height: var(--target-min);
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-1);
  text-decoration: none;
}
.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--ink);
  background: var(--soft);
}
.hero {
  width: min(100%, var(--page-max));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: center;
  padding: clamp(28px, 5vw, 54px) clamp(18px, 4vw, 48px) 20px;
}
.hero h1 {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2.1rem, 4.8vw, 3.9rem);
  line-height: 1.02;
  letter-spacing: 0;
}
.lede {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.65;
}
.question-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 20px;
  box-shadow: none;
}
.question-panel h2 {
  font-size: 0.95rem;
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0;
}
.question-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.layout {
  width: min(100%, var(--page-max));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: clamp(18px, 3vw, 28px);
  padding: 0 clamp(18px, 4vw, 48px) 56px;
}
.main-column, .side-column { min-width: 0; }
.section {
  scroll-margin-top: 86px;
  margin-top: 24px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0 0 28px;
}
.main-column > .section + .section {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.side-column {
  align-self: start;
  position: sticky;
  top: 84px;
}
.side-column .section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 18px;
  box-shadow: none;
}
.section h2 {
  margin: 0 0 14px;
  font-size: 1.28rem;
  line-height: 1.2;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: 16px;
}
.section-heading h2 { margin-bottom: 0; }
.section-heading p {
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.course-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.map-track {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper);
}
.map-track + .map-track::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -13px;
  width: 13px;
  border-top: 2px solid var(--line);
}
.map-step {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  font-weight: 900;
}
.map-track h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.map-track p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}
.map-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.map-tags span {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--paper-muted);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}
.map-track small {
  color: var(--accent);
  font-weight: 850;
}
.visual-guide-section {
  margin: 2px 0 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper-muted);
}
.visual-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.visual-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper);
}
.visual-card h3 {
  margin: 0;
  font-size: 1rem;
}
.visual-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.45;
}
.visual-diagram {
  display: flex;
  align-items: center;
  min-height: 68px;
  gap: 8px;
  overflow: hidden;
}
.visual-node {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: var(--radius-1);
  background: var(--soft);
  color: var(--accent);
  font-size: clamp(0.68rem, 0.6rem + 0.2vw, 0.78rem);
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
}
.visual-link {
  flex: 0 0 18px;
  border-top: 2px solid var(--line);
}
.visual-link::after {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  margin-left: auto;
  margin-top: -4px;
  border-top: 2px solid var(--line);
  border-right: 2px solid var(--line);
  transform: rotate(45deg);
}
.track-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: 18px;
}
.track-tab, .primary, .secondary {
  min-height: var(--target-min);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}
.track-tab.is-active, .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.secondary:hover, .track-tab:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.module-card {
  display: block;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  text-decoration: none;
  background: var(--paper);
  box-shadow: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.module-card:hover, .module-card.is-current {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(23, 32, 51, 0.06);
  transform: translateY(-1px);
}
.module-card h3 {
  margin: 12px 0 8px;
  font-size: 1.05rem;
  line-height: 1.25;
}
.module-card p {
  color: var(--muted);
  line-height: 1.45;
}
.module-card small {
  color: var(--accent);
  font-weight: 800;
}
.module-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent-2) 25%, transparent);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--color-accent-text);
  background: var(--soft-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 850;
}
.module-content article {
  max-width: 88ch;
  line-height: 1.7;
}
.module-content {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: clamp(18px, 3vw, 32px);
  box-shadow: var(--shadow-1);
}
.module-content:focus { outline: none; }
.module-content h1 {
  max-width: 22ch;
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  line-height: 1.1;
  margin: 0 0 16px;
}
.module-content h2 { margin-top: 30px; }
.module-content p,
.module-content li { max-width: var(--measure); }
/* Long identifiers in inline code (e.g. metric names with labels) must wrap so a
   single token never widens the page past the content column. */
.module-content code { overflow-wrap: anywhere; word-break: break-word; }
.kicker {
  color: var(--accent);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
}
.example-box, .lab-card, .quiz-card, .persona-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 16px;
  background: var(--paper);
}
.example-box { background: var(--soft); }
.module-actions { margin-top: 26px; }
.lab-card { margin-bottom: 14px; }
.lab-card h3 { margin: 0 0 6px; }
.lab-card p { color: var(--muted); }
.lab-scenario {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--paper-muted);
}
.lab-experiment,
.lab-reflection {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-1);
  background: var(--paper-muted);
}
.lab-experiment h4,
.lab-reflection h4 {
  margin: 0 0 8px;
  font-size: 0.94rem;
}
.lab-experiment ol,
.lab-reflection ul {
  margin: 0;
  padding-left: 20px;
}
.lab-real-world {
  margin-bottom: 0;
  font-size: 0.92rem;
}
.continue-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  margin-top: 6px;
  color: var(--accent);
  font-weight: 850;
  text-decoration-thickness: 2px;
}
.input-grid {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
label span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 4px;
}
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-2);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
input[type="number"]:focus-visible {
  border-color: var(--accent);
}
input[aria-invalid="true"] {
  border-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 5%, var(--paper));
}
.lab-output { margin-top: 12px; }
.lab-output p { margin: 6px 0; }
.error, .warn { color: var(--color-danger); }
.ok { color: var(--color-success); }
.quiz-card {
  margin: 12px 0;
  background: var(--paper);
}
.quiz-card legend { font-weight: 850; }
.quiz-card label {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-1);
}
.quiz-card label span {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}
.quiz-card input[type="radio"] {
  margin-top: 0.2rem;
}
.quiz-card label:hover { background: var(--paper-muted); }
progress {
  width: 100%;
  height: 12px;
  accent-color: var(--accent);
}
.habit-list {
  padding-left: 18px;
  line-height: 1.7;
}
.glossary {
  display: grid;
  gap: 10px;
}
.glossary dt { font-weight: 850; }
.glossary dd {
  margin: 0 0 8px;
  color: var(--muted);
}
footer {
  padding: 28px clamp(18px, 4vw, 48px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px clamp(14px, 3vw, 32px);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar .brand {
  color: var(--ink);
  text-decoration: none;
}

.topbar .top-nav {
  margin-left: auto;
}

.progress-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-muted);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  content: "";
}

.hamburger::before { transform: translateY(-6px); }
.hamburger::after { transform: translateY(4px); }

.course-layout {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.course-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.outline-nav {
  padding: 12px;
  overflow: auto;
}

.outline-home,
.outline-link,
.outline-track-toggle {
  width: 100%;
  min-height: var(--target-min);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-2);
  background: transparent;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.outline-home:hover,
.outline-link:hover,
.outline-track-toggle:hover,
.outline-home[aria-current="page"],
.outline-link[aria-current="page"] {
  background: var(--paper-muted);
  border-color: var(--line);
}

.outline-track { margin: 8px 0; }

.outline-track.is-collapsed .outline-list { display: none; }

.outline-track-toggle {
  align-items: center;
}

.outline-track-toggle small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.outline-caret {
  width: 18px;
  color: var(--muted);
  font-weight: 900;
}

.outline-num {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-2);
  background: var(--soft);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 900;
}

.outline-link.is-complete .outline-num {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 12%, white);
  font-size: 0.72rem;
}

.outline-text {
  min-width: 0;
  line-height: 1.25;
}

.outline-text small {
  color: var(--muted);
  font-weight: 650;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.sidebar-foot p {
  margin: 10px 0 6px;
}

.content {
  width: 100%;
  max-width: 1100px;
  padding: clamp(24px, 4vw, 56px);
  scroll-margin-top: 84px;
}

.content:focus { outline: none; }

.home-title {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2.4rem, 5.6vw, 4.6rem);
  line-height: 1.02;
}

.home-lede {
  max-width: 78ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.home-question {
  max-width: 720px;
  margin: 20px 0;
}

.home-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 28px;
}

.content > .module-content {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: clamp(18px, 3vw, 34px);
  box-shadow: var(--shadow-1);
}

.content > .module-content article {
  max-width: 88ch;
}

.content > .section {
  max-width: 88ch;
}
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.persona-card h3 { margin-top: 0; }
.expert-upgrade {
  border-left: 4px solid var(--accent);
  padding: 16px 0 16px 18px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, white), transparent 72%);
}
.misconception-check {
  background: var(--soft-2);
  border-radius: var(--radius-2);
  padding: 16px;
}
.practice-ladder li + li { margin-top: 8px; }
table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.95rem;
}
th, td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
th { background: var(--soft); }
.first-principles-path {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: var(--radius-2);
  background: linear-gradient(180deg, var(--soft), var(--paper) 62%);
}
.first-principles-path > h2 {
  color: var(--accent);
}
.first-principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.first-principles-grid > div {
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 14px;
  background: var(--paper);
}
.first-principles-grid h3,
.teach-back h3 { margin-top: 0; }
.teach-back {
  margin-top: 14px;
  border-left: 4px solid var(--accent-2);
  border-radius: 0 var(--radius-2) var(--radius-2) 0;
  padding: 12px 14px;
  background: var(--soft-2);
}
@media (max-width: 1080px) {
  .side-column {
    position: static;
  }
}
@media (max-width: 920px) {
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .top-nav {
    order: 3;
    width: 100%;
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .hero, .layout { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: 14ch; }
  .section-heading {
    display: block;
  }
  .section-heading p {
    margin-top: 6px;
  }
  .course-map {
    grid-template-columns: 1fr;
  }
  .visual-guide {
    grid-template-columns: 1fr;
  }
  .map-track + .map-track::before {
    top: -13px;
    left: 30px;
    width: 0;
    height: 13px;
    border-top: 0;
    border-left: 2px solid var(--line);
  }
}
@media (max-width: 560px) {
  .site-header { padding-inline: 14px; }
  .brand { font-size: 0.95rem; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: 2.2rem; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: auto; }
}

@media (max-width: 960px) {
  .icon-button {
    display: grid;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .topbar .top-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }
  .progress-pill {
    margin-left: auto;
  }
  .course-layout {
    display: block;
  }
  .course-sidebar {
    position: fixed;
    inset: 64px auto 0 0;
    z-index: 30;
    width: min(86vw, 340px);
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: var(--shadow-2);
  }
  body.sidebar-open .course-sidebar {
    transform: translateX(0);
  }
  .sidebar-scrim {
    position: fixed;
    inset: 64px 0 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.34);
  }
  .content {
    max-width: none;
    padding: 28px clamp(16px, 5vw, 28px);
  }
  .home-title {
    max-width: 14ch;
    font-size: clamp(2.1rem, 11vw, 3.1rem);
  }
  .progress-pill {
    display: none;
  }
}


.lesson-diagram {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: var(--space-4);
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--paper);
  padding: var(--space-4);
  margin: var(--space-5) 0;
}
.lesson-diagram h2 { margin-top: 0; }
.diagram-note-grid { display: grid; gap: var(--space-3); }
.diagram-note-grid > div { border: 1px solid var(--line); border-radius: var(--radius-1); padding: var(--space-3); background: var(--paper-muted); }
.diagram-note-grid h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.diagram-art { margin: 0; }
.diagram-art img, .visual-sheet img { width: 100%; border-radius: var(--radius-2); border: 1px solid var(--line); background: white; display: block; }
.diagram-art figcaption, .visual-sheet figcaption { color: var(--muted); font-size: 0.86rem; margin-top: var(--space-2); }
.lesson-diagram,
.lesson-diagram * {
  box-sizing: border-box;
}

.lesson-diagram-copy,
.diagram-note-grid,
.diagram-note-grid > div,
.diagram-art,
.diagram-art img,
.diagram-art figcaption {
  min-width: 0;
  max-width: 100%;
}

.lesson-diagram p,
.diagram-note-grid p,
.diagram-art figcaption {
  overflow-wrap: anywhere;
}

.diagram-art img {
  height: auto;
  object-fit: contain;
}
.visual-sheet { margin: 0 0 var(--space-4); }
.visual-card-kicker { color: var(--accent); font-size: 0.76rem; font-weight: 850; text-transform: uppercase; margin: 0 0 0.25rem; }
.lab-metaphor, .lab-insight, .lab-output-insight { border: 1px solid var(--line); border-radius: var(--radius-1); background: var(--paper-muted); padding: var(--space-3); }
.lab-output-insight { margin-top: var(--space-3); }
@media (max-width: 820px) { .lesson-diagram { grid-template-columns: minmax(0, 1fr); padding: var(--space-3); } }


.real-world-anchor {
  margin: var(--space-5, 24px) 0;
  padding: var(--space-4, 16px);
  border: 1px solid var(--color-border, #d8ded6);
  border-radius: var(--radius-2, 8px);
  background: var(--color-surface-muted, #f6f8f4);
}

.real-world-anchor h2 {
  margin-top: 0;
}

.anchor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3, 12px);
}

.anchor-grid > div {
  min-width: 0;
  padding: var(--space-3, 12px);
  border: 1px solid var(--color-border, #d8ded6);
  border-radius: var(--radius-1, 6px);
  background: var(--color-surface, #fff);
}

.anchor-grid h3 {
  margin-top: 0;
  font-size: 1rem;
}

.anchor-grid p {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .anchor-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile containment guard: diagrams, tables, and code should never widen the page. */
.content,
.module-content,
.content > .module-content,
.module-content article,
.main-column,
.module-header,
.lesson-diagram,
.real-world-anchor,
.first-principles-path,
.expert-upgrade,
.module-check-pack {
  min-width: 0;
  max-width: 100%;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  th,
  td {
    overflow-wrap: anywhere;
  }
}

.build-project {
  margin: var(--space-5, 24px) 0;
  padding: var(--space-4, 16px);
  border: 1px solid var(--color-border, #d8ded6);
  border-left: 4px solid var(--color-brand, #2f6f4f);
  border-radius: var(--radius-2, 8px);
  background: var(--color-brand-soft, #eef5f0);
}

.build-project h2 { margin-top: 0; }

.build-project ol {
  margin: var(--space-3, 12px) 0;
  padding-left: var(--space-5, 24px);
  display: grid;
  gap: var(--space-2, 8px);
}

.build-project .project-goal { font-weight: 600; }

.build-project .project-check,
.build-project .project-stretch { margin: var(--space-2, 8px) 0 0; }

/* Figure-it-out cards: bold lead + tight bullets */
.first-principles-grid .card-lead { font-weight: 600; margin: 0 0 8px; }
.first-principles-grid .card-points { margin: 0; padding-left: 18px; }
.first-principles-grid .card-points li { margin: 4px 0; }


/* diagram-fullwidth: rich infographic gets the whole content width, not a cramped side column */
.lesson-diagram { grid-template-columns: minmax(0, 1fr); }
.lesson-diagram .diagram-art { order: -1; width: 100%; max-width: 920px; margin: 0 auto var(--space-3); }
.lesson-diagram .diagram-art img { width: 100%; height: auto; }

/* self-assessment rubric block (pedagogy upgrade) */
.self-check{margin-top:14px;border:1px solid var(--line,#dce3ee);border-radius:var(--radius-2,12px);padding:14px 16px;background:var(--soft-2,#f1f5fb)}
.self-check h3{margin:0 0 8px}
.self-check p{margin:6px 0}
table.rubric{width:100%;border-collapse:collapse;margin:8px 0;font-size:.92rem}
table.rubric th,table.rubric td{text-align:left;border:1px solid var(--line,#dce3ee);padding:6px 9px;vertical-align:top}
table.rubric th{background:var(--paper,#fff);font-weight:600}

/* quiz-legend-fix: long question legends must not straddle the fieldset border */
.quiz-card { padding-top: 16px; }
.quiz-card legend { float: left; width: 100%; margin: 0 0 10px; padding: 0; line-height: 1.35; }
.quiz-card legend + * { clear: both; }
