:root {
  color-scheme: dark;
  --bg: #030409;
  --ink: #f6f1eb;
  --muted: #b8adbb;
  --cyan: #19d8ff;
  --cyan-soft: rgba(25, 216, 255, 0.42);
  --magenta: #d925b8;
  --magenta-soft: rgba(217, 37, 184, 0.4);
  --amber: #ffc46d;
  --panel: rgba(5, 8, 16, 0.52);
  --line: rgba(255, 255, 255, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(217, 37, 184, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(25, 216, 255, 0.13), transparent 26rem),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 4px 4px;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem clamp(1rem, 4vw, 4.5rem);
  background: linear-gradient(180deg, rgba(3, 4, 9, 0.84), rgba(3, 4, 9, 0));
  color: rgba(246, 241, 235, 0.9);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.38rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand i {
  color: var(--magenta);
  font-style: normal;
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.8rem);
  color: rgba(246, 241, 235, 0.7);
  font-size: 0.9rem;
}

nav a {
  transition: color 160ms ease;
}

nav a:hover {
  color: var(--ink);
}

.chapter {
  --progress: 0;
  --scene-alpha: 1;
  position: relative;
  min-height: 128vh;
  isolation: isolate;
}

.hero {
  min-height: 134vh;
}

.scene {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: #030409;
  opacity: var(--scene-alpha);
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 4, 9, 0.78), rgba(3, 4, 9, 0.25) 42%, rgba(3, 4, 9, 0.12)),
    linear-gradient(180deg, rgba(3, 4, 9, 0.18), rgba(3, 4, 9, 0) 42%, rgba(3, 4, 9, 0.45));
}

.reverse .scene::after {
  background:
    linear-gradient(90deg, rgba(3, 4, 9, 0.72), rgba(3, 4, 9, 0.2) 48%, rgba(3, 4, 9, 0.08)),
    linear-gradient(180deg, rgba(3, 4, 9, 0.1), rgba(3, 4, 9, 0) 48%, rgba(3, 4, 9, 0.46));
}

.scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform:
    scale(calc(1.03 + (var(--progress) * 0.045)))
    translate3d(calc((var(--progress) - 0.5) * -1.2rem), 0, 0);
  filter: saturate(1.05) contrast(1.04);
  transition: filter 240ms ease, opacity 240ms ease;
}

.hero .scene img {
  object-position: center center;
  transform:
    scale(calc(1.02 + (var(--progress) * 0.055)))
    translate3d(calc(var(--progress) * -1.2rem), 0, 0);
}

.dimmed img {
  filter: saturate(0.9) contrast(1.08) brightness(0.58);
}

.copy {
  position: relative;
  z-index: 5;
  width: min(42rem, calc(100% - 2rem));
  margin-left: clamp(1rem, 8vw, 7rem);
  margin-top: -72vh;
  padding-bottom: 28vh;
  opacity: calc(0.52 + var(--progress) * 1.1);
  transform: translate3d(0, calc((1 - var(--progress)) * 2.4rem), 0);
}

.hero-copy {
  margin-top: -78vh;
  width: min(54rem, calc(100% - 2rem));
  opacity: 0.94;
  transform: translate3d(0, 0, 0);
}

.final-copy {
  margin-top: -70vh;
  width: min(48rem, calc(100% - 2rem));
}

.kicker,
.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--amber);
  font-size: clamp(0.76rem, 1.2vw, 0.94rem);
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  max-width: 15ch;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 0.95;
  text-wrap: balance;
}

h1 {
  font-size: clamp(3.1rem, 9vw, 8.6rem);
}

h2 {
  font-size: clamp(2.3rem, 6vw, 6.2rem);
}

p {
  margin: 1.25rem 0 0;
  max-width: 42rem;
  color: rgba(246, 241, 235, 0.82);
  font-size: clamp(1.05rem, 1.65vw, 1.38rem);
  line-height: 1.58;
}

em {
  color: var(--ink);
  font-style: normal;
}

.text-chapter {
  min-height: 112vh;
  display: grid;
  place-items: center;
  padding: 8rem clamp(1rem, 7vw, 7rem);
  background:
    radial-gradient(circle at 22% 45%, rgba(217, 37, 184, 0.18), transparent 22rem),
    radial-gradient(circle at 78% 45%, rgba(25, 216, 255, 0.13), transparent 24rem),
    #030409;
}

.origin-text {
  background:
    radial-gradient(circle at 22% 35%, rgba(255, 196, 109, 0.12), transparent 24rem),
    radial-gradient(circle at 80% 62%, rgba(25, 216, 255, 0.1), transparent 28rem),
    #030409;
}

.text-stage {
  max-width: 72rem;
  border-left: 1px solid rgba(255, 196, 109, 0.42);
  padding-left: clamp(1.2rem, 3vw, 3rem);
  transform: translateY(calc((1 - var(--progress)) * 2rem));
  opacity: calc(0.62 + var(--progress) * 0.8);
}

.text-stage h2 {
  max-width: 18ch;
}

.text-stage p {
  max-width: 58rem;
}

.layered .substrate,
.thread-field,
.particle-field,
.core-pulse,
.scanline {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.substrate {
  left: 34%;
  right: 11%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-soft), var(--magenta-soft), transparent);
  box-shadow: 0 0 22px rgba(25, 216, 255, 0.4);
  transform: translateY(calc(var(--progress) * -3.8rem));
}

