/* ==========================================================================
   ANIMATIONS.CSS
   Pure-CSS keyframes for continuous/ambient motion (petals, spinners, ticks).
   Scroll-triggered reveals (fade/zoom/slide) are handled by GSAP in
   js/animations.js using the [data-animate] system — that JS reads element
   state and animates via JS tweens rather than toggling these classes, so
   most one-shot reveal keyframes are intentionally NOT duplicated here.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Preloader
   -------------------------------------------------------------------------- */
@keyframes preloader-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* --------------------------------------------------------------------------
   Scroll indicator (hero)
   -------------------------------------------------------------------------- */
@keyframes scroll-dot {
  0%   { transform: translateY(0);    opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(34px); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Music toggle — dashed ring rotates while a track is playing
   -------------------------------------------------------------------------- */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Countdown digits — brief tick pulse whenever a value changes
   -------------------------------------------------------------------------- */
@keyframes countdown-tick {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Floating flower petals (hero) — spawned dynamically by animations.js,
   each petal gets randomized duration/delay/drift set inline via CSS vars.
   -------------------------------------------------------------------------- */
@keyframes petal-fall {
  0% {
    transform: translate3d(0, -10%, 0) rotate(0deg);
    opacity: 0;
  }
  8% { opacity: var(--petal-opacity, 0.85); }
  92% { opacity: var(--petal-opacity, 0.85); }
  100% {
    transform: translate3d(var(--petal-drift, 40px), 115vh, 0) rotate(var(--petal-spin, 220deg));
    opacity: 0;
  }
}

.petal {
  position: absolute;
  top: 0;
  left: var(--petal-left, 50%);
  width: var(--petal-size, 16px);
  height: var(--petal-size, 16px);
  animation: petal-fall var(--petal-duration, 12s) linear var(--petal-delay, 0s) infinite;
  will-change: transform, opacity;
}

/* --------------------------------------------------------------------------
   Heartbeat — subtle pulse for the hero CTA heart icon on hover
   -------------------------------------------------------------------------- */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.18); }
  40% { transform: scale(0.96); }
  60% { transform: scale(1.1); }
}
.btn-primary:hover i.fa-heart { animation: heartbeat 0.9s ease-in-out; }

/* --------------------------------------------------------------------------
   Gentle float — used sparingly on small decorative icons (event icons on hover)
   -------------------------------------------------------------------------- */
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.event-card:hover .event-icon { animation: float-y 1.8s ease-in-out infinite; }

/* --------------------------------------------------------------------------
   Confetti canvas — created and destroyed by JS; this just ensures it never
   blocks interaction and always sits above content.
   -------------------------------------------------------------------------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Utility: generic one-shot entrance classes (used only where JS applies
   them directly, e.g. the RSVP success state swap)
   -------------------------------------------------------------------------- */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.js-fade-in-up { animation: fade-in-up 0.6s var(--ease-premium) both; }

@keyframes zoom-in-soft {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.js-zoom-in { animation: zoom-in-soft 0.5s var(--ease-premium) both; }

/* --------------------------------------------------------------------------
   Reduced motion — stop ambient/looping animation entirely; one-shot
   reveals are handled by JS checking prefers-reduced-motion before tweening.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .petal { display: none; }
  .music-toggle.playing .music-toggle-ring { animation: none; }
  .event-card:hover .event-icon { animation: none; }
  .btn-primary:hover i.fa-heart { animation: none; }
  .envelope-flap,
  .envelope-card,
  .invitation-opener { transition-duration: 0.01ms !important; }
  .envelope-seal:not(:disabled) { animation: none; }
}
