/* ============================================================
   How an Airplane Works — stylesheet
   Tokens live on :root. Dark is the default; [data-theme="light"]
   overrides. Nothing here depends on a framework.
   ============================================================ */

:root {
  --bg:            #070b14;
  --bg-alt:        #0b1220;
  --panel:         #101829;
  --panel-2:       #16203400;
  --panel-solid:   #131d31;
  --line:          #1e2b45;
  --line-soft:     #18243a;

  --ink:           #e8eef8;
  --ink-2:         #a8b8d0;
  --ink-3:         #6f82a0;

  --accent:        #4dd0ff;
  --accent-2:      #7c9cff;
  --warm:          #ffb648;
  --hot:           #ff6b4a;
  --good:          #46e0a8;
  --bad:           #ff5d73;

  --sky-1:         #0d1e42;
  --sky-2:         #17436f;
  --sky-3:         #2f78b4;

  --lift:          #4dd0ff;
  --weight:        #7c9cff;
  --thrust:        #46e0a8;
  --drag:          #ff8a5c;

  --shadow:        0 24px 60px -30px rgba(0,0,0,.85);
  --radius:        16px;
  --radius-sm:     10px;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1240px;
}

:root[data-theme="light"] {
  --bg:            #f5f7fb;
  --bg-alt:        #eceff6;
  --panel:         #ffffff;
  --panel-solid:   #ffffff;
  --line:          #d8dfeb;
  --line-soft:     #e6ebf3;

  --ink:           #131b2b;
  --ink-2:         #46566f;
  --ink-3:         #7889a2;

  --accent:        #0b83c4;
  --accent-2:      #4a63d8;
  --warm:          #c97a08;
  --hot:           #d64322;
  --good:          #0f9d6b;
  --bad:           #d33a52;

  --sky-1:         #bcd8f2;
  --sky-2:         #8dbde8;
  --sky-3:         #5fa2d8;

  --lift:          #0b83c4;
  --weight:        #4a63d8;
  --thrust:        #0f9d6b;
  --drag:          #d1643a;

  --shadow:        0 20px 45px -28px rgba(20,35,70,.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 82px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 650; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent); text-underline-offset: 3px; }
em { font-style: normal; color: var(--ink); background: color-mix(in oklab, var(--accent) 12%, transparent); padding: 0 .18em; border-radius: 3px; }
strong { color: var(--ink); font-weight: 650; }
kbd {
  font: 600 .78em var(--mono); background: var(--line-soft); border: 1px solid var(--line);
  border-radius: 5px; padding: .1em .4em; color: var(--ink-2);
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #041018; padding: .6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* ───────────────────────── top bar ───────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.25rem;
  padding: .7rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 650; font-size: .95rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em;
  white-space: nowrap;
}
.brand-mark { width: 22px; height: 22px; fill: var(--accent); flex: none; }
.topnav { display: flex; gap: .2rem; margin-left: auto; flex-wrap: wrap; }
.topnav a {
  color: var(--ink-3); text-decoration: none; font-size: .87rem; font-weight: 550;
  padding: .35rem .7rem; border-radius: 999px; transition: color .15s, background .15s;
}
.topnav a:hover { color: var(--ink); background: var(--line-soft); }
.topnav a.is-current { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 9px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-2); cursor: pointer; transition: color .15s, border-color .15s;
}
.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }
.icon-btn:hover { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); }

@media (max-width: 760px) {
  .topnav { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; overflow-x: auto; }
  .topbar { flex-wrap: wrap; row-gap: .4rem; }
  .icon-btn { margin-left: auto; }
}

