/**
 * ANIMATIONS CSS ACCESSIBLES - ÇA HANDI LONG
 *
 * Ces animations respectent les normes d'accessibilité WCAG 2025
 * et l'European Accessibility Act avec support prefers-reduced-motion
 */

/* ===================================
   ANIMATIONS DE BASE
   =================================== */

/* Effet rideau de scène - ouverture */
@keyframes curtainOpen {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

/* Spotlight animé */
@keyframes spotlight {
  0%, 100% {
    opacity: 0.3;
    transform: translateX(-10px);
  }
  50% {
    opacity: 0.6;
    transform: translateX(10px);
  }
}

/* Effet applaudissements - particules */
@keyframes applause {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.5);
  }
}

/* Confettis discrets */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100%) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Machine à écrire pour citations */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: currentColor;
  }
}

/* Morphing des formes géométriques */
@keyframes morph-circle-square {
  0%, 100% {
    border-radius: 50%;
  }
  50% {
    border-radius: 0%;
  }
}

/* Parallaxe subtil */
@keyframes parallax-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Fade in avec slide */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse doux pour éléments importants */
@keyframes soft-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* Shimmer effect pour chargement */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* ===================================
   CLASSES UTILITAIRES
   =================================== */

.curtain-effect {
  animation: curtainOpen 1.5s ease-in-out forwards;
  transform-origin: center;
}

.spotlight-effect {
  animation: spotlight 3s ease-in-out infinite;
}

.applause-particle {
  animation: applause 1s ease-out forwards;
}

.confetti {
  animation: confetti-fall 3s linear forwards;
}

.typewriter-text {
  overflow: hidden;
  border-right: 0.15em solid;
  white-space: nowrap;
  animation:
    typewriter 3s steps(40) 1s forwards,
    blink-caret 0.75s step-end infinite;
}

.morphing-shape {
  animation: morph-circle-square 8s ease-in-out infinite;
}

.parallax-element {
  animation: parallax-float 6s ease-in-out infinite;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.soft-pulse {
  animation: soft-pulse 2s ease-in-out infinite;
}

.shimmer-loading {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ===================================
   ACCESSIBILITÉ - PREFERS REDUCED MOTION
   Désactive TOUTES les animations pour les utilisateurs sensibles
   =================================== */

@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;
  }

  /* Désactiver les animations spécifiques */
  .curtain-effect,
  .spotlight-effect,
  .applause-particle,
  .confetti,
  .typewriter-text,
  .morphing-shape,
  .parallax-element,
  .fade-in-up,
  .soft-pulse,
  .shimmer-loading {
    animation: none !important;
  }

  /* Assurer que les éléments restent visibles */
  .typewriter-text {
    border-right: none;
    overflow: visible;
  }

  .morphing-shape {
    border-radius: 50%; /* Garder la forme par défaut */
  }
}

/* ===================================
   ANIMATIONS DE FOCUS (TOUJOURS ACTIVES)
   Important pour l'accessibilité clavier
   =================================== */

:focus-visible {
  outline: 3px solid #8B8BF3; /* brand-purple */
  outline-offset: 2px;
  /* Cette animation est autorisée même avec prefers-reduced-motion */
}

/* ===================================
   HOVER EFFECTS - Respectueux de prefers-reduced-motion
   =================================== */

.hover-lift {
  transition: transform 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
}

@media (prefers-reduced-motion: reduce) {
  .hover-lift:hover {
    transform: none;
    /* Alternative sans mouvement */
    box-shadow: 0 0 0 3px rgba(139, 139, 243, 0.3);
  }
}

/* ===================================
   ANIMATIONS DE CHARGEMENT
   =================================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
    /* Alternative statique */
    opacity: 0.5;
  }
}

/* ===================================
   SCROLL ANIMATIONS (optionnelles)
   =================================== */

@keyframes slideInFromLeft {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.scroll-slide-left {
  animation: slideInFromLeft 0.6s ease-out;
}

.scroll-slide-right {
  animation: slideInFromRight 0.6s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-slide-left,
  .scroll-slide-right {
    animation: none;
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===================================
   BOUTONS PAUSE POUR ANIMATIONS LONGUES
   Conformité WCAG - animations > 5 secondes
   =================================== */

.animation-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: none; /* Affiché en JS si animations présentes */
}

.btn-pause-animations {
  padding: 12px 20px;
  background: #1A2046; /* brand-navy */
  color: white;
  border: 2px solid #8B8BF3; /* brand-purple */
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease;
}

.btn-pause-animations:hover {
  background: #8B8BF3;
}

.btn-pause-animations:focus {
  outline: 3px solid #8B8BF3;
  outline-offset: 2px;
}

/* État paused */
body.animations-paused * {
  animation-play-state: paused !important;
}

/* ===================================
   TRANSITIONS SÛRES (jamais > 3 flashs/seconde)
   Prévention de l'épilepsie photosensible
   =================================== */

/* JAMAIS utiliser des animations qui clignotent > 3x par seconde */
/* ❌ INTERDIT */
/*
@keyframes dangerous-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.dangerous { animation: dangerous-flash 0.15s infinite; }
*/

/* ✅ AUTORISÉ - Maximum 2 flashs par seconde */
@keyframes safe-glow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.safe-glow {
  animation: safe-glow 1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .safe-glow {
    animation: none;
    opacity: 1;
  }
}

/* ===================================
   CLASSES UTILITAIRES POUR JS
   =================================== */

.no-animation {
  animation: none !important;
  transition: none !important;
}

.reduced-animation {
  animation-duration: 0.3s !important;
  transition-duration: 0.3s !important;
}

/* ===================================
   PRINT STYLES - Désactiver animations
   =================================== */

@media print {
  * {
    animation: none !important;
    transition: none !important;
  }
}
