:root {
  --bg: #020807;
  --text: #f2fff6;
  --muted: rgba(231, 255, 239, 0.58);
  --green: #7dffad;
  --line: rgba(227, 255, 237, 0.16);
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

body.is-loading {
  overflow: hidden;
}

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

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 44%, rgba(84, 255, 145, 0.12), transparent 23%),
    #010605;
  transition: opacity 0.8s cubic-bezier(.22, 1, .36, 1), visibility 0.8s;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__orb {
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 1px solid rgba(147, 255, 187, 0.3);
  border-radius: 50%;
  background: rgba(115, 255, 168, 0.05);
  box-shadow: 0 0 50px rgba(94, 255, 151, 0.12);
}

.loader__orb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.loader__brand {
  font-size: clamp(25px, 4vw, 48px);
  font-weight: 750;
  letter-spacing: -0.065em;
}

.loader__bar {
  width: min(340px, 72vw);
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.loader__bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 15px var(--green);
}

.loader__meta {
  width: min(340px, 72vw);
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font: 9px/1 var(--mono);
  letter-spacing: 0.15em;
}

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 30px;
  pointer-events: none;
}

.nav > * {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.045em;
}

.brand__glyph {
  display: grid;
  place-content: center;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(144, 255, 183, 0.28);
  border-radius: 8px;
  color: var(--green);
  background: rgba(91, 255, 150, 0.06);
  box-shadow: inset 0 0 16px rgba(91, 255, 150, 0.08);
  font: 700 12px/1 var(--sans);
}

.nav__status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(239, 255, 245, 0.55);
  font: 9px/1 var(--mono);
  letter-spacing: 0.15em;
}

.nav__status i {
  width: 24px;
  height: 1px;
  background: var(--line);
}

.nav__cta {
  padding: 10px 14px;
  border: 1px solid rgba(233, 255, 241, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(14px);
  font: 9px/1 var(--mono);
  letter-spacing: 0.12em;
  transition: border-color .25s, background .25s;
}

.nav__cta:hover {
  border-color: rgba(125, 255, 173, 0.65);
  background: rgba(125, 255, 173, 0.08);
}

.scroll-space {
  position: relative;
  height: 900vh;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: #020807;
}

#frameCanvas,
.poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#frameCanvas {
  z-index: 1;
  opacity: 0;
  transition: opacity .35s ease;
}

#frameCanvas.is-ready {
  opacity: 1;
}

.poster {
  z-index: 0;
  object-fit: cover;
  filter: saturate(.84) brightness(.78) contrast(1.08);
  transition: opacity .5s ease;
}

.poster.is-hidden {
  opacity: 0;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 5, 4, .68), transparent 42%, transparent 67%, rgba(0, 5, 4, .22)),
    linear-gradient(180deg, rgba(0, 5, 4, .36), transparent 30%, rgba(0, 5, 4, .67));
  box-shadow: inset 0 0 170px 35px rgba(0, 0, 0, .62);
}

.scene-light {
  position: absolute;
  z-index: 3;
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(70px);
  will-change: transform, opacity;
}

.scene-light--one {
  left: 53%;
  bottom: -28%;
  width: min(1000px, 90vw);
  aspect-ratio: 1;
  opacity: .16;
  background: rgba(58, 255, 132, .52);
}

.scene-light--two {
  right: -12%;
  top: 12%;
  width: 45vw;
  aspect-ratio: 1;
  opacity: .08;
  background: rgba(123, 255, 177, .45);
}

.grain {
  position: absolute;
  inset: -50%;
  z-index: 5;
  pointer-events: none;
  opacity: .038;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  animation: grain .24s steps(2) infinite;
}

@keyframes grain {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-2%, 3%, 0); }
  50% { transform: translate3d(3%, -2%, 0); }
  75% { transform: translate3d(2%, 2%, 0); }
  100% { transform: translate3d(-3%, -2%, 0); }
}

.story-panel {
  position: absolute;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
  pointer-events: none;
}

