/* ============================================================
   Crisalida — animations (piloté par static/js/motion.js)
   Les états « avant apparition » ne s'appliquent que sous html.mx-ready, posé par le script quand les animations
   sont autorisées : sans JavaScript ou avec « réduire les animations », tout reste visible et immobile.
   ============================================================ */

/* ---------------------------------------------------------------- Apparitions au défilement */
.mx-ready .mx { transition: opacity .75s cubic-bezier(.16, 1, .3, 1), transform .85s cubic-bezier(.16, 1, .3, 1), filter .75s ease, clip-path 1s cubic-bezier(.16, 1, .3, 1); transition-delay: var(--mx-delay, 0ms); }
.mx-ready .mx:not(.mx-in) { opacity: 0; }
.mx-ready .mx[data-mx="up"]:not(.mx-in) { transform: translateY(34px); }
.mx-ready .mx[data-mx="left"]:not(.mx-in) { transform: translateX(-38px); }
.mx-ready .mx[data-mx="right"]:not(.mx-in) { transform: translateX(38px); }
/* Téléphone : apparition par le bas, un bloc venu du côté dépassait de l'écran et faisait glisser la page */
@media (max-width: 760px) {
  .mx-ready .mx[data-mx="left"]:not(.mx-in), .mx-ready .mx[data-mx="right"]:not(.mx-in) { transform: translateY(26px); }
}
.mx-ready .mx[data-mx="zoom"]:not(.mx-in) { transform: scale(.94); filter: blur(6px); }
.mx-ready .mx[data-mx="pop"]:not(.mx-in) { transform: translateY(18px) scale(.96); }
.mx-ready .mx[data-mx="wipe"]:not(.mx-in) { opacity: 1; clip-path: inset(0 0 100% 0 round 14px); }
.mx-ready .mx[data-mx="wipe"].mx-in { clip-path: inset(0 0 0 0 round 14px); }
.mx-ready .mx[data-mx="blur"]:not(.mx-in) { filter: blur(10px); transform: translateY(14px); }
.mx-ready .mx.mx-done { transition-delay: 0ms; }

/* Filet des surtitres tracé à l'apparition de la section */
.eyebrow::before { transform-origin: left center; transition: transform .9s cubic-bezier(.16, 1, .3, 1) .15s; }
.mx-ready .mx:not(.mx-in) .eyebrow::before, .mx-ready .mx.eyebrow:not(.mx-in)::before { transform: scaleX(0); }

