/* ═══════════════════════════════════════════════════════════════════════════
   EVENT HORIZON
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #f4f1ee;
  --dim: rgba(244, 241, 238, 0.56);
  --dimmer: rgba(244, 241, 238, 0.34);
  --hair: rgba(244, 241, 238, 0.14);
  --accent: rgb(255, 122, 47);

  --f-display: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --f-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --pad: clamp(20px, 4.4vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  /* Smooth scrolling lives in JS: ScrollTrigger zeroes the page before it
     measures element positions on refresh, and CSS smooth turns that reset into
     an animation — every start/end then comes out off by a full scroll distance
     (resize, scroll back to the top, and the hero block is simply gone). */
  scrollbar-width: none;
  -webkit-text-size-adjust: 100%;
}
html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-display);
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-booting { overflow: hidden; height: 100vh; }

::selection { background: var(--accent); color: #000; }

a { color: inherit; text-decoration: none; }
h1, h2, p, dl, dd, dt, ul, li { margin: 0; padding: 0; }
ul { list-style: none; }

/* ── stage ───────────────────────────────────────────────────────────────── */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}
body.is-live #stage { opacity: 1; }

/* readability scrim: dark on the left where the type lives, plus top/bottom */
.fx-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(100deg, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.42) 30%, rgba(0,0,0,0) 62%),
    linear-gradient(to bottom, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0) 22%),
    linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 26%);
}

/* hairline frame — the whole page reads as an instrument panel */
.fx-grain {
  position: fixed;
  inset: clamp(10px, 1.5vw, 20px);
  z-index: 6;
  pointer-events: none;
  border: 1px solid rgba(244, 241, 238, 0.07);
  mix-blend-mode: screen;
}

/* ── chrome ──────────────────────────────────────────────────────────────── */

.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 3.2vw, 40px) var(--pad);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  mix-blend-mode: difference;
}

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 1.5px var(--accent), 0 0 14px 1px var(--accent);
  transition: box-shadow 0.7s var(--ease);
}
.brand-name { letter-spacing: 0.22em; }

.chrome-meta { display: inline-flex; align-items: center; gap: 10px; color: var(--dim); }
.chrome-meta .sep { color: var(--dimmer); }
.dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ── rail ────────────────────────────────────────────────────────────────── */