.substrate-one {
  bottom: 24%;
}

.substrate-two {
  bottom: 16%;
  opacity: 0.65;
  transform: translateY(calc(var(--progress) * -5.2rem));
}

.thread-field {
  inset: 12% 6% 10% 45%;
  opacity: calc(0.18 + var(--progress) * 0.55);
  background:
    linear-gradient(118deg, transparent 0 38%, rgba(25, 216, 255, 0.24) 39%, transparent 40%),
    linear-gradient(64deg, transparent 0 52%, rgba(217, 37, 184, 0.18) 53%, transparent 54%);
  transform: translate3d(calc((var(--progress) - 0.4) * -1.5rem), calc(var(--progress) * -1rem), 0);
}

.inward {
  inset: 18% 18% 8% 36%;
  filter: blur(0.2px);
}

.particle-field {
  inset: 0;
  opacity: calc(0.25 + var(--progress) * 0.45);
  background-image:
    radial-gradient(circle, rgba(25, 216, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(217, 37, 184, 0.45) 0 1px, transparent 1.5px);
  background-position: 10% 20%, 70% 44%;
  background-size: 4.8rem 4.8rem, 6.2rem 6.2rem;
  mask-image: radial-gradient(circle at 66% 47%, black, transparent 48%);
  transform: translateY(calc(var(--progress) * -1.8rem));
}

.core-pulse {
  right: 25%;
  bottom: 31%;
  width: clamp(8rem, 18vw, 17rem);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: calc(0.15 + var(--progress) * 0.35);
  background: radial-gradient(circle, rgba(255, 196, 109, 0.34), rgba(217, 37, 184, 0.16) 38%, transparent 65%);
  transform: scale(calc(0.82 + var(--progress) * 0.28));
  filter: blur(2px);
}

.scanline {
  inset: 0;
  opacity: calc(0.08 + var(--progress) * 0.18);
  background: repeating-linear-gradient(180deg, transparent 0 7px, rgba(25, 216, 255, 0.08) 8px);
  transform: translateY(calc(var(--progress) * 2rem));
}

.natural-scene::after {
  background:
    linear-gradient(90deg, rgba(3, 4, 9, 0.82), rgba(3, 4, 9, 0.18) 48%, rgba(3, 4, 9, 0.04)),
    radial-gradient(circle at 68% 48%, rgba(255, 196, 109, 0.14), transparent 30rem);
}

.natural-scene img {
  object-position: 70% center;
}

.finale {
  min-height: 112vh;
  display: grid;
  place-items: center;
  padding: 8rem clamp(1rem, 8vw, 7rem);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 196, 109, 0.14), transparent 24rem),
    radial-gradient(circle at 75% 70%, rgba(25, 216, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #030409, #05030a);
}

.final-stage {
  width: min(62rem, 100%);
  border-left: 1px solid rgba(255, 196, 109, 0.42);
  padding-left: clamp(1.2rem, 3vw, 3rem);
  opacity: calc(0.66 + var(--progress) * 0.6);
  transform: translateY(calc((1 - var(--progress)) * 1.8rem));
}

.final-stage h2 {
  max-width: 18ch;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1rem, 5vw, 5rem);
  color: rgba(246, 241, 235, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .site-header {
    position: static;
    padding: 0.9rem 1rem;
    background: rgba(3, 4, 9, 0.94);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  nav {
    display: none;
  }

  .chapter,
  .hero,
  .finale {
    min-height: auto;
  }

  .scene {
    position: relative;
    top: auto;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 0;
    opacity: 1;
    background: #030409;
  }

  .scene img,
  .hero .scene img,
  .natural-scene img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transform: none;
  }

  .scene::after,
  .reverse .scene::after,
  .natural-scene::after {
    background:
      linear-gradient(180deg, rgba(3, 4, 9, 0.08), rgba(3, 4, 9, 0) 62%, rgba(3, 4, 9, 0.52));
  }

  .copy,
  .hero-copy,
  .final-copy {
    width: calc(100% - 2rem);
    margin-left: 1rem;
    margin-top: 0;
    padding: 1.4rem 0 4.5rem;
    opacity: 1;
    transform: none;
  }

  .text-chapter,
  .finale {
    min-height: auto;
    display: block;
    padding: 5.25rem 1rem 4.5rem;
  }

  .origin-text {
    padding-top: 4.5rem;
  }

  h1 {
    font-size: clamp(2.7rem, 14vw, 5.2rem);
    max-width: 11ch;
  }

  h2 {
    font-size: clamp(2rem, 10vw, 4.4rem);
    max-width: 12ch;
  }

  p {
    font-size: 1.02rem;
    line-height: 1.54;
  }

  .text-stage {
    padding-left: 1rem;
    opacity: 1;
    transform: none;
  }

  .substrate,
  .particle-field,
  .core-pulse,
  .thread-field {
    display: none;
  }

  .final-stage {
    padding-left: 1rem;
    opacity: 1;
    transform: none;
  }

  .site-footer {
    display: block;
  }

  .site-footer p + p {
    margin-top: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .scene img,
  .copy,
  .text-stage,
  .substrate,
  .thread-field,
  .particle-field,
  .core-pulse,
  .scanline {
    transform: none !important;
  }
}
