/* ==========================================================================
   Birthday Greeting Page - Animations & Keyframes
   All keyframe definitions, animation utilities, and hover/touch transitions
   ========================================================================== */

/* ==========================================================================
   Scroll Reveal Animations (fade-in, slide-up, scale-in)
   Duration: 400-800ms, triggered at 20% viewport intersection
   Requirements: 3.3
   ========================================================================== */

/* Base state for elements before they animate in */
.scroll-hidden {
  opacity: 0;
  will-change: opacity, transform;
}

/* Hidden state for scroll animation module */
.scroll-anim--hidden {
  opacity: 0;
  will-change: opacity, transform;
}

/* Scroll animation classes applied by scroll-animations.js */
.scroll-anim--fade-in {
  animation: fadeIn var(--scroll-anim-duration, 600ms) ease-out forwards;
}

.scroll-anim--slide-up {
  animation: slideUp var(--scroll-anim-duration, 600ms) ease-out forwards;
}

.scroll-anim--scale-in {
  animation: scaleIn var(--scroll-anim-duration, 600ms) ease-out forwards;
}

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.anim-fade-in {
  animation: fadeIn var(--scroll-anim-duration, 600ms) ease-out forwards;
}

/* Slide Up */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-slide-up {
  animation: slideUp var(--scroll-anim-duration, 600ms) ease-out forwards;
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.anim-scale-in {
  animation: scaleIn var(--scroll-anim-duration, 600ms) ease-out forwards;
}

/* ==========================================================================
   Hero Text Animations (typing / glow / shimmer effect)
   Duration: 800-2000ms
   Requirements: 1.1, 5.3
   ========================================================================== */

/* Shimmer effect for hero title text */
@keyframes heroShimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.hero__title--shimmer {
  background: linear-gradient(
    90deg,
    var(--color-secondary-dark) 0%,
    var(--color-secondary-light) 25%,
    var(--color-secondary-dark) 50%,
    var(--color-secondary-light) 75%,
    var(--color-secondary-dark) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: heroShimmer 2000ms linear infinite;
}

/* Typing cursor animation for hero subtitle */
@keyframes typingCursor {
  0%, 100% {
    border-right-color: var(--color-secondary);
  }
  50% {
    border-right-color: transparent;
  }
}

.hero__subtitle--typing {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--color-secondary);
  animation: typingCursor 1000ms step-end infinite;
}

/* Glow pulse for hero name (complements nameGlow in main.css) */
@keyframes heroGlow {
  0% {
    opacity: 0.8;
    text-shadow:
      0 0 4px rgba(184, 134, 11, 0.2),
      0 0 8px rgba(242, 162, 179, 0.1);
  }
  50% {
    opacity: 1;
    text-shadow:
      0 0 10px rgba(184, 134, 11, 0.5),
      0 0 20px rgba(242, 162, 179, 0.4),
      0 0 30px rgba(230, 230, 250, 0.3);
  }
  100% {
    opacity: 0.8;
    text-shadow:
      0 0 4px rgba(184, 134, 11, 0.2),
      0 0 8px rgba(242, 162, 179, 0.1);
  }
}

.hero__name--glow {
  animation: heroGlow 1500ms ease-in-out infinite;
}

/* Hero text fade-in entrance */
@keyframes heroTextEntrance {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero__title--entrance {
  animation: heroTextEntrance 1200ms ease-out forwards;
}

/* ==========================================================================
   Gradient Background Cycle (3-10s)
   NOTE: The @keyframes gradientShift is already defined in main.css.
   This section only provides utility classes referencing it.
   Requirements: 3.4
   ========================================================================== */

.gradient-animated {
  background-size: 400% 400%;
  animation: gradientShift var(--gradient-cycle, 6s) ease infinite;
}

/* ==========================================================================
   Pulse Hint Animation (Flip Card Front)
   Requirements: 2.1
   ========================================================================== */

@keyframes pulseHint {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.flipcard__hint {
  animation: pulseHint 2s ease-in-out infinite;
}

/* Subtle glow ring pulse for flip card CTA */
@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(242, 162, 179, 0.5);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(242, 162, 179, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(242, 162, 179, 0);
  }
}

.flipcard__front--pulse {
  animation: pulseRing 2.5s ease-out infinite;
}

/* ==========================================================================
   Intro Sequence Animations
   Types: envelope open, curtain reveal, fade splash
   Duration: max 3000ms
   Requirements: 7.4
   ========================================================================== */

/* Envelope Open - top flap opens upward */
@keyframes envelopeOpen {
  0% {
    transform: rotateX(0deg);
    transform-origin: top center;
  }
  100% {
    transform: rotateX(-180deg);
    transform-origin: top center;
  }
}

/* Envelope body slides down to reveal content */
@keyframes envelopeReveal {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  60% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(100%);
  }
}

.intro--envelope .intro__flap {
  animation: envelopeOpen 1200ms ease-in-out forwards;
}

.intro--envelope .intro__body {
  animation: envelopeReveal 2800ms ease-in-out forwards;
}

/* Curtain Reveal - two halves slide apart */
@keyframes curtainLeft {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes curtainRight {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

.intro--curtain .intro__curtain-left {
  animation: curtainLeft 1500ms cubic-bezier(0.77, 0, 0.175, 1) forwards;
  animation-delay: 500ms;
}

.intro--curtain .intro__curtain-right {
  animation: curtainRight 1500ms cubic-bezier(0.77, 0, 0.175, 1) forwards;
  animation-delay: 500ms;
}

/* Fade Splash - radiant flash then fade out */
@keyframes fadeSplash {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  30% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(1.1);
  }
}

.intro--fade-splash .intro__splash {
  animation: fadeSplash 2000ms ease-out forwards;
  animation-delay: 800ms;
}

/* General intro overlay fade-out */
@keyframes introFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.intro-overlay--closing {
  animation: introFadeOut 600ms ease-out forwards;
}

/* ==========================================================================
   Floating Decorative Elements (flowers, hearts, stars, ribbons)
   Requirements: 1.3, 3.5
   ========================================================================== */

/* Generic float animation - gentle up and down */
@keyframes floatUpDown {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-15px) rotate(3deg);
  }
  50% {
    transform: translateY(-8px) rotate(-2deg);
  }
  75% {
    transform: translateY(-20px) rotate(2deg);
  }
}

