:root {
  color-scheme: dark;
  --bg: #000;
  --text: #fff;
  --muted: #777;
  --line: rgba(255,255,255,0.08);
  --accent: #fff;
  --radius: 12px;
}

section[data-accent="blue"] { --accent: #3b82f6; }
section[data-accent="red"] { --accent: #ef4444; }
section[data-accent="white"] { --accent: #fff; }

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.noise { display: none; }

.scroll-meter {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 20; height: 2px;
  background: rgba(255,255,255,0.06);
}
.scroll-meter span {
  display: block; width: 0; height: 100%;
  background: var(--accent);
  transition: background 400ms ease;
}

.site-header {
  position: fixed; top: 16px; left: 50%;
  z-index: 15;
  width: min(1120px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  color: var(--text); font-weight: 800;
  text-decoration: none; letter-spacing: -0.03em;
}
.brand-mark {
  width: 16px; height: 16px;
  border: 1px solid var(--accent);
  border-radius: 50%; background: transparent;
  transition: border-color 400ms ease;
}

nav { display: flex; gap: 4px; align-items: center; }
nav a {
  padding: 8px 12px; border-radius: 999px;
  color: var(--muted); font-size: 0.84rem; font-weight: 700;
  text-decoration: none;
  transition: color 200ms ease, background 200ms ease;
}
nav a:hover, nav a:focus-visible {
  color: var(--text); background: rgba(255,255,255,0.08);
}

main {
  position: relative;
}

.hero, .chapter, .references {
  min-height: 100vh;
  padding: 120px max(24px, calc((100vw - 1120px) / 2)) 80px;
}

.foreword {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 140px max(24px, calc((100vw - 1120px) / 2));
}
.foreword-inner { max-width: 720px; }
.foreword-lead {
  margin: 8px 0 28px;
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  line-height: 1.18; letter-spacing: -0.03em;
  text-wrap: balance;
}
.foreword-num {
  color: var(--accent);
  font-weight: 800;
}
.foreword-inner p:not(.foreword-lead):not(.eyebrow) {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  margin-bottom: 16px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(380px, 1.08fr);
  align-items: center; gap: 44px;
}

.hero-copy, .chapter-copy { max-width: 760px; }

.eyebrow {
  display: inline-flex; gap: 8px; align-items: center;
  margin: 0 0 16px;
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.76rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  transition: color 400ms ease;
}
.eyebrow::before {
  content: "";
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2C8 2 4 6 4 12c0 4 3 8 8 10 5-2 8-6 8-10 0-6-4-10-8-10z'/%3E%3Cpath d='M12 2v20'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 820px; margin-bottom: 24px;
  font-size: clamp(3rem, 8vw, 6.5rem);
  line-height: 0.9; letter-spacing: -0.08em;
  text-wrap: balance;
}

.burning {
  background: linear-gradient(135deg, #ff9a56 0%, #ff6b35 25%, #ff4500 50%, #ff2200 75%, #cc0000 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(255, 100, 50, 0.5);
}
h2 {
  margin-bottom: 20px;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.98; letter-spacing: -0.07em;
  text-wrap: balance;
}
h3 { margin-bottom: 12px; font-size: 1.2rem; letter-spacing: -0.04em; }
p { color: var(--muted); font-size: 1rem; line-height: 1.75; }

/* inline math: keep formulas monospace, aligned, and non-breaking */
.eq {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.9em;
  color: #d7def0;
  white-space: nowrap;
  padding: 0 0.05em;
}
.eq sub { font-size: 0.72em; line-height: 0; vertical-align: -0.25em; }
.eq sup { font-size: 0.72em; line-height: 0; vertical-align: 0.4em; }

.lede {
  max-width: 720px; color: #ccc;
  font-size: clamp(1rem, 2vw, 1.3rem); line-height: 1.7;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  font-weight: 700; text-decoration: none;
  transition: border-color 200ms ease, background 200ms ease;
}
.button.primary {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}
.button.primary:hover { background: rgba(255,255,255,0.14); }
.button.secondary { color: var(--muted); background: transparent; }

.plot-card {
  position: sticky;
  top: 96px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0a0a0a;
}

.plot-frame {
  display: block;
  width: 100%;
  min-height: 380px;
  border: 0;
  background: #0a0a0a;
}

.plot-card figcaption {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.sim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.sim-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 120px;
}
.sim-controls label span {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sim-controls input[type="range"] {
  width: 100%;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.sim-controls input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line);
}
.sim-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}
.sim-controls input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--line);
}
.sim-controls input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}
.sim-controls .sim-value {
  font-size: 0.82rem;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}

.sim-controls select.sim-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font: 700 12px Inter, system-ui, sans-serif;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.sim-controls select.sim-select option {
  background: #111;
  color: #fff;
  font-weight: 700;
}
.sim-controls button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
}
.sim-controls button:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
}

