/* ============================================================
   TROUVABL — animations.css
   Transitions, animations et classes Intersection Observer
   ============================================================ */

/* ----------------------------------------------------------
   Classes d'animation au scroll (Intersection Observer)
   ---------------------------------------------------------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Décalages pour créer un effet cascade */
.animate-on-scroll[data-delay="1"] { transition-delay: 0.1s; }
.animate-on-scroll[data-delay="2"] { transition-delay: 0.2s; }
.animate-on-scroll[data-delay="3"] { transition-delay: 0.3s; }

/* Carousels mobiles : items hors viewport non détectés par IntersectionObserver */
@media (max-width: 768px) {
  .method-steps .animate-on-scroll,
  .realizations-grid .animate-on-scroll,
  .stats-grid .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 900px) {
  .offers-grid--3 .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
}

/* Respect des préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ----------------------------------------------------------
   Animation du widget Lighthouse (CSS pur)
   ---------------------------------------------------------- */
@keyframes score-fill-bad {
  from { background: conic-gradient(#E85554 0%, #E0DDD9 0); }
  to   { background: conic-gradient(#E85554 42%, #E0DDD9 0); }
}

@keyframes score-fill-good {
  from { background: conic-gradient(var(--color-accent) 0%, #E0DDD9 0); }
  to   { background: conic-gradient(var(--color-accent) 97%, #E0DDD9 0); }
}

.score-circle--bad {
  animation: score-fill-bad 1s ease-out 0.3s both;
}

.score-circle--good {
  animation: score-fill-good 1.2s ease-out 0.5s both;
}

@media (prefers-reduced-motion: reduce) {
  .score-circle--bad,
  .score-circle--good {
    animation: none;
  }
}

/* ----------------------------------------------------------
   Micro-interactions boutons (renforcent style.css)
   ---------------------------------------------------------- */
.btn {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

/* Focus visible renforcé (accessibilité) */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------
   Animation apparition du site-header au scroll
   ---------------------------------------------------------- */
.site-header {
  transition:
    box-shadow 0.3s ease,
    border-color 0.3s ease,
    background-color 0.3s ease;
}

/* ----------------------------------------------------------
   Détails FAQ — animation ouverture
   ---------------------------------------------------------- */
details > .faq-answer {
  overflow: hidden;
  animation: faq-open 0.25s ease;
}

@keyframes faq-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  details > .faq-answer {
    animation: none;
  }
}

/* ----------------------------------------------------------
   Pulsation subtile sur le CTA principal (hero)
   ---------------------------------------------------------- */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 214, 131, 0); }
  50%       { box-shadow: 0 0 0 8px rgba(52, 214, 131, 0.2); }
}

.btn--accent.btn--pulse {
  animation: pulse-glow 3s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .btn--accent.btn--pulse {
    animation: none;
  }
}