/* Floating drift - lateral movement */
@keyframes floatDrift {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(10px, -12px) rotate(5deg);
  }
  50% {
    transform: translate(-5px, -20px) rotate(-3deg);
  }
  75% {
    transform: translate(8px, -8px) rotate(4deg);
  }
}

/* Spiral float for petals/confetti */
@keyframes floatSpiral {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-30px) rotate(180deg) scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(0) rotate(360deg) scale(1);
    opacity: 1;
  }
}

/* Falling animation for snow/confetti style elements */
@keyframes floatFall {
  0% {
    transform: translateY(-10%) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Twinkle for star elements */
@keyframes twinkle {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Heart beat for heart elements */
@keyframes heartBeat {
  0%, 100% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.15);
  }
  30% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.1);
  }
}

/* Ribbon wave */
@keyframes ribbonWave {
  0%, 100% {
    transform: skewX(0deg) translateX(0);
  }
  25% {
    transform: skewX(3deg) translateX(5px);
  }
  75% {
    transform: skewX(-3deg) translateX(-5px);
  }
}

/* Utility classes for decorative floating elements */
.decor-float {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
}

.decor-float--up-down {
  animation: floatUpDown 4s ease-in-out infinite;
}

.decor-float--drift {
  animation: floatDrift 5s ease-in-out infinite;
}

.decor-float--spiral {
  animation: floatSpiral 6s ease-in-out infinite;
}

.decor-float--fall {
  animation: floatFall 8s linear infinite;
}

.decor-float--twinkle {
  animation: twinkle 2s ease-in-out infinite;
}

.decor-float--heartbeat {
  animation: heartBeat 1.5s ease-in-out infinite;
}

.decor-float--ribbon {
  animation: ribbonWave 3s ease-in-out infinite;
}

/* Staggered delays for multiple decorative elements */
.decor-float--delay-1 { animation-delay: 0s; }
.decor-float--delay-2 { animation-delay: 0.5s; }
.decor-float--delay-3 { animation-delay: 1s; }
.decor-float--delay-4 { animation-delay: 1.5s; }
.decor-float--delay-5 { animation-delay: 2s; }
.decor-float--delay-6 { animation-delay: 2.5s; }

