/*
  NOW — an interactive field note about light delay and simultaneity.
  Primary surface: Decide / Learn. One idea lands per movement; the instruments
  are evidence, not decoration.
*/
:root {
  color-scheme: dark;
  --void: #050608;
  --deep: #090c10;
  --panel: #0d1117;
  --paper: #f3f0e9;
  --muted: #9aa2ad;
  --faint: #74808d;
  --line: rgba(196, 211, 225, 0.16);
  --signal: #ff5c35;
  --signal-hot: #ff8a5c;
  --photon: #83e7ff;
  --photon-dim: rgba(131, 231, 255, 0.14);
  --display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --edge: min(1220px, calc(100% - 40px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--void); }
body {
  margin: 0;
  background: var(--void);
  color: var(--paper);
  font-family: var(--body);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--signal); color: var(--void); }
:focus-visible { outline: 2px solid var(--photon); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--void);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}
.skip-link:focus { transform: none; }

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px max(20px, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid transparent;
  font: 600 11px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  transition: background 200ms ease, border-color 200ms ease;
}
.site-header.scrolled { background: rgba(5, 6, 8, .92); border-color: var(--line); }
.site-mark { text-decoration: none; }
.site-mark span { color: var(--signal); }
.site-nav { display: flex; gap: 24px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--paper); }

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: end start;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5,6,8,.96) 0%, rgba(5,6,8,.58) 48%, rgba(5,6,8,.04) 80%),
              linear-gradient(0deg, var(--void) 0%, transparent 42%);
  pointer-events: none;
}
.hero-copy {
  position: relative;
  z-index: 2;
  width: var(--edge);
  margin: 0 auto;
  padding: 150px 0 82px;
}
.eyebrow {
  margin: 0 0 24px;
  color: var(--photon);
  font: 600 11px/1.2 var(--mono);
  letter-spacing: .28em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -.045em; }
h1 {
  max-width: 920px;
  font-size: clamp(4.6rem, 11.5vw, 10.5rem);
  font-weight: 650;
  line-height: .79;
  text-transform: uppercase;
}
h1 .signal { color: var(--signal); }
.hero-intro {
  max-width: 650px;
  margin: 34px 0 0;
  color: #c6cbd2;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
  text-wrap: pretty;
}
.scroll-note {
  position: absolute;
  right: max(20px, calc((100vw - 1220px) / 2));
  bottom: 36px;
  z-index: 2;
  writing-mode: vertical-rl;
  color: var(--faint);
  font: 10px/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.movement { width: var(--edge); margin-inline: auto; padding: clamp(90px, 13vw, 180px) 0; }
.section-id { color: var(--signal); font: 600 11px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.thesis {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .6fr);
  gap: clamp(50px, 9vw, 130px);
  align-items: end;
}
.thesis h2 { font-size: clamp(3rem, 7.4vw, 7.3rem); line-height: .92; }
.thesis p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.thesis strong { color: var(--paper); font-weight: 550; }

.instrument-section { width: 100%; border-block: 1px solid var(--line); background: var(--deep); }
.instrument-wrap { width: var(--edge); margin: 0 auto; padding: clamp(70px, 10vw, 130px) 0; }
.instrument-heading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: end;
  margin-bottom: 70px;
}
.instrument-heading h2 { max-width: 800px; font-size: clamp(3rem, 6.5vw, 6.7rem); line-height: .9; }
.instrument-heading p { max-width: 520px; justify-self: end; margin: 0; color: var(--muted); }

