:root {
  --ink: #f5f2eb;
  --muted: rgba(245, 242, 235, .66);
  --black: #090908;
  --accent: #ff5a30;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--black); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--black);
  font-family: Manrope, Arial, sans-serif;
  overscroll-behavior-y: none;
}
a { color: inherit; }

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #050505;
}
.stage__frame {
  position: absolute;
  inset: -4%;
  opacity: 0;
  transition: opacity 2.8s var(--ease), filter 2.8s var(--ease);
  will-change: opacity, transform, filter;
}
.stage__frame.is-visible { opacity: 1; }
.stage__frame::before,
.stage__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--image) var(--position, 50% 50%) / cover no-repeat;
  animation: zero-gravity 35s ease-in-out infinite alternate;
  will-change: transform;
}
.stage__frame::before {
  filter: grayscale(var(--gray, 0)) saturate(var(--sat, 1)) contrast(1.04) brightness(.91);
}
.stage__frame::after {
  opacity: var(--spot-opacity, 0);
  clip-path: ellipse(var(--focus-w, 0%) var(--focus-h, 0%) at var(--focus-x, 50%) var(--focus-y, 50%));
  filter: saturate(1.07) contrast(1.025) brightness(1.025);
  transition: clip-path 1.7s var(--ease), opacity 1.5s ease;
}
.stage__frame[data-mode="plant"]::before {
  filter: grayscale(.82) saturate(.55) contrast(1.15) brightness(.6);
}
.stage__frame[data-mode="plant"]::after { display: none; }
.stage__frame[data-mode="spotlight"] {
  --gray: 1;
  --sat: .58;
  --spot-opacity: 1;
}
.stage__frame[data-mode="mono"] { --gray: 1; --sat: .45; }
.stage__frame[data-mode="spotlight"] .marker { opacity: 1; }

.marker {
  position: absolute;
  left: var(--focus-x);
  top: var(--focus-y);
  width: calc(var(--focus-w) * 1.22);
  height: calc(var(--focus-h) * 1.14);
  translate: -50% -50%;
  border: 2px solid color-mix(in srgb, var(--accent) 88%, transparent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 1.4s .5s ease;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14) inset, 0 0 28px color-mix(in srgb, var(--accent) 14%, transparent);
}
.marker::before,
.marker::after {
  content: "";
  position: absolute;
  background: var(--accent);
}
.marker::before { width: 34px; height: 1px; right: -17px; top: 50%; }
.marker::after { width: 5px; height: 5px; border-radius: 50%; right: -20px; top: calc(50% - 2px); }

.stage__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.38), transparent 32%, transparent 67%, rgba(0,0,0,.22)),
    linear-gradient(0deg, rgba(0,0,0,.45), transparent 36%, rgba(0,0,0,.1));
  pointer-events: none;
}
.stage__grain {
  position: absolute;
  inset: -50%;
  opacity: .055;
  pointer-events: none;
  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='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  animation: grain .24s steps(2) infinite;
}

.masthead {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px 28px;
  font: 400 10px/1 DM Mono, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
  mix-blend-mode: difference;
}
.masthead p { margin: 0; }
.masthead__mark { text-decoration: none; font-weight: 500; }
.masthead__status { justify-self: end; display: flex; gap: 9px; align-items: center; }
.masthead__status span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.progress {
  position: fixed;
  z-index: 20;
  right: 25px;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  justify-items: center;
  gap: 10px;
  font: 10px/1 DM Mono, monospace;
}
.progress::before {
  content: "";
  width: 1px;
  height: 88px;
  background: rgba(255,255,255,.25);
}
.progress__bar {
  position: absolute;
  top: 0;
  width: 1px;
  height: calc(88px * var(--progress, 0));
  background: currentColor;
}
.progress p { margin: 0; writing-mode: vertical-rl; }

