:root {
  --flow-paper: #f7f8f5;
  --flow-surface: #ffffff;
  --flow-soft: #eef4f4;
  --flow-ink: #10283d;
  --flow-copy: #526979;
  --flow-muted: #778794;
  --flow-blue: #2f7faa;
  --flow-teal: #3f9188;
  --flow-violet: #8063a2;
  --flow-coral: #cf725c;
  --flow-line: #d9e0df;
  --flow-line-soft: #e9edeb;
  --flow-code: #112635;
  --flow-max: 1540px;
  --flow-radius: 14px;
  color: var(--flow-ink);
  background: var(--flow-paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--flow-paper); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; color: var(--flow-ink); background: var(--flow-paper); }
button, select, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  z-index: 3000;
  top: 10px;
  left: 10px;
  padding: 10px 13px;
  border-radius: 8px;
  color: #fff;
  background: var(--flow-ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.small-label,
.eyebrow {
  margin: 0;
  color: var(--flow-blue);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.family-header {
  width: min(var(--flow-max), calc(100% - 56px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  background: var(--flow-paper);
}
.family-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--flow-ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.family-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid #a9c9d3;
  border-radius: 50%;
  color: var(--flow-blue);
  background: #edf6f7;
  font-size: 9px;
  letter-spacing: .06em;
}
.family-header nav { display: flex; align-items: center; gap: 24px; }
.family-header nav a {
  padding: 7px 0;
  color: var(--flow-copy);
  border-bottom: 1px solid transparent;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}
.family-header nav a:hover,
.family-header nav a[aria-current="page"] { color: var(--flow-blue); border-bottom-color: var(--flow-blue); }

.sankey-hero {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--flow-line-soft);
  border-bottom: 1px solid var(--flow-line);
  background:
    radial-gradient(circle at 72% 0, rgba(63, 145, 136, .11), transparent 31%),
    linear-gradient(90deg, rgba(47, 127, 170, .055), transparent 45%),
    var(--flow-paper);
  box-shadow: inset 0 3px 0 var(--flow-blue);
}
.sankey-hero__inner {
  position: relative;
  width: min(var(--flow-max), calc(100% - 56px));
  min-height: 148px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px) 168px;
  gap: 38px;
  align-items: center;
}
.hero-copy { position: relative; z-index: 2; padding: 26px 0 24px; }
.sankey-hero h1 {
  margin: 6px 0 0;
  color: var(--flow-ink);
  font: 600 clamp(34px, 3vw, 48px)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.046em;
}
.subtitle { max-width: 680px; margin: 10px 0 0; color: var(--flow-copy); font-size: 14px; line-height: 1.5; }

.hero-flow { opacity: .66; }
.hero-flow svg { display: block; width: 100%; }
.hero-ribbons path { fill: none; stroke: url(#heroRibbon); stroke-linecap: round; opacity: .38; }
.hero-ribbons path:nth-child(1) { stroke-width: 23; }
.hero-ribbons path:nth-child(2) { stroke-width: 14; }
.hero-ribbons path:nth-child(3) { stroke-width: 8; stroke-dasharray: 2 6; }
.hero-nodes rect { fill: #fff; stroke: var(--flow-blue); stroke-width: 2; }

.hero-progress { position: relative; z-index: 2; }
.hero-progress strong {
  display: block;
  margin-bottom: 9px;
  color: var(--flow-ink);
  font: 600 27px/1 Georgia, "Times New Roman", serif;
  text-align: right;
}
.hero-progress-track,
.progress-track { height: 3px; overflow: hidden; border-radius: 999px; background: var(--flow-line); }
.hero-progress-track span,
.progress-track span {
  display: block;
  width: calc(100% / 14);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--flow-blue), var(--flow-teal));
  transition: width .22s ease;
}

.lab-shell {
  width: min(var(--flow-max), 100%);
  min-height: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}
.journey {
  min-width: 0;
  padding: 29px 20px 34px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--flow-line);
}
.journey-heading { display: grid; gap: 7px; padding: 0 9px; }
.journey-heading strong { font-size: 18px; font-weight: 680; letter-spacing: -.02em; }
.lesson-navigation { display: grid; gap: 2px; margin-top: 18px; }
.lesson-button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--flow-copy);
  background: transparent;
  text-align: left;
  font-size: 12px;
}
.lesson-button:hover { color: var(--flow-ink); background: #f0f3f1; }
.lesson-button.active { color: var(--flow-blue); background: #e8f2f4; font-weight: 750; }
.lesson-number { opacity: .72; font-size: 10px; font-weight: 800; }
.compact-stage-picker { display: none; }
.progress-area { margin: 19px 9px 0; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--flow-muted); font-size: 10px; }
.guide-link {
  margin: 17px 9px 0;
  padding-top: 15px;
  border-top: 1px solid var(--flow-line-soft);
  color: var(--flow-copy);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.guide-link:hover { color: var(--flow-blue); }

.presentation { min-width: 0; padding: 30px 36px 46px; }
.presentation-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}
#section-kicker { margin-bottom: 7px; }
#lesson-title {
  max-width: 840px;
  margin: 0;
  color: var(--flow-ink);
  font: 600 clamp(31px, 3.2vw, 45px)/1.04 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}
