/**
 * Valentine's Day Boilerplate - Animation Library
 * ================================================
 * Romantic animations and effects
 */

/* =============================================
   KEYFRAME ANIMATIONS
   ============================================= */

/* Heartbeat */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
  60% { transform: scale(1); }
}

/* Float Up (for floating hearts) */
@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% {
    transform: translateY(-100px) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* Float Soft (gentle hover) */
@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Float with Sway */
@keyframes floatSway {
  0%, 100% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  25% {
    transform: translateY(-15px) translateX(10px) rotate(5deg);
  }
  50% {
    transform: translateY(-25px) translateX(0) rotate(0deg);
  }
  75% {
    transform: translateY(-15px) translateX(-10px) rotate(-5deg);
  }
}

/* Fall Down (for petals) */
@keyframes fallDown {
  0% {
    transform: translateY(-100px) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% {
    transform: translateY(100vh) translateX(50px) rotate(720deg);
    opacity: 0;
  }
}

/* Fall with Flutter */
@keyframes fallFlutter {
  0% {
    transform: translateY(-50px) translateX(0) rotateZ(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  25% { transform: translateY(25vh) translateX(30px) rotateZ(90deg); }
  50% { transform: translateY(50vh) translateX(-20px) rotateZ(180deg); }
  75% { transform: translateY(75vh) translateX(40px) rotateZ(270deg); }
  100% {
    transform: translateY(100vh) translateX(10px) rotateZ(360deg);
    opacity: 0;
  }
}

/* Pulse Glow */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(var(--vday-pink-rgb), 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(var(--vday-pink-rgb), 0.8),
                0 0 60px rgba(var(--vday-red-rgb), 0.4);
  }
}

/* Text Glow */
@keyframes textGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(var(--vday-red-rgb), 0.3);
  }
  50% {
    text-shadow: 0 0 20px rgba(var(--vday-red-rgb), 0.6),
                 0 0 30px rgba(var(--vday-pink-rgb), 0.4);
  }
}

/* Shimmer Effect */
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Sparkle */
@keyframes sparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* Bounce In */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Scale */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Heart Burst */
@keyframes heartBurst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(0);
    opacity: 0;
  }
}

/* Rotate */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Rotate Reverse */
@keyframes rotateReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* Swing */
@keyframes swing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  75% { transform: rotate(-15deg); }
}

/* Typewriter Cursor Blink */
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Wave */
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-20deg); }
}

/* Shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Wiggle */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* Pop */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Slide In From Bottom */
@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide Out To Bottom */
@keyframes slideOutBottom {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* =============================================
   ANIMATION UTILITY CLASSES
   ============================================= */

/* Apply animations */
.animate-heartbeat { animation: heartbeat 1.5s ease-in-out infinite; }
.animate-float { animation: floatSoft 3s ease-in-out infinite; }
.animate-float-sway { animation: floatSway 4s ease-in-out infinite; }
.animate-pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }
.animate-text-glow { animation: textGlow 2s ease-in-out infinite; }
.animate-sparkle { animation: sparkle 1.5s ease-in-out infinite; }
.animate-bounce-in { animation: bounceIn 0.6s ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out forwards; }
.animate-fade-in-down { animation: fadeInDown 0.6s ease-out forwards; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease-out forwards; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease-out forwards; }
.animate-fade-in-scale { animation: fadeInScale 0.6s ease-out forwards; }
.animate-rotate { animation: rotate 10s linear infinite; }
.animate-rotate-slow { animation: rotate 20s linear infinite; }
.animate-swing { animation: swing 2s ease-in-out infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-wiggle { animation: wiggle 0.5s ease-in-out infinite; }
.animate-pop { animation: pop 0.3s ease-out; }
.animate-wave { animation: wave 1s ease-in-out infinite; }

/* Animation Delays */
.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-400 { animation-delay: 400ms; }
.animation-delay-500 { animation-delay: 500ms; }
.animation-delay-700 { animation-delay: 700ms; }
.animation-delay-1000 { animation-delay: 1000ms; }

/* Animation Durations */
.animation-duration-fast { animation-duration: 0.3s; }
.animation-duration-normal { animation-duration: 0.6s; }
.animation-duration-slow { animation-duration: 1s; }
.animation-duration-slower { animation-duration: 2s; }

/* Animation Fill Mode */
.animation-fill-forwards { animation-fill-mode: forwards; }
.animation-fill-backwards { animation-fill-mode: backwards; }
.animation-fill-both { animation-fill-mode: both; }

/* Animation Play State */
.animation-paused { animation-play-state: paused; }
.animation-running { animation-play-state: running; }

/* =============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================= */

/* Base state for scroll animations */
[data-animate] {
  opacity: 0;
}

[data-animate="fade-up"] {
  transform: translateY(30px);
}

[data-animate="fade-down"] {
  transform: translateY(-30px);
}

[data-animate="fade-left"] {
  transform: translateX(30px);
}

[data-animate="fade-right"] {
  transform: translateX(-30px);
}

[data-animate="zoom-in"] {
  transform: scale(0.9);
}

[data-animate="zoom-out"] {
  transform: scale(1.1);
}

/* Active state when in viewport */
[data-animate].animated {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Stagger children */
[data-animate-stagger] > *:nth-child(1) { transition-delay: 0ms; }
[data-animate-stagger] > *:nth-child(2) { transition-delay: 100ms; }
[data-animate-stagger] > *:nth-child(3) { transition-delay: 200ms; }
[data-animate-stagger] > *:nth-child(4) { transition-delay: 300ms; }
[data-animate-stagger] > *:nth-child(5) { transition-delay: 400ms; }
[data-animate-stagger] > *:nth-child(6) { transition-delay: 500ms; }

/* =============================================
   HOVER ANIMATIONS
   ============================================= */

.hover\:heartbeat:hover { animation: heartbeat 1s ease-in-out infinite; }
.hover\:float:hover { animation: floatSoft 2s ease-in-out infinite; }
.hover\:pulse-glow:hover { animation: pulseGlow 1.5s ease-in-out infinite; }
.hover\:wiggle:hover { animation: wiggle 0.4s ease-in-out; }
.hover\:pop:hover { animation: pop 0.3s ease-out; }
.hover\:shake:hover { animation: shake 0.4s ease-in-out; }

/* =============================================
   SPECIAL EFFECTS
   ============================================= */

/* Shimmer Effect */
.effect-shimmer {
  position: relative;
  overflow: hidden;
}

.effect-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-shimmer);
  animation: shimmer 3s infinite;
}

/* Glow Border */
.effect-glow-border {
  position: relative;
}

.effect-glow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--gradient-romantic);
  border-radius: inherit;
  z-index: -1;
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Rainbow Glow */
@keyframes rainbowGlow {
  0% { box-shadow: 0 0 20px var(--vday-red); }
  33% { box-shadow: 0 0 20px var(--vday-pink); }
  66% { box-shadow: 0 0 20px var(--vday-rose-gold); }
  100% { box-shadow: 0 0 20px var(--vday-red); }
}

.effect-rainbow-glow {
  animation: rainbowGlow 3s ease-in-out infinite;
}

/* Parallax Effect (use with JS) */
.parallax {
  will-change: transform;
}

.parallax-slow { --parallax-speed: 0.3; }
.parallax-medium { --parallax-speed: 0.5; }
.parallax-fast { --parallax-speed: 0.7; }

/* =============================================
   REDUCED MOTION
   ============================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }
}