/* ───────────────────────── hero ───────────────────────── */

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-soft); }
.hero-sky { position: absolute; inset: 0; z-index: 0; }
.hero-sky canvas { width: 100%; height: 100%; display: block; }
.hero-inner {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) clamp(1rem, 3vw, 2rem) clamp(3.5rem, 7vw, 5.5rem);
}
.eyebrow {
  font: 600 .74rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.1rem;
}
.hero h1 {
  font-size: clamp(2.6rem, 7.2vw, 5.4rem); font-weight: 700; letter-spacing: -.035em; margin-bottom: 1.1rem;
}
.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--warm));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(1rem, 1.55vw, 1.2rem); color: var(--ink-2); max-width: 58ch; }
.hero-cta { display: flex; gap: .7rem; flex-wrap: wrap; margin: 2rem 0 3rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .72rem 1.35rem; border-radius: 999px; font-weight: 600; font-size: .94rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform .12s, background .15s, border-color .15s;
}
.btn.primary { background: var(--accent); color: #04121c; }
.btn.primary:hover { transform: translateY(-1px); background: color-mix(in oklab, var(--accent) 88%, white); }
.btn.ghost { border-color: var(--line); color: var(--ink); background: color-mix(in oklab, var(--panel) 70%, transparent); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.small { padding: .45rem .95rem; font-size: .85rem; }

.hero-stats { display: flex; flex-wrap: wrap; gap: clamp(1.4rem, 4vw, 3.2rem); margin: 0; }
.hero-stats div { min-width: 0; }
.hero-stats dt { font-size: .74rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.hero-stats dd { margin: .3rem 0 0; font: 650 clamp(1.4rem, 2.6vw, 2rem)/1 var(--mono); color: var(--ink); }
.hero-stats dd span { font-size: .52em; color: var(--ink-3); font-weight: 500; }

.scroll-cue { position: absolute; left: 50%; bottom: 14px; z-index: 1; translate: -50% 0; }
.scroll-cue span {
  display: block; width: 20px; height: 32px; border: 2px solid var(--ink-3); border-radius: 12px; position: relative; opacity: .5;
}
.scroll-cue span::after {
  content: ""; position: absolute; left: 50%; top: 6px; translate: -50% 0;
  width: 3px; height: 6px; border-radius: 2px; background: var(--ink-2);
  animation: cue 1.9s ease-in-out infinite;
}
@keyframes cue { 0%,100% { transform: translateY(0); opacity: 1 } 60% { transform: translateY(11px); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .scroll-cue span::after { animation: none; } }

/* ───────────────────────── sections ───────────────────────── */

.section {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3.5rem, 7vw, 6rem) clamp(1rem, 3vw, 2rem);
}
.section.alt { max-width: none; background: var(--bg-alt); border-block: 1px solid var(--line-soft); }
.section.alt > * { max-width: var(--maxw); margin-inline: auto; }

.section-head { max-width: 72ch; margin-bottom: 2.5rem; }
.kicker {
  font: 600 .74rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .9rem;
}
.section h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
.sub { color: var(--ink-2); font-size: clamp(.98rem, 1.3vw, 1.08rem); margin: 0; }

/* ───────────────────────── panels & controls ───────────────────────── */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.controls { display: grid; gap: 1.35rem; padding: 1.4rem clamp(1rem, 2.2vw, 1.6rem); }
.control label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-size: .86rem; font-weight: 600; color: var(--ink-2); margin-bottom: .55rem;
}
.control output { font: 650 .95rem var(--mono); color: var(--accent); }
.control .hint { font-size: .78rem; color: var(--ink-3); margin: .5rem 0 0; line-height: 1.45; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; display: block;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) var(--pct, 50%), var(--line) var(--pct, 50%));
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 99px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 17px; height: 17px; margin-top: -6px;
  border-radius: 50%; background: var(--ink); border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.45); transition: transform .12s;
}
input[type="range"]::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.45); box-sizing: border-box;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }

.toggles { display: flex; flex-wrap: wrap; gap: .5rem; }
.switch { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  font-size: .8rem; font-weight: 600; color: var(--ink-3);
  padding: .34rem .75rem; border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in oklab, var(--panel-solid) 60%, transparent); transition: all .15s;
}
.switch input:checked + span { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 55%, var(--line)); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.readouts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 45%, transparent);
}
.readouts .ro { padding: .85rem 1rem; border-right: 1px solid var(--line-soft); min-width: 0; }
.readouts .ro:last-child { border-right: 0; }
.ro-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 650; display: block; }
.ro-value { font: 650 1.12rem/1.3 var(--mono); color: var(--ink); display: block; margin-top: .25rem; white-space: nowrap; }
.ro-value.is-good { color: var(--good); }
.ro-value.is-bad { color: var(--bad); }
.ro-value.is-warn { color: var(--warm); }
.ro-value small { font-size: .62em; color: var(--ink-3); font-weight: 500; }

/* ───────────────────────── cards ───────────────────────── */

.cards {
  display: grid; gap: 1rem; margin-top: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 1.25rem 1.3rem; min-width: 0;
}
.card h3 { font-size: 1.02rem; margin-bottom: .55rem; }
.card p { font-size: .9rem; color: var(--ink-2); margin: 0; }
.card p + p { margin-top: .7rem; }
.card .eq {
  font: 600 .95rem var(--mono); color: var(--accent); margin-bottom: .7rem;
  background: color-mix(in oklab, var(--accent) 9%, transparent); padding: .5rem .7rem; border-radius: 8px; display: inline-block;
}
.card.accent { border-left: 3px solid var(--accent); }
.cards.closing .card h3 { color: var(--warm); }
.cards.closing .card { border-left: 3px solid var(--warm); }