/* ==========================================================================
   Hover / Touch Transitions for Interactive Elements
   Duration: 200-400ms transform effects
   Requirements: 3.5
   ========================================================================== */

/* General interactive element hover */
.interactive-hover {
  transition: transform 300ms ease, box-shadow 300ms ease;
}

.interactive-hover:hover,
.interactive-hover:focus-visible {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(242, 162, 179, 0.3);
}

.interactive-hover:active {
  transform: scale(0.97);
}

/* Gallery image hover effect (base styles in main.css) */

/* Button hover lift effect */
.btn-hover-lift {
  transition: transform 250ms ease, box-shadow 250ms ease;
}

.btn-hover-lift:hover,
.btn-hover-lift:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.btn-hover-lift:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Card hover tilt (subtle 3D feel) */
.card-hover-tilt {
  transition: transform 350ms ease, box-shadow 350ms ease;
}

.card-hover-tilt:hover {
  transform: perspective(800px) rotateY(3deg) rotateX(2deg);
  box-shadow: 0 12px 32px rgba(242, 162, 179, 0.25);
}

/* Touch-friendly tap feedback */
.tap-feedback {
  transition: transform 200ms ease, opacity 200ms ease;
}

.tap-feedback:active {
  transform: scale(0.95);
  opacity: 0.85;
}

/* ==========================================================================
   Flip Card Animation Transitions
   ========================================================================== */

.flipcard__inner {
  transition: transform var(--flip-duration, 800ms) ease-in-out,
              box-shadow var(--flip-duration, 800ms) ease-in-out;
  transform-style: preserve-3d;
}

.flipcard__inner--flipped {
  transform: rotateY(180deg);
}

/* Shadow transitions during flip for depth simulation */
.flipcard__inner {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.flipcard__inner--flipped {
  box-shadow: -4px 4px 20px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Lightbox Animations
   ========================================================================== */

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

@keyframes lightboxFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes lightboxImageIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox--opening {
  animation: lightboxFadeIn 300ms ease-out forwards;
}

.lightbox--closing {
  animation: lightboxFadeOut 250ms ease-in forwards;
}

.lightbox__image--entering {
  animation: lightboxImageIn 300ms ease-out forwards;
}

/* ==========================================================================
   Reduced Motion Override
   When user prefers reduced motion, replace all animations with simple fade
   Requirements: 3.7
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Allow a single gentle fade-in for scroll reveals (300-500ms) */
  .anim-fade-in,
  .anim-slide-up,
  .anim-scale-in,
  .scroll-anim--fade-in,
  .scroll-anim--slide-up,
  .scroll-anim--scale-in {
    animation: fadeIn 400ms ease-out forwards !important;
    animation-iteration-count: 1 !important;
  }

  /* Ensure hidden sections become visible */
  .scroll-anim--hidden {
    opacity: 1 !important;
  }

  /* Disable floating decorations */
  .decor-float {
    animation: none !important;
    opacity: 1 !important;
  }

  /* Disable pulse/glow effects */
  .flipcard__hint,
  .flipcard__front--pulse,
  .hero__name--glow,
  .hero__title--shimmer {
    animation: none !important;
  }

  /* Simplify flip card transition (still allow interaction) */
  .flipcard__inner {
    transition: transform 300ms ease !important;
  }

  /* Disable intro animations */
  .intro-overlay--closing {
    animation: fadeIn 400ms ease-out forwards !important;
  }

  /* Hide particle canvas when reduced motion is preferred */
  #particle-canvas {
    display: none !important;
  }

  /* Hide cursor follower when reduced motion is preferred */
  .cursor-follower {
    display: none !important;
  }

  /* Hide rising hearts animation */
  .rising-hearts {
    display: none !important;
  }
}

/* ==========================================================================
   Extra Romantic Effects - Added for Hồng Ánh
   ========================================================================== */

/* Bounce entrance for flip card section */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.section--flipcard {
  animation: bounceIn 1s ease-out;
}