.capsule-card span,
.startup-card span,
.timeline span,
.reference-list strong {
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 400ms ease;
}

.chapter.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 44px;
}

.yantar-chapter { display: block; }
.yantar-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 40px;
}
.yantar-figures .plot-card { position: relative; top: auto; }
.yantar-figures .plot-frame { min-height: 420px; }
.zenit-figures .plot-card { position: relative; top: auto; }
.plot-frame--tall { min-height: 480px; }
.figure-interlude {
  max-width: 760px;
  margin: 56px auto;
  padding: 4px 0;
}
.figure-interlude h3 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}
.figure-interlude p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 14px;
}
.designer-panel { margin-top: 22px; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; overflow: hidden; background: #05070e; }
.plot-frame--designer { min-height: 600px; }
/* break the optimization charts out of the 760px text column to span the full viewport width */
.optimizer-shell, .designer-panel {
  width: calc(100vw - 40px);
  max-width: none;
  margin-left: calc(20px - max(24px, (100vw - 1120px) / 2));
  margin-right: 0;
}
.plot-frame--cinema { min-height: 560px; }
.plot-card--cinematic { background: #050507; }
@media (max-width: 920px) { .plot-frame--cinema { min-height: 440px; } }

@media (max-width: 920px) {
  .yantar-figures { grid-template-columns: 1fr; }
}

.fact-grid,
.startup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 34px;
}

.startup-card,
.capsule-card,
.reference-list li {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(12px);
}

.startup-card,
.capsule-card {
  padding: 22px;
  border-radius: var(--radius);
}

.startup-card p,
.capsule-card p,
.source-note {
  margin-bottom: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.optimizer-copy blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.04);
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.capsule-card {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 620px;
  margin-top: 32px;
  border-radius: var(--radius);
}

.capsule-icon {
  width: 80px;
  height: 80px;
  flex: 0 0 auto;

  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;

  background:
    /* top camera */
    radial-gradient(circle at 50% 22%, #be0000 0 4px, #8a2929 5px, #000 7px, transparent 8px),

    /* bottom-left camera */
    radial-gradient(circle at 35% 40%, #be0000 0 4px, #8a2929 5px, #000 7px, transparent 8px),

    /* bottom-right camera */
    radial-gradient(circle at 65% 40%, #be0000 0 4px, #8a2929 5px, #000 7px, transparent 8px),

    /* sphere body */
    radial-gradient(circle at 35% 30%, #555 0%, #333 45%, #111 100%);

  transform: rotate(-8deg);

  box-shadow:
    inset -8px -8px 12px rgba(0,0,0,0.45),
    inset 6px 6px 10px rgba(255,255,255,0.05);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.timeline div {
  position: relative;
  min-height: 130px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
}

.timeline div::after {
  content: "";
  position: absolute;
  right: -28px; bottom: -34px;
  width: 88px; height: 88px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 50%;
}

.timeline strong {
  display: block;
  margin-top: 40px;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
}

.modern .chapter-copy { margin-bottom: 28px; }

.size-compare,
.payload-table {
  margin-top: 44px;
}

.size-compare .eyebrow,
.payload-table .eyebrow {
  color: #fff;
}

.silhouette-stack {
  display: flex;
  align-items: flex-end;
  gap: clamp(16px, 4vw, 44px);
  min-height: 320px;
  padding: 24px 0 30px;
  border-bottom: 1px solid var(--line);
}

.silhouette {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: 0;
}

.silhouette i {
  display: block;
  width: var(--w);
  height: var(--h);
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  position: relative;
}

.silhouette i::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(255,255,255,0.16);
}

.shape-disc i {
  border-radius: 999px / 45%;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.18);
}

.shape-disc i::after {
  border-radius: 999px / 45%;
}

.shape-sphere i {
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, rgba(255,255,255,0.32), rgba(255,255,255,0.12) 60%, rgba(255,255,255,0.06));
}

.shape-sphere i::after {
  border-radius: 50%;
}

.shape-blunt i {
  border-radius: 48% 48% 18% 18% / 64% 64% 24% 24%;
  clip-path: polygon(50% 0, 86% 18%, 100% 54%, 82% 100%, 18% 100%, 0 54%, 14% 18%);
}

.shape-blunt i::after {
  border-radius: 42% 42% 18% 18% / 54% 54% 24% 24%;
}

/* cone flown apex-first: domed (spherical aft) top tapering to a point at the bottom */
.shape-cone-down i {
  clip-path: polygon(50% 0, 85% 5%, 100% 17%, 50% 100%, 0 17%, 15% 5%);
  border-radius: 0;
}
.shape-cone-down i::after { display: none; }

.shape-human i {
  width: var(--w);
  height: var(--h);
  border: 0;
  background: url("human_silhouette.jpg") center bottom / contain no-repeat;
  filter: invert(1);
  mix-blend-mode: screen;
}

.shape-human i::after {
  content: none;
}

.silhouette span {
  display: block;
  margin-bottom: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}

.silhouette::after {
  content: attr(data-length);
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.stack-note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: #666;
  max-width: 760px;
}

.payload-table table {
  width: 100%;
  max-width: 1000px;
  border-collapse: collapse;
  margin-top: 18px;
  border: 1px solid var(--line);
}

.payload-table th,
.payload-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.5;
}

.payload-table th {
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.03);
}

.payload-table td {
  color: var(--muted);
}

.payload-table td strong {
  color: #fff;
  font-weight: 700;
}

.payload-table tbody tr:last-child td {
  border-bottom: 0;
}

.payload-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.startup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.startup-card {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}

.startup-card-img {
  width: 100%;
  height: 180px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.startup-card-body {
  padding: clamp(24px, 4vw, 36px);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.startup-card h3 {
  margin-top: 16px;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 0.96;
}

.startup-card a {
  display: inline-flex;
  margin-top: 20px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: border-color 400ms ease;
}

.optimizer-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0a0a0a;
  overflow: hidden;
}

.optimizer-plot {
  position: relative;
  min-height: 360px;
  overflow: hidden;
}

.optimizer-plot--globe { min-height: 480px; }
.optimizer-plot--globe .plot-frame { min-height: 480px; }

.optimizer-copy { padding: 18px; }

.optimizer-copy code {
  display: block;
  margin-top: 16px;
  padding: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #ccc;
  background: rgba(255,255,255,0.03);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
}

.source-note { margin-top: 18px; }

.opt-subhead {
  margin-top: 64px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.04em;
}

.references {
  min-height: auto;
  padding-bottom: 120px;
}

.reference-list {
  display: grid;
  gap: 12px;
  max-width: 1000px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: refs;
}

.reference-list li {
  position: relative;
  min-height: 68px;
  padding: 16px 20px 16px 60px;
  border-radius: var(--radius);
  color: var(--muted);
  line-height: 1.55;
  counter-increment: refs;
}

.reference-list li::before {
  content: counter(refs);
  position: absolute;
  left: 16px; top: 16px;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  font-weight: 800;
  font-size: 0.82rem;
}

.reference-list a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.25);
  text-underline-offset: 4px;
}

