:root {
  --bg: #0c0c0d;
  --ink: #fbfaf9;
  --ink-muted: rgba(251, 250, 249, 0.62);
  --ink-faint: rgba(251, 250, 249, 0.38);
  --accent: #ff5a36;
  --scene-vh: 150vh;
  --scene-count: 8;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  overflow-x: hidden;
  cursor: default;
}

h1, h2 {
  font-family: "Playfair Display", serif;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

a { color: inherit; }

/* ---------- loader / cinematic entrance ---------- */
body.is-loading {
  overflow: hidden;
  height: 100vh;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, #18191b 0%, var(--bg) 65%);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.loader.is-hidden {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.loader-eyebrow {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1s ease 0.1s, transform 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.reveal-mask {
  overflow: hidden;
}

.reveal-item {
  display: block;
  transform: translateY(110%);
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.25s;
}

.reveal-wordmark {
  height: clamp(34px, 7vw, 64px);
  width: auto;
}

.loader-bar {
  width: 160px;
  height: 1px;
  background: rgba(251, 250, 249, 0.14);
  position: relative;
  overflow: hidden;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.8s ease 0.5s;
}

.loader-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

body.is-loaded .loader-eyebrow,
body.is-loaded .loader-bar {
  opacity: 1;
  transform: translateY(0);
}

body.is-loaded .reveal-item {
  transform: translateY(0);
}

/* ---------- grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  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>");
  background-size: 220px 220px;
}

/* ---------- fixed chrome ---------- */
.chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 32px clamp(20px, 4vw, 56px);
  pointer-events: none;
}

.brand-mark {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.brand-mark:hover {
  opacity: 1;
  transform: scale(1.05);
}

.brand-mark img {
  display: block;
  height: clamp(52px, 6vw, 84px);
  width: auto;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: auto;
}

.rail-dot {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-dot span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: transform 0.35s ease, background 0.35s ease;
  display: block;
}

.rail-dot.active span {
  background: var(--accent);
  transform: scale(1.7);
}

/* ---------- scroll cue ---------- */
.scroll-cue {
  position: fixed;
  left: clamp(20px, 4vw, 56px);
  bottom: 32px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  transition: opacity 0.5s ease;
}

.scroll-cue i {
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, var(--ink) 0%, transparent 100%);
  position: relative;
  overflow: hidden;
  display: block;
}

.scroll-cue i::after {
  content: "";
  position: absolute;
  left: 0;
  top: -100%;
  width: 100%;
  height: 100%;
  background: var(--accent);
  animation: cue-fall 1.8s ease-in-out infinite;
}

@keyframes cue-fall {
  0% { top: -100%; }
  60% { top: 100%; }
  100% { top: 100%; }
}

.scroll-cue.is-hidden { opacity: 0; }

/* ---------- track / stage ---------- */
#track {
  position: relative;
  height: calc(var(--scene-count) * var(--scene-vh));
}

#stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  will-change: opacity;
}

.scene[data-index="0"] { opacity: 1; }

.scene-media {
  position: absolute;
  inset: -6%;
  overflow: hidden;
  /* keep .tint's blend contained to the footage below it */
  isolation: isolate;
}

.scene-media img,
.scene-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.86) contrast(1.06) brightness(0.92);
  transform: scale(1.06);
  will-change: transform;
  /* the clips carry no audio; keep the element inert to pointer/selection */
  pointer-events: none;
  user-select: none;
}

.scene-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6,6,7,0.55) 0%, rgba(6,6,7,0.05) 28%, rgba(6,6,7,0.1) 55%, rgba(6,6,7,0.82) 100%),
    linear-gradient(90deg, rgba(6,6,7,0.55) 0%, rgba(6,6,7,0) 40%);
}

/* One continuous grade spanning the whole story. JS drives --grade on :root, so
   every scene shares the same value at any instant — it reads as one grade
   sliding from cold grey to warm dust to clear light, never a per-scene jump.
   It lives inside .scene-media so it tints the footage only, never the copy. */
.tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: soft-light;
  background: var(--grade, rgb(90, 108, 130));
  opacity: 0.5;
}

/* The closing scene is bright, so white copy needs its own pool of shade —
   a soft radial behind the centred block instead of a heavier global scrim. */
.scene-scrim.scrim-light {
  background:
    radial-gradient(ellipse 60% 45% at 50% 48%, rgba(8,14,24,0.52) 0%, rgba(8,14,24,0.28) 45%, rgba(8,14,24,0) 100%),
    linear-gradient(180deg, rgba(6,6,7,0.45) 0%, rgba(6,6,7,0.05) 30%, rgba(6,6,7,0.1) 55%, rgba(10,14,20,0.7) 100%);
}

/* ---------- copy ---------- */
.scene-copy {
  position: absolute;
  left: clamp(20px, 6vw, 88px);
  bottom: clamp(64px, 12vh, 120px);
  max-width: 560px;
  opacity: 0;
  transform: translateY(26px);
  will-change: opacity, transform;
}