/* Shimmer text effect for section headings */
@keyframes shimmerText {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.wishes__heading,
.gallery__heading {
  background: linear-gradient(
    90deg,
    var(--color-secondary-dark) 0%,
    var(--color-primary) 25%,
    var(--color-secondary-dark) 50%,
    var(--color-primary) 75%,
    var(--color-secondary-dark) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerText 4s linear infinite;
}

/* Glowing border pulse for wishes card */
@keyframes glowPulse {
  0%, 100% {
    box-shadow:
      0 4px 20px rgba(232, 143, 172, 0.15),
      0 0 0 0 rgba(232, 143, 172, 0);
  }
  50% {
    box-shadow:
      0 4px 20px rgba(232, 143, 172, 0.3),
      0 0 20px 2px rgba(232, 143, 172, 0.15);
  }
}

.wishes__content {
  animation: glowPulse 3s ease-in-out infinite;
}

/* Floating hearts background (CSS-only, no JS) */
@keyframes riseHeart {
  0% {
    transform: translateY(100vh) scale(0.5) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-10vh) scale(1) rotate(30deg);
    opacity: 0;
  }
}

.rising-hearts {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.rising-hearts__heart {
  position: absolute;
  bottom: -20px;
  font-size: 1.2rem;
  opacity: 0;
  animation: riseHeart 8s ease-in infinite;
}

.rising-hearts__heart:nth-child(1) { left: 5%; animation-delay: 0s; animation-duration: 9s; }
.rising-hearts__heart:nth-child(2) { left: 15%; animation-delay: 1.5s; animation-duration: 7s; font-size: 0.9rem; }
.rising-hearts__heart:nth-child(3) { left: 25%; animation-delay: 3s; animation-duration: 10s; }
.rising-hearts__heart:nth-child(4) { left: 40%; animation-delay: 0.5s; animation-duration: 8s; font-size: 1.4rem; }
.rising-hearts__heart:nth-child(5) { left: 55%; animation-delay: 2s; animation-duration: 9s; }
.rising-hearts__heart:nth-child(6) { left: 65%; animation-delay: 4s; animation-duration: 7.5s; font-size: 1rem; }
.rising-hearts__heart:nth-child(7) { left: 75%; animation-delay: 1s; animation-duration: 8.5s; }
.rising-hearts__heart:nth-child(8) { left: 85%; animation-delay: 3.5s; animation-duration: 9.5s; font-size: 0.8rem; }
.rising-hearts__heart:nth-child(9) { left: 92%; animation-delay: 2.5s; animation-duration: 7s; }
.rising-hearts__heart:nth-child(10) { left: 35%; animation-delay: 5s; animation-duration: 10s; font-size: 1.3rem; }

/* Gallery image entrance stagger */
@keyframes galleryItemIn {
  from {
    opacity: 0;
    transform: translateY(30px) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

.gallery__item {
  animation: galleryItemIn 0.6s ease-out both;
}

.gallery__item:nth-child(1) { animation-delay: 0.1s; }
.gallery__item:nth-child(2) { animation-delay: 0.2s; }
.gallery__item:nth-child(3) { animation-delay: 0.3s; }
.gallery__item:nth-child(4) { animation-delay: 0.4s; }
.gallery__item:nth-child(5) { animation-delay: 0.5s; }
.gallery__item:nth-child(6) { animation-delay: 0.6s; }

/* Wishes quote entrance */
@keyframes quoteSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.wishes__quote {
  animation: quoteSlideIn 0.8s ease-out 0.5s both;
}

/* Music button pulse when not playing */
@keyframes musicPulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(232, 143, 172, 0.4);
  }
  50% {
    box-shadow: 0 4px 12px rgba(232, 143, 172, 0.4), 0 0 0 8px rgba(232, 143, 172, 0.15);
  }
}

.music-btn:not(.music-btn--playing) {
  animation: musicPulse 2s ease-in-out infinite;
}

/* Sparkle on hover for gallery images */
.gallery__image-wrapper::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 60%
  );
  transform: translateX(-100%) rotate(45deg);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.gallery__image-wrapper:hover::after {
  transform: translateX(100%) rotate(45deg);
}

/* ==========================================================================
   New Interactive Effects
   ========================================================================== */

/* Flame flicker */
@keyframes flameFlicker {
  0% { transform: scale(1) rotate(-3deg); }
  50% { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(0.95) rotate(-2deg); }
}

/* Scroll bounce indicator */
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.7; }
  50% { transform: translateX(-50%) translateY(10px); opacity: 1; }
}