.navigation-buttons,
.experiment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
button,
.primary-link {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfdad9;
  border-radius: 9px;
  color: var(--flow-ink);
  background: #fff;
  box-shadow: none;
  font-size: 13px;
  font-weight: 680;
  text-decoration: none;
}
button:hover { border-color: #9fbfc3; background: #f6fbfa; }
.primary-button,
.primary-link { border-color: var(--flow-blue); color: #fff; background: var(--flow-blue); }
.primary-button:hover,
.primary-link:hover { border-color: #276d92; color: #fff; background: #276d92; }
button:disabled { cursor: default; opacity: .42; }
button:focus-visible,
a:focus-visible,
select:focus-visible { outline: 3px solid rgba(47, 127, 170, .27); outline-offset: 3px; }

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 330px);
  gap: clamp(30px, 3vw, 48px);
  align-items: start;
}
.experiment-pane { min-width: 0; }
.question-block { margin-bottom: 20px; }
#central-question {
  max-width: 880px;
  margin: 8px 0 0;
  color: var(--flow-ink);
  font: 600 clamp(21px, 2.05vw, 29px)/1.28 Georgia, "Times New Roman", serif;
  letter-spacing: -.022em;
}
.concept-strip {
  margin-bottom: 16px;
  padding: 15px 17px;
  border: 1px solid var(--flow-line);
  border-radius: 11px;
  background: var(--flow-soft);
}
.concept-strip p { margin: 6px 0 0; color: var(--flow-copy); font-size: 13px; line-height: 1.55; }

.motion-evidence {
  overflow: hidden;
  border: 1px solid var(--flow-line);
  border-radius: var(--flow-radius);
  background: var(--flow-surface);
}
.motion-heading {
  min-height: 62px;
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}
.motion-heading h4 { margin: 5px 0 0; color: var(--flow-ink); font-size: 15px; }
.evidence-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--flow-teal);
  font-size: 10px;
  font-weight: 750;
}
.evidence-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(63, 145, 136, .12); }
.evidence-status.is-paused { color: var(--flow-muted); }
.motion-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 6.8; border-block: 1px solid var(--flow-line); background: #eaf0f2; }
.motion-frame video { width: 100%; height: 100%; display: block; object-fit: cover; }
.motion-scrim {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 24px 15px 9px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  color: rgba(255, 255, 255, .88);
  background: linear-gradient(transparent, rgba(10, 32, 50, .74));
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}
.experiment-copy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 16px; }
.experiment-copy > div + div { padding-left: 24px; border-left: 1px solid var(--flow-line-soft); }
.experiment-copy p { margin: 6px 0 0; color: var(--flow-copy); font-size: 13px; line-height: 1.55; }
.experiment-actions { padding: 0 16px 16px; }
.experiment-actions .primary-link { margin-left: auto; }

.interpretation-pane { min-width: 0; padding-left: 25px; border-left: 1px solid var(--flow-line); }
.reasoning-block { margin: 0; padding: 18px 0; border-top: 1px solid var(--flow-line); }
.reasoning-block:first-child { padding-top: 0; border-top: 0; }
.reasoning-block .small-label { display: block; margin-bottom: 8px; }
.reasoning-block p { margin: 0; color: var(--flow-copy); font-size: 13px; line-height: 1.58; }
.boundary-block .small-label { color: var(--flow-teal); }
.decision-block .small-label { color: var(--flow-coral); }
.connection-block .small-label { color: var(--flow-violet); }

.review-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-top: 31px;
  padding-top: 20px;
  border-top: 1px solid var(--flow-line);
}
.review-bar p { margin: 5px 0 0; color: var(--flow-ink); font-size: 14px; line-height: 1.5; }
.review-answer { margin-top: 12px; padding: 15px 17px; border: 1px solid var(--flow-line); border-radius: 10px; color: var(--flow-copy); background: var(--flow-soft); font-size: 13px; line-height: 1.55; }
#reveal-button[aria-expanded="true"] { border-color: var(--flow-blue); background: #edf7f7; }

