/* ===================================================================
   Design tokens
   =================================================================== */
:root {
  --bg: #0a0a0c;
  --bg-raised: #121215;
  --text-primary: #f2f0eb;
  --text-secondary: #9a958c;
  --accent: #ff8000;
  --accent-dim: #7a4118;
  --highlight: #c9c9cf;
  --scrim: 10, 10, 12;

  --font-display: "Archivo Black", "Arial Black", sans-serif;
  --font-body: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  width: 100%;
  overscroll-behavior: none;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
::selection { background: var(--accent); color: var(--bg); }

/* subtle film grain, sits above everything, never blocks interaction */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ===================================================================
   Film loader
   =================================================================== */
#film-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.7s var(--ease-smooth), visibility 0.7s;
}
#film-loader.is-loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.film-loader-mark {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
}
.film-loader-mark span { color: var(--accent); font-weight: 600; }
.film-loader-bar {
  width: min(280px, 60vw);
  height: 2px;
  background: rgba(201, 201, 207, 0.18);
  overflow: hidden;
}
.film-loader-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s var(--ease-smooth);
}
.film-loader-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

/* ===================================================================
   Nav
   =================================================================== */
#site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px clamp(24px, 4vw, 56px);
  pointer-events: none;
  background: linear-gradient(rgba(6, 6, 7, 0.6) 0%, rgba(6, 6, 7, 0.28) 60%, transparent 100%);
}
#site-nav > * { pointer-events: auto; }
#site-nav, #chapter-rail, #tachometer {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 16px rgba(0, 0, 0, 0.5);
}

.nav-mark {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  display: flex;
  gap: 8px;
}
.nav-mark-name { color: var(--text-secondary); }
.nav-mark-model { color: var(--accent); font-weight: 600; }

#nav-links {
  list-style: none;
  display: flex;
  gap: clamp(14px, 2vw, 30px);
  margin: 0;
  padding: 0;
}
#nav-links li a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding-bottom: 6px;
  transition: color 0.4s var(--ease-smooth);
}
#nav-links li a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-smooth);
}
#nav-links li a:hover { color: var(--text-primary); }
#nav-links li a:hover::after,
#nav-links li.is-active a::after { transform: scaleX(1); }
#nav-links li.is-active a { color: var(--accent); }

.nav-scroll-cue {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  transition: opacity 0.6s var(--ease-smooth);
}
.nav-scroll-cue span {
  width: 1px;
  height: 22px;
  background: linear-gradient(var(--accent), transparent);
  animation: cue-drop 1.8s var(--ease-smooth) infinite;
}
@keyframes cue-drop {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}
.nav-scroll-cue.is-hidden { opacity: 0; }

/* ===================================================================
   Stage / canvas
   =================================================================== */
#experience { position: relative; }

.scroll-track { position: relative; width: 100%; }

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

#film-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 100%),
    linear-gradient(rgba(0,0,0,0.35), transparent 20%, transparent 80%, rgba(0,0,0,0.45));
}

/* ===================================================================
   Chapter text blocks
   =================================================================== */
#text-blocks { position: absolute; inset: 0; z-index: 20; }

.chapter-text {
  position: absolute;
  top: 50%;
  width: min(38vw, 560px);
  padding: 48px 44px;
  opacity: 0;
  will-change: opacity, transform;
}
.chapter-text.side-left  { left: clamp(150px, 12vw, 210px); transform: translateY(-50%); }
.chapter-text.side-right { right: 0; transform: translateY(-50%); }
.chapter-text.side-center {
  left: 50%;
  width: min(48vw, 640px);
  text-align: center;
  transform: translate(-50%, -50%);
}

.text-scrim {
  position: absolute;
  inset: -14% -10%;
  z-index: -1;
  pointer-events: none;
}
.side-left .text-scrim {
  background: linear-gradient(90deg, rgba(var(--scrim), 0.90) 0%, rgba(var(--scrim), 0.62) 58%, transparent 100%);
}
.side-right .text-scrim {
  background: linear-gradient(270deg, rgba(var(--scrim), 0.90) 0%, rgba(var(--scrim), 0.62) 58%, transparent 100%);
}
.side-center .text-scrim {
  background: radial-gradient(ellipse at center, rgba(var(--scrim), 0.86) 0%, rgba(var(--scrim), 0.55) 45%, transparent 75%);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0 0 18px;
}
.headline {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  color: var(--text-primary);
}
.body-copy {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.1vw, 1.08rem);
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0 0 22px;
  max-width: 48ch;
}
.side-center .body-copy { max-width: 60ch; margin-left: auto; margin-right: auto; }

.spec-line {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--highlight);
  padding-top: 16px;
  border-top: 1px solid rgba(201, 201, 207, 0.25);
}

/* ===================================================================
   Hotspots
   =================================================================== */
