/* Scroll storytelling: each chapter's paper and type arrive as the guest reaches it.
   Hidden states exist only under html.orbit-scroll, which orbit-scroll.js adds and a failsafe removes. */
/* .001, not 0: orbit-effects.js skips its ornament trace inside anything with opacity exactly 0. */
html.orbit-scroll .orbit-reveal:not(.is-in) { opacity: .001; }

/* Map pin: one soft drop, then a ground ripple while the map is in view. */
#orbit-map-svg .orbit-map-pin,
#orbit-map-svg .orbit-map-pulse {
  transform-box: fill-box;
}

#orbit-map-svg .orbit-map-pin { transform-origin: 50% 100%; }
#orbit-map-svg .orbit-map-pulse {
  transform-origin: 50% 50%;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .orbit-map-shell.is-dropping .orbit-map-pin {
    animation: orbit-pin-drop 720ms 260ms both;
  }

  .orbit-map-shell.is-pulsing .orbit-map-pulse {
    animation: orbit-pin-pulse 2.5s cubic-bezier(.2, .7, .2, 1) infinite;
  }

  /* Sign-off: the hairline draws, then the signature is written in. */
  html.orbit-scroll .orbit-signoff .poetry-signature.is-signing {
    position: relative;
    border-top-color: transparent;
  }

  html.orbit-scroll .orbit-signoff .poetry-signature.is-signing::before {
    position: absolute;
    inset: -1px 0 auto;
    border-top: inherit;
    border-top-color: #eadac385;
    content: "";
    transform-origin: left;
    animation: orbit-hairline-draw 820ms cubic-bezier(.2, .7, .2, 1) both;
  }

  html.orbit-scroll .orbit-signoff .poetry-signature.is-signing span {
    animation: orbit-sign-ink 640ms 260ms cubic-bezier(.2, .7, .2, 1) both;
  }

  html.orbit-scroll .orbit-signoff .poetry-signature.is-signing strong {
    animation: orbit-sign-wipe 1100ms 420ms cubic-bezier(.33, .6, .25, 1) both;
  }
}

/* Chapter photographs drift a little slower than the page. Countdown and sign-off stills are
   cut pieces aligned to a cloth backdrop, so they stay put; only full-bleed rooms move. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .orbit :is(.orbit-letter-art, .orbit-venue-art, .orbit-keepsake-art) img {
      animation: orbit-art-drift linear both;
      animation-timeline: view();
    }

    /* Keep the letter's existing daylight swell alongside the drift (it animates transform; the drift uses translate/scale). */
    html.orbit-scroll .orbit .orbit-letter:has(.orbit-letter-inner.orbit-from-fold) .orbit-letter-art img {
      animation: orbit-table-daylight 1450ms cubic-bezier(.16, .62, .31, 1) both, orbit-art-drift linear both;
      animation-timeline: auto, view();
    }
  }
}

@keyframes orbit-art-drift {
  from { translate: 0 -3.5%; scale: 1.09; }
  to { translate: 0 3.5%; scale: 1.09; }
}

@keyframes orbit-pin-drop {
  0% { opacity: 0; transform: translateY(-34px); animation-timing-function: cubic-bezier(.4, 0, .7, .4); }
  12% { opacity: 1; }
  62% { transform: translateY(3px) scaleY(.94); animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
  100% { opacity: 1; transform: none; }
}

@keyframes orbit-pin-pulse {
  0% { opacity: .62; transform: scale(.35); }
  72%, 100% { opacity: 0; transform: scale(2.6); }
}

@keyframes orbit-hairline-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes orbit-sign-ink {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes orbit-sign-wipe {
  from { clip-path: inset(-.4em calc(100% + .6em) -.4em -.6em); }
  to { clip-path: inset(-.4em -.6em -.4em -.6em); }
}