.scene-index {
  display: block;
  font-size: 16px;
  line-height: 1.08;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 14px;
  font-weight: 600;
}

.scene-copy h2 {
  font-size: clamp(40px, 5.5vw, 70px);
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 18px;
}

.scene-copy p {
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.6;
  color: var(--ink-muted);
  font-weight: 300;
  max-width: 460px;
}

/* alternates the narrative copy right instead of left so the story doesn't
   read as a single fixed column while the camera moves through the scene */
.scene-copy.align-right {
  left: auto;
  right: clamp(20px, 6vw, 88px);
  text-align: right;
}

.scene-copy.align-right p {
  margin-left: auto;
}

/* hero + final variants: centered, larger */
.hero-copy {
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

.hero-copy .eyebrow {
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 22px;
}

.wordmark-image {
  display: block;
  width: auto;
  margin: 0 auto;
}

.hero-wordmark {
  height: clamp(62px, 11.5vw, 140px);
}

.final-wordmark {
  height: clamp(50px, 7.8vw, 110px);
}

.hero-copy .lede {
  margin-top: 24px;
  max-width: 520px;
  font-size: clamp(18px, 1.55vw, 22px);
  color: var(--ink-muted);
  font-weight: 300;
  line-height: 1.7;
}

.scene[data-index="0"] .hero-copy .lede {
  margin-top: 8px;
}

/* Closing scene only: the copy lands on the brightest footage of the whole
   story, so it carries its own lift rather than relying on the scrim alone. */
.final-copy .eyebrow {
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 1px 14px rgba(8, 12, 24, 0.7);
}

.final-copy .lede {
  text-shadow: 0 2px 22px rgba(8, 12, 24, 0.45);
}

/* Keep the closing content reachable on shorter displays instead of letting the
   stage clip the demo panel and CTA at its bottom edge. */
.final-copy {
  overflow-y: auto;
  justify-content: flex-start;
  padding-top: clamp(76px, 9vh, 112px);
  padding-bottom: 28px;
  scrollbar-width: thin;
}

.demo-panel {
  width: min(100%, 680px);
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid rgba(251, 250, 249, 0.24);
  background: rgba(8, 12, 24, 0.42);
  text-align: left;
  backdrop-filter: blur(8px);
}

.demo-panel-heading,
.demo-meta,
.demo-metrics,
.demo-zones li {
  display: flex;
  align-items: center;
}

.demo-panel-heading {
  justify-content: space-between;
  gap: 20px;
}

.demo-kicker,
.demo-label {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.demo-panel h2 {
  margin-top: 5px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
}

.demo-state {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.demo-state.is-ready { color: #9ee6bb; }
.demo-state.is-error { color: #ff9d86; }

.demo-message {
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
}

.demo-content { margin-top: 16px; }

.demo-incident strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  font-weight: 500;
}

.demo-meta {
  gap: 14px;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 11px;
}

.demo-meta span + span::before {
  content: "·";
  margin-right: 14px;
  color: var(--accent);
}

.demo-metrics {
  gap: 34px;
  margin-top: 18px;
  padding: 14px 0;
  border-top: 1px solid rgba(251, 250, 249, 0.12);
  border-bottom: 1px solid rgba(251, 250, 249, 0.12);
}

.demo-metric strong {
  display: block;
  font-family: "Playfair Display", serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.demo-metric span {
  display: block;
  margin-top: 5px;
  color: var(--ink-muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.demo-zones { margin-top: 14px; }

.demo-zones ul {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.demo-zones li {
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(251, 250, 249, 0.07);
  color: var(--ink-muted);
  font-size: 11px;
}

.demo-zones li strong { color: var(--ink); font-weight: 500; }

.final-copy .wordmark-image {
  filter: drop-shadow(0 2px 22px rgba(8, 12, 24, 0.45));
}

.final-copy .cta {
  border-color: rgba(251, 250, 249, 0.55);
  background: rgba(8, 12, 24, 0.18);
  backdrop-filter: blur(2px);
}

.cta {
  margin-top: 34px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  border: 1px solid rgba(251, 250, 249, 0.32);
  border-radius: 0;
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
  will-change: transform;
}

.cta:hover {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--accent), 0 0 22px rgba(255, 90, 54, 0.45);
}

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  z-index: 5;
  background: var(--bg);
  margin-top: clamp(28px, 5vw, 72px);
  padding: 40px clamp(20px, 4vw, 56px) 56px;
  border-top: 1px solid rgba(251, 250, 249, 0.08);
}

.site-footer p {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  :root { --scene-vh: 130vh; }
  .rail { display: none; }
  .scene-copy { bottom: 84px; }
  .demo-panel { padding: 15px; }
  .demo-zones ul { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-media img,
  .scene-media video { transform: none !important; }
  .scroll-cue i::after { animation: none; }
  .cta { transition: none; }
  .loader, .reveal-item, .loader-eyebrow, .loader-bar { transition-duration: 0.01s !important; }
}
