/* Apollo Studio - animations du site (préprod, 19/11/2026)
 * Chargé par le mu-plugin apollo-animations.php, avec animations.js (defer).
 * Principes :
 * - tout le mouvement est sous @media (prefers-reduced-motion: no-preference) et sous la classe .apa,
 *   posée dans <head> par le mu-plugin : sans JavaScript ou avec « réduire les animations », rien ne bouge ni ne se cache ;
 * - seulement opacity, translate / scale / transform (et stroke-dashoffset pour le trait sous le mot jaune) ;
 * - l'état caché d'un bloc (.apa-cache) n'est posé que par animations.js, sur des blocs hors écran au chargement ;
 * - ne touche pas aux composants qui ont leurs propres animations : refonte des prestations ([class*="ap-v-"]),
 *   story et lecteur de l'accueil, curseur fusée, chat Groomy, formulaires. */
:root { --apa-e: cubic-bezier(.22, .8, .2, 1); --apa-y: 18px; --apa-jaune: #F0B432; }
@media (max-width: 767px) { :root { --apa-y: 10px; } }

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

/* ---------- Héros des pages intérieures : même entrée que l'accueil ---------- */
/* --apa-h0 : départ du héros. Quand le loader d'arrivée (apollo-effets) s'affiche, le héros attend sa sortie. */
.apa { --apa-h0: 0s; }
.apa.apa-apres-loader { --apa-h0: .95s; }
/* Soleil : il se lève (posé sur le fil d'Ariane) */
.apa .ap-ariane:not([class*="ap-v-"]):not(:has(+ [class*="ap-v-"]))::before { animation: apa-soleil .7s var(--apa-e) var(--apa-h0) both; }
.apa .ap-ariane:not([class*="ap-v-"]):not(:has(+ [class*="ap-v-"])) .kt-inside-inner-col > * { animation: apa-fondu .45s var(--apa-e) var(--apa-h0) both; }
/* Anneau et étoiles */
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"]))::before { animation: apa-anneau .7s var(--apa-e) calc(var(--apa-h0) + .16s) both; }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) > .kt-row-column-wrap::before { animation: apa-etoile .6s var(--apa-e) calc(var(--apa-h0) + .26s) both; }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) > .kt-row-column-wrap::after { animation: apa-etoile .6s var(--apa-e) calc(var(--apa-h0) + .36s) both; }
/* Titre : il monte, puis le mot jaune arrive (le trait jaune dessous est ajouté par animations.js) */
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) h1 { animation: apa-titre .7s var(--apa-e) var(--apa-h0) both; }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) h1 mark { position: relative; animation: apa-fondu .6s var(--apa-e) calc(var(--apa-h0) + .12s) both; }
/* Ce qui suit le titre : en cascade courte (tout a commencé à apparaître avant 250 ms) */
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) .wp-block-kadence-column:first-child > .kt-inside-inner-col > :not(h1) { animation: apa-monte .6s var(--apa-e) calc(var(--apa-h0) + .1s) both; }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) .wp-block-kadence-column:first-child > .kt-inside-inner-col > h1 ~ * { animation-delay: calc(var(--apa-h0) + .14s); }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) .wp-block-kadence-column:first-child > .kt-inside-inner-col > h1 ~ * ~ * { animation-delay: calc(var(--apa-h0) + .18s); }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) .wp-block-kadence-column:first-child > .kt-inside-inner-col > h1 ~ * ~ * ~ * { animation-delay: calc(var(--apa-h0) + .22s); }
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) .wp-block-kadence-column:first-child > .kt-inside-inner-col > h1 ~ * ~ * ~ * ~ * { animation-delay: calc(var(--apa-h0) + .24s); }
/* Visuel du héros (photo, carte, chiffres) : il s'installe ; jamais le formulaire */
.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) > .kt-row-column-wrap > .wp-block-kadence-column:nth-child(2):not(.ap-panneau-form):not(:has(form, iframe)) { animation: apa-pose .7s var(--apa-e) calc(var(--apa-h0) + .08s) both; }
/* Trait jaune sous le mot jaune : il se dessine */
.apa .apa-trait { position: absolute; left: 0; bottom: -.16em; width: 100%; height: .22em; overflow: visible; pointer-events: none; }
.apa .apa-trait path { fill: none; stroke: var(--apa-jaune); stroke-width: var(--apa-ep, 4px); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: apa-trace .7s var(--apa-e) var(--apa-td, .5s) forwards; }

/* Le soleil, l'anneau et la grande étoile suivent légèrement la souris (ordinateur) ; la grande étoile scintille doucement */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
	.apa .ap-ariane::before { translate: calc(var(--apa-mx, 0) * -28px) calc(var(--apa-my, 0) * -20px); transition: translate .9s var(--apa-e); }
	.apa .ap-ouverture::before { translate: calc(var(--apa-mx, 0) * 34px) calc(var(--apa-my, 0) * 24px); transition: translate .9s var(--apa-e); }
	.apa .ap-ouverture > .kt-row-column-wrap::before { translate: calc(var(--apa-mx, 0) * -40px) calc(var(--apa-my, 0) * -28px); transition: translate .9s var(--apa-e); }
	.apa .ap-ouverture:not([class*="ap-v-"]):not(:has([class*="ap-v-"])) > .kt-row-column-wrap::before { animation: apa-etoile .6s var(--apa-e) calc(var(--apa-h0) + .26s) both, apa-luit 3.4s ease-in-out calc(var(--apa-h0) + 1.2s) infinite alternate; }
}

