/* ============================================================
   assets/css/animations.css
   Animations & transitions
   ============================================================ */

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

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Classes d'animation au scroll (gérées par JS) ── */

/* État initial : invisible */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.reveal--left {
  transform: translateX(-28px);
}

.reveal.reveal--right {
  transform: translateX(28px);
}

.reveal.reveal--scale {
  transform: scale(0.95);
}

/* État visible (ajouté par JS quand l'élément entre dans le viewport) */
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Délais échelonnés pour les grilles */
.reveal-group > *:nth-child(1) { transition-delay: 0ms; }
.reveal-group > *:nth-child(2) { transition-delay: 80ms; }
.reveal-group > *:nth-child(3) { transition-delay: 160ms; }
.reveal-group > *:nth-child(4) { transition-delay: 240ms; }
.reveal-group > *:nth-child(5) { transition-delay: 320ms; }
.reveal-group > *:nth-child(6) { transition-delay: 400ms; }

/* Chaque enfant d'un reveal-group hérite de l'animation */
.reveal-group > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal-group.is-visible > * {
  opacity: 1;
  transform: none;
}

/* ── Hero : entrées au chargement ── */
.hero__text  { animation: fadeUp 0.8s 0.1s ease both; }
.hero__visual { animation: fadeUp 0.8s 0.3s ease both; }
.hero__stats  { animation: fadeIn 1s 0.6s ease both; }

/* ── Nombre compteur (déclenché par JS) ── */
.counter { display: inline-block; }

/* ── Ligne de progression (décoration) ── */
.progress-bar {
  height: 3px;
  background: var(--color-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-green), var(--color-gold));
  border-radius: var(--radius-full);
  width: 0;
  transition: width 1s ease;
}

.progress-bar__fill.animated { width: var(--target-width, 75%); }

/* ── Loader page (optionnel) ── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader__bar {
  width: 120px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.page-loader__bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 40%;
  background: var(--color-gold-light);
  border-radius: var(--radius-full);
  animation: slideRight 0.9s ease infinite;
}

/* ── Hover card lift ── */
.lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ── Réduction des animations pour accessibilité ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero__text, .hero__visual, .hero__stats {
    animation: none;
    opacity: 1;
  }

  .reveal, .reveal-group > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
