/* ==========================================================================
   Lot 17.1 (md/plancms_enrichi.md) — 58 animations du CMS.
   Servie seulement si un bloc de la page en porte une (sx_anim_ressources()).
   TOUT est conditionné à html.sx-anim, posée par le script en ligne : jamais sous
   « moins d'animations » ni sous Save-Data, et retirée par le filet de sécurité si le
   moteur (sx-anim.js) ne démarre pas. Sans cette classe : rien n'est caché, rien ne bouge.
   Cibles : .sxa.sxa--<code> (posées par sx-anim.js) ; jouée quand .sxa-on est ajoutée.
   Variables : --sxa-k (vitesse : 0,5 / 1 / 2), --sxa-l (délai), --sxa-r (répétitions),
   --sxa-c (pas de la cascade), --sxa-p (avancement au défilement, 0 à 1), --i (rang).
   ========================================================================== */
html.sx-anim { --sxa-e: cubic-bezier(.2,.7,.2,1); }
html.sx-anim .sxa { --sxa-run: calc(600ms * var(--sxa-k, 1)); }

/* Bloc entier porteur d'une ENTRÉE : caché jusqu'au déclenchement (la cascade cache ses cartes, pas le bloc). */
html.sx-anim .sx[data-sx-af="entree"]:not([data-sx-a="cascade"]):not([data-sx-a="trace"]):not(.sxa-on) { opacity: 0; }