.python-companion {
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--flow-line);
  border-radius: var(--flow-radius);
  background: var(--flow-soft);
}
.python-companion > header { display: flex; justify-content: space-between; gap: 20px; align-items: start; padding: 16px 19px; border-bottom: 1px solid var(--flow-line); }
.python-companion h3 { margin: 5px 0 0; color: var(--flow-ink); font-size: 16px; }
.companion-badge { padding: 5px 8px; border-radius: 999px; color: var(--flow-teal); background: #e0f0ed; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.python-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(240px, .82fr); gap: 24px; padding: 17px 19px 19px; }
.python-code { min-height: 116px; margin: 8px 0 0; padding: 15px; overflow-x: auto; border-radius: 9px; color: #eaf0f6; background: var(--flow-code); font: 11px/1.55 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; }
.python-why p { margin: 8px 0 13px; color: var(--flow-copy); font-size: 13px; line-height: 1.58; }
.python-why a { color: var(--flow-blue); font-size: 11px; font-weight: 750; text-decoration: none; }
.python-why a:hover { text-decoration: underline; }
.data-ai-footer { margin-top: 0 !important; }

@media (max-width: 1180px) {
  .lab-shell { grid-template-columns: 196px minmax(0, 1fr); }
  .presentation { padding-inline: 27px; }
  .content-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 26px; }
  .sankey-hero__inner { grid-template-columns: minmax(0, 1fr) 320px 140px; }
}

@media (max-width: 920px) {
  .sankey-hero__inner { grid-template-columns: minmax(0, 1fr) 120px; }
  .hero-flow { display: none; }
  .lab-shell { grid-template-columns: 170px minmax(0, 1fr); }
  .journey { padding-inline: 10px; }
  .content-layout { grid-template-columns: 1fr; }
  .interpretation-pane { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin-top: 18px; padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--flow-line); }
  .reasoning-block,
  .reasoning-block:first-child { padding: 17px 0; border-top: 0; }
  .reasoning-block:nth-child(n+3) { border-top: 1px solid var(--flow-line); }
  .python-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .family-header { width: min(100% - 28px, var(--flow-max)); min-height: 58px; }
  .family-header nav { gap: 13px; }
  .family-header nav a { font-size: 10px; }
  .family-header nav a:first-child,
  .family-header nav a:last-child { display: none; }
  .sankey-hero__inner { width: min(100% - 28px, var(--flow-max)); min-height: 136px; grid-template-columns: 1fr; }
  .hero-copy { padding: 22px 0 10px; }
  .sankey-hero h1 { font-size: clamp(31px, 9vw, 40px); }
  .subtitle { font-size: 13px; }
  .hero-progress { padding-bottom: 19px; }
  .hero-progress strong { margin-bottom: 7px; font-size: 20px; text-align: left; }

  .lab-shell { display: block; }
  .journey { padding: 17px 18px; border-right: 0; border-bottom: 1px solid var(--flow-line); }
  .journey-heading,
  .lesson-navigation,
  .progress-area,
  .guide-link { display: none; }
  .compact-stage-picker { display: grid; gap: 6px; }
  .compact-stage-picker label { color: var(--flow-muted); font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
  .compact-stage-picker select { width: 100%; min-height: 42px; padding: 0 38px 0 12px; border: 1px solid var(--flow-line); border-radius: 9px; color: var(--flow-ink); background: #fff; font-size: 13px; }
  .presentation { padding: 23px 18px 38px; }
  .presentation-header { grid-template-columns: 1fr; gap: 16px; }
  #lesson-title { font-size: clamp(29px, 9vw, 38px); }
  .navigation-buttons { justify-content: space-between; }
  .content-layout { display: block; }
  .motion-frame { aspect-ratio: 16 / 8.7; }
  .experiment-copy { grid-template-columns: 1fr; gap: 16px; }
  .experiment-copy > div + div { padding: 16px 0 0; border-top: 1px solid var(--flow-line-soft); border-left: 0; }
  .experiment-actions .primary-link { width: 100%; margin: 2px 0 0; }
  .interpretation-pane { grid-template-columns: 1fr; }
  .reasoning-block,
  .reasoning-block:first-child,
  .reasoning-block:nth-child(n+3) { padding: 16px 0; border-top: 1px solid var(--flow-line); }
  .reasoning-block:first-child { border-top: 0; }
  .review-bar { grid-template-columns: 1fr; }
  .review-bar button { justify-self: start; }
  .python-companion > header { flex-direction: column; gap: 10px; }
  .python-grid { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-progress-track span,
  .progress-track span { transition: none; }
}