sup a {
  display: inline-grid;
  place-items: center;
  min-width: 1.3em;
  height: 1.3em;
  margin-left: 3px;
  border-radius: 50%;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  font-size: 0.7em;
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px max(24px, calc((100vw - 1120px) / 2));
  border-top: 1px solid var(--line);
  background: #000;
}

.site-footer p { margin: 0; font-size: 0.88rem; }
.site-footer a {
  color: var(--text); font-weight: 700; text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .startup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .startup-card-img { height: 200px; }
}

@media (max-width: 920px) {
  .site-header {
    align-items: flex-start;
    border-radius: 24px;
    flex-direction: column;
  }
  nav { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .hero, .chapter.split, .optimizer-shell { grid-template-columns: 1fr; }
  .hero .plot-card { order: -1; } /* lead with the animation at the top when the hero stacks */
  .plot-card { position: relative; top: auto; }
  .plot-frame { min-height: 340px; }
  .timeline { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .hero, .chapter, .references { padding-top: 140px; }
  .brand span:last-child { display: none; }
  nav a { font-size: 0.78rem; }
  h1 { font-size: clamp(3rem, 16vw, 4.5rem); }
  .startup-grid, .timeline { grid-template-columns: 1fr; }
  .capsule-card, .site-footer { flex-direction: column; align-items: flex-start; }
  .plot-frame { min-height: 300px; }
  .sim-controls { gap: 8px; padding: 12px; }
  .sim-controls label { flex: 1 1 100%; }
  .silhouette-stack { min-height: 220px; gap: 12px; }
  .silhouette i { min-height: 28px; }
  .silhouette span { font-size: 0.65rem; }
  .silhouette::after { font-size: 0.7rem; }
  .payload-table th, .payload-table td { padding: 10px; font-size: 0.85rem; }
}