main { position: relative; z-index: 2; }
.chapter {
  min-height: 150vh;
  position: relative;
  display: flex;
  align-items: center;
  padding: 8vw;
}
.chapter--opening { min-height: 130vh; align-items: flex-end; }
.opening__copy { margin-bottom: 15vh; }
.edition {
  margin: 0 0 18px;
  font: 400 11px/1 DM Mono, monospace;
  letter-spacing: .22em;
  text-transform: uppercase;
}
h1, h2 { font-family: Newsreader, Georgia, serif; font-weight: 300; }
h1 {
  margin: 0;
  font-size: clamp(88px, 13vw, 210px);
  line-height: .72;
  letter-spacing: -.075em;
}
h1 em { color: #ffdf30; font-weight: 300; }
.opening__note {
  max-width: 390px;
  margin: 38px 0 0 53vw;
  font-size: 13px;
  line-height: 1.65;
}
.opening__footer {
  position: absolute;
  bottom: 25px;
  left: 28px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  font: 9px/1 DM Mono, monospace;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.chapter--portrait { align-items: flex-end; min-height: 155vh; }
.portrait--right { justify-content: flex-end; text-align: right; }
.portrait-copy { margin-bottom: 15vh; }
.portrait-copy > p {
  font: 10px/1 DM Mono, monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.portrait-copy h2 {
  margin: 20px 0 32px;
  font-size: clamp(62px, 8vw, 138px);
  line-height: .82;
  letter-spacing: -.055em;
}
.cast-notes { display: flex; gap: 24px; flex-wrap: wrap; }
.portrait--right .cast-notes { justify-content: flex-end; }
.cast-notes span {
  position: relative;
  padding-left: 18px;
  font: 10px/1 DM Mono, monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.cast-notes span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255,255,255,.7);
  background: var(--swatch);
  translate: 0 -50%;
}

.chapter--finale { min-height: 180vh; align-items: flex-end; }
.finale__copy { margin-bottom: 16vh; }
.finale__copy p,
.teaser__copy > p:first-child { font: 10px/1 DM Mono, monospace; letter-spacing: .18em; text-transform: uppercase; }
.finale__copy h2 {
  margin: 22px 0 0;
  font-size: clamp(78px, 12vw, 190px);
  line-height: .75;
  letter-spacing: -.065em;
}

.chapter--teaser {
  min-height: 140vh;
  align-items: flex-end;
  justify-content: space-between;
  background: linear-gradient(0deg, #090908 0%, transparent 38%);
}
.teaser__line { position: absolute; left: 8vw; top: 0; width: 1px; height: 23vh; background: #b8ff38; }
.teaser__copy { margin-bottom: 18vh; }
.teaser__copy h2 {
  margin: 17px 0 25px;
  font-size: clamp(92px, 14vw, 220px);
  line-height: .75;
  letter-spacing: -.07em;
  color: #b8ff38;
}
.teaser__copy p:last-child { max-width: 350px; color: var(--muted); line-height: 1.6; font-size: 12px; }
.back-top {
  margin-bottom: 18vh;
  display: flex;
  width: 170px;
  justify-content: space-between;
  padding: 17px 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  text-decoration: none;
  font: 10px/1 DM Mono, monospace;
  text-transform: uppercase;
  letter-spacing: .14em;
}

@keyframes zero-gravity {
  0% { transform: scale(1.07) translate3d(-.8%, -.4%, 0) rotate(-.18deg); }
  48% { transform: scale(1.105) translate3d(.8%, .7%, 0) rotate(.22deg); }
  100% { transform: scale(1.075) translate3d(-.2%, 1%, 0) rotate(-.08deg); }
}
@keyframes grain {
  0% { transform: translate(0,0); }
  25% { transform: translate(3%, -2%); }
  50% { transform: translate(-2%, 3%); }
  75% { transform: translate(2%, 2%); }
  100% { transform: translate(-3%, -2%); }
}

@media (max-width: 700px) {
  .masthead { padding: 18px; grid-template-columns: 1fr 1fr; }
  .masthead > p:nth-child(2) { display: none; }
  .progress { right: 12px; }
  .chapter { min-height: 135vh; padding: 24px; }
  .chapter--opening { min-height: 115vh; }
  .opening__copy { margin-bottom: 19vh; }
  h1 { font-size: clamp(74px, 25vw, 126px); }
  .opening__note { margin: 32px 38px 0 0; max-width: 290px; }
  .opening__footer { left: 18px; right: 18px; }
  .opening__footer p:first-child { display: none; }
  .opening__footer { justify-content: flex-end; }
  .chapter--portrait { min-height: 140vh; }
  .portrait-copy { margin-bottom: 13vh; }
  .portrait-copy h2 { font-size: 18vw; }
  .portrait--right { text-align: left; justify-content: flex-start; }
  .portrait--right .cast-notes { justify-content: flex-start; }
  .cast-notes { display: grid; gap: 13px; }
  .finale__copy h2 { font-size: 23vw; }
  .chapter--teaser { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; }
  .teaser__copy { margin-bottom: 7vh; }
  .teaser__copy h2 { font-size: 25vw; }
  .back-top { margin-bottom: 11vh; }
  .stage__frame::before, .stage__frame::after {
    background-image: var(--image-mobile, var(--image));
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage__frame, .stage__frame::before, .stage__frame::after, .stage__grain { transition-duration: .2s; animation: none; }
}
