/* The Ordered Cosmos. Night above, paper below. The front page opens in the sky and the reading
   happens on laid paper; one family, Cardo, carries both. */
:root {
  --paper: #ECE6DA;
  --paper-deep: #E2DACA;
  --ink: #1B2233;
  --ink-soft: #4A5368;
  --ink-faint: #8A91A3;
  --gold: #A8842E;
  --gold-bright: #D9B55A;
  --blue: #2F4A7A;
  --night: #0C1324;
  --night-2: #121C33;
  --night-3: #1A2744;
  --star: #EFE8D8;
  --star-dim: rgba(239, 232, 216, 0.74);
  --star-faint: rgba(239, 232, 216, 0.46);
  --line: rgba(239, 232, 216, 0.16);
  --rule: rgba(27, 34, 51, 0.18);
  --fire: #D9B55A; --earth: #9FB38A; --air: #9DB4D9; --water: #6FB0A8;
  --glyph: "Noto Sans Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", "Apple Symbols", sans-serif;
  --measure: 66ch;
}
* { box-sizing: border-box; }
html { background: var(--night); color: var(--ink); font-family: Cardo, "Palatino Linotype", Palatino, Georgia, serif; font-size: 19px; line-height: 1.55; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
body.home, body.essay { background: var(--night); }
a { color: var(--blue); text-decoration-color: rgba(47, 74, 122, 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--blue); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
h1, h2, h3 { font-weight: 400; line-height: 1.12; margin: 0; letter-spacing: -0.005em; }
main { flex: 1; }
.night { background: var(--night); color: var(--star); position: relative; overflow: hidden; }
.night a { color: var(--gold-bright); text-decoration-color: rgba(217, 181, 90, 0.4); }
.sky-canvas { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.night > :not(.sky-canvas) { position: relative; z-index: 1; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; max-width: 1240px; margin: 0 auto; width: 100%; position: relative; z-index: 3; color: var(--star); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 1.05rem; }
.brand svg { color: var(--gold-bright); flex: none; }
.nav { display: flex; gap: 22px; align-items: center; font-size: 0.95rem; }
.nav a { color: var(--star-dim); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 2px; }
.nav a:hover { color: var(--star); border-bottom-color: var(--gold-bright); }
.nav-chart { color: var(--gold-bright) !important; }
body:not(.home):not(.essay) .top { color: var(--ink); }
body:not(.home):not(.essay) .brand svg { color: var(--gold); }
body:not(.home):not(.essay) .nav a { color: var(--ink-soft); }
body:not(.home):not(.essay) .nav a:hover { color: var(--ink); border-bottom-color: var(--gold); }
body:not(.home):not(.essay) .nav-chart { color: var(--gold) !important; }

.btn { display: inline-block; background: var(--star); color: var(--night); text-decoration: none; padding: 12px 22px; border-radius: 3px; font-size: 1rem; border: 1px solid var(--star); font-family: inherit; cursor: pointer; }
.btn:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: var(--night); }
.btn-ghost { background: transparent; color: var(--star); border-color: var(--line); }
.btn-ghost:hover { background: rgba(239, 232, 216, 0.08); color: var(--star); border-color: var(--star-faint); }
.btn-gold { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn-gold:hover { background: var(--star); border-color: var(--star); }
.night .btn, .night .btn:hover { color: var(--night); }
.night .btn-ghost, .night .btn-ghost:hover { color: var(--star); }

/* hero */
.hero { min-height: 92vh; display: flex; flex-direction: column; justify-content: center; margin-top: -78px; padding: 120px 24px 48px; }
.hero-in { max-width: 1240px; margin: 0 auto; width: 100%; }
.hero-kicker { margin: 0 0 18px; color: var(--gold-bright); font-style: italic; font-size: 1.02rem; }
.hero-h { font-size: clamp(2.6rem, 6.4vw, 5.6rem); max-width: 15ch; line-height: 1.04; }
.hero-h span { display: inline-block; opacity: 0; transform: translateY(0.35em); transition: opacity 900ms ease, transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.hero-h span:nth-child(2) { transition-delay: 260ms; } .hero-h span:nth-child(3) { transition-delay: 520ms; } .hero-h span:nth-child(4) { transition-delay: 780ms; }
.hero-h.in span { opacity: 1; transform: none; }
.hero-lede { margin: 30px 0 0; max-width: var(--measure); color: var(--star-dim); font-size: 1.1rem; }
.hero-actions { margin: 32px 0 0; display: flex; gap: 14px; flex-wrap: wrap; }
.ecliptic { position: relative; height: 92px; max-width: 1240px; margin: 64px auto 0; width: 100%; font-family: var(--glyph); }
.ec-line { position: absolute; left: 0; right: 0; top: 58px; height: 1px; background: linear-gradient(90deg, transparent, var(--star-faint) 8%, var(--star-faint) 92%, transparent); }
.ec-sign { position: absolute; top: 66px; transform: translateX(-50%); font-size: 15px; opacity: 0.75; }
.ec-sign.fire { color: var(--fire); } .ec-sign.earth { color: var(--earth); } .ec-sign.air { color: var(--air); } .ec-sign.water { color: var(--water); }
.ec-planet { position: absolute; top: calc(30px - var(--row) * 26px); transform: translateX(-50%); text-align: center; line-height: 1; }
.ec-planet b { display: block; font-weight: 400; font-size: 22px; color: var(--star); text-shadow: 0 0 14px rgba(217, 181, 90, 0.55); }
.ec-planet i { display: block; font-family: Cardo, Georgia, serif; font-style: normal; font-size: 11px; color: var(--star-faint); margin-top: 3px; letter-spacing: 0.02em; }
.ec-cap { max-width: 1240px; margin: 10px auto 0; width: 100%; color: var(--star-faint); font-size: 0.9rem; }

/* the orrery walk */
.walk { --n: 8; overflow: clip; }
.walk > .walk-sticky { position: sticky; top: 0; height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 480px); gap: 40px; align-items: center; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.walk-spacer { height: calc(var(--n) * 70vh); }
.walk-ring { position: relative; z-index: 1; }
.walk-ring svg { width: 100%; max-height: 86vh; display: block; overflow: visible; }
.wr-ring { fill: none; stroke: var(--star-faint); stroke-width: 1; }
.wr-dash { stroke-dasharray: 2 6; opacity: 0.6; }
.wr-faint { opacity: 0.4; }
.wr-sun { fill: var(--gold-bright); }
.wr-rot { transform-origin: 300px 300px; transform-box: view-box; will-change: transform; }
.wr-node circle { fill: var(--night); stroke: var(--star-faint); stroke-width: 1.5; transition: fill 300ms ease, stroke 300ms ease, r 300ms ease; }
.wr-node.is-on circle { fill: var(--gold-bright); stroke: var(--gold-bright); r: 12; }
.wr-name { font-size: 17px; fill: var(--star-faint); dominant-baseline: central; transition: fill 300ms ease; }
.wr-name.is-on { fill: var(--star); font-size: 19px; }
.walk-panel { position: relative; z-index: 1; min-height: 360px; }
.wp-item { position: absolute; inset: 0; opacity: 0; transform: translateY(14px); transition: opacity 420ms ease, transform 420ms ease; pointer-events: none; }
.wp-item.is-on { opacity: 1; transform: none; pointer-events: auto; position: relative; }
.wp-step { margin: 0 0 6px; color: var(--star-faint); font-size: 0.9rem; }
.wp-when { margin: 0 0 12px; color: var(--gold-bright); font-style: italic; }
.wp-title { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.wp-who { margin: 10px 0 0; color: var(--star-dim); }
.wp-sum { margin: 14px 0 22px; color: var(--star-dim); font-size: 1.02rem; }
.wp-hint { position: absolute; left: 0; bottom: -56px; margin: 0; color: var(--star-faint); font-size: 0.9rem; font-style: italic; transition: opacity 400ms ease; }
.wp-hint.gone { opacity: 0; }

.dawn { height: 160px; background: linear-gradient(180deg, var(--night) 0%, #3A3F55 35%, #B9AE98 70%, var(--paper) 100%); }

/* paper */
.shelf, .questions { background: var(--paper); color: var(--ink); }
.section-head { max-width: 1240px; margin: 0 auto; padding: 56px 24px 8px; }
.section-head h2 { font-size: 2rem; }
.section-head p { margin: 10px 0 0; color: var(--ink-soft); max-width: var(--measure); }
.timeline { list-style: none; margin: 0 auto; padding: 24px 24px 24px; max-width: 1240px; }
.tl-item { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; padding: 30px 0; border-top: 1px solid var(--rule); }
.tl-item:last-child { border-bottom: 1px solid var(--rule); }
.tl-when { display: flex; flex-direction: column; gap: 4px; }
.tl-year { font-size: 1.45rem; line-height: 1.1; color: var(--ink); }
.tl-place { color: var(--ink-faint); font-size: 0.95rem; }
.tl-body h3 { font-size: 1.55rem; }
.tl-body h3 a { color: var(--ink); text-decoration: none; }
.tl-body h3 a:hover { color: var(--blue); }
.tl-who { margin: 6px 0 0; color: var(--gold); font-style: italic; }
.tl-body p { max-width: var(--measure); }
.tl-body > p:not(.tl-who):not(.tl-meta) { margin: 12px 0 0; color: var(--ink-soft); }
.tl-meta { margin: 10px 0 0; color: var(--ink-faint); font-size: 0.9rem; }
.q-grid { max-width: 1240px; margin: 0 auto; padding: 24px 24px 72px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.q-card { background: var(--paper-deep); padding: 26px 24px 28px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 10px; border-radius: 3px; border: 1px solid transparent; }
.q-card:hover { border-color: var(--gold); background: #E8E0CE; }
.q-when { color: var(--gold); font-style: italic; font-size: 0.95rem; }
.q-card h3 { font-size: 1.35rem; }
.q-card p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }

.chart-pull { color: var(--star); }
.chart-pull-in { max-width: 1240px; margin: 0 auto; padding: 72px 24px; }
.chart-pull h2 { font-size: 2rem; color: var(--gold-bright); }
.chart-pull p { max-width: var(--measure); margin: 16px 0 0; color: var(--star-dim); }

/* essays */
.essay-wrap { background: var(--paper); }
.essay-sky { padding: 24px 24px 56px; }
.essay-head { max-width: 760px; margin: 0 auto; padding: 24px 0 12px; }
.essay-when { margin: 0 0 14px; color: var(--gold-bright); font-style: italic; }
.essay-head h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
.essay-who { margin: 14px 0 0; color: var(--star-dim); font-size: 1.1rem; }
.essay-lede { margin: 18px 0 0; color: var(--star-dim); font-size: 1.12rem; }
.essay-paper { max-width: 760px; margin: 0 auto; padding: 36px 24px 72px; color: var(--ink); }
.essay-body { font-size: 1.08rem; line-height: 1.6; }
.essay-body p { margin: 0 0 1.25em; }
.essay-body h2 { font-size: 1.6rem; margin: 2em 0 0.6em; }
.essay-body h3 { font-size: 1.3rem; margin: 1.6em 0 0.5em; }
.essay-body blockquote { margin: 1.6em 0; padding: 0 0 0 22px; border-left: 2px solid var(--gold); color: var(--ink-soft); font-style: italic; }
.essay-body ul, .essay-body ol { padding-left: 1.3em; }
.essay-body li { margin: 0.35em 0; }
.essay-body strong { font-weight: 700; }
.essay-foot { margin-top: 48px; border-top: 1px solid var(--rule); padding-top: 28px; }
.sources h2 { font-size: 1.25rem; }
.sources ul { padding-left: 1.2em; color: var(--ink-soft); font-size: 0.98rem; }
.essay-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 32px; }
.essay-nav a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); padding: 16px 18px; border: 1px solid var(--rule); border-radius: 3px; }
.essay-nav a:hover { border-color: var(--gold); }
.essay-nav span { color: var(--ink-faint); font-size: 0.9rem; }
.essay-nav strong { font-weight: 400; font-size: 1.1rem; line-height: 1.25; }
.essay-next { text-align: right; align-items: flex-end; }
.essay-chart { margin-top: 36px; padding: 20px 22px; background: var(--night); color: var(--star-dim); border-radius: 3px; }
.essay-chart p { margin: 0; }
.essay-chart a { color: var(--gold-bright); }

/* instruments */
.instrument { max-width: 760px; margin: 36px auto 0; padding: 26px 26px 22px; background: rgba(12, 19, 36, 0.55); border: 1px solid var(--line); border-radius: 4px; backdrop-filter: blur(6px); }
.inst-title { margin: 0 0 14px; color: var(--star); font-size: 1.1rem; }
.inst-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.inst-btn { font: inherit; font-size: 0.95rem; background: transparent; color: var(--star); border: 1px solid var(--star-faint); border-radius: 3px; padding: 9px 14px; cursor: pointer; }
.inst-btn:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
.inst-note { margin: 14px 0 0; color: var(--star-dim); font-size: 0.95rem; }
.mono { width: 100%; height: auto; display: block; }
.mono-box { fill: #2A2416; stroke: var(--gold-deep, #A8842E); stroke-width: 1; }
.mono-bridge { fill: var(--gold-bright); }
.mono-stop { fill: var(--star); }
.mono-string { stroke: var(--star-faint); stroke-width: 1.2; fill: none; }
.mono-live { stroke: var(--gold-bright); stroke-width: 1.6; fill: none; }
.kep { display: flex; flex-direction: column; gap: 10px; }
.kep-row { display: grid; grid-template-columns: 80px 1fr minmax(160px, 1.2fr); gap: 14px; align-items: center; font-size: 0.95rem; }
.kep-name { color: var(--star); }
.kep-track { position: relative; height: 2px; background: var(--line); display: block; }
.kep-dot { position: absolute; top: -5px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--gold-bright); transform: translateX(-50%); box-shadow: 0 0 12px rgba(217, 181, 90, 0.7); }
.kep-int { color: var(--star-dim); font-size: 0.9rem; }
.spin { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto; }
.sp-stars circle { fill: var(--star-dim); }
.sp-stars { transform-origin: 300px 300px; transform-box: view-box; animation: sp-ccw linear infinite; }
.sp-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.sp-orbit { transform-origin: 300px 300px; transform-box: view-box; animation: sp-cw linear infinite; }
.sp-planet { fill: var(--star); }
.sp-sun { fill: var(--gold-bright); }
.sp-earth { fill: var(--air); }
.sp-name { font-size: 12px; fill: var(--star-faint); }
.sp-mid { text-anchor: middle; }
@keyframes sp-cw { to { transform: rotate(360deg); } }
@keyframes sp-ccw { to { transform: rotate(-360deg); } }

.foot { border-top: 1px solid var(--rule); margin-top: auto; background: var(--paper); color: var(--ink); }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 36px 24px 44px; }
.foot-line { margin: 0; max-width: 80ch; color: var(--ink-soft); }
.foot-small { margin: 14px 0 0; color: var(--ink-faint); font-size: 0.92rem; max-width: 80ch; }

@media (max-width: 1000px) {
  .walk > .walk-sticky { grid-template-columns: 1fr; gap: 12px; align-content: center; }
  .walk-ring svg { max-height: 44vh; }
  .walk-panel { min-height: 300px; }
  .wp-title { font-size: 1.7rem; }
  .tl-item { grid-template-columns: 1fr; gap: 10px; padding: 24px 0; }
  .tl-when { flex-direction: row; align-items: baseline; gap: 12px; }
}
@media (max-width: 600px) {
  html { font-size: 17px; }
  .top { padding: 14px 16px; flex-wrap: wrap; row-gap: 10px; }
  .nav { gap: 14px; font-size: 0.92rem; width: 100%; justify-content: space-between; }
  .nav a[href="/#questions"] { display: none; }
  .hero { padding: 110px 16px 40px; min-height: 0; }
  .ecliptic { margin-top: 40px; }
  .ec-planet i { display: none; }
  .ec-planet b { font-size: 19px; }
  .walk > .walk-sticky, .section-head, .timeline, .q-grid, .chart-pull-in, .foot-in, .essay-sky, .essay-paper { padding-left: 16px; padding-right: 16px; }
  .walk-ring svg { max-height: 34vh; }
  .wr-name { display: none; }
  .wp-hint { bottom: -40px; }
  .essay-nav { grid-template-columns: 1fr; }
  .essay-next { text-align: left; align-items: flex-start; }
  .instrument { padding: 18px 16px; }
  .kep-row { grid-template-columns: 70px 1fr; }
  .kep-int { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-h span { opacity: 1; transform: none; transition: none; }
  .wp-item, .wr-node circle, .wr-name { transition: none; }
  .sp-stars, .sp-orbit { animation: none; }
}
@media print {
  .top, .foot, .essay-chart, .chart-pull, .instrument { display: none; }
  html, body, .essay-wrap, .essay-sky { background: #fff; color: #000; font-size: 12pt; }
  .essay-sky, .essay-head h1, .essay-who, .essay-lede { color: #000; }
}
