/* ───── Mouvement du site ─────
   Conventions retenues (validées avec Jérémie) :
   · d’une page à l’autre, aucun fondu de page : le navigateur garde l’ancienne page à l’écran jusqu’à ce que la nouvelle
     soit prête, l’en-tête ne bouge pas. Un fondu de page s’ajoutait à l’ouverture et donnait des transitions en double ;
   · photos, dessins, vidéos et cartes sont là dès l’arrivée et ne s’animent jamais (une image animée clignote dans Safari
     à la fin de l’animation et rappelle qu’elle se charge) ;
   · seuls les textes de l’ouverture arrivent : le titre en fondu, les textes en montant à peine, les uns après les autres ;
   · au défilement, seuls les blocs de texte encore sous l’écran apparaissent, une seule fois, en montant légèrement ;
   · « réduire les animations » coupe tout.
   On n’anime que opacity et translate (et l’échelle pour les barres d’un graphique). Les animations utilisent
   « backwards » : une fois finies, elles ne laissent aucun style derrière elles. */

@keyframes mv-in { from { opacity: 0; } }
@keyframes mv-up { from { opacity: 0; translate: 0 14px; } }
@keyframes mv-grow { from { scale: 1 0; } }

/* ─ Accueil : « Plusieurs défis », puis « Un seul bureau d’études techniques », puis le texte et les boutons ; la vidéo ne bouge pas ─ */
html.mv-first .hero:not([hidden]) h1 > span { display: block; animation: mv-up .9s cubic-bezier(.22, 1, .36, 1) backwards; }
html.mv-first .hero:not([hidden]) h1 > span:nth-child(1) { animation-delay: .15s; }
html.mv-first .hero:not([hidden]) h1 > span:nth-child(2) { animation-delay: .4s; }
html.mv-first .hero:not([hidden]) .lead { animation: mv-up .8s cubic-bezier(.22, 1, .36, 1) .7s backwards; }
html.mv-first .hero:not([hidden]) .actions { animation: mv-up .8s cubic-bezier(.22, 1, .36, 1) .85s backwards; }

/* ─ Pages intérieures : le surtitre et le titre en fondu, puis les textes qui montent à peine ─ */
html.mv-first :is(.gt-open-copy, .mo-hero-copy, .vb-hero-copy, .qs-hero-copy, .tq-oc-main, .tq-open-copy, .tq-ob-copy, .tq-od-doc, .px-head, .jx-head, .ar-head, .cp-hero-copy, .lg-head) > :is(.pg-kicker, h1) { animation: mv-in .9s ease-out backwards; }
html.mv-first :is(.gt-open-copy, .mo-hero-copy, .vb-hero-copy, .qs-hero-copy, .tq-oc-main, .tq-open-copy, .tq-ob-copy, .tq-od-doc, .px-head, .jx-head, .ar-head, .cp-hero-copy, .lg-head) > :not(.pg-kicker, h1) { animation: mv-up .8s cubic-bezier(.22, 1, .36, 1) .3s backwards; }
html.mv-first :is(.gt-open-copy, .mo-hero-copy, .vb-hero-copy, .qs-hero-copy, .tq-oc-main, .tq-open-copy, .tq-ob-copy, .tq-od-doc, .px-head, .jx-head, .ar-head, .cp-hero-copy, .lg-head) > :nth-child(n+4):not(.pg-kicker, h1) { animation-delay: .45s; }
/* la note manuscrite arrive en dernier, comme écrite après coup */
html.mv-first :is(.gt-hand, .vb-note) { animation: mv-in .9s ease-out .9s backwards; }

/* Décret tertiaire : les barres du graphique poussent depuis l’axe (c’est une donnée qui se construit, pas une image) */
html.mv-first .tq-ex :is(.mx-b, .mx-b13, .mx-b21) { transform-box: fill-box; transform-origin: 50% 100%; animation: mv-grow .7s cubic-bezier(.22, 1, .36, 1) .2s backwards; }
html.mv-first .tq-ex rect[fill^="url"] { transform-box: fill-box; transform-origin: 50% 100%; animation: mv-grow .7s cubic-bezier(.22, 1, .36, 1) .9s backwards; }
html.mv-first .tq-ex .mx-tr { animation: mv-in .6s ease-out 1.4s backwards; }
html.mv-first .tq-steps li { transform-origin: 50% 100%; animation: mv-grow .9s cubic-bezier(.22, 1, .36, 1) backwards; }
html.mv-first .tq-steps li:nth-child(2) { animation-delay: .12s; }
html.mv-first .tq-steps li:nth-child(3) { animation-delay: .24s; }
html.mv-first .tq-steps li:nth-child(4) { animation-delay: .36s; }

/* ─ Au défilement : les blocs de texte encore sous l’écran apparaissent une fois ─ */
html.mv-on [data-mv]:not(.mv-in) { opacity: 0; translate: 0 20px; }
html.mv-on [data-mv].mv-in { transition: opacity .8s cubic-bezier(.22, 1, .36, 1), translate .8s cubic-bezier(.22, 1, .36, 1); transition-delay: calc(var(--mv-i, 0) * 80ms); }

/* Frise d’étapes (maîtrise d’œuvre) : le trait part de la gauche, chaque étape le suit, doucement */
html.mv-on [data-mv="steps"], html.mv-on [data-mv="steps"].mv-in { position: relative; opacity: 1; translate: none; border-top-color: transparent; transition: none; }
html.mv-on [data-mv="steps"]::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 2px; background: rgba(255, 255, 255, .5); transform: scaleX(0); transform-origin: 0 50%; }
html.mv-on [data-mv="steps"].mv-in::after { transform: scaleX(1); transition: transform 1.8s cubic-bezier(.45, 0, .25, 1) .1s; }
html.mv-on [data-mv="steps"] > li { opacity: 0; translate: 0 16px; }
html.mv-on [data-mv="steps"].mv-in > li { opacity: 1; translate: none; transition: opacity 1s cubic-bezier(.22, 1, .36, 1), translate 1s cubic-bezier(.22, 1, .36, 1); transition-delay: calc(var(--k, 0) * 200ms + 250ms); }

@media (prefers-reduced-motion: reduce) {
  html *, html *::before, html *::after { animation: none !important; }
  html.mv-on [data-mv] > li { opacity: 1 !important; translate: none !important; transition: none !important; }
  html.mv-on [data-mv] { opacity: 1 !important; translate: none !important; transition: none !important; }
}
