/* Motion design O Chaude O Froide, en CSS seul (aucun script) :
   - entrées en cascade au chargement (hero, en-têtes de page) ;
   - apparitions au défilement via les animations liées au scroll (animation-timeline).
     Les navigateurs qui ne les gèrent pas affichent simplement le contenu, sans animation ;
   - en-tête qui prend une ombre au défilement ;
   - micro-interactions au survol, changements d'étape des formulaires, icône du bandeau selon la saison.
   Tout est désactivé si le visiteur a demandé à réduire les animations. */

@media (prefers-reduced-motion: no-preference){

  /* translate/scale (et non transform) : les effets de survol en transform restent possibles */
  @keyframes mo-monte{from{translate:0 28px}to{translate:none}}
  @keyframes mo-zoom{from{scale:.94;translate:0 18px}to{scale:1;translate:none}}
  @keyframes mo-flotte{0%,100%{translate:0 0}50%{translate:0 -8px}}
  @keyframes mo-onde{0%{transform:scale(1);opacity:.55}100%{transform:scale(1.7);opacity:0}}
  @keyframes mo-ombre{to{box-shadow:0 10px 30px rgba(0,0,0,.08)}}
  @keyframes mo-tourne{to{transform:rotate(360deg)}}
  @keyframes mo-balance{0%,100%{transform:rotate(-10deg)}50%{transform:rotate(10deg)}}
  @keyframes mo-pousse{0%,100%{transform:scale(1)}50%{transform:scale(1.15) translateY(-1px)}}

  /* ---------- Accueil : entrée du hero ---------- */
  #hero .hero-copy>*{animation:mo-monte .8s cubic-bezier(.2,.7,.2,1) both}
  #hero .hero-copy>:nth-child(2){animation-delay:.08s}
  #hero .hero-copy>:nth-child(3){animation-delay:.16s}
  #hero .hero-copy>:nth-child(4){animation-delay:.26s}
  #hero .hero-copy>:nth-child(5){animation-delay:.36s}
  #hero .hero-copy>:nth-child(6){animation-delay:.46s}
  #hero .hero-visual{animation:mo-zoom 1s .2s cubic-bezier(.2,.7,.2,1) both,mo-flotte 7s 1.4s ease-in-out infinite}
  #hero .hero-services{animation:mo-monte .8s .45s cubic-bezier(.2,.7,.2,1) both}
  #hero .hero-service-tag{animation:mo-monte .6s cubic-bezier(.2,.7,.2,1) both}
  #hero .hero-service-tag:nth-child(1){animation-delay:.7s}
  #hero .hero-service-tag:nth-child(2){animation-delay:.78s}
  #hero .hero-service-tag:nth-child(3){animation-delay:.86s}

  /* Icône du bandeau, selon la saison */
  .seasonal-note-icon i{display:inline-block}
  .saison-avant-hiver .seasonal-note-icon i{animation:mo-balance 3.5s ease-in-out infinite;transform-origin:50% 90%}
  .saison-hiver .seasonal-note-icon i{animation:mo-tourne 12s linear infinite}
  .saison-apres-hiver .seasonal-note-icon i{animation:mo-pousse 3s ease-in-out infinite;transform-origin:50% 100%}
  .saison-ete .seasonal-note-icon i{animation:mo-tourne 18s linear infinite}

  /* Panneaux qui apparaissent après un clic (détail du problème, fiche de contact, étapes du diagnostic, bulle de la caméra) */
  .pb-panneau:not([hidden]),
  .ex-merci:not([hidden]),
  .ct-form>*{animation:mo-monte .45s cubic-bezier(.2,.7,.2,1) both}
  .cam-bulle:not([hidden]){animation:mo-zoom .3s ease-out both}

  /* ---------- Pages intérieures : entrée de l'en-tête ---------- */
  .pg-main>.pg-eyebrow,.pg-main>.pg-h1,.pg-main>.pg-lead,.pg-main>.badge,.pg-main>.btn-row,.pg-main>.alert,
  .lg-main>*{animation:mo-monte .75s cubic-bezier(.2,.7,.2,1) both}
  .pg-main>.pg-h1,.lg-main>:nth-child(2){animation-delay:.08s}
  .pg-main>.pg-lead,.lg-main>:nth-child(3){animation-delay:.16s}
  .pg-main>.badge,.pg-main>.btn-row,.lg-main>:nth-child(4){animation-delay:.24s}
  .pg-main>.alert,.lg-main>:nth-child(n+5){animation-delay:.32s}

  /* ---------- Micro-interactions ---------- */
  .bouton,.ex-btn,.btn,.ocf-header-call,header a[href^="tel:"],.ocf-footer-btn,.ocf-menu-cta{
    transition:transform .25s cubic-bezier(.2,.7,.2,1),box-shadow .25s ease,background-color .3s ease,color .3s ease,border-color .3s ease;
  }
  .bouton:hover,.ex-btn:not([disabled]):hover,.btn:hover,.ocf-header-call:hover,header a[href^="tel:"]:hover,.ocf-footer-btn:hover,.ocf-menu-cta:hover{
    transform:translateY(-2px);box-shadow:0 10px 24px color-mix(in srgb,var(--texte) 16%,transparent);
  }
  .pb-choix{transition:transform .25s cubic-bezier(.2,.7,.2,1),box-shadow .25s ease,background-color .3s ease,border-color .3s ease}
  .pb-choix:hover{transform:translateY(-3px);box-shadow:0 12px 26px color-mix(in srgb,var(--texte) 10%,transparent)}
  .pb-choix i{transition:transform .3s cubic-bezier(.2,.7,.2,1)}
  .pb-choix:hover i{transform:scale(1.18) rotate(-6deg)}
  .ph-arrow-right{display:inline-block;transition:transform .25s cubic-bezier(.2,.7,.2,1)}
  a:hover .ph-arrow-right,a:focus-visible .ph-arrow-right{transform:translateX(4px)}
  .card .card-visual{transition:transform .5s cubic-bezier(.2,.7,.2,1)}
  a.card:hover .card-visual{transform:scale(1.03)}
  .hero-service-tag{transition:transform .25s ease,border-color .3s ease}
  .hero-service-tag:hover{transform:translateY(-2px);border-color:var(--accent)}

  /* Bouton WhatsApp flottant : trois ondes discrètes après l'arrivée sur la page */
  .whatsapp-button::after{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid var(--whatsapp);opacity:0;pointer-events:none;animation:mo-onde 2.2s 2.5s ease-out 3}

  /* ---------- Animations liées au défilement ---------- */
  @supports (animation-timeline: view()){

    /* En-têtes : une ombre apparaît dès qu'on défile */
    [data-om-page]>.entete,.ocf-header{animation:mo-ombre linear both;animation-timeline:scroll(root);animation-range:0 160px}

    /* Apparition des blocs */
    .bloc>h2,
    .bloc>p,
    .cam-cadre,
    .ex-bloc,
    .rea-grille>.ba,
    .rea-photo,
    .pb-choix,
    .arg,
    .gr-entete,
    .gr-carrousel,
    .zones-liste,
    .horaires,
    .pg-section>:not(.cards):not(.steps),
    .cards>.card,
    .steps>.step,
    .cta-band,
    .ct-side>*,
    .ocf-footer-grid>*{
      animation:mo-monte linear both;
      animation-timing-function:cubic-bezier(.2,.7,.2,1);
      animation-timeline:view();
      animation-range:entry 0% cover 30%;
    }
    /* Décalage en cascade dans les grilles */
    .pb-choix:nth-child(3n+2),.arg:nth-child(4n+2),.cards>.card:nth-child(3n+2),.steps>.step:nth-child(4n+2),.ocf-footer-grid>:nth-child(2){animation-range:entry 6% cover 34%}
    .pb-choix:nth-child(3n),.arg:nth-child(4n+3),.cards>.card:nth-child(3n),.steps>.step:nth-child(4n+3),.ocf-footer-grid>:nth-child(3){animation-range:entry 12% cover 38%}
    .steps>.step:nth-child(4n),.ocf-footer-grid>:nth-child(4){animation-range:entry 18% cover 42%}
  }
}

/* ---------- Ouverture du site : le triangle du logo se dessine (0,8 s, une fois par visite) ----------
   Classe logo-intro posée sur <html> par src/tete.js ; jamais si le visiteur réduit les animations. */
@media (prefers-reduced-motion: no-preference){
  html.logo-intro .entete-marque,html.logo-intro .ocf-header-brand{position:relative}
  html.logo-intro .entete-marque::before,html.logo-intro .ocf-header-brand::before{
    content:"";position:absolute;left:0;top:50%;width:var(--logo-entete,58px);height:var(--logo-entete,58px);transform:translateY(-50%);
    background:url(/assets/logo-trace.svg) center/contain no-repeat;pointer-events:none;animation:logo-trace-fin .25s .55s ease forwards}
  html.logo-intro .entete-marque img,html.logo-intro .ocf-header-brand img{opacity:0;animation:logo-net .25s .55s ease forwards}
  html.logo-intro .entete-marque{--logo-entete:64px}
  @media (max-width:767px){ html.logo-intro .entete-marque{--logo-entete:56px} }
  @media (max-width:400px){ html.logo-intro .entete-marque{--logo-entete:52px} }
  @keyframes logo-net{to{opacity:1}}
  @keyframes logo-trace-fin{to{opacity:0}}
}
