:root {
  --bg: #0a0807;
  --panel: #12100f;
  --text: #efe7de;
  --muted: rgba(239, 231, 222, 0.72);
  --accent: #cfb07a;
  --frame-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(112, 72, 31, 0.22), transparent 36%),
    linear-gradient(180deg, #171311 0%, var(--bg) 45%, #050404 100%);
  color: var(--text);
}

body {
  font-family: 'Instrument Serif', Georgia, serif;
}

.page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.stage-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.video-stage {
  position: absolute;
  inset: 0;
  background: #050505;
  overflow: hidden;
}

.media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video {
  z-index: 1;
}

.intro-frame {
  z-index: 2;
  opacity: 0;
  transition: opacity 220ms ease;
}

.intro-frame.is-visible {
  opacity: 1;
}

.freeze-frame {
  z-index: 3;
  opacity: 0;
  transition: opacity 700ms ease;
}

.video-stage.is-frozen .freeze-frame {
  opacity: 1;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.08), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(255, 188, 122, 0.08), transparent 28%);
  mix-blend-mode: screen;
  opacity: 0.42;
  pointer-events: none;
}

.video-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.72)),
    radial-gradient(circle at center, transparent 46%, rgba(0, 0, 0, 0.36) 100%);
  pointer-events: none;
}

.stale-pfp {
  position: absolute;
  left: 50%;
  top: clamp(120px, 18vh, 210px);
  z-index: 6;
  width: clamp(184px, 22vw, 304px);
  height: clamp(184px, 22vw, 304px);
  object-fit: cover;
  transform: translateX(-50%) translateY(-8px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.34),
    0 0 0 10px rgba(10, 8, 7, 0.16);
  opacity: 0;
  transition: opacity 700ms ease, transform 700ms ease;
}

.stale-pfp.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.stale-pfp.is-writing-in {
  animation: pfpFadeIn 1.6s ease forwards;
}

.subtitle {
  position: absolute;
  left: 50%;
  bottom: clamp(86px, 16vh, 180px);
  z-index: 6;
  width: min(92vw, 1100px);
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  transition: opacity 600ms ease;
}

.subtitle.is-visible {
  opacity: 1;
}

.subtitle-group {
  transition: opacity 700ms ease, transform 700ms ease;
}

.subtitle-group-secondary {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(10px);
}

.subtitle.is-secondary .subtitle-group-primary {
  opacity: 0;
  transform: translateY(-10px);
}

.subtitle.is-secondary .subtitle-group-secondary {
  opacity: 1;
  transform: translateY(0);
}

.subtitle-line {
  margin: 0;
  display: block;
  overflow: hidden;
  white-space: normal;
  font-family: 'Caveat', 'Brush Script MT', cursive;
  font-size: clamp(2rem, 4.1vw, 3.8rem);
  line-height: 1.02;
  color: var(--muted);
  letter-spacing: 0.01em;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  clip-path: inset(0 100% 0 0);
}

.subtitle-line + .subtitle-line {
  margin-top: 0.08em;
}

.subtitle.is-writing #subtitleLine1 {
  animation: writeReveal 2.9s steps(42, end) forwards;
}

.subtitle.is-writing #subtitleLine2 {
  animation: writeReveal 3.2s steps(54, end) forwards 2.7s;
}

.subtitle.is-secondary-writing #subtitleLineFinal {
  animation: writeReveal 3.2s steps(24, end) forwards;
}

.sound-toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 8, 7, 0.5);
  color: rgba(239, 231, 222, 0.92);
  width: min(240px, 56vw);
  height: min(240px, 56vw);
  padding: 22px;
  border-radius: 999px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  letter-spacing: 0.01em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  gap: 12px;
  opacity: 0.5;
  transition: opacity 220ms ease, transform 220ms ease, background 220ms ease;
}

.sound-toggle:hover {
  opacity: 0.82;
  transform: translate(-50%, -50%) scale(1.02);
  background: rgba(10, 8, 7, 0.66);
}

.sound-toggle.is-active {
  opacity: 0;
  pointer-events: none;
}

.sound-toggle-icon {
  position: relative;
  width: 82px;
  height: 82px;
}

.sound-toggle-icon::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 25px;
  width: 26px;
  height: 30px;
  background: rgba(239, 231, 222, 0.95);
  clip-path: polygon(0 28%, 42% 28%, 72% 0, 72% 100%, 42% 72%, 0 72%);
}

.sound-toggle-icon::after {
  content: '';
  position: absolute;
  left: 40px;
  top: 14px;
  width: 30px;
  height: 54px;
  border-right: 4px solid rgba(239, 231, 222, 0.95);
  border-top: 4px solid rgba(239, 231, 222, 0.95);
  border-bottom: 4px solid rgba(239, 231, 222, 0.95);
  border-left: 0;
  border-radius: 0 999px 999px 0;
}

.sound-toggle-text {
  display: block;
  text-align: center;
  text-transform: uppercase;
  font-size: 0.82em;
  letter-spacing: 0.18em;
}

@keyframes writeReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes pfpFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 640px) {
  .subtitle {
    bottom: 96px;
    width: min(94vw, 680px);
  }

  .stale-pfp {
    top: 88px;
    width: clamp(156px, 44vw, 224px);
    height: clamp(156px, 44vw, 224px);
  }

  .subtitle-line {
    font-size: clamp(1.7rem, 7vw, 2.6rem);
  }

  .sound-toggle {
    width: min(180px, 58vw);
    height: min(180px, 58vw);
    padding: 16px;
    font-size: 0.9rem;
  }

  .sound-toggle-icon {
    width: 62px;
    height: 62px;
  }

  .sound-toggle-icon::before {
    left: 8px;
    top: 19px;
    width: 20px;
    height: 24px;
  }

  .sound-toggle-icon::after {
    left: 31px;
    top: 10px;
    width: 24px;
    height: 40px;
  }
}
