@import "./styles/tokens.css";
@import "./styles/base.css";

.story-sticky {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-frame {
  position: relative;
  width: 100%;
  height: 100vh;
}

@property --reveal {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}

.intro-screen {
  position: absolute;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translate3d(0, 0, 0);
  background: #000;
  will-change: transform, opacity;
}

.intro-demo {
  width: min(100vw, 2400px);
  min-height: 100vh;
  position: relative;
  padding: clamp(24px, 5vh, 72px) clamp(18px, 2.6vw, 72px) clamp(74px, 8vh, 112px);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(20px, 4.2vh, 72px);
}

.headline {
  --reveal: 0%;
  position: relative;
  margin: 0;
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(0.92rem, 1.55vmin, 2rem);
  letter-spacing: clamp(0.14em, 0.26vmin, 0.26em);
  line-height: 1.28;
  color: rgba(225, 240, 250, 0.9);
  opacity: 0;
  animation: none;
  -webkit-mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 var(--reveal),
    rgba(0, 0, 0, 0.72) calc(var(--reveal) + 3%),
    rgba(0, 0, 0, 0.32) calc(var(--reveal) + 8%),
    transparent calc(var(--reveal) + 14%),
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000 0%,
    #000 var(--reveal),
    rgba(0, 0, 0, 0.72) calc(var(--reveal) + 3%),
    rgba(0, 0, 0, 0.32) calc(var(--reveal) + 8%),
    transparent calc(var(--reveal) + 14%),
    transparent 100%
  );
}

.headline::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  text-align: inherit;
  text-transform: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  color: transparent;
  background: linear-gradient(90deg, #000, #fff, #000);
  background-repeat: no-repeat;
  background-size: 80% 100%;
  background-position: -500% 0;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 14px rgba(156, 229, 255, 0.94));
  pointer-events: none;
  opacity: 0;
  animation: none;
}

.word {
  white-space: nowrap;
}

.word-tail {
  color: rgba(225, 240, 250, 0.9);
}

.cap-target {
  display: inline-block;
  color: rgba(225, 240, 250, 0.9);
  transform: translateY(0) scale(1);
  text-shadow: 0 0 0 rgba(145, 224, 255, 0);
  animation: none;
}

.acronym {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.18em;
  font-size: clamp(3.6rem, 11.2vmin, 15rem);
  line-height: 0.9;
  letter-spacing: clamp(0.05em, 0.12vmin, 0.11em);
  color: #e2f1fb;
}

.acronym-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px) scale(0.88);
  filter: blur(2px);
  text-shadow: 0 0 0 rgba(138, 216, 250, 0);
  animation: none;
}

.intro-hint {
  margin: 0;
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 3.6vh, 42px);
  width: max-content;
  max-width: calc(100vw - 28px);
  text-align: center;
  font-size: clamp(0.72rem, 0.95vmin, 1.18rem);
  letter-spacing: clamp(0.13em, 0.18vmin, 0.2em);
  text-transform: uppercase;
  color: rgba(183, 214, 233, 0.72);
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

@media (min-width: 2200px) {
  .intro-demo {
    gap: clamp(42px, 4.8vh, 112px);
  }

  .headline {
    font-size: clamp(1.2rem, 1.7vmin, 2.5rem);
  }

  .acronym {
    font-size: clamp(6.8rem, 12vmin, 18rem);
  }
}