/* ---------- Apparitions au défilement (classes posées par animations.js) ---------- */
.apa .apa-cache { opacity: 0; }
.apa .apa-on { animation: apa-monte .6s var(--apa-e) var(--apa-d, 0ms) both; will-change: opacity, translate; }
.apa .apa-on.apa-t-pose { animation-name: apa-pose; animation-duration: .7s; }
.apa .apa-on.apa-t-logo { animation-name: apa-logo; animation-duration: .5s; }
.apa .apa-on.apa-t-carte { animation-name: apa-carte; }
/* Frise : le trait se dessine, les pastilles arrivent une par une */
.apa .apa-frise-cache > .kt-row-column-wrap::before { transform: scaleX(0); }
.apa .apa-frise-on > .kt-row-column-wrap::before { transform-origin: 0 50%; animation: apa-trait-x .7s var(--apa-e) both; }
.apa .apa-on.apa-t-etape .ap-frise__num { animation: apa-pastille .5s var(--apa-e) calc(var(--apa-d, 0ms) + 80ms) both; }
@media (max-width: 1024px) {
	.apa .apa-frise-cache > .kt-row-column-wrap::before { transform: scaleY(0); }
	.apa .apa-frise-on > .kt-row-column-wrap::before { transform-origin: 50% 0; animation-name: apa-trait-y; }
}
/* Bloc « 30 minutes de conseil » : son soleil se lève */
.apa .apa-on .appel30__soleil { animation: apa-soleil-bloc .7s var(--apa-e) calc(var(--apa-d, 0ms) + 100ms) both; }
/* Compteurs : largeur figée pendant le décompte (aucun décalage de mise en page) */
.apa-compteur { display: inline-block; white-space: nowrap; text-align: left; }

/* ---------- FAQ : la réponse glisse et apparaît en douceur ---------- */
.apa .ap-faq .kt-panel-is-expanding > .kt-accordion-panel-inner { animation: apa-faq .45s var(--apa-e) both; }
.apa .ap-faq .kt-panel-is-collapsing > .kt-accordion-panel-inner { opacity: 0; transition: opacity .2s; }

/* ---------- Micro-interactions au survol (souris uniquement) ---------- */
@media (hover: hover) and (pointer: fine) {
	/* Cartes qui se soulèvent (les cartes « étude » et projets le font déjà) */
	.ap-chiffre-accueil:hover, .kb-query-item:hover { transform: translateY(-3px); }
	.ap-atout, .ap-membre, .ap-hv2 .temoin { transition: translate .35s var(--apa-e); }
	.ap-atout:hover, .ap-membre:hover, .ap-hv2 .temoin:hover { translate: 0 -3px; }
	/* Liens fléchés : la flèche avance et le souligné se redessine de gauche à droite.
	   La flèche passe en inline-block pour pouvoir bouger : elle garde son propre souligné au repos. */
	p.ap-lien-fleche > a { position: relative; }
	p.ap-lien-fleche > a::after { display: inline-block; text-decoration: inherit; transition: transform .3s var(--apa-e); }
	p.ap-lien-fleche > a:hover::after { transform: translateX(4px); }
	p.ap-lien-fleche > a:hover, p.ap-lien-fleche > a:hover::after { text-decoration-color: transparent !important; }
	p.ap-lien-fleche > a::before { content: ""; position: absolute; left: 0; right: 0; top: 1.28em; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; transition: transform .35s var(--apa-e); pointer-events: none; }
	p.ap-lien-fleche > a:hover::before { transform: none; }
}

/* ---------- Mouvements ---------- */
@keyframes apa-fondu { from { opacity: 0; } }
@keyframes apa-monte { from { opacity: 0; translate: 0 var(--apa-y); } }
@keyframes apa-titre { from { opacity: 0; translate: 0 .32em; } }
@keyframes apa-pose { from { opacity: 0; translate: 0 calc(var(--apa-y) * .7); scale: .96; } }
@keyframes apa-carte { from { opacity: 0; translate: 0 var(--apa-y); scale: .98; } }
@keyframes apa-logo { from { opacity: 0; translate: 0 8px; } }
@keyframes apa-soleil { from { opacity: 0; transform: translate3d(6%, 34%, 0) scale(.86); } to { opacity: 1; transform: none; } }
@keyframes apa-soleil-bloc { from { opacity: 0; scale: .7; } }
@keyframes apa-anneau { from { opacity: 0; transform: scale(.7); } to { transform: none; } }
@keyframes apa-etoile { from { opacity: 0; transform: scale(0) rotate(-60deg); } to { transform: none; } }
@keyframes apa-luit { from { scale: 1; } to { opacity: .45; scale: .82; } }
@keyframes apa-trace { to { stroke-dashoffset: 0; } }
@keyframes apa-trait-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes apa-trait-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes apa-pastille { from { opacity: 0; scale: .6; } }
@keyframes apa-faq { from { opacity: 0; translate: 0 -8px; } }

/* Mobile : plus discret (pas de zoom, cascade plus courte), rien ne bouge en continu */
@media (max-width: 767px) {
	@keyframes apa-pose { from { opacity: 0; translate: 0 var(--apa-y); scale: .985; } }
	@keyframes apa-titre { from { opacity: 0; translate: 0 .22em; } }
}

} /* fin prefers-reduced-motion: no-preference */

@media print { .apa .apa-cache { opacity: 1 !important; } }
