/* ============================================================
   HymSchool — Animations & Micro-interactions
   animations.css
   ============================================================ */

/* ─── Scroll animations (IntersectionObserver) ──────────────────────────────── */
.fade-in-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.fade-in-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Délais échelonnés pour les éléments enfants */
.stagger > .fade-in-up:nth-child(1) { transition-delay: 0ms; }
.stagger > .fade-in-up:nth-child(2) { transition-delay: 80ms; }
.stagger > .fade-in-up:nth-child(3) { transition-delay: 160ms; }
.stagger > .fade-in-up:nth-child(4) { transition-delay: 240ms; }
.stagger > .fade-in-up:nth-child(5) { transition-delay: 320ms; }
.stagger > .fade-in-up:nth-child(6) { transition-delay: 400ms; }
.stagger > .fade-in-up:nth-child(7) { transition-delay: 480ms; }
.stagger > .fade-in-up:nth-child(8) { transition-delay: 560ms; }

/* Fade in simple (sans translation) */
.fade-in {
  opacity: 0;
  transition: opacity 600ms ease-out;
}
.fade-in.is-visible { opacity: 1; }

/* Slide depuis la gauche */
.slide-in-left {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.slide-in-left.is-visible { opacity: 1; transform: translateX(0); }

/* Slide depuis la droite */
.slide-in-right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.slide-in-right.is-visible { opacity: 1; transform: translateX(0); }

/* ─── Compteurs animés ───────────────────────────────────────────────────────── */
.counter-value {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* ─── Hero particles ─────────────────────────────────────────────────────────── */
.hero__particle:nth-child(1)  { width: 4px;  height: 4px;  left: 15%; animation-duration: 12s; animation-delay: 0s; }
.hero__particle:nth-child(2)  { width: 3px;  height: 3px;  left: 25%; animation-duration: 18s; animation-delay: 2s; }
.hero__particle:nth-child(3)  { width: 5px;  height: 5px;  left: 40%; animation-duration: 14s; animation-delay: 4s; }
.hero__particle:nth-child(4)  { width: 3px;  height: 3px;  left: 55%; animation-duration: 16s; animation-delay: 1s; }
.hero__particle:nth-child(5)  { width: 4px;  height: 4px;  left: 70%; animation-duration: 20s; animation-delay: 3s; }
.hero__particle:nth-child(6)  { width: 3px;  height: 3px;  left: 82%; animation-duration: 13s; animation-delay: 5s; }
.hero__particle:nth-child(7)  { width: 5px;  height: 5px;  left: 10%; animation-duration: 22s; animation-delay: 7s; }
.hero__particle:nth-child(8)  { width: 3px;  height: 3px;  left: 90%; animation-duration: 15s; animation-delay: 6s; }

/* Positionnements Y de départ */
.hero__particle:nth-child(1)  { bottom: -5%; }
.hero__particle:nth-child(2)  { bottom: 20%; }
.hero__particle:nth-child(3)  { bottom: -10%; }
.hero__particle:nth-child(4)  { bottom: 30%; }
.hero__particle:nth-child(5)  { bottom: 5%; }
.hero__particle:nth-child(6)  { bottom: 40%; }
.hero__particle:nth-child(7)  { bottom: 15%; }
.hero__particle:nth-child(8)  { bottom: 25%; }

/* ─── Gradient animé (hero bg optionnel) ─────────────────────────────────────── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ─── Pulse sur badges/CTAs ──────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13,148,136,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(13,148,136,0); }
}
.pulse {
  animation: pulse 2.5s ease infinite;
}

/* ─── Shimmer (loading placeholder) ─────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.shimmer {
  background: linear-gradient(90deg,
    var(--color-bg-light) 25%,
    var(--color-border) 50%,
    var(--color-bg-light) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
}

/* ─── Hover micro-interactions ───────────────────────────────────────────────── */
/* Icônes dans les cartes modules */
.card--module:hover .card__icon svg {
  animation: wiggle 300ms ease;
}
@keyframes wiggle {
  0%  { transform: rotate(0deg) scale(1); }
  30% { transform: rotate(-8deg) scale(1.1); }
  60% { transform: rotate(6deg) scale(1.1); }
  100%{ transform: rotate(0deg) scale(1); }
}

/* Flèche CTA */
.btn .icon-arrow {
  transition: transform var(--transition);
}
.btn:hover .icon-arrow {
  transform: translateX(4px);
}

/* ─── Page transitions ───────────────────────────────────────────────────────── */
.page-enter {
  animation: pageIn 300ms ease forwards;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Barre de chargement en haut de page ────────────────────────────────────── */
.progress-top {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--color-primary);
  z-index: 9999;
  width: 0;
  transition: width 200ms ease;
}

/* ─── Scroll indicator ───────────────────────────────────────────────────────── */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: rgba(255,255,255,.4);
  font-size: var(--text-xs);
  animation: bounce 2s ease infinite;
}
.scroll-indicator__arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid rgba(255,255,255,.3);
  border-bottom: 2px solid rgba(255,255,255,.3);
  transform: rotate(45deg);
  margin-top: -4px;
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ─── Reduce motion (accessibilité) ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .fade-in-up,
  .fade-in,
  .slide-in-left,
  .slide-in-right {
    opacity: 1;
    transform: none;
  }
}