.story-frame.is-intro-playing .intro-screen {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.story-frame.is-intro-ready .intro-screen,
.story-frame.is-intro-dissolving .intro-screen {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.story-frame.is-intro-boot .headline {
  animation: reveal-progress 2.9s linear 640ms forwards;
}

.story-frame.is-intro-boot .headline::after {
  animation: glow-sweep 2.9s linear 640ms forwards;
}

.story-frame.is-intro-boot .word-key .word-tail {
  animation: tail-dim 520ms ease forwards;
  animation-delay: calc(3.8s + var(--cap-index, 0) * 240ms);
}

.story-frame.is-intro-boot .word-dim {
  animation: tail-dim 520ms ease forwards;
  animation-delay: calc(3.8s + var(--dim-index, 0) * 240ms);
}

.story-frame.is-intro-boot .cap-target {
  animation: cap-highlight 520ms ease forwards;
  animation-delay: calc(3.8s + var(--cap-index, 0) * 240ms);
}

.story-frame.is-intro-boot .acronym-letter {
  animation: acronym-in 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(3.8s + var(--cap-index, 0) * 240ms);
}

.story-frame.is-intro-boot .intro-hint {
  animation: intro-hint-in 460ms ease 5850ms forwards;
}

.story-frame.is-intro-ready .headline,
.story-frame.is-intro-dissolving .headline {
  --reveal: 100%;
  opacity: 1;
}

.story-frame.is-intro-ready .headline::after,
.story-frame.is-intro-dissolving .headline::after {
  opacity: 0;
  background-position: 500% 0;
}

.story-frame.is-intro-ready .word-key .word-tail,
.story-frame.is-intro-ready .word-dim,
.story-frame.is-intro-dissolving .word-key .word-tail,
.story-frame.is-intro-dissolving .word-dim {
  color: rgba(150, 173, 190, 0.55);
}

.story-frame.is-intro-ready .cap-target,
.story-frame.is-intro-dissolving .cap-target {
  color: #f3fbff;
  transform: translateY(0) scale(1);
  text-shadow: 0 0 12px rgba(145, 224, 255, 0.58);
}

.story-frame.is-intro-ready .acronym-letter,
.story-frame.is-intro-dissolving .acronym-letter {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  text-shadow: 0 0 10px rgba(138, 216, 250, 0.52);
}

.story-frame.is-intro-ready .intro-hint,
.story-frame.is-intro-dissolving .intro-hint {
  opacity: 0.78;
  transform: translateX(-50%) translateY(0);
}

.story-frame.is-intro-dissolving .intro-screen {
  animation: intro-screen-swipe-up 980ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes intro-screen-swipe-up {
  0% {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0);
    background: #000;
  }

  65% {
    opacity: 1;
    transform: translate3d(0, -62%, 0);
    background: #000;
  }

  100% {
    opacity: 1;
    visibility: hidden;
    transform: translate3d(0, -112%, 0);
    background: #000;
  }
}

@keyframes reveal-progress {
  from {
    --reveal: 0%;
    opacity: 0;
  }

  4% {
    opacity: 1;
  }

  96% {
    --reveal: 100%;
    opacity: 1;
  }

  to {
    --reveal: 100%;
    opacity: 1;
  }
}

@keyframes glow-sweep {
  0% {
    opacity: 0;
    background-position: -500% 0;
  }

  8% {
    opacity: 1;
  }

  92% {
    opacity: 1;
    background-position: 500% 0;
  }

  100% {
    opacity: 0;
    background-position: 500% 0;
  }
}

@keyframes cap-highlight {
  0% {
    color: rgba(225, 240, 250, 0.9);
    transform: translateY(0) scale(1);
    text-shadow: 0 0 0 rgba(145, 224, 255, 0);
  }

  45% {
    color: #ffffff;
    transform: translateY(-1px) scale(1.06);
    text-shadow:
      0 0 10px rgba(145, 224, 255, 0.95),
      0 0 20px rgba(145, 224, 255, 0.6);
  }

  100% {
    color: #f3fbff;
    transform: translateY(0) scale(1);
    text-shadow: 0 0 12px rgba(145, 224, 255, 0.58);
  }
}

@keyframes tail-dim {
  0% {
    color: rgba(225, 240, 250, 0.9);
  }

  100% {
    color: rgba(150, 173, 190, 0.55);
  }
}

@keyframes acronym-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.88);
    filter: blur(2px);
    text-shadow: 0 0 0 rgba(138, 216, 250, 0);
  }

  45% {
    opacity: 1;
    transform: translateY(0) scale(1.04);
    filter: blur(0);
    text-shadow: 0 0 18px rgba(138, 216, 250, 0.85);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    text-shadow: 0 0 10px rgba(138, 216, 250, 0.52);
  }
}

@keyframes intro-hint-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }

  to {
    opacity: 0.78;
    transform: translateX(-50%) translateY(0);
  }
}