#hotspots { position: absolute; inset: 0; z-index: 30; }

.hotspot-btn {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-smooth);
}
.hotspot-btn.is-visible { opacity: 1; pointer-events: auto; }

.hotspot-btn::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 128, 0, 0.55);
  animation: hotspot-ping 2.4s var(--ease-smooth) infinite;
}
.hotspot-btn:hover::before { background: var(--text-primary); }
@keyframes hotspot-ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 128, 0, 0.55); }
  70% { box-shadow: 0 0 0 16px rgba(255, 128, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 128, 0, 0); }
}

#hotspot-card {
  position: fixed;
  left: clamp(24px, 4vw, 56px);
  bottom: clamp(24px, 4vw, 56px);
  z-index: 700;
  width: min(340px, 84vw);
  padding: 26px 26px 24px;
  background: var(--bg-raised);
  border: 1px solid rgba(201, 201, 207, 0.18);
  border-left: 2px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
}
#hotspot-card.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
#hotspot-card.card-pos-right {
  left: auto;
  right: clamp(24px, 4vw, 56px);
  bottom: 220px;
}
#hotspot-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 12px;
  color: var(--accent);
}
#hotspot-card p {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}
#hotspot-card-close {
  position: absolute;
  top: 12px; right: 14px;
  font-size: 20px;
  line-height: 1;
  color: var(--text-secondary);
  transition: color 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
}
#hotspot-card-close:hover { color: var(--accent); transform: rotate(90deg); }

/* ===================================================================
   Tachometer — signature scroll indicator
   =================================================================== */
#tachometer {
  position: fixed;
  right: clamp(20px, 3vw, 44px);
  bottom: clamp(20px, 3vw, 44px);
  z-index: 400;
  width: 148px;
  text-align: center;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.5));
}
#tachometer svg { width: 100%; height: auto; overflow: visible; }
.tach-face {
  fill: rgba(18, 18, 21, 0.78);
  stroke: rgba(201, 201, 207, 0.35);
  stroke-width: 1.5;
}
.tach-tick { stroke: var(--highlight); stroke-width: 1.5; opacity: 0.55; }
.tach-tick.is-major { stroke: var(--text-primary); stroke-width: 2; opacity: 0.9; }
.tach-redline { fill: none; stroke: var(--accent); stroke-width: 4; opacity: 0.85; }
#tach-needle {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transform-origin: 100px 100px;
  filter: drop-shadow(0 0 6px rgba(255,128,0,0.65));
}
.tach-hub { fill: var(--highlight); }
.tach-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  margin-top: 6px;
}
.tach-chapter-readout {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-top: 4px;
}

/* ===================================================================
   Chapter rail
   =================================================================== */
#chapter-rail {
  position: fixed;
  left: clamp(20px, 3vw, 40px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 400;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
#chapter-rail::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(201, 201, 207, 0.2);
}
.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.rail-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid rgba(201, 201, 207, 0.4);
  transition: background 0.4s var(--ease-smooth), border-color 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
}
.rail-item.is-active .rail-dot {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.3);
}
.rail-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
  white-space: nowrap;
}
.rail-item.is-active .rail-label,
.rail-item:hover .rail-label { opacity: 1; transform: translateX(0); }

/* ===================================================================
   Footer
   =================================================================== */
#site-footer {
  position: relative;
  z-index: 10;
  background: var(--bg);
  padding: 48px clamp(24px, 6vw, 100px) 60px;
  border-top: 1px solid rgba(201, 201, 207, 0.12);
}
.footer-disclaimer {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  opacity: 0.7;
}

/* ===================================================================
   Reduced-motion fallback
   =================================================================== */
#fallback { display: none; }

.fallback-chapter {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px clamp(24px, 8vw, 140px);
  border-bottom: 1px solid rgba(201, 201, 207, 0.1);
  background: linear-gradient(160deg, var(--bg-raised) 0%, var(--bg) 70%);
}
.fallback-chapter .chapter-text {
  position: static;
  opacity: 1;
  width: 100%;
  max-width: 640px;
  padding: 0;
  transform: none;
}
.fallback-chapter .text-scrim { display: none; }
.fallback-hotspots {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.fallback-hotspot {
  border: 1px solid rgba(201, 201, 207, 0.25);
  padding: 14px 16px;
  max-width: 260px;
}
.fallback-hotspot h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 8px;
}
.fallback-hotspot p {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  #experience { display: none; }
  #fallback { display: block; }
  #chapter-rail, #tachometer, .nav-scroll-cue { display: none; }
  body::after { display: none; }
}

/* ===================================================================
   Narrow-window notice (desktop-only experience)
   =================================================================== */
#narrow-notice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
@media (max-width: 880px) {
  #narrow-notice { display: flex; }
  #experience, #fallback, #site-nav, #tachometer, #chapter-rail { display: none !important; }
}
