/* motion fixes from the Impeccable critique */
/* Motion + media refinements: one authored moment (the doors), exponential
   ease-out instead of bounce, and prefers-reduced-motion. */

:root {
  --im-ease-out-expo: cubic-bezier(.16, 1, .3, 1);
}

/* ---------------------------------------------------------------------------
   Cover: opened-doors still (last frame of the door video). Used when the
   video stalls or fails, and for reduced motion. The image
   is only requested once the guest has tapped (or under reduced motion).
--------------------------------------------------------------------------- */
.im-hero-video-nc__opened {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 410px;
  margin: 0 auto;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity .6s var(--im-ease-out-expo);
}
.im-hero-video-nc:not(.is-waiting-tap) .im-hero-video-nc__opened,
.im-hero-video-nc.is-reduced-motion .im-hero-video-nc__opened {
  background-image: url(../media/hero-opened.webp);
}
.im-hero-video-nc.is-skipped .im-hero-video-nc__opened,
.im-hero-video-nc.is-video-failed:not(.is-waiting-tap) .im-hero-video-nc__opened,
.im-hero-video-nc.is-reduced-motion .im-hero-video-nc__opened {
  opacity: 1;
}

/* The tap target is the whole cover; ring the visible pill instead. */
html body .im-hero-video-nc__tap:focus-visible {
  outline: none;
}
html body .im-hero-video-nc__tap:focus-visible .im-hero-video-nc__tap-pill {
  outline: 2px solid #721022;
  outline-offset: 3px;
}

/* The scroll cue is invisible until the doors open; keep it out of the tab
   order until then too. */
html body .im-hero-video-nc:not(.is-opened) .im-hero-video-nc__scroll,
html body .im-hero-video-nc.is-scroll-locked .im-hero-video-nc__scroll {
  visibility: hidden;
}

/* Once the cover is tapped, the gate's float/shine/pulse loops stop instead
   of running invisibly for the rest of the visit. */
html body .im-hero-video-nc:not(.is-waiting-tap) .im-hero-video-nc__tap,
html body .im-hero-video-nc:not(.is-waiting-tap) .im-hero-video-nc__tap-pill::before,
html body .im-hero-video-nc:not(.is-waiting-tap) .im-hero-video-nc__tap-pill::after {
  animation-play-state: paused;
}

/* ---------------------------------------------------------------------------
   Bounce / overshoot easing -> exponential ease-out
--------------------------------------------------------------------------- */
/* Scroll cue: three settling nudges after the doors open, then rest. */
html body .im-hero-video-nc.is-opened .im-hero-video-nc__scroll {
  animation: im-hero-video-nc-cue 2.4s var(--im-ease-out-expo) 1s 3 both;
}
html body .im-hero-video-nc.is-scroll-locked .im-hero-video-nc__scroll {
  animation: none;
}
@keyframes im-hero-video-nc-cue {
  0%, 100% { transform: translate(-50%, 0); }
  30% { transform: translate(-50%, 8px); }
}
/* Event timeline lotus turn (was cubic-bezier(.34,1.4,.64,1)). */
html body .im-banana-leaf__lotus-turn {
  transition-timing-function: var(--im-ease-out-expo);
}
/* RSVP map pin drop (was cubic-bezier(.34,1.56,.64,1)). */
html body .im-guest-rsvp .im-guest-rsvp-map-marker__pin {
  animation-timing-function: var(--im-ease-out-expo);
}

/* ---------------------------------------------------------------------------
   prefers-reduced-motion: reduce
   Decorative loops stop, entrances end visible with no movement, the cover
   shows the opened doors without the video and never locks scroll
   (hero-video.js adds .is-reduced-motion and skips the lock).
--------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
  }

  /* Purely decorative movers: removed rather than frozen mid-air. */
  html body .im-petal-field,
  html body .im-hero-video-nc__petals,
  html body .im-love-footer__floating-heart,
  html body .im-couple-profile__floating-heart {
    display: none !important;
  }

  /* Cover: opened doors, no video, no gate. */
  html body .im-hero-video-nc__video,
  html body .im-hero-video-nc__poster-overlay {
    visibility: hidden;
  }
  html body .im-hero-video-nc__tap {
    display: none !important;
  }
  html body .im-hero-video-nc__eyebrow,
  html body .im-hero-video-nc__name,
  html body .im-hero-video-nc__ampersand {
    transform: none !important;
    filter: none !important;
  }

  /* Marquee: a still, centred, wrapping line of the phrases. */
  html body .marquee-track {
    width: auto;
    flex-wrap: wrap;
    justify-content: center;
    transform: none !important;
  }
  html body .marquee-content {
    flex-wrap: wrap;
    justify-content: center;
    flex-shrink: 1;
    row-gap: 8px;
    padding: 0 16px;
  }
  html body .marquee-content[aria-hidden="true"],
  html body .marquee-content .star:last-child {
    display: none;
  }
}