.rail {
  position: fixed;
  right: var(--pad);
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
  padding-right: 22px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rail-item {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  color: var(--dimmer);
  transition: color 0.5s var(--ease);
}
.rail-item b {
  font-weight: 400;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.rail-item i { font-style: normal; font-variant-numeric: tabular-nums; }
.rail-item:hover { color: var(--dim); }
.rail-item:hover b { opacity: 0.7; transform: none; }
.rail-item.is-on { color: var(--accent); }
.rail-item.is-on b { opacity: 1; transform: none; }

.rail-line {
  position: absolute;
  right: 0; top: 2px; bottom: 2px;
  width: 1px;
  background: rgba(244, 241, 238, 0.16);
  overflow: hidden;
}
.rail-fill {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
}

/* ── hud ─────────────────────────────────────────────────────────────────── */

.hud {
  position: fixed;
  left: var(--pad);
  bottom: clamp(22px, 3.2vw, 40px);
  z-index: 8;
  display: grid;
  gap: 3px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.hud-row { display: grid; grid-template-columns: 52px auto; }
.hud-row i { font-style: normal; }
.hud-row b {
  font-weight: 400;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ── chapters ────────────────────────────────────────────────────────────── */

main { position: relative; z-index: 4; }

.chapter { position: relative; height: 240vh; }
#sc0 { height: 300vh; }

.panel {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  align-content: center;
  padding: 0 var(--pad);
  padding-right: clamp(var(--pad), 14vw, 200px);
}

.stage {
  grid-area: 1 / 1;
  max-width: min(52ch, 46vw);
  will-change: transform, opacity;
}

/* ── type ────────────────────────────────────────────────────────────────── */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: clamp(20px, 2.4vw, 34px);
}
.eyebrow .idx {
  font-style: normal;
  color: var(--accent);
  padding-right: 3px;
  transition: color 0.7s var(--ease);
}

.display {
  /* Matched to the Chinese build: same face, same hairline weight, same size. At 8.4rem
     and weight 600 "Event Horizon" outran its line box and lost the last letter to the
     reveal mask. */
  font-size: clamp(2.6rem, 6vw, 6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 200;
  margin: 0 0 clamp(26px, 3vw, 46px);
}
.ln { display: block; overflow: hidden; padding-bottom: 0.06em; }
.ln > span { display: block; }

.title {
  font-size: clamp(2.3rem, 5.4vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 500;
  margin-bottom: clamp(22px, 2.6vw, 38px);
}

.lead {
  font-size: clamp(14.5px, 1.02vw, 17.5px);
  line-height: 1.66;
  color: var(--dim);
  max-width: 44ch;
  font-weight: 400;
}
.lead.dim { color: var(--dimmer); margin-top: 14px; }
.hero-lead { max-width: 38ch; }

.specs {
  margin-top: clamp(30px, 3.6vw, 52px);
  display: grid;
  gap: 0;
  border-top: 1px solid var(--hair);
  max-width: 40ch;
}
.specs > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hair);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.specs dt { color: var(--dimmer); }
.specs dd { color: var(--fg); opacity: 0.82; }
.specs sub { font-size: 0.8em; }

.cue {
  margin-top: clamp(34px, 4vw, 60px);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
}
.cue-line {
  width: 48px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  position: relative;
  overflow: hidden;
}
.cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  animation: sweep 2.4s var(--ease) infinite;
}
@keyframes sweep {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ── outro ───────────────────────────────────────────────────────────────── */

.outro {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(80px, 11vh, 130px) var(--pad) 0;
}
.outro::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.72) 26%, rgba(0,0,0,0.88) 100%);
  pointer-events: none;
}
.outro-inner, .foot { position: relative; }
.outro-inner { max-width: 94ch; }
.outro-title { font-size: clamp(2.4rem, 6.2vw, 5.6rem); }
.outro-lead { max-width: 52ch; }

.ledger {
  margin-top: clamp(30px, 4vw, 56px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--hair);
}
.ledger li {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 15px 18px 17px 0;
  border-bottom: 1px solid var(--hair);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ledger i { font-style: normal; color: var(--dimmer); }
.ledger b { font-weight: 400; color: var(--fg); opacity: 0.85; }

.backtop {
  margin-top: clamp(32px, 4vw, 56px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 14px 22px;
  border: 1px solid var(--hair);
  border-radius: 100px;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), gap 0.4s var(--ease);
}
.backtop svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.backtop:hover { color: var(--accent); border-color: var(--accent); gap: 18px; }

.foot {
  margin-top: auto;
  padding: 24px 0 clamp(26px, 3.4vw, 40px);
  border-top: 1px solid var(--hair);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dimmer);
}

/* ── boot ────────────────────────────────────────────────────────────────── */

.boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  display: grid;
  place-items: center;
}
.boot-inner { display: grid; justify-items: center; gap: 22px; }
.boot-mark {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 1.5px var(--accent), 0 0 26px 2px var(--accent);
  animation: breathe 2.2s var(--ease) infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.68); opacity: 0.55; }
}
.boot-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
}
.boot-bar { width: 168px; height: 1px; background: rgba(244,241,238,0.16); overflow: hidden; }
.boot-fill {
  display: block; height: 100%; width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.boot.is-gone { opacity: 0; pointer-events: none; transition: opacity 0.9s var(--ease); }

/* ── no gpu ──────────────────────────────────────────────────────────────── */

.nogpu {
  position: fixed;
  inset: 0;
  z-index: 22;
  background:
    radial-gradient(120% 90% at 70% 10%, rgba(255,122,47,0.10), transparent 60%),
    #000;
  display: grid;
  align-content: center;
  padding: 0 var(--pad);
}
.nogpu[hidden] { display: none; }
.nogpu-inner { max-width: 54ch; }

/* ── responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .stage { max-width: none; }
  .panel { padding-right: var(--pad); }
  .rail { gap: 13px; }
  .rail-item b { display: none; }
  .fx-scrim {
    background:
      linear-gradient(to top, rgba(0,0,0,0.86) 0%, rgba(0,0,0,0.30) 46%, rgba(0,0,0,0.55) 100%);
  }
  .panel { align-content: end; padding-bottom: 16vh; }
  .stage-hero { align-content: end; }
}

@media (max-width: 640px) {
  .hud { display: none; }
  .chapter { height: 200vh; }
  #sc0 { height: 260vh; }
  .specs > div { grid-template-columns: 1fr; gap: 4px; }
  /* the rail would sit on top of full-bleed copy — keep only the progress line */
  .rail { padding-right: 0; gap: 0; }
  .rail-item { display: none; }
  .rail-line { top: -22vh; bottom: -22vh; }
  .outro { justify-content: flex-start; }
  .foot { margin-top: clamp(56px, 10vh, 96px); }
}

@media (prefers-reduced-motion: reduce) {
  .dot, .boot-mark, .cue-line::after { animation: none; }
  * { scroll-behavior: auto !important; }
}

.hud{display:none!important}#motion-toggle{border:1px solid #ffffff35;background:#090b1270;color:inherit;border-radius:30px;padding:8px 12px;font:10px inherit;cursor:pointer}.source-use{margin-right:28px}.outro-title{font-size:clamp(42px,7vw,106px)}.nogpu[hidden]{display:none!important}.specs dt{opacity:.5}.stage-hero .eyebrow{font-size:10px}@media(max-width:650px){.chrome-meta{display:block}.source-use{margin-right:0;display:flex}.stage-hero .display{font-size:clamp(58px,16vw,110px)}.outro-title{font-size:45px}.hero-lead{max-width:33ch}}