/* ───────────────────────── anatomy ───────────────────────── */

.anatomy-panel { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
@media (max-width: 960px) { .anatomy-panel { grid-template-columns: minmax(0, 1fr); } }

.anatomy-diagram { padding: 1rem clamp(.6rem, 1.6vw, 1.2rem) 1rem; border-right: 1px solid var(--line); min-width: 0; }
@media (max-width: 960px) { .anatomy-diagram { border-right: 0; border-bottom: 1px solid var(--line); } }

.viewtabs { display: inline-flex; gap: .25rem; padding: .25rem; background: var(--bg-alt); border-radius: 999px; border: 1px solid var(--line-soft); margin-bottom: .6rem; }
.viewtab {
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  font: 600 .81rem var(--sans); padding: .34rem .85rem; border-radius: 999px; transition: all .15s;
}
.viewtab:hover { color: var(--ink); }
.viewtab.is-active { background: var(--panel-solid); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

.diagram-stage { position: relative; }
.diagram-view { display: none; }
.diagram-view.is-active { display: block; }
.diagram-view svg { display: block; width: 100%; height: auto; }

.diagram-hint { font-size: .74rem; color: var(--ink-3); margin: .5rem 0 0; text-align: center; }

/* SVG part styling — script drives state via classes on <g> */
.part { cursor: pointer; }
.part .skin { transition: fill .18s, stroke .18s; }
.part:hover .skin, .part.is-active .skin { fill: var(--accent); }
.part.is-active .skin { fill: var(--warm); }
.hull { fill: color-mix(in oklab, var(--ink) 14%, transparent); stroke: var(--line); stroke-width: 1.4; }
.hull-2 { fill: color-mix(in oklab, var(--ink) 9%, transparent); stroke: var(--line); stroke-width: 1.2; }
.detail-line { stroke: var(--line); stroke-width: 1.1; fill: none; }
.lead-line { stroke: var(--accent); stroke-width: 1.2; fill: none; opacity: 0; transition: opacity .18s; }
.part:hover .lead-line, .part.is-active .lead-line { opacity: .9; }
.part-label { font: 600 13px var(--sans); fill: var(--ink); opacity: 0; transition: opacity .18s; pointer-events: none; }
.part-label-bg { fill: var(--panel-solid); stroke: var(--accent); stroke-width: 1; opacity: 0; transition: opacity .18s; pointer-events: none; }
.part:hover .part-label, .part.is-active .part-label,
.part:hover .part-label-bg, .part.is-active .part-label-bg { opacity: 1; }

.anatomy-info { display: flex; flex-direction: column; min-width: 0; }
.info-card { padding: 1.4rem clamp(1rem, 2vw, 1.5rem) 1.1rem; border-bottom: 1px solid var(--line); }
.info-tag { font: 650 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: .6rem; }
.info-card h3 { font-size: 1.32rem; margin-bottom: .6rem; }
.info-card p { font-size: .92rem; color: var(--ink-2); margin: 0; }
.info-spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .8rem; margin: 1.1rem 0 0; }
.info-spec > div { min-width: 0; }
.info-spec dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 650; }
.info-spec dd { margin: .2rem 0 0; font: 600 .95rem var(--mono); color: var(--ink); }

.part-list { padding: .9rem clamp(.7rem, 1.6vw, 1rem) 1.2rem; display: flex; flex-wrap: wrap; gap: .4rem; align-content: flex-start; overflow-y: auto; max-height: 420px; }
.part-chip {
  font: 600 .79rem var(--sans); color: var(--ink-3); cursor: pointer;
  border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: .3rem .72rem;
  transition: all .15s;
}
.part-chip:hover { color: var(--ink); border-color: var(--ink-3); }
.part-chip.is-active { color: #04121c; background: var(--warm); border-color: var(--warm); }

/* ───────────────────────── forces ───────────────────────── */

.forces-panel { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .85fr); }
.forces-panel .readouts { grid-column: 1 / -1; }
@media (max-width: 900px) { .forces-panel { grid-template-columns: minmax(0, 1fr); } }

.forces-left { border-right: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; }
@media (max-width: 900px) { .forces-left { border-right: 0; border-bottom: 1px solid var(--line); } }
.forces-stage { position: relative; padding: .5rem .5rem 0; min-width: 0; }
.forces-stage svg { display: block; width: 100%; height: auto; }