/* ---------------------------------------------------------------- Intro des bandeaux (héros) */
.mx-ready .mx-intro > * { animation: mx-rise .9s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(var(--i, 0) * 90ms + 80ms); }
.mx-ready .mx-words .mx-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .08em; margin-bottom: -.08em; }
.mx-ready .mx-words .mx-w > span { display: inline-block; animation: mx-word 1s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(var(--wi, 0) * 55ms + 160ms); }
.mx-ready .mx-words { animation: none !important; }
@keyframes mx-rise { from { opacity: 0; transform: translateY(26px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes mx-word { from { transform: translateY(105%) rotate(4deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* Mots mis en avant du grand titre : dégradé animé (trois passages, puis immobile : il repeint le texte à chaque image).
   Titre découpé en mots (mx-words) : chaque mot porte son propre dégradé. Un « background: inherit » sur le mot
   héritait de son enveloppe .mx-w, sans fond : le mot restait transparent, donc invisible. */
.mx-ready .hero h1 em, .mx-ready .el-hero h1 em,
.mx-ready .hero h1.mx-words em .mx-w > span, .mx-ready .el-hero h1.mx-words em .mx-w > span {
  background: linear-gradient(100deg, #f3697e 0%, #ffb3bf 25%, #f3697e 50%, #e8536a 75%, #f3697e 100%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: mx-shine 7s linear 3;
}
.mx-ready .hero h1.mx-words em, .mx-ready .el-hero h1.mx-words em { background: none; animation: none; color: inherit; }
.mx-ready .hero h1.mx-words em .mx-w > span, .mx-ready .el-hero h1.mx-words em .mx-w > span {
  animation: mx-word 1s cubic-bezier(.16, 1, .3, 1) backwards, mx-shine 7s linear 3;
  animation-delay: calc(var(--wi, 0) * 55ms + 160ms), calc(var(--wi, 0) * 55ms + 1.2s);
}
@keyframes mx-shine { to { background-position: -220% 0; } }

/* Lueurs des bandeaux sombres qui dérivent lentement */
.mx-ready .page-hero:not(.help-hero)::before, .mx-ready .c-hero::before, .mx-ready .el-hero::before, .mx-ready .dash-hero::before {
  animation: mx-drift 16s ease-in-out infinite alternate; will-change: transform;
}
@keyframes mx-drift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(3%, 2%, 0) scale(1.12); } }

/* Indicateur du héros d'accueil qui respire */
.mx-ready .hero-kicker .dot { animation: mx-breathe 2.4s ease-in-out infinite; }
@keyframes mx-breathe { 50% { transform: scale(1.15); opacity: .7; } }

/* ---------------------------------------------------------------- Barre de progression de lecture */
.mx-progress { position: fixed; z-index: 120; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; transform-origin: left center;
  transform: scaleX(0); will-change: transform; background: linear-gradient(90deg, #f3697e, #c0203a 60%, #9a1830); box-shadow: 0 0 10px rgba(192, 32, 58, .45); }
/* Calque dédié : la barre bouge sans repeindre la page. Navigateurs récents : elle suit le défilement d'elle-même. */
@supports (animation-timeline: view()) {
  .mx-progress { animation: mx-progress linear both; animation-timeline: scroll(root block); }
}
@keyframes mx-progress { to { transform: scaleX(1); } }

/* ---------------------------------------------------------------- Parallaxe des fonds de bandeau */
.mx-ready .mx-parallax { will-change: transform; }
@supports (animation-timeline: view()) {
  /* Le bandeau (overflow: hidden, donc conteneur de défilement) publie sa progression sous le nom --mx-hero :
     son fond descend de 22 % de sa hauteur pendant que le bandeau quitte l'écran, sans JavaScript. */
  .mx-ready .mx-parallax-host { view-timeline: --mx-hero block; }
  .mx-ready .mx-parallax { animation: mx-parallax linear both; animation-timeline: --mx-hero; animation-range: exit 0% exit 100%; }
}
@keyframes mx-parallax { from { transform: scale(1.08); } to { transform: translateY(22%) scale(1.08); } }

/* ---------------------------------------------------------------- Cartes en relief (souris uniquement) */
/* Calque dédié uniquement pendant l'effet (sinon une page de cartes en garderait des dizaines en mémoire) */
.mx-tilt.mx-tilting, .mx-tilt.mx-leaving { transform-style: preserve-3d; will-change: transform; }
.mx-tilt.mx-tilting { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px) !important;
  transition: transform .12s ease-out, box-shadow .3s ease !important; box-shadow: var(--sh-xl) !important; }
.mx-tilt.mx-leaving { transition: transform .6s cubic-bezier(.16, 1, .3, 1), box-shadow .4s ease !important; }
.mx-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(420px circle at var(--mx-x, 50%) var(--mx-y, 50%), rgba(255, 255, 255, .22), rgba(232, 83, 106, .08) 35%, transparent 60%);
  mix-blend-mode: soft-light; }
.mx-tilting .mx-glare { opacity: 1; }
[data-theme="dark"] .mx-glare { background: radial-gradient(420px circle at var(--mx-x, 50%) var(--mx-y, 50%), rgba(255, 255, 255, .12), rgba(236, 77, 104, .12) 35%, transparent 60%); mix-blend-mode: screen; }

/* Boutons « magnétiques » : la propriété translate se cumule avec les transformations existantes */
.mx-magnet { translate: var(--mgx, 0px) var(--mgy, 0px); transition: translate .35s cubic-bezier(.16, 1, .3, 1), transform .2s ease, box-shadow .2s ease; }
.mx-magnet.mx-pulling { transition: translate .08s linear, transform .2s ease, box-shadow .2s ease; }

/* Onde au clic */
.btn, .adv-chip, .search-tab, .help-hint, .help-tour, .bo-link { position: relative; overflow: hidden; isolation: isolate; }
.mx-ripple { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; transform: scale(0); opacity: .5;
  background: currentColor; animation: mx-ripple .65s cubic-bezier(.16, 1, .3, 1) forwards; }
@keyframes mx-ripple { to { transform: scale(1); opacity: 0; } }

/* ---------------------------------------------------------------- Graphiques du back-office */
.mx-ready .chart:not(.mx-draw) svg .line, .mx-ready .chart:not(.mx-draw) svg .area, .mx-ready .chart:not(.mx-draw) svg .bar { opacity: 0; }
.mx-ready .chart.mx-draw svg .line { stroke-dasharray: 1; animation: mx-draw 1.6s cubic-bezier(.65, 0, .35, 1) both; }
.mx-ready .chart.mx-draw svg .area { animation: mx-fade 1.2s ease .5s both; }
.mx-ready .chart.mx-draw svg .bar { transform-box: fill-box; transform-origin: center bottom; animation: mx-bar .8s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--bi, 0) * 28ms); }
.mx-ready .spark path { stroke-dasharray: 1; animation: mx-draw 1.4s cubic-bezier(.65, 0, .35, 1) both .3s; }
.mx-ready .progress > span { animation: mx-grow 1.1s cubic-bezier(.16, 1, .3, 1) both .2s; transform-origin: left center; }
@keyframes mx-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mx-fade { from { opacity: 0; } }
@keyframes mx-bar { from { transform: scaleY(0); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes mx-grow { from { transform: scaleX(0); } }

/* ---------------------------------------------------------------- Catalogue : résultats qui se réorganisent */
.mx-ready .mx-flash { animation: mx-rowin .45s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--ri, 0) * 35ms); }
@keyframes mx-rowin { from { opacity: 0; transform: translateY(12px) scale(.985); } }

/* ---------------------------------------------------------------- Transitions entre pages (navigateurs compatibles) */
@view-transition { navigation: auto; }
.header { view-transition-name: site-header; }
.bo-side { view-transition-name: bo-side; }
::view-transition-old(root) { animation: mx-vt-out .22s ease both; }
::view-transition-new(root) { animation: mx-vt-in .45s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes mx-vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes mx-vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------------------------------------------------------------- Préférence « réduire les animations » */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .mx-progress { display: none; }
}
@media print {
  .mx-progress, .mx-glare { display: none !important; }
  .mx { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
}