/* ---------------------------------------------------------------- Entrées (25) */
html.sx-anim .sxa-on:is(.sxa--fondu,.sxa--fondu_haut,.sxa--fondu_bas,.sxa--fondu_gauche,.sxa--fondu_droite,.sxa--zoom_avant,.sxa--zoom_arriere,
  .sxa--rebond,.sxa--elastique,.sxa--retourne_h,.sxa--retourne_v,.sxa--rotation,.sxa--glisse_haut,.sxa--glisse_bas,.sxa--glisse_gauche,
  .sxa--glisse_droite,.sxa--rideau,.sxa--cercle,.sxa--diagonale,.sxa--flou) {
  animation-duration: var(--sxa-run); animation-timing-function: var(--sxa-e); animation-delay: var(--sxa-l, 0ms);
  animation-iteration-count: var(--sxa-r, 1); animation-fill-mode: both;
}
html.sx-anim .sxa-on.sxa--fondu         { animation-name: sxa-fondu; }
html.sx-anim .sxa-on.sxa--fondu_haut    { animation-name: sxa-fondu-haut; }
html.sx-anim .sxa-on.sxa--fondu_bas     { animation-name: sxa-fondu-bas; }
html.sx-anim .sxa-on.sxa--fondu_gauche  { animation-name: sxa-fondu-gauche; }
html.sx-anim .sxa-on.sxa--fondu_droite  { animation-name: sxa-fondu-droite; }
html.sx-anim .sxa-on.sxa--zoom_avant    { animation-name: sxa-zoom-avant; }
html.sx-anim .sxa-on.sxa--zoom_arriere  { animation-name: sxa-zoom-arriere; }
html.sx-anim .sxa-on.sxa--rebond        { animation-name: sxa-rebond; animation-timing-function: ease-out; }
html.sx-anim .sxa-on.sxa--elastique     { animation-name: sxa-elastique; animation-timing-function: ease-out; }
html.sx-anim .sxa-on.sxa--retourne_h    { animation-name: sxa-retourne-h; }
html.sx-anim .sxa-on.sxa--retourne_v    { animation-name: sxa-retourne-v; }
html.sx-anim .sxa-on.sxa--rotation      { animation-name: sxa-rotation; }
html.sx-anim .sxa-on.sxa--glisse_haut   { animation-name: sxa-glisse-haut; }
html.sx-anim .sxa-on.sxa--glisse_bas    { animation-name: sxa-glisse-bas; }
html.sx-anim .sxa-on.sxa--glisse_gauche { animation-name: sxa-glisse-gauche; }
html.sx-anim .sxa-on.sxa--glisse_droite { animation-name: sxa-glisse-droite; }
html.sx-anim .sxa-on.sxa--rideau        { animation-name: sxa-rideau; }
html.sx-anim .sxa-on.sxa--cercle        { animation-name: sxa-cercle; }
html.sx-anim .sxa-on.sxa--diagonale     { animation-name: sxa-diagonale; }
html.sx-anim .sxa-on.sxa--flou          { animation-name: sxa-flou; }
@keyframes sxa-fondu          { from { opacity: 0; } to { opacity: 1; } }
@keyframes sxa-fondu-haut     { from { opacity: 0; transform: translateY(36px); } to { opacity: 1; transform: none; } }
@keyframes sxa-fondu-bas      { from { opacity: 0; transform: translateY(-36px); } to { opacity: 1; transform: none; } }
@keyframes sxa-fondu-gauche   { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes sxa-fondu-droite   { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes sxa-zoom-avant     { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes sxa-zoom-arriere   { from { opacity: 0; transform: scale(1.15); } to { opacity: 1; transform: none; } }
@keyframes sxa-rebond         { 0% { opacity: 0; transform: translateY(40px); } 55% { opacity: 1; transform: translateY(-10px); } 75% { transform: translateY(4px); } 100% { opacity: 1; transform: none; } }
@keyframes sxa-elastique      { 0% { opacity: 0; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.08); } 70% { transform: scale(.96); } 85% { transform: scale(1.02); } 100% { opacity: 1; transform: none; } }
@keyframes sxa-retourne-h     { from { opacity: 0; transform: perspective(800px) rotateY(80deg); } to { opacity: 1; transform: none; } }
@keyframes sxa-retourne-v     { from { opacity: 0; transform: perspective(800px) rotateX(80deg); } to { opacity: 1; transform: none; } }
@keyframes sxa-rotation       { from { opacity: 0; transform: rotate(-10deg) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes sxa-glisse-haut    { from { opacity: 0; transform: translateY(-100px); } to { opacity: 1; transform: none; } }
@keyframes sxa-glisse-bas     { from { opacity: 0; transform: translateY(100px); } to { opacity: 1; transform: none; } }
@keyframes sxa-glisse-gauche  { from { opacity: 0; transform: translateX(-120px); } to { opacity: 1; transform: none; } }
@keyframes sxa-glisse-droite  { from { opacity: 0; transform: translateX(120px); } to { opacity: 1; transform: none; } }
@keyframes sxa-rideau         { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes sxa-cercle         { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }
@keyframes sxa-diagonale      { from { clip-path: polygon(0 0, 0 0, 0 0, 0 0); } to { clip-path: polygon(0 0, 200% 0, 0 200%, 0 0); } }
@keyframes sxa-flou           { from { opacity: 0; filter: blur(14px); } to { opacity: 1; filter: none; } }
/* Le dévoilement (rideau, cercle, diagonale) montre l'élément : son opacité suit la classe .sxa-on. */
html.sx-anim .sxa-on:is(.sxa--rideau,.sxa--cercle,.sxa--diagonale) { opacity: 1; }

/* Texte découpé (machine à écrire, lettres, mots) : sx-anim.js pose des <span class="sxa-ch" style="--i">,
   aria-hidden, et garde le texte entier pour les lecteurs d'écran (.sxa-sr). */
.sxa-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html.sx-anim .sxa--machine.sxa-on, html.sx-anim .sxa--lettres.sxa-on, html.sx-anim .sxa--mots.sxa-on { opacity: 1; }
html.sx-anim .sxa--machine .sxa-ch, html.sx-anim .sxa--lettres .sxa-ch, html.sx-anim .sxa--mots .sxa-ch { opacity: 0; display: inline-block; white-space: pre; }
html.sx-anim .sxa--machine.sxa-on .sxa-ch { animation: sxa-fondu 1ms steps(1) calc(var(--sxa-l, 0ms) + var(--i) * 45ms * var(--sxa-k, 1)) both; }
html.sx-anim .sxa--lettres.sxa-on .sxa-ch { animation: sxa-fondu-haut calc(420ms * var(--sxa-k, 1)) var(--sxa-e) calc(var(--sxa-l, 0ms) + var(--i) * 32ms * var(--sxa-k, 1)) both; }
html.sx-anim .sxa--mots.sxa-on .sxa-ch    { animation: sxa-fondu-haut calc(520ms * var(--sxa-k, 1)) var(--sxa-e) calc(var(--sxa-l, 0ms) + var(--i) * 110ms * var(--sxa-k, 1)) both; }

/* Tracé du dessin (icônes SVG de l'élément) : chemins ramenés à une longueur de 1 par sx-anim.js. */
html.sx-anim .sxa--trace :is(path,line,polyline,polygon,circle,rect,ellipse) { stroke-dasharray: 1; stroke-dashoffset: 1; }
html.sx-anim .sxa--trace.sxa-on :is(path,line,polyline,polygon,circle,rect,ellipse) { animation: sxa-trace calc(1400ms * var(--sxa-k, 1)) ease-in-out var(--sxa-l, 0ms) both; }
@keyframes sxa-trace { to { stroke-dashoffset: 0; } }

/* Cascade : les cartes entrent l'une après l'autre (pas : --sxa-c). */
html.sx-anim .sxa-carte { opacity: 0; }
html.sx-anim .sxa-on .sxa-carte, html.sx-anim .sxa-carte.sxa-on { animation: sxa-fondu-haut var(--sxa-run, 600ms) var(--sxa-e) calc(var(--sxa-l, 0ms) + var(--i) * var(--sxa-c, 100ms)) both; }

/* ---------------------------------------------------------------- Continues et attention (20) */
html.sx-anim .sxa-on:is(.sxa--pulsation,.sxa--battement,.sxa--secousse,.sxa--vibration,.sxa--balancement,.sxa--flottement,.sxa--rotation_lente,
  .sxa--clignotement,.sxa--vague,.sxa--rebond_continu,.sxa--respiration,.sxa--neon,.sxa--degrade_texte,.sxa--gelatine,.sxa--tada,.sxa--oscillation,.sxa--halo) {
  animation-delay: var(--sxa-l, 0ms); animation-iteration-count: var(--sxa-r, infinite); animation-fill-mode: both;
}
html.sx-anim .sxa-on.sxa--pulsation      { animation-name: sxa-pulsation;   animation-duration: calc(1600ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
html.sx-anim .sxa-on.sxa--battement      { animation-name: sxa-battement;   animation-duration: calc(1400ms * var(--sxa-k, 1)); }
html.sx-anim .sxa-on.sxa--secousse       { animation-name: sxa-secousse;    animation-duration: calc(800ms * var(--sxa-k, 1)); }
html.sx-anim .sxa-on.sxa--vibration      { animation-name: sxa-vibration;   animation-duration: calc(300ms * var(--sxa-k, 1)); animation-timing-function: linear; }
html.sx-anim .sxa-on.sxa--balancement    { animation-name: sxa-balancement; animation-duration: calc(2200ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; transform-origin: 50% 0; }
html.sx-anim .sxa-on.sxa--flottement     { animation-name: sxa-flottement;  animation-duration: calc(3200ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
html.sx-anim .sxa-on.sxa--rotation_lente { animation-name: sxa-tour;        animation-duration: calc(14000ms * var(--sxa-k, 1)); animation-timing-function: linear; }
html.sx-anim .sxa-on.sxa--clignotement   { animation-name: sxa-clignote;    animation-duration: calc(2000ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }   /* au plus 1 par seconde, même en « rapide » */
html.sx-anim .sxa-on.sxa--vague          { animation-name: sxa-vague;       animation-duration: calc(2400ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
html.sx-anim .sxa-on.sxa--rebond_continu { animation-name: sxa-rebond-c;    animation-duration: calc(1300ms * var(--sxa-k, 1)); }
html.sx-anim .sxa-on.sxa--respiration    { animation-name: sxa-respire;     animation-duration: calc(4000ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
html.sx-anim .sxa-on.sxa--neon           { animation-name: sxa-neon;        animation-duration: calc(2400ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
html.sx-anim .sxa-on.sxa--degrade_texte  { animation-name: sxa-degrade;     animation-duration: calc(4000ms * var(--sxa-k, 1)); animation-timing-function: linear;
  background-image: linear-gradient(90deg, currentColor 0%, var(--c-pink, #c2185b) 35%, var(--c-gold, #b8860b) 65%, currentColor 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
html.sx-anim .sxa-on.sxa--gelatine       { animation-name: sxa-gelatine;    animation-duration: calc(1600ms * var(--sxa-k, 1)); }
html.sx-anim .sxa-on.sxa--tada           { animation-name: sxa-tada;        animation-duration: calc(1600ms * var(--sxa-k, 1)); }
html.sx-anim .sxa-on.sxa--oscillation    { animation-name: sxa-oscille;     animation-duration: calc(2600ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
html.sx-anim .sxa-on.sxa--halo           { animation-name: sxa-halo;        animation-duration: calc(2400ms * var(--sxa-k, 1)); animation-timing-function: ease-in-out; }
@keyframes sxa-pulsation   { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes sxa-battement   { 0%, 40%, 100% { transform: scale(1); } 10% { transform: scale(1.08); } 20% { transform: scale(.98); } 30% { transform: scale(1.06); } }
@keyframes sxa-secousse    { 0%, 100% { transform: none; } 15%, 45%, 75% { transform: translateX(-6px); } 30%, 60%, 90% { transform: translateX(6px); } }
@keyframes sxa-vibration   { 0%, 100% { transform: none; } 25% { transform: translate(1px, -1px); } 50% { transform: translate(-1px, 1px); } 75% { transform: translate(1px, 1px); } }
@keyframes sxa-balancement { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes sxa-flottement  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sxa-tour        { to { transform: rotate(360deg); } }
@keyframes sxa-clignote    { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes sxa-vague       { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-4px) rotate(-1.5deg); } 75% { transform: translateY(4px) rotate(1.5deg); } }
@keyframes sxa-rebond-c    { 0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(.8,0,1,1); } 50% { transform: translateY(-14px); animation-timing-function: cubic-bezier(0,0,.2,1); } }
@keyframes sxa-respire     { 0%, 100% { transform: scale(.97); } 50% { transform: scale(1.03); } }
@keyframes sxa-neon        { 0%, 100% { text-shadow: 0 0 2px currentColor, 0 0 6px currentColor; } 50% { text-shadow: 0 0 4px currentColor, 0 0 14px currentColor, 0 0 24px currentColor; } }
@keyframes sxa-degrade     { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes sxa-gelatine    { 0%, 100% { transform: none; } 30% { transform: scale(1.12, .88); } 40% { transform: scale(.88, 1.12); } 50% { transform: scale(1.05, .95); } 65% { transform: scale(.98, 1.02); } 75% { transform: scale(1.01, .99); } }
@keyframes sxa-tada        { 0%, 100% { transform: none; } 10%, 20% { transform: scale(.94) rotate(-3deg); } 30%, 50%, 70%, 90% { transform: scale(1.06) rotate(3deg); } 40%, 60%, 80% { transform: scale(1.06) rotate(-3deg); } }
@keyframes sxa-oscille     { 0%, 100% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
@keyframes sxa-halo        { 0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } 50% { box-shadow: 0 0 22px 4px var(--c-pink, #c2185b); } }

/* Reflet balayant : une bande claire traverse l'élément (posé sur le parent d'une image). */
html.sx-anim .sxa--brillance { position: relative; overflow: hidden; }
html.sx-anim .sxa--brillance::after { content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.5) 50%, transparent 70%); }
html.sx-anim .sxa--brillance.sxa-on::after { animation: sxa-reflet calc(2600ms * var(--sxa-k, 1)) ease-in-out var(--sxa-l, 0ms) var(--sxa-r, infinite); }
@keyframes sxa-reflet { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(120%); } }

/* Curseur de saisie : clignote une fois par seconde au plus. */
html.sx-anim .sxa--curseur.sxa-on::after { content: ""; display: inline-block; width: .08em; height: 1em; margin-left: .08em; vertical-align: -.12em;
  background: currentColor; animation: sxa-caret 1s steps(1) var(--sxa-r, infinite); }
@keyframes sxa-caret { 50% { opacity: 0; } }

/* Défilement vertical des cartes : une carte à la fois (sx-anim.js choisit .sxa-act). */
html.sx-anim .sxa-defile > .sxa-hors { display: none !important; }
html.sx-anim .sxa-defile > .sxa-act { animation: sxa-fondu-haut 500ms var(--sxa-e) both; }

/* ---------------------------------------------------------------- Au défilement (10) : --sxa-p de 0 à 1 */
html.sx-anim .sxa--parallaxe_lente  { transform: translate3d(0, calc((var(--sxa-p, .5) - .5) * -60px), 0); will-change: transform; }
html.sx-anim .sxa--parallaxe_rapide { transform: translate3d(0, calc((var(--sxa-p, .5) - .5) * -160px), 0); will-change: transform; }
html.sx-anim .sxa--zoom_defil       { transform: scale(calc(1 + var(--sxa-p, 0) * .15)); }
html.sx-anim .sxa--rotation_defil   { transform: rotate(calc((var(--sxa-p, .5) - .5) * 24deg)); }
html.sx-anim .sxa--apparition_prog  { opacity: calc(min(1, var(--sxa-p, 1) * 2.2)); transform: translateY(calc((1 - min(1, var(--sxa-p, 1) * 2.2)) * 30px)); }
html.sx-anim .sxa--effacement       { opacity: calc(1 - var(--sxa-p, 0) * 1.4); }   /* s'efface dès qu'il sort par le haut */
html.sx-anim .sxa--lignes           { clip-path: inset(0 0 calc((1 - min(1, var(--sxa-p, 1) * 2)) * 100%) 0); }
html.sx-anim .sxa--epingle          { position: sticky; top: 0; z-index: 0; }
html.sx-anim .sxa--progression      { position: relative; }
html.sx-anim .sxa--progression::before { content: ""; position: absolute; left: 0; top: 0; height: 4px; z-index: 2; pointer-events: none;
  width: calc(var(--sxa-p, 0) * 100%); background: var(--c-pink, #c2185b); }
/* Défilement horizontal : la liste glisse de côté pendant que la page descend (hauteur réglée par le moteur). */
html.sx-anim .sxa--horizontal { position: relative; }
html.sx-anim .sxa-h-cadre { position: sticky; top: 0; overflow: hidden; }
html.sx-anim .sxa-h-liste { display: flex !important; flex-wrap: nowrap !important; transform: translate3d(var(--sxa-hx, 0px), 0, 0); will-change: transform; }
html.sx-anim .sxa-h-liste > * { flex: 0 0 auto; }

/* ---------------------------------------------------------------- Interaction (3) */
html.sx-anim .sxa--ripple { position: relative; overflow: hidden; }
.sxa-onde { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); background: currentColor; opacity: .28;
  animation: sxa-onde 650ms ease-out forwards; }
@keyframes sxa-onde { to { transform: scale(2.6); opacity: 0; } }
html.sx-anim .sxa--magnetique, html.sx-anim .sxa--tilt { transition: transform 260ms var(--sxa-e); will-change: transform; }

/* ---------------------------------------------------------------- « Moins d'animations » : filet en plus du script */
@media (prefers-reduced-motion: reduce) {
  html.sx-anim .sxa, html.sx-anim .sxa *, html.sx-anim .sxa::before, html.sx-anim .sxa::after, html.sx-anim .sx[data-sx-a] {
    animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; filter: none !important; }
}