.verdict {
  display: flex; flex-wrap: wrap; gap: .4rem; padding: .2rem 1rem 1.1rem; margin-top: auto;
}
.verdict span {
  font: 650 .78rem var(--mono); padding: .3rem .65rem; border-radius: 6px;
  background: color-mix(in oklab, var(--bg) 55%, transparent); border: 1px solid var(--line); color: var(--ink-2);
}
.verdict span.up { color: var(--good); border-color: color-mix(in oklab, var(--good) 45%, var(--line)); }
.verdict span.down { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 45%, var(--line)); }
.verdict span.level { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); }

/* ───────────────────────── aerofoil ───────────────────────── */

.airfoil-panel { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr); }
.airfoil-panel .readouts { grid-column: 1 / -1; }
@media (max-width: 900px) { .airfoil-panel { grid-template-columns: minmax(0, 1fr); } }

.airfoil-stage { position: relative; border-right: 1px solid var(--line); background: var(--bg); min-width: 0; }
@media (max-width: 900px) { .airfoil-stage { border-right: 0; border-bottom: 1px solid var(--line); } }
#airfoilCanvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }

.stage-legend { position: absolute; left: .8rem; bottom: .7rem; display: flex; flex-wrap: wrap; gap: .8rem; pointer-events: none; }
.lg { font: 600 .7rem var(--mono); color: var(--ink-3); display: inline-flex; align-items: center; gap: .35rem; }
.lg::before { content: ""; width: 14px; height: 4px; border-radius: 2px; }
.lg-low::before  { background: linear-gradient(90deg, #2f80ff, #7bd4ff); }
.lg-high::before { background: linear-gradient(90deg, #ffb648, #ff5d5d); }
.lg-line::before { background: var(--ink-3); height: 2px; }

.stall-banner {
  position: absolute; right: .8rem; bottom: .7rem;
  font: 650 .78rem var(--mono); text-transform: uppercase; letter-spacing: .08em;
  color: #170606; background: var(--bad); padding: .35rem .75rem; border-radius: 6px;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }
@media (prefers-reduced-motion: reduce) { .stall-banner { animation: none; } }

.caption {
  font-size: .82rem; color: var(--ink-3); margin: .9rem 0 0; max-width: 84ch; line-height: 1.55;
}

.myth {
  margin-top: 1.6rem; border: 1px solid color-mix(in oklab, var(--warm) 40%, var(--line));
  border-radius: var(--radius); background: color-mix(in oklab, var(--warm) 7%, var(--panel));
  padding: 1.4rem clamp(1.1rem, 2.4vw, 1.8rem);
}
.myth-tag { font: 650 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--warm); margin-bottom: 1rem; }
.myth-body { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.myth-body h3 { font-size: 1.05rem; }
.myth-body p { font-size: .92rem; color: var(--ink-2); margin: 0; }

/* ───────────────────────── control axes ───────────────────────── */

.axes-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.axis-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; min-width: 0;
}
.axis-head { padding: 1.1rem 1.25rem .6rem; }
.axis-head .axis-kick { font: 650 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.axis-head h3 { font-size: 1.18rem; margin: .5rem 0 .35rem; }
.axis-head p { font-size: .84rem; color: var(--ink-2); margin: 0; }
.axis-stage { background: var(--bg); border-block: 1px solid var(--line-soft); }
.axis-stage svg { display: block; width: 100%; height: auto; }
.axis-foot { padding: 1rem 1.25rem 1.2rem; }
.axis-foot .control label { font-size: .8rem; }
.axis-state { font: 600 .78rem var(--mono); color: var(--ink-3); margin: .7rem 0 0; min-height: 2.6em; }
.axis-state b { color: var(--accent); font-weight: 650; }

.coupling { margin-top: 1rem; padding: 1.4rem clamp(1.1rem, 2.4vw, 1.8rem); }
.coupling h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.coupling-body { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.coupling-body p { font-size: .89rem; color: var(--ink-2); margin: 0; }

/* ───────────────────────── engine ───────────────────────── */

.engine-panel { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(255px, .8fr); }
.engine-panel .readouts, .engine-panel .stage-detail { grid-column: 1 / -1; }
@media (max-width: 900px) { .engine-panel { grid-template-columns: minmax(0, 1fr); } }
.engine-stage { background: var(--bg); border-right: 1px solid var(--line); min-width: 0; padding: .4rem; }
@media (max-width: 900px) { .engine-stage { border-right: 0; border-bottom: 1px solid var(--line); } }
.engine-stage svg { display: block; width: 100%; height: auto; }
.engine-controls { border-bottom: 1px solid var(--line); }

.stage-detail { padding: 1.2rem clamp(1rem, 2.2vw, 1.5rem) 1.4rem; border-top: 1px solid var(--line); }
.stage-detail h3 { font-size: 1.1rem; margin-bottom: .45rem; }
.stage-detail p { font-size: .9rem; color: var(--ink-2); margin: 0; max-width: 75ch; }

.estage { cursor: pointer; }
/* a plain class rule outranks the fill-opacity presentation attribute, so the
   hover state needs no !important and no per-node bookkeeping */
.estage .eskin { transition: fill-opacity .15s, stroke-opacity .15s; }
.estage:hover .eskin, .estage.is-active .eskin { fill-opacity: .42; stroke-opacity: .95; }
.estage-label { font: 600 11px var(--sans); fill: var(--ink-3); pointer-events: none; transition: fill .15s; }
.estage:hover .estage-label, .estage.is-active .estage-label { fill: var(--accent); }
.estage-lead { pointer-events: none; }

/* ───────────────────────── flight ───────────────────────── */

.flight-panel { display: grid; }
.flight-stage { background: var(--bg); border-bottom: 1px solid var(--line); min-width: 0; }
.flight-stage svg { display: block; width: 100%; height: auto; }
.flight-scrub { display: flex; align-items: center; gap: .9rem; padding: .9rem clamp(1rem, 2.2vw, 1.5rem); border-bottom: 1px solid var(--line); }
.flight-scrub input[type="range"] { flex: 1 1 auto; min-width: 0; }
.icon-btn.play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); border-color: var(--accent); color: #04121c; }
.icon-btn.play:hover { color: #04121c; background: color-mix(in oklab, var(--accent) 88%, white); }
.icon-btn.play svg { width: 20px; height: 20px; }

.flight-detail { padding: 1.3rem clamp(1rem, 2.2vw, 1.6rem) 1.6rem; }
.phase-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.flight-detail h3 { font-size: 1.45rem; margin: 0 0 .7rem; }
.flight-detail > p { font-size: .95rem; color: var(--ink-2); max-width: 78ch; }
.phase-spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: .9rem; margin: 1.2rem 0 0; }
.phase-spec > div { min-width: 0; }
.phase-spec dt { font-size: .67rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 650; }
.phase-spec dd { margin: .22rem 0 0; font: 650 1rem var(--mono); color: var(--ink); }

.config-strip { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.3rem; }
.cfg {
  font: 650 .74rem var(--mono); letter-spacing: .04em; text-transform: uppercase;
  padding: .3rem .7rem; border-radius: 6px; border: 1px solid var(--line); color: var(--ink-3);
}
.cfg.on { color: var(--good); border-color: color-mix(in oklab, var(--good) 50%, var(--line)); background: color-mix(in oklab, var(--good) 10%, transparent); }
.cfg.warn { color: var(--warm); border-color: color-mix(in oklab, var(--warm) 50%, var(--line)); background: color-mix(in oklab, var(--warm) 10%, transparent); }

/* ───────────────────────── footer ───────────────────────── */

.footer { border-top: 1px solid var(--line); background: var(--bg-alt); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 3rem clamp(1rem, 3vw, 2rem); }
.foot-title { font-weight: 650; font-size: 1.05rem; margin-bottom: .6rem; }
.foot-sub { font-size: .87rem; color: var(--ink-3); max-width: 80ch; }
.foot-meta { font-size: .82rem; color: var(--ink-3); margin: 1.2rem 0 0; }

/* ───────────────────── narrow screens ─────────────────────
   These drawings carry 11–13 px labels. Scaled into a 343 px column
   they would render at four pixels, so below the breakpoint they keep
   a legible minimum width and the reader swipes instead. A scroll
   container only zeroes its *own* automatic minimum size, so the grid
   item around it needs min-width: 0 as well. */

.swipe-hint { display: none; }

@media (max-width: 720px) {
  .diagram-stage, .forces-stage, .engine-stage, .flight-stage {
    overflow-x: auto; overscroll-behavior-x: contain; min-width: 0;
    scrollbar-width: thin;
  }
  .diagram-view svg { min-width: 480px; }
  .forces-stage  svg { min-width: 520px; }
  .engine-stage  svg { min-width: 660px; }
  .flight-stage  svg { min-width: 700px; }

  .swipe-hint {
    display: block; margin: .45rem 0 0; text-align: center;
    font: 600 .72rem var(--mono); color: var(--ink-3); letter-spacing: .02em;
  }
  .forces-stage + .swipe-hint,
  .engine-stage + .swipe-hint,
  .flight-stage + .swipe-hint { padding: .5rem 0 .7rem; margin: 0; }

  .readouts { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .part-list { max-height: none; }
  .hero-stats { gap: 1.2rem 2rem; }
}
