/* ============================================================
   ANIMATIONS.CSS - All Decorative Animations & Effects
   Sakshi's Secret Garden
   ============================================================ */

/* ============================================================
   CORE KEYFRAMES
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================
   GENTLE FLOATING
   ============================================================ */

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ============================================================
   PULSE
   ============================================================ */

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.85;
  }
}

/* ============================================================
   SHIMMER (Skeleton Loading)
   ============================================================ */

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================================
   PETAL FALL
   Petals drift down with rotation and horizontal sway
   ============================================================ */

@keyframes petalFall {
  0% {
    transform: translateY(-10vh) translateX(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  25% {
    transform: translateY(22vh) translateX(15px) rotate(90deg) scale(0.95);
    opacity: 0.9;
  }
  50% {
    transform: translateY(48vh) translateX(-10px) rotate(180deg) scale(0.9);
    opacity: 0.75;
  }
  75% {
    transform: translateY(72vh) translateX(20px) rotate(270deg) scale(0.85);
    opacity: 0.5;
  }
  100% {
    transform: translateY(105vh) translateX(-5px) rotate(360deg) scale(0.8);
    opacity: 0;
  }
}

@keyframes petalFallAlt {
  0% {
    transform: translateY(-5vh) translateX(0) rotate(45deg) scale(1);
    opacity: 0.9;
  }
  30% {
    transform: translateY(28vh) translateX(-20px) rotate(135deg) scale(0.92);
    opacity: 0.8;
  }
  60% {
    transform: translateY(58vh) translateX(12px) rotate(225deg) scale(0.88);
    opacity: 0.6;
  }
  100% {
    transform: translateY(110vh) translateX(-8px) rotate(405deg) scale(0.75);
    opacity: 0;
  }
}

/* ============================================================
   HEART FLOAT
   Hearts rise upward and fade out
   ============================================================ */

@keyframes heartFloat {
  0% {
    transform: translateY(0) scale(0.5) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(-10px) scale(1) rotate(-5deg);
  }
  50% {
    opacity: 0.8;
    transform: translateY(-60px) scale(1.1) rotate(5deg);
  }
  100% {
    transform: translateY(-140px) scale(0.8) rotate(-3deg);
    opacity: 0;
  }
}

/* ============================================================
   SPARKLE
   Scale up, rotate, and fade out
   ============================================================ */

@keyframes sparkle {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  20% {
    transform: scale(1.2) rotate(72deg);
    opacity: 1;
  }
  50% {
    transform: scale(1) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

/* ============================================================
   CONFETTI
   Multi-direction falling with rotation
   ============================================================ */

@keyframes confetti {
  0% {
    transform: translateY(-20px) translateX(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  25% {
    transform: translateY(25vh) translateX(30px) rotate(120deg) scale(0.95);
    opacity: 0.95;
  }
  50% {
    transform: translateY(50vh) translateX(-20px) rotate(240deg) scale(0.9);
    opacity: 0.8;
  }
  75% {
    transform: translateY(75vh) translateX(15px) rotate(330deg) scale(0.85);
    opacity: 0.5;
  }
  100% {
    transform: translateY(100vh) translateX(-10px) rotate(420deg) scale(0.8);
    opacity: 0;
  }
}

/* ============================================================
   GARDEN BLOOM
   Scale from 0 with bounce overshoot
   ============================================================ */

@keyframes gardenBloom {
  0% {
    transform: scale(0) rotate(-10deg);
    opacity: 0;
  }
  40% {
    transform: scale(1.15) rotate(3deg);
    opacity: 1;
  }
  60% {
    transform: scale(0.95) rotate(-2deg);
  }
  80% {
    transform: scale(1.03) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* ============================================================
   SHOOTING STAR
   Streak across the screen
   ============================================================ */

@keyframes shootingStar {
  0% {
    transform: translateX(-100px) translateY(100px) rotate(-45deg) scaleX(0);
    opacity: 0;
  }
  5% {
    opacity: 1;
    transform: translateX(-50px) translateY(50px) rotate(-45deg) scaleX(1);
  }
  30% {
    opacity: 0.8;
  }
  100% {
    transform: translateX(calc(100vw + 200px)) translateY(calc(-100vh - 200px)) rotate(-45deg) scaleX(1);
    opacity: 0;
  }
}

/* ============================================================
   GENTLE GLOW
   Subtle opacity pulse
   ============================================================ */

@keyframes gentleGlow {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* ============================================================
   TYPEWRITER
   Text reveal character by character
   ============================================================ */

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blinkCaret {
  0%, 100% { border-color: transparent; }
  50%      { border-color: var(--accent); }
}

/* ============================================================
   POP (scale bounce in)
   ============================================================ */

@keyframes pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================================
   DECORATIVE ELEMENTS
   ============================================================ */

/* ---- Petal ---- */
.petal {
  position: fixed;
  width: 12px;
  height: 12px;
  pointer-events: none;
  z-index: 0;
  border-radius: 50% 0 50% 50%;
  opacity: 0;
}

.petal-sm { width: 8px;  height: 8px; }
.petal-md { width: 14px; height: 14px; }
.petal-lg { width: 20px; height: 20px; }

.petal-pink      { background: linear-gradient(135deg, #FFB6C1, #E8879B); }
.petal-rose      { background: linear-gradient(135deg, #F4A0B0, #D87090); }
.petal-blush     { background: linear-gradient(135deg, #FFD1DC, #F0A0B4); }
.petal-lavender  { background: linear-gradient(135deg, #D8B4FE, #A78BFA); }
.petal-white     { background: linear-gradient(135deg, #FFF5F7, #FFE8EE); }

.petal:nth-child(1) { left: 10%; animation: petalFall 8s linear infinite; animation-delay: 0s; }
.petal:nth-child(2) { left: 25%; animation: petalFallAlt 10s linear infinite; animation-delay: 1.5s; }
.petal:nth-child(3) { left: 40%; animation: petalFall 9s linear infinite; animation-delay: 3s; }
.petal:nth-child(4) { left: 55%; animation: petalFallAlt 11s linear infinite; animation-delay: 0.8s; }
.petal:nth-child(5) { left: 70%; animation: petalFall 7s linear infinite; animation-delay: 4.2s; }
.petal:nth-child(6) { left: 85%; animation: petalFallAlt 12s linear infinite; animation-delay: 2s; }
.petal:nth-child(7) { left: 15%; animation: petalFall 10s linear infinite; animation-delay: 5s; }
.petal:nth-child(8) { left: 60%; animation: petalFallAlt 8.5s linear infinite; animation-delay: 3.5s; }

/* ---- Floating Heart ---- */
.floating-heart {
  position: fixed;
  font-size: 20px;
  pointer-events: none;
  z-index: 0;
  animation: heartFloat 3s ease-out forwards;
}

.floating-heart-sm { font-size: 14px; }
.floating-heart-lg { font-size: 28px; }

/* ---- Sparkle Particle ---- */
.sparkle-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 0;
  animation: sparkle 1.2s ease-out forwards;
}

.sparkle-particle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.sparkle-particle-gold::before   { background: #FFD700; }
.sparkle-particle-silver::before { background: #C0C0C0; }
.sparkle-particle-pink::before   { background: #E8879B; }

/* ---- Confetti Piece ---- */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: var(--z-toast);
  animation: confetti 4s ease-out forwards;
}

.confetti-piece:nth-child(odd)  { border-radius: 2px; }
.confetti-piece:nth-child(even) { border-radius: 50%; }

.confetti-piece:nth-child(1) { left: 10%; background: #FFB6C1; animation-delay: 0s; }
.confetti-piece:nth-child(2) { left: 20%; background: #FFD700; animation-delay: 0.1s; width: 8px; height: 12px; }
.confetti-piece:nth-child(3) { left: 30%; background: #A78BFA; animation-delay: 0.2s; }
.confetti-piece:nth-child(4) { left: 40%; background: #6BBF8A; animation-delay: 0.05s; width: 12px; height: 8px; }
.confetti-piece:nth-child(5) { left: 50%; background: #60B0F0; animation-delay: 0.15s; }
.confetti-piece:nth-child(6) { left: 60%; background: #E8879B; animation-delay: 0.25s; width: 6px; height: 14px; }
.confetti-piece:nth-child(7) { left: 70%; background: #F0B060; animation-delay: 0.08s; }
.confetti-piece:nth-child(8) { left: 80%; background: #FF8C42; animation-delay: 0.18s; }
.confetti-piece:nth-child(9) { left: 90%; background: #FFB6C1; animation-delay: 0.12s; width: 14px; height: 6px; }
.confetti-piece:nth-child(10) { left: 15%; background: #D8B4FE; animation-delay: 0.3s; }

/* ---- Shooting Star ---- */
.shooting-star {
  position: fixed;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
  pointer-events: none;
  z-index: 0;
  bottom: 50%;
  left: 0;
  animation: shootingStar 2s ease-out forwards;
}

.shooting-star::after {
  content: '';
  position: absolute;
  right: 0;
  top: -2px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: var(--radius-circle);
  box-shadow: 0 0 6px var(--accent), 0 0 12px var(--accent);
}

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

.fade-in,
.animate-fade-in {
  animation: fadeIn 0.4s ease both;
}

.fade-out,
.animate-fade-out {
  animation: fadeOut 0.3s ease both;
}

.animate-slide-up {
  animation: slideUp 0.4s ease both;
}

.animate-slide-down {
  animation: slideDown 0.4s ease both;
}

.animate-slide-in-right {
  animation: slideInRight 0.4s ease both;
}

.animate-slide-in-left {
  animation: slideInLeft 0.4s ease both;
}

.animate-pop {
  animation: pop 0.4s ease both;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-bloom {
  animation: gardenBloom 0.6s ease both;
}

.animate-glow {
  animation: gentleGlow 2s ease-in-out infinite;
}

.animate-typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: typewriter 2s steps(30) forwards,
             blinkCaret 0.75s step-end infinite;
}

/* Staggered children animation */
.stagger-children > * {
  animation: slideUp 0.4s ease both;
}

.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.40s; }
.stagger-children > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.50s; }

/* Animation delay utilities */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-500 { animation-delay: 0.5s; }
.delay-700 { animation-delay: 0.7s; }
.delay-1000 { animation-delay: 1s; }

/* Animation duration utilities */
.duration-fast { animation-duration: 0.2s; }
.duration-normal { animation-duration: 0.4s; }
.duration-slow { animation-duration: 0.8s; }

/* ============================================================
   REDUCED MOTION - Accessibility
   Respects user preference for reduced motion
   ============================================================ */

@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;
  }

  .petal,
  .floating-heart,
  .sparkle-particle,
  .confetti-piece,
  .shooting-star {
    display: none !important;
  }

  .animate-float,
  .animate-pulse,
  .animate-glow {
    animation: none !important;
  }

  .streak-icon {
    animation: none !important;
  }
}
