/* Event-based animations for festive occasions */

/* Snowfall animation for Christmas — oblique fall with lateral sway */
@keyframes snowfall {
  0% {
    transform: translateY(-100vh) translateX(0) rotate(0deg);
    opacity: 1;
  }
  30% {
    transform: translateY(-40vh) translateX(-25px) rotate(110deg);
  }
  60% {
    transform: translateY(20vh) translateX(30px) rotate(220deg);
  }
  100% {
    transform: translateY(100vh) translateX(60px) rotate(360deg);
    opacity: 0;
  }
}

.animation-snowfall .snowflake {
  position: fixed;
  /* Bleu glacé : visible sur fond clair */
  color: #60a5fa;
  text-shadow: 0 1px 3px rgba(30, 64, 175, 0.35);
  font-size: 1.25rem;
  animation: snowfall linear infinite;
  pointer-events: none;
  z-index: 1000;
  user-select: none;
}

/* Blanc lumineux sur thème sombre */
.dark .animation-snowfall .snowflake {
  color: #ffffff;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.85);
}

/* Confetti animation for birthdays — oblique fall with lateral sway */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) translateX(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translateY(0) translateX(-30px) rotate(360deg);
  }
  100% {
    transform: translateY(100vh) translateX(40px) rotate(720deg);
    opacity: 0;
  }
}

.animation-confetti .confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear infinite;
  pointer-events: none;
  z-index: 1000;
}

/* Hearts animation for Valentine's/Wedding */
@keyframes hearts-float {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) scale(1);
    opacity: 0;
  }
}

.animation-hearts .heart {
  position: fixed;
  color: #ef4444;
  font-size: 1.25rem;
  animation: hearts-float ease-in-out infinite;
  pointer-events: none;
  z-index: 1000;
  user-select: none;
}

/* Bubbles animation for baby showers */
@keyframes bubble-float {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
  20% {
    opacity: 0.7;
  }
  100% {
    transform: translateY(-100vh) scale(1.2);
    opacity: 0;
  }
}

.animation-bubbles .bubble {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(6, 182, 212, 0.8), rgba(6, 182, 212, 0.2));
  animation: bubble-float ease-out infinite;
  pointer-events: none;
  z-index: 1000;
}

/* Petals animation for Mother's Day */
@keyframes petal-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg) translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateY(0) rotate(180deg) translateX(50px);
  }
  100% {
    transform: translateY(100vh) rotate(360deg) translateX(0);
    opacity: 0;
  }
}

.animation-petals .petal {
  position: fixed;
  color: #f472b6;
  font-size: 1.25rem;
  animation: petal-fall ease-in-out infinite;
  pointer-events: none;
  z-index: 1000;
  user-select: none;
}

/* Leaves animation for housewarming */
@keyframes leaf-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg) translateX(0);
    opacity: 1;
  }
  50% {
    transform: translateY(0) rotate(-160deg) translateX(-40px);
  }
  100% {
    transform: translateY(100vh) rotate(-360deg) translateX(20px);
    opacity: 0;
  }
}

.animation-leaves .leaf {
  position: fixed;
  font-size: 1.25rem;
  animation: leaf-fall ease-in-out infinite;
  pointer-events: none;
  z-index: 1000;
  user-select: none;
}

/* Eggs animation for Easter */
@keyframes egg-fall {
  0% {
    transform: translateY(-100vh) rotate(-12deg);
    opacity: 1;
  }
  50% {
    transform: translateY(0) rotate(12deg);
  }
  100% {
    transform: translateY(100vh) rotate(-12deg);
    opacity: 0;
  }
}

.animation-eggs .egg {
  position: fixed;
  font-size: 1.25rem;
  animation: egg-fall linear infinite;
  pointer-events: none;
  z-index: 1000;
  user-select: none;
}

/* Twinkle animation for Father's Day stars and custom sparkles */
@keyframes twinkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0.4);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.animation-stars .star,
.animation-sparkles .sparkle {
  position: fixed;
  font-size: 1rem;
  animation: twinkle ease-in-out infinite;
  pointer-events: none;
  z-index: 1000;
  user-select: none;
}

.animation-stars .star {
  color: #93c5fd;
  text-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
}

.animation-sparkles .sparkle {
  color: #a5b4fc;
  text-shadow: 0 0 6px rgba(99, 102, 241, 0.6);
}

/* Animation container */
#event-animation-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

/* Applique l'état initial de l'image-clé PENDANT le délai de démarrage :
   sans ça, les particules restent figées en haut de page jusqu'à ce que
   leur délai aléatoire s'écoule. */
#event-animation-container > * {
  animation-fill-mode: backwards;
}

/* ============================================
   Event cards — thematic accents (event_list, dashboard banner)
   ============================================ */

/* Sweeping reflection, staggered between cards */
.event-card {
  position: relative;
  overflow: hidden;
}

.event-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.13), transparent);
  animation: card-sweep 9s ease-in-out infinite;
  pointer-events: none;
}

.event-card:nth-child(2)::after { animation-delay: 1.5s; }
.event-card:nth-child(3)::after { animation-delay: 3s; }
.event-card:nth-child(4)::after { animation-delay: 4.5s; }
.event-card:nth-child(n+5)::after { animation-delay: 6s; }

@keyframes card-sweep {
  0%, 88% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}

/* Slowly shifting gradient stripe on the left of the active event card.
   Color comes from the inline --event-color variable. */
.event-card-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg,
      var(--event-color, #d42426),
      transparent 55%,
      var(--event-color, #d42426));
  background-size: 100% 220%;
  animation: stripe-shift 6s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes stripe-shift {
  from { background-position: 0 0; }
  to { background-position: 0 100%; }
}

/* Season emoji popping in on card hover */
.season-emoji {
  position: absolute;
  right: 0.6rem;
  bottom: 0.35rem;
  font-size: 1.25rem;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

.event-card:hover .season-emoji {
  animation: emoji-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes emoji-pop {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(6px);
  }
  70% {
    opacity: 1;
    transform: scale(1.15) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ============================================
   Confetti burst (event creation)
   ============================================ */
#confetti-burst {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1001;
  overflow: hidden;
}

#confetti-burst .confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear 1 both;
  pointer-events: none;
}

/* ============================================
   Animations réduites — pilotées UNIQUEMENT par la classe .reduce-motion
   (posée par base.html : app > préférence système). On n'utilise volontairement
   PAS de @media (prefers-reduced-motion) ici, pour que le choix explicite
   dans l'app puisse réactiver les effets même si l'OS demande de les réduire.
   ============================================ */
.reduce-motion #event-animation-container,
.reduce-motion #confetti-burst,
.reduce-motion .season-emoji {
  display: none;
}

.reduce-motion .event-card::after,
.reduce-motion .event-card-active::before,
.reduce-motion .page-enter,
.reduce-motion .stagger > * {
  animation: none;
}
