/* ==========================================================
   The Domino Effect of Planetary Motion
   A night-sky star atlas: navy + slide orange + old parchment
   ========================================================== */
:root {
  --bg: #050c1f;
  --bg-2: #0a1530;
  --panel: #0a1631;
  --line: rgba(243, 230, 200, 0.12);
  --text: #ece4d2;
  --muted: #a9a593;
  --cream: #f3e6c8;
  --orange: #ff9a2e;
  --gold: #e9b44c;
  --rust: #b5531f;
  --sky: #8ecbff;
  --parch: #efe3c6;
  --parch-2: #e4d3ad;
  --ink: #33240f;
  --good: #7fd8a0;
  --bad: #ff8577;
  --ease: cubic-bezier(.2, .75, .2, 1);
  --display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  --body: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; overflow-x: clip; }
body {
  background:
    radial-gradient(1100px 700px at 90% -5%, rgba(255, 154, 46, .07), transparent 60%),
    radial-gradient(900px 700px at -10% 40%, rgba(142, 203, 255, .05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
b, strong { color: #fff6e3; font-weight: 700; }
em { color: var(--gold); font-style: italic; font-family: var(--serif); font-size: 1.08em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hand { font-family: var(--hand); }
::selection { background: var(--orange); color: #1a0d00; }

#stars, #trail { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#stars { z-index: -1; }
#trail { z-index: 60; mix-blend-mode: screen; }
.grain {
  position: fixed; inset: -50%; z-index: 300; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite;
}

/* ---------- progress + nav ---------- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 120; }
.progress span { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--rust), var(--orange), var(--gold)); }

.nav {
  position: fixed; top: 2px; left: 0; right: 0; z-index: 110;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 48px);
  transition: background .4s, transform .45s var(--ease);
}
.nav.scrolled { background: rgba(5, 12, 31, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav.hide { transform: translateY(-110%); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 21px; font-style: italic; letter-spacing: .01em; }
.brand svg { width: 28px; height: 28px; animation: spin 24s linear infinite; }
.brand circle { fill: var(--orange); }
.brand ellipse { fill: none; stroke: var(--cream); stroke-width: 1.6; }
.nav ul { list-style: none; display: flex; gap: 2px; }
.nav nav a { display: flex; align-items: baseline; gap: 6px; padding: 7px 12px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--muted); position: relative; transition: color .25s; }
.nav nav a i { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 15px; }
.nav nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--orange); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.nav nav a:hover { color: #fff; }
.nav nav a.active { color: #fff; }
.nav nav a.active::after { transform: scaleX(1); }
.nav-toggle { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; position: relative; }
.nav-toggle span { position: absolute; left: 9px; right: 9px; height: 2px; background: var(--cream); border-radius: 2px; transition: transform .3s, opacity .3s; }
.nav-toggle span:nth-child(1) { top: 13px; } .nav-toggle span:nth-child(2) { top: 19px; } .nav-toggle span:nth-child(3) { top: 25px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* year counter */
.era { position: fixed; left: clamp(12px, 2.4vw, 30px); bottom: clamp(12px, 2.4vw, 28px); z-index: 90; display: grid; line-height: 1.05; padding: 10px 16px 11px; background: rgba(5, 12, 31, .78); border: 1px solid rgba(233, 180, 76, .35); border-radius: 4px; backdrop-filter: blur(6px); opacity: 0; transform: translateY(12px); transition: opacity .5s, transform .5s var(--ease); pointer-events: none; }
.era.show { opacity: 1; transform: none; }
.era-label { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--muted); }
.era-year { font-family: var(--display); font-size: 30px; color: var(--orange); letter-spacing: .02em; }
.era-year b { color: inherit; font-weight: 400; font-variant-numeric: tabular-nums; }
.era-year small { font-size: 14px; color: var(--gold); }
.era-who { font-family: var(--hand); font-size: 19px; color: var(--cream); }

/* ---------- HERO ---------- */
.hero { min-height: 100vh; min-height: 100svh; position: relative; display: grid; place-items: center; padding: 110px 16px 110px; overflow: hidden; }
.astrolabe { position: absolute; width: min(118vmin, 1100px); left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: .55; pointer-events: none; }
.astrolabe circle, .astrolabe line, .astrolabe path { fill: none; stroke: rgba(243, 230, 200, .22); stroke-width: 1.2; }
.astrolabe text { fill: rgba(233, 180, 76, .55); font-family: 'Cormorant Garamond', serif; font-size: 22px; font-style: italic; stroke: none; }
.astrolabe .al-ring { transform-box: view-box; transform-origin: 50% 50%; }
.astrolabe .r1 { animation: spin 220s linear infinite reverse; }
.astrolabe .r2 { animation: spin 160s linear infinite; }
.astrolabe .r3 { animation: spin 40s linear infinite; }
.astrolabe .r4 { animation: spin 24s linear infinite reverse; }
.astrolabe .r5 { animation: spin 12s linear infinite; }
.astrolabe .al-planet { fill: var(--gold); stroke: none; }
.astrolabe .al-planet.small { fill: var(--sky); }
.astrolabe .al-sun { fill: rgba(255, 154, 46, .25); stroke: rgba(255, 154, 46, .6); }
.astrolabe .al-cross line { stroke-dasharray: 3 9; }
.astrolabe .drawin { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawIn 2.6s var(--ease) forwards; animation-delay: var(--dd, 0s); }

.hero-content { position: relative; z-index: 2; text-align: center; max-width: 1100px; }
.hero-kicker { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.2vw, 23px); color: var(--cream); display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero-kicker span { font-family: var(--body); font-style: normal; font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #1a0d00; background: var(--orange); padding: 4px 10px 3px; border-radius: 2px; }
.hero-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; line-height: .92; margin: 20px 0 22px; font-size: clamp(3.8rem, 13vw, 10.5rem); letter-spacing: .01em; }
.hero-title .line { display: block; color: var(--orange); }
.hero-title .ch { display: inline-block; opacity: 0; transform: translateY(60%) rotate(8deg); animation: charIn .9s var(--ease) forwards; animation-delay: calc(.25s + var(--i) * 45ms); }
.hero-title .accent .ch { color: var(--cream); }
.hero-sub { max-width: 640px; margin: 0 auto; color: #cfc8b4; font-size: clamp(17px, 2vw, 20px); font-family: var(--serif); font-weight: 500; font-size: clamp(19px, 2.3vw, 23px); line-height: 1.5; }
.hero-in { opacity: 0; transform: translateY(24px); animation: fadeUp 1s var(--ease) forwards; animation-delay: var(--d, 0s); }

.hero-faces { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 4px; margin-top: 40px; position: relative; }
.hero-faces::before { content: ""; position: absolute; left: 8%; right: 8%; top: 34px; border-top: 1px dashed rgba(233, 180, 76, .45); }
.hero-faces a { position: relative; display: flex; flex-direction: column; align-items: center; text-decoration: none; width: 104px; }
.hero-faces img { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; object-position: 50% 18%; border: 2px solid var(--gold); box-shadow: 0 0 0 4px var(--bg), 0 8px 20px rgba(0,0,0,.5); filter: sepia(.75) saturate(.8); transition: filter .4s, transform .4s var(--ease); }
.hero-faces a:hover img, .hero-faces a:focus-visible img { filter: none; transform: translateY(-5px) scale(1.06); }
.hero-faces b { font-size: 15px; margin-top: 8px; }
.hero-faces i { font-style: italic; font-family: var(--serif); font-size: 15px; color: var(--gold); }
.hero-note { font-size: 22px; color: var(--gold); margin-top: 18px; display: inline-flex; align-items: flex-end; gap: 4px; transform: rotate(-2deg); }
.hero-note svg { width: 70px; height: 36px; transform: scaleY(-1) translateY(-10px); }

.scroll-cue { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted); z-index: 2; opacity: 0; animation: fadeIn 1s 2.2s forwards; }
.scroll-cue i { width: 1px; height: 46px; background: linear-gradient(var(--gold), transparent); position: relative; overflow: hidden; }
.scroll-cue i::after { content: ""; position: absolute; left: -2px; top: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); animation: drop 1.8s infinite; }

/* ---------- CHAPTERS ---------- */
.chapter { position: relative; max-width: 1200px; margin: 0 auto; padding: clamp(90px, 13vw, 160px) clamp(16px, 4vw, 40px) clamp(40px, 6vw, 70px); }
.ch-head { max-width: 880px; margin-bottom: clamp(40px, 6vw, 70px); }
.ch-head.center { text-align: center; margin-left: auto; margin-right: auto; }
.ch-head.center .ink-rule { margin-left: auto; margin-right: auto; }
.ch-num { font-family: var(--serif); font-size: clamp(26px, 3vw, 34px); color: var(--gold); font-style: italic; font-weight: 600; margin-bottom: 6px; }
.ch-num span { font-style: normal; font-family: var(--body); font-weight: 700; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-right: 6px; vertical-align: middle; }
.ch-num em { font-size: .62em; color: var(--muted); margin-left: 12px; font-weight: 500; }
.chapter h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(2.7rem, 7.8vw, 6.2rem); line-height: .98; color: var(--orange); letter-spacing: .01em; }
.ink-rule { width: min(560px, 80%); height: 14px; margin: 14px 0 22px; overflow: visible; }
.ink-rule path { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; }
.lead { font-family: var(--serif); font-weight: 500; font-size: clamp(21px, 2.5vw, 27px); line-height: 1.42; color: #ddd4bf; max-width: 760px; }

.split .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; margin-right: .22em; }
.split .w > span { display: inline-block; transform: translateY(110%); transition: transform 1s var(--ease); transition-delay: calc(var(--i) * 80ms); }
.split.in .w > span { transform: none; }

/* self-drawing svg strokes */
.draw path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s var(--ease) .3s; }
.draw.in path, .in .draw path { stroke-dashoffset: 0; }
.hero .draw path { transition-delay: 2.2s; }

/* bio + portraits */
.bio { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: clamp(28px, 5vw, 70px); align-items: center; margin-bottom: clamp(50px, 7vw, 80px); }
.bio.flip { grid-template-columns: 1fr minmax(240px, 380px); }
.portrait { position: relative; justify-self: center; width: 100%; max-width: 380px; }
.portrait .frame { position: relative; padding: 14px; background: linear-gradient(145deg, #3b2a12, #1d1408 60%, #3b2a12); border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(233,180,76,.55), inset 0 0 0 7px #2a1d0b, inset 0 0 0 8px rgba(233,180,76,.45), 0 30px 60px -20px rgba(0,0,0,.8); transition: transform .6s var(--ease); }
.portrait .frame::before, .portrait .frame::after { content: ""; position: absolute; width: 22px; height: 22px; border: 2px solid var(--gold); opacity: .8; }
.portrait .frame::before { top: 3px; left: 3px; border-right: 0; border-bottom: 0; }
.portrait .frame::after { bottom: 3px; right: 3px; border-left: 0; border-top: 0; }
.portrait img:not(.signature) { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; filter: sepia(.95) contrast(1.05) brightness(.8); transition: filter 1.8s ease .5s; }
.portrait.in img:not(.signature) { filter: none; }
.tilt-l .frame { transform: rotate(-2.2deg); }
.tilt-r .frame { transform: rotate(2deg); }
.portrait:hover .frame { transform: rotate(0) scale(1.015); }
.portrait figcaption { font-family: var(--serif); font-style: italic; font-size: 16.5px; color: var(--muted); margin-top: 18px; line-height: 1.4; text-align: center; padding: 0 6px; }
.signature { width: 62%; max-height: 74px; object-fit: contain; margin: 10px auto 0; filter: invert(89%) sepia(23%) saturate(400%) hue-rotate(345deg); clip-path: inset(0 100% 0 0); transition: clip-path 2.2s cubic-bezier(.6,.1,.3,1) 1.4s; }
.portrait.in .signature { clip-path: inset(0 0 0 0); }
.name { font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 4.6vw, 3.6rem); text-transform: uppercase; color: var(--cream); line-height: 1; letter-spacing: .02em; }
.dates { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold); margin: 4px 0 20px; }
.aside-fact { margin-top: 22px; font-size: 23px; color: var(--gold); line-height: 1.25; transform: rotate(-1deg); max-width: 520px; }

.ticks { list-style: none; display: grid; gap: 12px; }
.ticks li { position: relative; padding-left: 28px; color: #d6cfbd; }
.ticks li::before { content: "✶"; position: absolute; left: 2px; top: 0; color: var(--orange); font-size: 15px; }
.ticks.small li { font-size: 15.5px; }

/* sims */
.sim-wrap { display: grid; grid-template-columns: 1fr 230px; gap: 26px; align-items: center; margin-bottom: clamp(40px, 6vw, 64px); }
.sim-wrap.flip { grid-template-columns: 230px 1fr; }
.sim-wrap .sim { max-width: 720px; width: 100%; justify-self: center; }
.margin-note { font-size: 23px; line-height: 1.22; color: var(--gold); transform: rotate(-1.5deg); }
.margin-note u { text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.margin-note svg { width: 96px; height: 60px; margin: 6px 0; }
.margin-note path, .hero-note path { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.sim { background: radial-gradient(circle at 50% 35%, #0f1e42, #071028 75%); border: 1px solid rgba(233,180,76,.22); border-radius: 6px; padding: 14px; position: relative; box-shadow: 0 30px 60px -30px rgba(0,0,0,.7); }
.sim::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(233,180,76,.08); border-radius: 3px; pointer-events: none; }
.sim canvas { width: 100%; aspect-ratio: 1 / 1; position: relative; }
.sim canvas.wide { aspect-ratio: 16 / 9; }
.sim figcaption { font-size: 14.5px; color: var(--muted); padding: 12px 6px 4px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 6px 0; position: relative; }
.controls.col { flex-direction: column; align-items: stretch; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 6px 4px; position: relative; }
.chip { font: 600 13.5px var(--body); color: var(--text); background: transparent; border: 1px solid rgba(243,230,200,.25); padding: 7px 14px; border-radius: 3px; cursor: pointer; transition: all .25s var(--ease); }
.chip:hover { border-color: var(--orange); color: #fff; }
.chip.active { background: rgba(255,154,46,.14); border-color: var(--orange); color: var(--orange); }
.chip.fire { background: var(--orange); color: #1a0d00; border-color: var(--orange); }
.chip.fire:hover { background: #ffb15c; }
.chip.fire:active { transform: scale(.95); }
.range { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.range.grow { flex: 1 1 260px; flex-wrap: wrap; }
.range.grow input { flex: 1 1 160px; }
.range b { color: var(--gold); min-width: 64px; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 3px; background: rgba(243,230,200,.25); outline: none; min-width: 100px; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--orange); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--orange); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--orange); }
input[type="range"]:focus-visible { box-shadow: 0 0 0 2px var(--sky); }

/* notes (footnote style, no boxes) */
.notes { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: clamp(50px, 7vw, 80px); border-top: 1px solid var(--line); }
.notes li { padding: 26px 26px 10px; position: relative; }
.notes li + li { border-left: 1px solid var(--line); }
.notes .n { font-family: var(--serif); font-style: italic; font-size: 34px; color: var(--orange); line-height: 1; display: block; margin-bottom: 6px; }
.notes h4 { font-size: 18.5px; margin-bottom: 6px; color: var(--cream); }
.notes p { color: var(--muted); font-size: 15.5px; }
.notes.stacked { grid-template-columns: 1fr 1fr; border-top: 0; }
.notes.stacked li { border-left: 0; border-top: 1px solid var(--line); padding: 18px 18px 8px 0; }
.sub-head { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(1.9rem, 4vw, 2.8rem); color: var(--cream); margin: 10px 0 22px; letter-spacing: .02em; }

/* archive plates */
.plate { margin: 0 auto clamp(50px, 7vw, 80px); max-width: 980px; }
.plate-img { background: var(--parch); padding: clamp(10px, 1.8vw, 20px); box-shadow: inset 0 0 60px rgba(120, 80, 30, .35), 0 30px 60px -25px rgba(0,0,0,.85); position: relative; overflow: hidden; cursor: zoom-in; }
.plate-img::after { content: ""; position: absolute; inset: clamp(5px, .9vw, 10px); border: 1px solid rgba(58, 42, 20, .35); pointer-events: none; }
.plate-img img { width: 100%; transform: scale(var(--z, 1.08)); transition: transform .15s linear; will-change: transform; }
.plate-img.paper img { mix-blend-mode: multiply; }
.plate figcaption { font-family: var(--serif); font-size: 17px; color: #cbc3ad; margin-top: 14px; line-height: 1.45; }
.plate-no { font-family: var(--body); font-weight: 700; font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--orange); margin-right: 8px; }
.loupe-hint { color: var(--muted); font-size: 14px; }
@media (hover: none) { .loupe-hint { display: none; } .plate-img { cursor: default; } }
.loupe { position: fixed; z-index: 250; width: 190px; height: 190px; border-radius: 50%; pointer-events: none; border: 3px solid #2a1d0b; box-shadow: 0 0 0 2px var(--gold), 0 18px 40px rgba(0,0,0,.6), inset 0 0 20px rgba(0,0,0,.25); background-repeat: no-repeat; background-color: var(--parch); opacity: 0; transform: translate(-50%, -50%) scale(.6); transition: opacity .2s, transform .25s var(--ease); }
.loupe.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.split-plates { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 50px); align-items: start; margin-bottom: clamp(50px, 7vw, 80px); }
.split-plates .plate, .jupiter-row .plate, .moon-row .plate, .cannon-row .plate { margin: 0; }
.plate.small figcaption { font-size: 16px; }
.precision h4 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(1.8rem, 3.4vw, 2.5rem); color: var(--cream); margin-bottom: 12px; line-height: 1.05; }
.precision p { color: #d0c9b6; }
.precision p + p { margin-top: 12px; }
.jupiter-row, .cannon-row { display: grid; grid-template-columns: minmax(200px, .55fr) 1fr; gap: clamp(24px, 4vw, 50px); align-items: start; margin-bottom: clamp(50px, 7vw, 80px); }
.moon-row { display: grid; grid-template-columns: minmax(220px, .7fr) 1.3fr; gap: clamp(24px, 4vw, 50px); align-items: start; margin-bottom: clamp(40px, 6vw, 64px); }

/* "problem" note pinned on parchment */
.problem { position: relative; max-width: 760px; margin: 0 auto; background: linear-gradient(170deg, var(--parch), var(--parch-2)); color: var(--ink); padding: 34px clamp(22px, 4vw, 42px) 26px; transform: rotate(-.8deg); box-shadow: 0 30px 50px -25px rgba(0,0,0,.9), inset 0 0 50px rgba(140, 95, 40, .25); }
.problem::before { content: ""; position: absolute; top: -12px; left: 50%; width: 120px; height: 26px; margin-left: -60px; background: rgba(243, 230, 200, .45); transform: rotate(2deg); box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.problem b { color: #1d1306; }
.problem p { font-family: var(--serif); font-size: clamp(18px, 2vw, 21px); font-weight: 500; line-height: 1.45; }
.problem-title { font-family: var(--hand) !important; font-size: clamp(30px, 3.6vw, 38px) !important; color: var(--rust); line-height: 1 !important; margin-bottom: 10px; }
.next { display: inline-block; text-decoration: none; font-size: 25px; color: var(--rust); margin-top: 10px; transition: transform .3s var(--ease); }
.next:hover { transform: translateX(6px); }

/* jupiter notebook */
.notebook { margin: 12px 0 0; background: var(--parch); color: var(--ink); padding: 12px 16px; font-family: var(--mono); box-shadow: inset 0 0 30px rgba(120, 80, 20, .3); position: relative; }
.notebook-head { display: flex; justify-content: space-between; font-family: var(--hand); font-size: 20px; color: var(--rust); margin-bottom: 4px; }
.notebook pre { font-size: 12.5px; line-height: 1.55; min-height: 6.2em; white-space: pre; overflow: hidden; }

/* venus */
.sim.venus { margin-bottom: clamp(50px, 7vw, 80px); padding: 22px; }
.venus-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; position: relative; }
.venus-head h4 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(1.8rem, 3.6vw, 2.6rem); color: var(--cream); line-height: 1; margin-bottom: 6px; }
.venus-head p { color: var(--muted); max-width: 680px; font-size: 15.5px; }
.seg { display: inline-flex; border: 1px solid rgba(243,230,200,.25); border-radius: 3px; }
.seg-btn { font: 600 14px var(--body); color: var(--muted); background: none; border: 0; padding: 8px 16px; cursor: pointer; transition: all .3s var(--ease); }
.seg-btn.active { background: var(--orange); color: #1a0d00; }
.verdict { font-weight: 600; font-size: 15px !important; }
.verdict.good { color: var(--good) !important; }
.verdict.bad { color: var(--bad) !important; }

/* quote */
.quote { margin-top: 26px; padding-left: 22px; border-left: 2px solid var(--orange); }
.quote p { font-family: var(--serif); font-style: italic; font-size: clamp(20px, 2.2vw, 24px); line-height: 1.38; color: var(--cream); }
.quote cite { display: block; margin-top: 8px; font-style: normal; color: var(--muted); font-size: 14px; }

/* laws */
.law { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(28px, 4vw, 60px); align-items: center; margin: clamp(60px, 9vw, 110px) 0; }
.law.flip { grid-template-columns: 1.2fr 1fr; }
.law-num { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 600; }
.law-text h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; color: var(--orange); font-size: clamp(2.5rem, 5.6vw, 4.4rem); line-height: 1; margin: 2px 0 18px; }
.law-statement { font-family: var(--serif); font-weight: 500; font-size: clamp(20px, 2.2vw, 24px); line-height: 1.4; color: var(--cream); margin-bottom: 20px; }
.law-text > p { color: #d0c9b6; margin-bottom: 14px; }

.equation { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px; font-family: var(--mono); font-size: clamp(20px, 2.6vw, 28px); margin: 6px 0 22px; padding: 18px 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.frac span:first-child { border-bottom: 2px solid currentColor; padding: 0 6px 2px; }
.frac span:last-child { padding-top: 2px; }
.equation .arrow { color: var(--orange); }
.big-eq { color: var(--orange); font-weight: 600; }

.speedo { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.speedo-bar, .force-meter div { flex: 1; height: 6px; background: rgba(243,230,200,.12); overflow: hidden; }
.speedo-bar i, .force-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--orange)); }
.force-meter { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; font-size: 13.5px; font-weight: 600; color: var(--muted); position: relative; }
.force-meter i { min-width: 2px; transition: width .3s var(--ease); }

.skater { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: center; padding-top: 18px; border-top: 1px solid var(--line); }
.skater p { color: #d0c9b6; font-size: 15.5px; }
.skater canvas { width: 96px; height: 96px; }

/* harmony table — a printed page */
.table-wrap { background: var(--parch); color: var(--ink); padding: 18px 20px 10px; overflow-x: auto; box-shadow: inset 0 0 50px rgba(140, 95, 40, .25), 0 30px 60px -30px rgba(0,0,0,.8); }
.harmony { width: 100%; border-collapse: collapse; font-size: 15.5px; min-width: 420px; }
.harmony th { text-align: center; font-family: var(--serif); font-size: 17px; font-weight: 600; padding: 8px; border-bottom: 2px solid var(--ink); }
.harmony th:first-child, .harmony td:first-child { text-align: left; }
.harmony td { text-align: center; padding: 6px 8px; font-family: var(--mono); font-size: 14.5px; border-bottom: 1px solid rgba(51, 36, 15, .15); }
.harmony td:first-child { font-family: var(--serif); font-weight: 600; font-size: 17px; }
.harmony td.ratio { color: var(--rust); font-weight: 600; }
.harmony tr { opacity: 0; transform: translateX(16px); transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: calc(var(--r) * 70ms); }
.table-wrap.in .harmony tr { opacity: 1; transform: none; }
.table-note { font-family: var(--serif); font-size: 17px; padding: 10px 2px 6px; }
.table-note b { color: var(--rust); }

/* gravitation */
.newton-eq { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: clamp(28px, 3.8vw, 40px); color: var(--orange); padding: 18px 0; margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.eq-note { color: var(--muted); font-size: 15px; margin-top: 10px; }
.big { font-size: 18px; color: var(--orange); }
.derive { display: grid; gap: 0; margin: 6px 0 18px; border-left: 2px solid var(--orange); }
.step { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 14px; padding: 12px 16px; }
.step + .step { border-top: 1px dashed var(--line); }
.step .mono { font-size: clamp(15px, 1.8vw, 18px); color: #fff; }
.step i { font-family: var(--hand); font-style: normal; font-size: 20px; color: var(--gold); }
.step:last-child .mono { color: var(--orange); }

/* ---------- DOMINOES ---------- */
.domino-stage { display: flex; flex-direction: column; align-items: center; gap: 26px; margin-bottom: clamp(60px, 8vw, 90px); }
.domino-row { --dw: clamp(30px, 9vw, 110px); display: flex; gap: calc(var(--dw) * .42); align-items: flex-end; padding: 30px calc(var(--dw) * 1.9) 0 10px; min-height: calc(var(--dw) * 2.1); border-bottom: 2px solid rgba(243,230,200,.25); width: 100%; justify-content: center; }
.domino { width: var(--dw); height: calc(var(--dw) * 1.9); background: linear-gradient(160deg, #fffaf0, #e7dbc0); color: #111; border-radius: calc(var(--dw) * .1); display: grid; grid-template-rows: 1fr auto; box-shadow: inset 0 0 0 2px #fff, 0 12px 24px -10px rgba(0,0,0,.7); transform-origin: 100% 100%; transition: transform .45s cubic-bezier(.55, 0, .9, .5); transition-delay: calc(var(--i) * .38s); position: relative; }
.domino-row.fall .domino { transform: rotate(var(--rot, 24deg)); }
.domino-row.fall .domino:last-child { --rot: 88deg; transition-duration: .7s; transition-timing-function: cubic-bezier(.5, 0, .8, .6); }
.pips { position: relative; border-bottom: 2px solid #222; margin: 0 8%; }
.pips i { position: absolute; width: 16%; aspect-ratio: 1; border-radius: 50%; background: #1b1b1b; transform: translate(-50%, -50%); }
.d-name { font-family: var(--display); text-transform: uppercase; text-align: center; font-size: clamp(9px, 1.6vw, 16px); line-height: 1.1; padding: 6% 2% 10%; letter-spacing: .02em; }
.d-name small { display: block; font-family: var(--serif); font-style: italic; font-size: 1em; text-transform: none; color: var(--rust); }

.chain { list-style: none; position: relative; display: grid; gap: 28px; max-width: 1000px; margin: 0 auto; }
.chain::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: linear-gradient(var(--orange), var(--gold)); transform-origin: top; transform: scaleY(var(--chain, 0)); }
.link { position: relative; width: calc(50% - 44px); padding: 4px 0 6px; }
.link:nth-child(even) { margin-left: auto; }
.link::before { content: ""; position: absolute; top: 30px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--orange); }
.link:nth-child(odd)::before { right: -52px; }
.link:nth-child(even)::before { left: -52px; }
.link:nth-child(odd) { text-align: right; }
.link:nth-child(odd) .link-faces { justify-content: flex-end; }
.link-faces { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.link-faces img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: 50% 18%; border: 2px solid var(--gold); filter: sepia(.6); }
.link-faces img.crossed { filter: grayscale(1) brightness(.6); }
.link-faces span { font-family: var(--hand); font-size: 26px; color: var(--orange); }
.link-year { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--gold); }
.link h4 { font-size: 20px; margin: 0 0 6px; color: var(--cream); }
.link p { color: #c9c2ae; font-size: 15.5px; }

/* footer */
.footer { text-align: center; padding: 110px 16px 80px; color: var(--muted); display: grid; gap: 12px; justify-items: center; border-top: 1px solid var(--line); margin-top: 60px; }
.footer-title { font-family: var(--display); text-transform: uppercase; font-size: clamp(3.4rem, 11vw, 7.5rem); color: var(--orange); line-height: 1; }
.footer-sub { font-family: var(--serif); font-size: 18px; }
.made-by { margin: 26px 0 8px; display: grid; justify-items: center; gap: 2px; }
.made-by .hand { font-size: 24px; color: var(--gold); transform: rotate(-2deg); }
.names { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.names .names-sep { font-family: var(--body); font-size: 15px; color: var(--orange); }
.names li { font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 3.4vw, 36px); color: var(--cream); letter-spacing: .01em; }
.credits { max-width: 720px; text-align: left; font-size: 14px; margin: 18px 0 6px; }
.credits summary { cursor: pointer; text-align: center; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--gold); list-style: none; }
.credits summary::-webkit-details-marker { display: none; }
.credits summary::after { content: " ▾"; }
.credits[open] summary::after { content: " ▴"; }
.credits p { margin: 12px 0 8px; text-align: center; }
.credits ul { list-style: none; columns: 2; column-gap: 30px; }
.credits li { break-inside: avoid; margin-bottom: 6px; }
.credits a { color: var(--cream); }
.footer .next { color: var(--gold); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.portrait.reveal { transform: translateY(50px) rotate(var(--rr, 0deg)); }
.tilt-l.reveal { --rr: -4deg; } .tilt-r.reveal { --rr: 4deg; }
.portrait.reveal.in { transform: none; }

/* ---------- keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes charIn { to { opacity: 1; transform: none; } }
@keyframes fadeUp { to { opacity: 1; transform: none; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes drop { 0% { transform: translateY(-6px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(46px); opacity: 0; } }
@keyframes drawIn { to { stroke-dashoffset: 0; } }
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-5%, 3%); } 50% { transform: translate(4%, -4%); } 75% { transform: translate(-2%, 5%); } 100% { transform: translate(3%, -2%); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav nav a i { display: none; }
}
@media (max-width: 960px) {
  .nav-toggle { display: block; }
  .nav nav { position: absolute; top: 100%; left: 0; right: 0; background: rgba(5,12,31,.97); border-bottom: 1px solid var(--line); max-height: 0; overflow: hidden; transition: max-height .4s var(--ease); }
  .nav nav.open { max-height: 480px; }
  .nav ul { flex-direction: column; padding: 10px 16px 18px; }
  .nav nav a { padding: 12px 16px; font-size: 16px; }
  .nav nav a i { display: inline; }
  .nav nav a::after { display: none; }
  .bio, .bio.flip, .law, .law.flip, .split-plates, .jupiter-row, .moon-row, .cannon-row { grid-template-columns: 1fr; }
  .bio.flip > .portrait, .law.flip > :first-child { order: 2; }
  .bio.flip > .portrait { order: -1; }
  .portrait { max-width: 320px; }
  .sim-wrap, .sim-wrap.flip { grid-template-columns: 1fr; }
  .sim-wrap.flip .margin-note { order: 2; }
  .margin-note { max-width: 420px; }
  .margin-note svg { display: none; }
  .notes { grid-template-columns: 1fr; }
  .notes li + li { border-left: 0; border-top: 1px solid var(--line); }
  .notes li { padding: 20px 0 8px; }
  .jupiter-row .plate, .cannon-row .plate { max-width: 380px; }
  .chain::before { left: 10px; }
  .link, .link:nth-child(even) { width: auto; margin-left: 40px; text-align: left; }
  .link:nth-child(odd) .link-faces { justify-content: flex-start; }
  .link:nth-child(odd)::before, .link:nth-child(even)::before { left: -38px; right: auto; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .notes.stacked { grid-template-columns: 1fr; }
  .hero-faces a { width: 92px; }
  .hero-faces img { width: 56px; height: 56px; }
  .hero-faces::before { display: none; }
  .skater { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .sim { padding: 10px; }
  .d-name { display: none; }
  .domino { grid-template-rows: 1fr; }
  .pips { border-bottom: 0; }
  .credits ul { columns: 1; }
  .era { padding: 7px 12px 8px; }
  .era-year { font-size: 22px; }
  .era-who { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; transition-delay: 0s !important; }
  .reveal, .hero-in, .hero-title .ch, .portrait.reveal { opacity: 1 !important; transform: none !important; }
  .split .w > span { transform: none !important; }
  .grain { display: none; }
}
