/* Opening title (GOOD-59). Present only while <html> has .is-intro (set by web/intro-gate.js before first paint).
   The sky itself is a canvas painted by web/intro.js; this file handles the line, the hint and the hero underneath. */

.intro {
  display: none;
}

/* Every intro movement, the hero text's included, starts from rest and settles gently: no curve begins or ends at speed. */
.is-intro {
  --intro-ease: cubic-bezier(0.33, 0, 0.2, 1);
}

.is-intro .intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  /* Solid night until the canvas paints its first frame, then the canvas owns the sky (and can thin it out). */
  background: #0b0c0e;
  color: #f2f2ef;
  cursor: pointer;
}

.is-intro .intro.is-live {
  background: transparent;
}

.intro-sky,
.intro-sky canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* One line on every screen: the size follows the viewport width, capped on large screens. */
.intro-line {
  position: relative;
  margin: 0;
  padding: 0 1.25rem;
  font-family: "Archivo", sans-serif;
  font-size: min(4.6rem, calc((100vw - 2.5rem) / 12.6));
  font-stretch: 87%;
  font-weight: 640;
  letter-spacing: var(--display-letter-spacing);
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  filter: blur(12px);
}

.intro-skip {
  position: absolute;
  right: 0;
  bottom: 1.5rem;
  left: 0;
  margin: 0;
  color: rgba(242, 242, 239, 0.4);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
}

.intro.is-out .intro-skip {
  opacity: 1;
  animation: intro-hint-out 500ms var(--intro-ease) both;
}

.intro.is-playing .intro-line {
  animation: intro-line-in 950ms var(--intro-ease) 150ms both;
}

/* The hint arrives with the line, quietly. */
.intro.is-playing .intro-skip {
  animation: intro-hint-in 950ms var(--intro-ease) 150ms both;
}

/* As the sky opens, the camera moves through the line, which grows and dissolves as it passes. */
.intro.is-out .intro-line {
  opacity: 1;
  filter: none;
  animation: intro-line-through 1200ms cubic-bezier(0.55, 0, 0.45, 1) both;
}

/* The page shows through as the sky thins, so taps fall through to it near the end. */
.intro.is-out {
  cursor: default;
}

/* The hero waits underneath: its photo is already in place (the constellation lands on it), its words enter late. */
.is-intro .hero .hero-visual {
  opacity: 1;
  transform: none;
  transition: none;
}

.is-intro .hero .hero-copy {
  opacity: 0;
  transform: translateY(2rem);
  transition: none;
}

.is-intro.is-intro-reveal .hero .hero-copy {
  opacity: 1;
  transform: none;
  transition: opacity 800ms var(--intro-ease), transform 1000ms var(--intro-ease);
}

/* The intro draws Virgo onto the dog itself, so the hero's own Virgo waits for the hand-off. */
.is-intro .hero-constellation {
  opacity: 0;
}

@keyframes intro-line-in {
  from { opacity: 0; filter: blur(12px); transform: scale(1.03); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}

@keyframes intro-hint-in {
  to { opacity: 1; }
}

@keyframes intro-hint-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes intro-line-through {
  from { opacity: 1; filter: blur(0); transform: scale(1); }
  to { opacity: 0; filter: blur(6px); transform: scale(1.35); }
}

/* Reduced motion: the line is shown still, then the whole intro fades to the page. */
@media (prefers-reduced-motion: reduce) {
  .intro-line,
  .intro-skip {
    opacity: 1;
    filter: none;
    animation: none;
  }

  .is-intro .intro.is-fading {
    opacity: 0;
    transition: opacity 500ms ease;
  }

  .is-intro .hero .hero-copy {
    opacity: 1;
    transform: none;
  }
}