/* Age counter roll-up */
@keyframes counterPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.countdown__number--animate {
  animation: counterPop 0.6s ease-out forwards;
}

/* Confetti button shake on idle */
@keyframes gentleShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.confetti-btn--idle {
  animation: gentleShake 2s ease-in-out 3s infinite;
}

/* Parallax fade on scroll for hero */
.hero--scrolled {
  opacity: 0.3;
  transform: translateY(-30px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ==========================================================================
   Gallery 3D Tilt on Hover
   ========================================================================== */
.gallery__image-wrapper {
  transform-style: preserve-3d;
  perspective: 800px;
}

.gallery__image-wrapper:hover {
  transform: scale(1.05) rotateY(3deg) rotateX(2deg);
}

/* ==========================================================================
   Hero photo frame pulse
   ========================================================================== */
@keyframes photoFramePulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(232, 143, 172, 0.35), 0 0 0 4px var(--color-primary);
  }
  50% {
    box-shadow: 0 8px 24px rgba(232, 143, 172, 0.55), 0 0 0 6px var(--color-primary), 0 0 20px rgba(232, 143, 172, 0.3);
  }
}

.hero__photo-frame {
  animation: photoFramePulse 3s ease-in-out infinite, floatUpDown 4s ease-in-out infinite;
}

/* ==========================================================================
   Love Meter fill glow
   ========================================================================== */
@keyframes fillGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.love-meter__fill {
  animation: fillGlow 2s ease-in-out infinite;
}

/* ==========================================================================
   Timeline Card Entrance Animation
   ========================================================================== */
@keyframes timelineSlideLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes timelineSlideRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.timeline__item--left .timeline__card {
  animation: timelineSlideLeft 0.6s ease-out both;
}

.timeline__item--right .timeline__card {
  animation: timelineSlideRight 0.6s ease-out both;
}

.timeline__item:nth-child(1) .timeline__card { animation-delay: 0.1s; }
.timeline__item:nth-child(2) .timeline__card { animation-delay: 0.3s; }
.timeline__item:nth-child(3) .timeline__card { animation-delay: 0.5s; }
.timeline__item:nth-child(4) .timeline__card { animation-delay: 0.7s; }
.timeline__item:nth-child(5) .timeline__card { animation-delay: 0.9s; }

/* Hero photo slideshow crossfade */
@keyframes photoFadeIn {
  from { opacity: 0; transform: scale(1.05); }
  to { opacity: 1; transform: scale(1); }
}

.hero__photo--transition {
  animation: photoFadeIn 0.8s ease-out;
}

/* ==========================================================================
   Enhanced Section Transitions
   Each section has unique entrance when scrolled into view
   ========================================================================== */

/* Wishes - slide up with opacity */
.section--wishes {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section--wishes.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Quiz - scale in */
.section--quiz {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section--quiz.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Stories - slide from right */
.section--stories {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.section--stories.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Timeline - fade in */
.section--timeline {
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.section--timeline.is-visible {
  opacity: 1;
}

/* Gallery - slide up */
.section--gallery.is-visible .gallery__grid {
  animation: slideUp 0.8s ease-out;
}

/* ==========================================================================
   Gallery Glow Border + Sparkle on Scroll
   ========================================================================== */

/* Animated rainbow glow border */
@keyframes glowBorderRotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gallery__image-wrapper {
  position: relative;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    #FF69B4 20%,
    #FFD700 40%,
    var(--color-primary) 60%,
    #FF69B4 80%,
    var(--color-primary) 100%
  );
  background-size: 300% 300%;
  animation: glowBorderRotate 4s ease infinite;
  padding: 4px;
  border: none !important;
}

.gallery__image-wrapper .gallery__image {
  border-radius: 8px;
}

/* Sparkle dots that appear on hover */
.gallery__image-wrapper::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(255, 105, 180, 0.6) 0%,
    rgba(255, 215, 0, 0.4) 25%,
    rgba(232, 143, 172, 0.6) 50%,
    rgba(255, 105, 180, 0.4) 75%,
    rgba(255, 215, 0, 0.6) 100%
  );
  background-size: 300% 300%;
  animation: glowBorderRotate 4s ease infinite;
  z-index: -1;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.4s ease;
}

.gallery__image-wrapper:hover::before,
.gallery__image-wrapper:focus-within::before {
  opacity: 1;
}

/* Sparkle particles on gallery section scroll reveal */
@keyframes sparkleFloat {
  0% { opacity: 0; transform: translate(0, 0) scale(0); }
  20% { opacity: 1; transform: translate(var(--sx), var(--sy)) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--sx) * 2), calc(var(--sy) * 2)) scale(0.5); }
}