.delay-console {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  border: 1px solid var(--line);
  background: var(--void);
}
.console-main { padding: clamp(24px, 5vw, 64px); border-right: 1px solid var(--line); }
.console-readout { padding: clamp(24px, 5vw, 56px); display: flex; flex-direction: column; justify-content: space-between; }
.control-label, .readout-label { display: block; margin-bottom: 14px; color: var(--muted); font: 600 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.range-wrap { position: relative; margin: 38px 0 26px; }
input[type='range'] { width: 100%; height: 44px; margin: 0; appearance: none; background: transparent; cursor: ew-resize; }
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--signal) var(--range-fill, 0%), #29313b var(--range-fill, 0%)); }
input[type='range']::-moz-range-track { height: 2px; background: #29313b; }
input[type='range']::-moz-range-progress { height: 2px; background: var(--signal); }
input[type='range']::-webkit-slider-thumb { appearance: none; width: 22px; height: 22px; margin-top: -10px; border: 2px solid var(--void); border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 1px var(--signal); }
input[type='range']::-moz-range-thumb { width: 20px; height: 20px; border: 2px solid var(--void); border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 1px var(--signal); }
.range-ends { display: flex; justify-content: space-between; color: var(--faint); font: 10px/1 var(--mono); text-transform: uppercase; }
.object-name { color: var(--photon); font: 500 14px/1.2 var(--mono); }
.delay-value { margin: 20px 0 8px; font: 600 clamp(2.4rem, 5vw, 5.2rem)/.92 var(--display); letter-spacing: -.05em; text-wrap: balance; }
.distance-value { color: var(--muted); font: 12px/1.5 var(--mono); }
.verdict { margin: 44px 0 0; padding-top: 24px; border-top: 1px solid var(--line); color: #c7cbd0; }
.verdict span { color: var(--signal-hot); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.preset {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font: 600 10px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.preset:hover, .preset[aria-pressed='true'] { border-color: var(--photon); color: var(--paper); background: var(--photon-dim); }

.light-run { position: relative; height: 170px; margin-top: 44px; overflow: hidden; border-top: 1px solid var(--line); }
.light-axis { position: absolute; top: 84px; left: 0; right: 0; height: 1px; background: var(--line); }
.light-source, .observer { position: absolute; top: 70px; width: 28px; height: 28px; border-radius: 50%; }
.light-source { left: 0; background: var(--signal); box-shadow: 0 0 32px rgba(255,92,53,.72); }
.observer { right: 0; border: 2px solid var(--photon); background: var(--void); box-shadow: 0 0 22px rgba(131,231,255,.3); }
.photon { position: absolute; top: 78px; left: 13px; width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 0 18px var(--photon); animation: photon-run 3.8s linear infinite; }
.light-caption { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: space-between; color: var(--faint); font: 10px/1 var(--mono); text-transform: uppercase; }
@keyframes photon-run { from { transform: translateX(0); } to { transform: translateX(calc(100vw - max(40px, calc((100vw - 1220px) / 2)) * 2 - 45px)); } }

.room-history { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(50px, 10vw, 150px); align-items: start; }
.room-history h2 { font-size: clamp(3rem, 7vw, 7rem); line-height: .9; position: sticky; top: 120px; }
.history-list { margin: 0; padding: 0; list-style: none; counter-reset: history; }
.history-list li { counter-increment: history; padding: 30px 0 36px; border-bottom: 1px solid var(--line); }
.history-list li::before { content: '0' counter(history); display: block; margin-bottom: 18px; color: var(--signal); font: 10px/1 var(--mono); }
.history-list strong { display: block; margin-bottom: 8px; font: 550 1.35rem/1.2 var(--display); }
.history-list p { margin: 0; color: var(--muted); }

.simultaneity { width: 100%; background: var(--paper); color: var(--void); }
.simultaneity .instrument-wrap { padding-bottom: 90px; }
.simultaneity .section-id { color: #ba321b; }
.simultaneity .instrument-heading p { color: #555d66; }
.sim-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 0; border: 1px solid #bdc2c6; }
.spacetime-wrap { min-height: 520px; padding: 20px; background: #e6e3dc; border-right: 1px solid #bdc2c6; }
#spacetime-canvas { width: 100%; height: 100%; min-height: 480px; display: block; }
.sim-controls { padding: clamp(28px, 5vw, 58px); }
.sim-controls input[type='range']::-webkit-slider-runnable-track { background: linear-gradient(90deg, #ba321b var(--range-fill, 50%), #9aa0a5 var(--range-fill, 50%)); }
.beta { margin: 20px 0 0; font: 650 clamp(3rem, 6vw, 6rem)/1 var(--display); letter-spacing: -.05em; }
.beta small { font-size: .28em; letter-spacing: 0; color: #60666b; }
.sim-shift { margin: 40px 0 6px; font: 600 1.7rem/1.05 var(--display); }
.sim-explain { color: #555d66; font-size: .95rem; }
.sim-callout { margin-top: 42px; padding-top: 24px; border-top: 1px solid #bdc2c6; font: 500 12px/1.6 var(--mono); }

.coda { min-height: 90svh; display: grid; place-items: center; text-align: center; position: relative; overflow: hidden; }
.coda::before { content: ''; position: absolute; width: min(80vw, 900px); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 0 0 70px rgba(131,231,255,.018), 0 0 0 140px rgba(131,231,255,.012); }
.coda-inner { position: relative; width: var(--edge); }
.coda h2 { font-size: clamp(3.5rem, 9vw, 9rem); line-height: .86; }
.coda h2 span { color: var(--signal); }
.coda p { max-width: 590px; margin: 30px auto 0; color: var(--muted); font-size: 1.1rem; }

.sources { width: var(--edge); margin: 0 auto; padding: 80px 0; border-top: 1px solid var(--line); }
.sources-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 28px; }
.sources h2 { font-size: clamp(2rem, 4vw, 3.8rem); }
.source-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 50px; margin: 0; padding: 0; list-style: none; }
.source-list a { display: flex; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.source-list a:hover { color: var(--photon); }
.source-list span { color: var(--faint); font: 10px/1.6 var(--mono); text-transform: uppercase; }

.site-footer { width: var(--edge); margin: 0 auto; padding: 24px 0 38px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--faint); font: 10px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.site-footer a { color: var(--muted); text-decoration: none; }

.reveal { opacity: 1; transform: none; }
.reveal.visible { animation: reveal-in 700ms cubic-bezier(.2,.75,.2,1) both; }
@keyframes reveal-in {
  from { opacity: .01; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 800px) {
  :root { --edge: min(100% - 28px, 1220px); }
  .site-nav { display: none; }
  .hero-copy { padding-bottom: 96px; }
  h1 { font-size: clamp(4rem, 20vw, 7rem); }
  .scroll-note { display: none; }
  .thesis, .instrument-heading, .room-history, .delay-console, .sim-grid { grid-template-columns: 1fr; }
  .thesis { align-items: start; }
  .instrument-heading p { justify-self: start; }
  .console-main, .spacetime-wrap { border-right: 0; border-bottom: 1px solid var(--line); }
  .room-history h2 { position: static; }
  .spacetime-wrap { min-height: 360px; }
  #spacetime-canvas { min-height: 320px; }
  .source-list { grid-template-columns: 1fr; }
  .sources-head, .site-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
