/* =====================================================================
 *  Animations des pages du site, en plus de css/pma.css (inc/head.php les charge partout, sauf $statique).
 *
 *  Arrivée (CSS seul) : la photo en fondu, le logo et le menu, puis l'accroche, puis les rubriques une à une.
 *  Défilement (js/anime.js), une seule fois par bloc et sans que les blocs bougent : les titres de section sortent
 *  de derrière un masque, les rendez-vous et les articles se mettent en place l'un après l'autre (articles :
 *  photo et texte ensemble, en fondu et léger glissé), les textes des cartes Adhésion et Shop arrivent en place, le t-shirt apparaît en fondu.
 *  Le club : photo du haut en fondu, puis surtitre, titre, accroche, sous-menu (logo et menu fixes) ; au défilement, présentation,
 *  objectifs et lieux en fondu glissé, et dans les cartes des disciplines les éléments arrivent l'un après l'autre.
 *  Rien de tout ça si le visiteur a demandé moins d'animations sur son appareil.
 * ===================================================================== */

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

  /* Arrivée ----------------------------------------------------------------------------------------------------- */
  .hero .slides{animation:pm-fondu .9s ease-out backwards}
  .hero .trame{animation:pm-fondu 1.2s ease-out backwards}
  .hero .kicker{animation:pm-monte .6s cubic-bezier(.2,.8,.2,1) .55s backwards}
  .hero .cats li{overflow:hidden}   /* chaque rubrique surgit de sous sa ligne */
  .hero .cats a{animation:pm-surgit .55s cubic-bezier(.2,.9,.25,1) backwards}
  .hero .cats li:nth-child(1) a{animation-delay:.75s}
  .hero .cats li:nth-child(2) a{animation-delay:.85s}
  .hero .cats li:nth-child(3) a{animation-delay:.95s}
  .hero .cats li:nth-child(4) a{animation-delay:1.05s}
  .hero .cats li:nth-child(5) a{animation-delay:1.15s}
  .hero .cats li:nth-child(6) a{animation-delay:1.25s}
  body:has(.hero) .top{animation:pm-descend .6s cubic-bezier(.2,.8,.2,1) .15s backwards}   /* accueil seulement : logo et menu d'abord */
  .hero .dots,.hero .scroll{animation:pm-fondu .8s ease 1.6s backwards}
  /* Pages intérieures (le club) : photo du haut, puis surtitre, titre, accroche et sous-menu */
  .phero{animation:pm-fondu .9s ease-out backwards}
  .phero .k{animation:pm-monte .6s cubic-bezier(.2,.8,.2,1) .5s backwards}
  .phero h1{animation:pm-monte .7s cubic-bezier(.2,.8,.2,1) .65s backwards}
  .phero .lead{animation:pm-monte .6s cubic-bezier(.2,.8,.2,1) .85s backwards}
  .subnav{animation:pm-fondu .6s ease 1.05s backwards}

  @keyframes pm-fondu{from{opacity:0}}   /* « backwards » : après l’animation, les styles normaux (survol…) reprennent */
  @keyframes pm-monte{from{opacity:0;transform:translateY(24px)}}
  @keyframes pm-surgit{from{transform:translateY(105%)}}
  @keyframes pm-descend{from{opacity:0;transform:translateY(-100%)}}

  /* Défilement -------------------------------------------------------------------------------------------------- */
  .apparait{opacity:0;transform:translateY(24px);
            transition:opacity .8s ease,transform .9s cubic-bezier(.2,.8,.2,1);transition-delay:calc(var(--rang,0) * 90ms)}
  .apparait.vu{opacity:1;transform:none}

  /* Titres de section : le texte monte derrière un masque */
  :is(.s-head,.rule-title).apparait{opacity:1;transform:none}
  :is(.s-head h2,.rule-title){overflow:hidden}
  :is(.s-head h2,.rule-title) > span{display:inline-block;transform:translateY(105%);transition:transform .8s cubic-bezier(.2,.8,.2,1)}
  :is(.s-head.vu h2,.rule-title.vu) > span{transform:none}
  .s-head .more{opacity:0;transition:opacity .6s ease .4s}
  .s-head.vu .more{opacity:1}

  /* Rendez-vous (accueil, agenda) : la case reste en place, la date puis les textes y arrivent, case après case */
  :is(.ev,.ag-row).apparait{opacity:1;transform:none}
  :is(.ev,.ag-row).apparait:not(.vu) > *{opacity:0}
  :is(.ev,.ag-row).vu > *{animation:pm-monte .7s cubic-bezier(.2,.8,.2,1) backwards;animation-delay:calc(var(--rang,0) * 120ms + var(--n,0) * 80ms)}

  /* Cartes des disciplines (le club) : même principe, élément après élément */
  .cl-card.apparait{opacity:1;transform:none}
  .cl-card.apparait:not(.vu) > *{opacity:0}
  .cl-card.vu > *{animation:pm-monte .7s cubic-bezier(.2,.8,.2,1) backwards;animation-delay:calc(var(--rang,0) * 150ms + var(--n,0) * 70ms)}

  /* Cartes Adhésion et Shop : la carte reste en place, ses textes arrivent l'un après l'autre */
  .card.apparait{opacity:1;transform:none}
  .card.apparait:not(.vu) :is(h3,p,.btn,.tee){opacity:0}
  .card.vu :is(h3,p,.btn){animation:pm-monte .8s cubic-bezier(.2,.8,.2,1) backwards}   /* animation : le survol du bouton reste vif */
  .card.vu p{animation-delay:.12s}
  .card.vu .btn{animation-delay:.24s}
  .card.vu .tee{animation:pm-fondu 1s ease .3s backwards}
}