.gallery__sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: radial-gradient(circle, #FFD700 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: sparkleFloat 1.5s ease-out forwards;
  z-index: 20;
}

/* ==========================================================================
   Handwritten Text Animation (SVG stroke-dasharray)
   ========================================================================== */
.handwritten-svg {
  width: 100%;
  max-width: 500px;
  height: 60px;
  display: block;
  margin: 0 auto;
}

.handwritten-text {
  font-family: 'Dancing Script', cursive;
  font-size: 24px;
  fill: none;
  stroke: var(--color-secondary-dark, #7B5B00);
  stroke-width: 1;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: handwrite 4s ease forwards;
}

@keyframes handwrite {
  0% {
    stroke-dashoffset: 1000;
    fill: transparent;
  }
  70% {
    stroke-dashoffset: 0;
    fill: transparent;
  }
  100% {
    stroke-dashoffset: 0;
    fill: var(--color-secondary-dark, #7B5B00);
  }
}

.wishes__quote--handwritten {
  border: none;
  background: none;
  padding: 1.5rem 0;
}

/* ==========================================================================
   LED Marquee Text
   ========================================================================== */
.led-marquee {
  margin: 0.75rem 0;
  overflow: hidden;
}

.led-marquee__text {
  display: inline-block;
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 2.5vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: transparent;
  background: linear-gradient(90deg,
    rgba(255,215,0,0.3) 0%,
    #FFD700 10%,
    #FFF 15%,
    #FFD700 20%,
    rgba(255,215,0,0.3) 30%
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: ledSweep 3s linear infinite;
}

@keyframes ledSweep {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* LED individual char glow */
.led-marquee__char {
  display: inline-block;
  animation: ledCharGlow 2s ease-in-out infinite;
  animation-delay: var(--char-delay, 0s);
}

@keyframes ledCharGlow {
  0%, 100% { opacity: 0.4; text-shadow: none; }
  50% { opacity: 1; text-shadow: 0 0 8px #FFD700, 0 0 16px rgba(255,215,0,0.5); }
}

/* ==========================================================================
   Cinematic Zoom Reveal (Stories Section)
   ========================================================================== */
.stories__cinema-wrap {
  transform: scale(0.85);
  opacity: 0.7;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s ease;
}

.stories__cinema-wrap.is-zoomed {
  transform: scale(1);
  opacity: 1;
}

/* ==========================================================================
   Long-press Hearts (TikTok style)
   ========================================================================== */
@keyframes heartRise {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(calc(-50% + var(--drift, 0px)), -80px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px)), -160px) scale(0.8);
  }
}

.longpress-heart {
  position: fixed;
  font-size: 1.8rem;
  pointer-events: none;
  z-index: 9998;
  animation: heartRise 1.2s ease-out forwards;
}

/* ==========================================================================
   Gallery 3D Mouse Tilt
   ========================================================================== */
.gallery__image-wrapper--tilt {
  transition: transform 150ms ease-out;
  transform-style: preserve-3d;
}

/* ==========================================================================
   Letter Drop Animation (Hero title)
   ========================================================================== */
@keyframes letterDrop {
  0% {
    opacity: 0;
    transform: translateY(-60px) rotate(var(--rot, 5deg));
  }
  60% {
    opacity: 1;
    transform: translateY(5px) rotate(calc(var(--rot, 5deg) * -0.3));
  }
  80% {
    transform: translateY(-3px) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

.hero__title--letter-drop .letter-char {
  display: inline-block;
  opacity: 0;
  animation: letterDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--letter-delay, 0s);
}

.hero__title--letter-drop .letter-space {
  display: inline-block;
  width: 0.3em;
}
