/* Cover and hero motion. Everything here animates transform or opacity only
   (plus clip-path for the one-off title reveal) and has a reduced-motion path. */

/* ---------- Cover: ambient snow behind the envelope ---------- */
.orbit-intro .orbit-intro-wrap { position: relative; z-index: 1; }

.orbit-cover-snow {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity .18s ease-out;
}

.orbit-cover-snow i {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #eaf2ff;
  opacity: var(--o);
  animation: orbit-alive-cover-fall var(--d) linear var(--delay) infinite;
}

/* Opening takes over the moment it starts. */
.orbit-intro.is-opening .orbit-cover-snow { opacity: 0; }
.orbit-intro.is-opening .orbit-cover-snow i { animation-play-state: paused; }

@keyframes orbit-alive-cover-fall {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--drift), calc(100vh + 24px), 0); }
}

/* ---------- Cover: the seal breathes after its three glints ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* 0.6s delay + 3 x 3.4s glint = 10.8s; the wrapper scales so the face's hover/press still compose. */
  .orbit-intro[open]:not(.is-opening) .orbit-seal-hit {
    animation: orbit-alive-seal-breathe 3s 10.8s ease-in-out infinite;
  }
}

@keyframes orbit-alive-seal-breathe {
  0%, 62%, 100% { transform: scale(1); }
  31% { transform: scale(1.035); }
}

/* ---------- Hero: settle after opening ---------- */
@media (prefers-reduced-motion: no-preference) {
  .orbit-hero.orbit-hero-settle .orbit-landscape img {
    transform-origin: 68% 50%;
    animation: orbit-alive-settle 2.4s cubic-bezier(.2, .7, .2, 1) both;
  }
}

@keyframes orbit-alive-settle {
  from { transform: scale(1.06); }
  to { transform: none; }
}

/* ---------- Hero: continuous snowfall (canvas) replaces the 4.4s burst ---------- */
html.orbit-alive-snow .orbit-snow { display: none; }

.orbit-hero-snow {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease-out;
}

.orbit-hero-snow.is-running { opacity: 1; }

/* ---------- Hero: title lines rise out of their own clip ---------- */
.orbit-layout h1 .orbit-line { display: block; }
.orbit-layout h1 .orbit-line > span { display: inline-block; }

@media (prefers-reduced-motion: no-preference) {
  html.orbit-intro-revealing .orbit-layout > h1.has-lines { animation: none; }

  /* The clip exists only while the line moves, so the title's soft shadow is never cut afterwards. */
  html.orbit-intro-revealing .orbit-layout h1 .orbit-line {
    animation: orbit-alive-line-clip 860ms var(--line-delay, 1380ms) linear backwards;
  }

  html.orbit-intro-revealing .orbit-layout h1 .orbit-line > span {
    animation: orbit-alive-mask-up 860ms var(--line-delay, 1380ms) cubic-bezier(.2, .7, .2, 1) backwards;
  }
}

@keyframes orbit-alive-line-clip {
  from, 99.9% { clip-path: inset(-.3em -.6em -.2em -.2em); }
  to { clip-path: inset(-100vh -100vw); }
}

@keyframes orbit-alive-mask-up {
  0% { opacity: 0; transform: translateY(108%); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

/* ---------- Music button: a small equalizer while the song plays ---------- */
.orbit .music-button .orbit-eq {
  display: none;
  order: -1;
  align-items: flex-end;
  gap: 2px;
  width: 20px;
  height: 14px;
  padding-inline: 2px;
}

.orbit .music-button[data-playing="true"]:has(.orbit-eq) svg:nth-child(2) { display: none; }
.orbit .music-button[data-playing="true"] .orbit-eq { display: inline-flex; }

.orbit .music-button .orbit-eq i {
  flex: 1;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: 50% 100%;
  transform: scaleY(.5);
}

.orbit .music-button .orbit-eq i:nth-child(2) { transform: scaleY(.9); }
.orbit .music-button .orbit-eq i:nth-child(3) { transform: scaleY(.65); }
.orbit .music-button .orbit-eq i:nth-child(4) { transform: scaleY(.4); }

@media (prefers-reduced-motion: no-preference) {
  .orbit .music-button[data-playing="true"] .orbit-eq i {
    animation: orbit-alive-eq 1.05s ease-in-out infinite alternate;
  }
  .orbit .music-button[data-playing="true"] .orbit-eq i:nth-child(2) { animation-duration: .8s; animation-delay: -.3s; }
  .orbit .music-button[data-playing="true"] .orbit-eq i:nth-child(3) { animation-duration: 1.2s; animation-delay: -.7s; }
  .orbit .music-button[data-playing="true"] .orbit-eq i:nth-child(4) { animation-duration: .95s; animation-delay: -.45s; }
}

@keyframes orbit-alive-eq {
  from { transform: scaleY(.25); }
  to { transform: scaleY(1); }
}

/* ---------- Reduced motion: no ambient loops ---------- */
@media (prefers-reduced-motion: reduce) {
  .orbit-cover-snow, .orbit-hero-snow { display: none; }
}
