/* =====================================================================
   CEDA – Animations légères (v1.0)
   1. Défilement fluide & variables
   2. Entrée de l'en-tête au chargement
   3. Entrée du hero (accueil) au chargement
   4. Entrée des en-têtes de pages internes au chargement
   5. Apparition au défilement (piloté par assets/animations.js)
   6. Micro-interactions
   7. Accessibilité : prefers-reduced-motion
   ===================================================================== */

/* ---------- 1. Défilement fluide (ancres type #contact) ---------- */
html { scroll-behavior: smooth; }

:root { --cd-anim-ease: cubic-bezier(0.22, 0.61, 0.36, 1); }

/* Keyframes partagées */
@keyframes cdRise   { from { transform: translateY(20px); }  to { transform: translateY(0); } }
@keyframes cdFade   { from { opacity: 0; }                   to { opacity: 1; } }
@keyframes cdSlide  { from { transform: translateX(28px); }  to { transform: translateX(0); } }
@keyframes cdGrow   { from { transform: scaleX(0); }          to { transform: scaleX(1); } }
@keyframes cdReveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes cdPulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes cdBeat   { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- 2. En-tête : entrée douce au chargement ---------- */
.cd-header .cd-header-row,
.cd-header > .et_pb_row {
  animation: cdRise 0.5s var(--cd-anim-ease) 0.02s backwards,
             cdFade 0.5s ease 0.02s backwards;
}
.cd-header-col-brand,
.cd-header-actions,
.cd-header .et_mobile_nav_menu {
  animation: cdFade 0.45s ease 0.12s backwards;
}
.cd-nav nav > ul > li,
.cd-nav ul#menu-menu-principal > li {
  animation: cdFade 0.4s ease backwards;
}
.cd-nav nav > ul > li:nth-child(1), ul#menu-menu-principal > li:nth-child(1) { animation-delay: 0.10s; }
.cd-nav nav > ul > li:nth-child(2), ul#menu-menu-principal > li:nth-child(2) { animation-delay: 0.16s; }
.cd-nav nav > ul > li:nth-child(3), ul#menu-menu-principal > li:nth-child(3) { animation-delay: 0.22s; }
.cd-nav nav > ul > li:nth-child(4), ul#menu-menu-principal > li:nth-child(4) { animation-delay: 0.28s; }
.cd-nav nav > ul > li:nth-child(5), ul#menu-menu-principal > li:nth-child(5) { animation-delay: 0.34s; }
.cd-nav nav > ul > li:nth-child(6), ul#menu-menu-principal > li:nth-child(6) { animation-delay: 0.40s; }

/* ---------- 3. Hero accueil : apparition en cascade ----------
   Le déplacement s'applique aux modules, l'opacité à leur contenu
   (évite tout conflit avec les styles de waypoint de Divi). */
.cd-hero .cd-badge {
  animation: cdRise 0.55s var(--cd-anim-ease) 0s backwards;
}
.cd-hero .cd-badge .et_pb_text_inner {
  animation: cdFade 0.55s ease 0s backwards;
}
.cd-hero .et_pb_text:has(h1) {
  animation: cdRise 0.6s var(--cd-anim-ease) 0.08s backwards;
}
.cd-hero .et_pb_text:has(h1) .et_pb_text_inner {
  animation: cdFade 0.6s ease 0.08s backwards;
}
.cd-hero .et_pb_text:not(.cd-badge):not(.cd-checks):not(:has(h1)) {
  animation: cdRise 0.6s var(--cd-anim-ease) 0.18s backwards;
}
.cd-hero .et_pb_text:not(.cd-badge):not(.cd-checks):not(:has(h1)) .et_pb_text_inner {
  animation: cdFade 0.6s ease 0.18s backwards;
}
.cd-hero .et_pb_button_module_wrapper {
  animation: cdRise 0.55s var(--cd-anim-ease) 0.28s backwards;
}
.cd-hero .et_pb_button {
  animation: cdFade 0.55s ease 0.28s backwards;
}
.cd-hero .cd-checks {
  animation: cdRise 0.55s var(--cd-anim-ease) 0.36s backwards;
}
.cd-hero .cd-checks .et_pb_text_inner {
  animation: cdFade 0.55s ease 0.36s backwards;
}
.cd-hero .cd-hero-blend-img {
  animation: cdSlide 0.7s var(--cd-anim-ease) 0.15s backwards;
}
.cd-hero .cd-hero-blend-img .et_pb_image_wrap {
  animation: cdFade 0.7s ease 0.15s backwards;
}

/* ---------- 4. Pages internes : en-tête violet ---------- */
.cd-page-hero .cd-breadcrumb {
  animation: cdRise 0.5s var(--cd-anim-ease) 0s backwards;
}
.cd-page-hero .cd-breadcrumb .et_pb_text_inner {
  animation: cdFade 0.5s ease 0s backwards;
}
.cd-page-hero .et_pb_text:has(h1) {
  animation: cdRise 0.55s var(--cd-anim-ease) 0.08s backwards;
}
.cd-page-hero .et_pb_text:has(h1) .et_pb_text_inner {
  animation: cdFade 0.55s ease 0.08s backwards;
}
.cd-page-hero .cd-page-sub {
  animation: cdRise 0.55s var(--cd-anim-ease) 0.18s backwards;
}
.cd-page-hero .cd-page-sub .et_pb_text_inner {
  animation: cdFade 0.55s ease 0.18s backwards;
}
/* Soulignement vert du titre : croissance douce */
.cd-page-hero h1::after {
  transform-origin: 0 50%;
  animation: cdGrow 0.45s ease 0.55s backwards;
}

/* ---------- 5. Apparition au défilement ----------
   La classe .cd-reveal est posée par animations.js (html.cd-js
   garantit que rien n'est masqué si le JS ne se charge pas). */
html.cd-js .cd-reveal:not(.is-visible) {
  opacity: 0 !important;
  transform: translateY(16px) !important;
}
html.cd-js .cd-reveal.is-visible {
  animation: cdReveal 0.6s var(--cd-anim-ease) backwards;
}

/* ---------- 6. Micro-interactions ---------- */
/* Pastille orange du badge : pulsation très douce */
.cd-dot { animation: cdPulse 2.4s ease-in-out 0.8s infinite; }
/* Icône du bandeau CTA : léger battement */
.cd-cta .cd-cta-icon { animation: cdBeat 3.2s ease-in-out 1s infinite; }
/* Logo de l'en-tête : réaction au survol */
.cd-brand-link .cd-logo { transition: transform 0.25s ease; }
.cd-brand-link:hover .cd-logo,
.cd-brand-link:focus-visible .cd-logo { transform: scale(1.06) rotate(-4deg); }

/* ---------- 7. Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cd-header *, .cd-header *::before, .cd-header *::after,
  .cd-hero *, .cd-hero *::before, .cd-hero *::after,
  .cd-page-hero *, .cd-page-hero *::before, .cd-page-hero *::after,
  .cd-dot, .cd-cta .cd-cta-icon,
  html.cd-js .cd-reveal { animation: none !important; }
  html.cd-js .cd-reveal:not(.is-visible) { opacity: 1 !important; transform: none !important; }
}