.hero {
  left: clamp(22px, 7vw, 110px);
  bottom: clamp(90px, 12vh, 145px);
  max-width: 1000px;
}

.kicker {
  margin: 0 0 16px;
  color: rgba(219, 255, 232, .65);
  font: 10px/1 var(--mono);
  letter-spacing: .2em;
}

.hero h1,
.ending h2 {
  margin: 0;
  font-size: clamp(50px, 9vw, 145px);
  font-weight: 720;
  line-height: .84;
  letter-spacing: -.078em;
}

.hero h1 span {
  color: rgba(239, 255, 245, .42);
}

.hint {
  margin: 25px 0 0;
  color: var(--muted);
  font: 9px/1 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}

.chapter {
  left: clamp(22px, 8vw, 130px);
  bottom: clamp(100px, 15vh, 180px);
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: min(900px, 76vw);
}

.chapter > span {
  margin-top: 8px;
  color: var(--green);
  font: 9px/1 var(--mono);
  letter-spacing: .12em;
}

.chapter h2 {
  margin: 0;
  font-size: clamp(34px, 5.4vw, 82px);
  line-height: .98;
  letter-spacing: -.062em;
  font-weight: 560;
}

.ending {
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding:
    clamp(80px, 10vh, 125px)
    clamp(22px, 7vw, 110px)
    clamp(100px, 12vh, 140px);
}

.ending h2 {
  font-size: clamp(54px, 9.5vw, 150px);
}

.ending__copy {
  max-width: 610px;
  margin: 22px 0 0;
  color: rgba(237, 255, 244, .68);
  font-size: clamp(14px, 1.35vw, 19px);
  line-height: 1.55;
}

.ending__actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 32px;
  pointer-events: auto;
}

.button {
  font: 9px/1 var(--mono);
  letter-spacing: .14em;
}

.button--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid rgba(129, 255, 175, .62);
  border-radius: 999px;
  background: rgba(88, 255, 147, .1);
  box-shadow: 0 0 35px rgba(88, 255, 147, .08);
  transition: transform .25s, background .25s;
}

.button--primary:hover {
  transform: translateY(-2px);
  background: rgba(88, 255, 147, .18);
}

.button--text {
  color: rgba(238, 255, 244, .62);
}

.progress {
  position: absolute;
  right: 30px;
  bottom: 28px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(239, 255, 245, .42);
  font: 8px/1 var(--mono);
  letter-spacing: .14em;
}

.progress__track {
  width: 88px;
  height: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, .15);
}

.progress__track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(125, 255, 173, .85);
}

.frame-status {
  position: absolute;
  left: 30px;
  bottom: 26px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(239, 255, 245, .34);
  font: 8px/1 var(--mono);
  letter-spacing: .12em;
}

.frame-status__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

@media (max-width: 760px) {
  .nav {
    padding: 18px 20px;
  }

  .nav__status {
    display: none;
  }

  .brand {
    font-size: 12px;
  }

  .nav__cta {
    font-size: 7px;
    padding: 9px 10px;
  }

  .scroll-space {
    height: 760vh;
  }

  .hero {
    left: 20px;
    right: 20px;
    bottom: 110px;
  }

  .hero h1 {
    font-size: clamp(48px, 15vw, 78px);
  }

  .chapter {
    left: 20px;
    right: 20px;
    bottom: 120px;
    max-width: none;
  }

  .chapter h2 {
    font-size: clamp(31px, 10vw, 49px);
  }

  .ending {
    padding: 90px 20px 105px;
  }

  .ending h2 {
    font-size: clamp(50px, 15.5vw, 80px);
  }

  .ending__actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .frame-status {
    left: 20px;
    bottom: 21px;
  }

  .frame-status {
    font-size: 0;
  }

  .progress {
    right: 20px;
    bottom: 22px;
  }

  .progress > span:first-child {
    display: none;
  }

  .progress__track {
    width: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grain {
    animation: none;
  }
}
