/* anim.css — animations « premium » communes à tous les sites de Game Duo.

   ⚠️ SOURCE UNIQUE : Game Duo/partage/anim.css, recopiée sur chaque site par
   `node outils/partage.mjs` (depuis Game Duo/). Ne jamais éditer une copie.
   Va de pair avec anim.js (mêmes attributs data-*).

   À charger AVANT la feuille du site : le site garde le dernier mot.
   Chaque site donne ses couleurs, rien d'autre :
     --fx-a   accent principal   (halo, barre, liseré)
     --fx-b   accent secondaire  (début de la barre, halo)
     --fx-c   accent clair       (fin de la barre, reflets)
   Les classes sont préfixées fx- pour ne heurter aucune classe d'un site.

   Le contenu reste visible sans anim.js : seul .is-out (posé par le script,
   sur ce qui est encore sous l'écran) cache quelque chose. Tout s'arrête si
   l'appareil demande moins d'animations (bloc en fin de fichier). */

:root {
  --fx-a: #f0b452;
  --fx-b: #f06a4f;
  --fx-c: #f7d79a;
  --fx-glare: rgb(255 255 255 / 10%);   /* intensité du reflet (data-glare) */
  --fx-glare-size: 420px;
  --fx-ease: cubic-bezier(.2, .7, .2, 1);
  --fx-spring: cubic-bezier(.2, .8, .2, 1);
}

/* Une entrée « depuis la droite », un anneau qui tourne, un téléphone penché
   débordent un instant du bord : sans ceci la page défile de côté sur mobile.
   clip et non hidden : ne crée pas de conteneur de défilement (sticky intact). */
html, body { overflow-x: clip; }

/* ─── Apparition au défilement (data-reveal, data-stagger) ───
   translate et non transform : une carte inclinée garde son inclinaison. */
[data-reveal] {
  transition: opacity .9s var(--fx-ease) var(--d, 0ms),
              translate .9s var(--fx-ease) var(--d, 0ms),
              filter .9s ease var(--d, 0ms);
}
/* Pas de flou (filter: blur) sur l'état caché : retiré le 21/11/2026. Chaque
   élément flouté devient un calque graphique ; sur Tous à bord (53 éléments,
   SVG animés, captures), Safari affichait une page blanche. */
.anim .is-out { opacity: 0; translate: 0 34px; }
.anim .is-out[data-reveal="left"] { translate: -60px 0; }
.anim .is-out[data-reveal="right"] { translate: 60px 0; }

/* ─── Titre mot par mot (data-words) : chaque mot monte de sous un cache ─── */
[data-words] .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  /* Marge pour l'italique et les jambages, rendue aussitôt par la marge
     négative : l'espacement du texte ne change pas, le cache ne rogne plus. */
  padding: 0 .28em .18em .22em;
  margin: 0 -.28em -.18em -.22em;
}
[data-words] .w > span { display: inline-block; }
.anim [data-words] .w > span {
  animation: fxWordUp 1.15s var(--fx-spring) both;
  animation-delay: calc(var(--i, 0) * 85ms + 120ms);
}
/* Titre en dégradé (background-clip: text) : un mot animé a sa propre couche,
   le dégradé doit donc être reposé sur chaque mot. Le site le donne dans
   --fx-words-bg et pose la classe fx-clip, sur le titre ou sur un de ses
   enfants (<em>…). */
[data-words] .w > span { background-image: var(--fx-words-bg, none); }
[data-words] .fx-clip .w > span,
[data-words].fx-clip .w > span {
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 0 .22em .16em .2em; margin: 0 -.22em -.16em -.2em;
}
@keyframes fxWordUp { from { transform: translateY(115%) rotate(5deg); } to { transform: none; } }

/* ─── Halo qui suit la souris (.fx-spotlight, posé par anim.js) ─── */
.fx-spotlight {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(520px circle at var(--sx, 50%) var(--sy, 30%),
    color-mix(in srgb, var(--fx-a) 8%, transparent),
    color-mix(in srgb, var(--fx-b) 3%, transparent) 40%, transparent 65%);
  opacity: 0;
  transition: opacity .8s ease;
}
.fx-spotlight.is-on { opacity: 1; }

/* ─── Barre de lecture (navigateurs qui lient une animation au défilement) ─── */
.fx-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .fx-progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 2px;
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--fx-b), var(--fx-a), var(--fx-c));
    box-shadow: 0 0 12px color-mix(in srgb, var(--fx-a) 60%, transparent);
    pointer-events: none;
    animation: fxProgress linear both;
    animation-timeline: scroll(root);
  }
  @keyframes fxProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ─── Boutons aimantés (data-magnetic) ───
   .anim devant : passe AVANT la transition propre au bouton du site, et la
   reprend (transform, fond, ombre, bordure) pour ne rien lui retirer. */
.anim [data-magnetic] {
  translate: var(--tx, 0px) var(--ty, 0px);
  transition: translate .45s var(--fx-spring), transform .2s ease, background .2s ease,
              box-shadow .2s ease, border-color .2s ease, color .2s ease;
}

/* ─── Inclinaison (data-tilt) ─── */
[data-tilt] { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }

/* ─── Reflet qui suit la souris ou le doigt (data-glare) ───
   Occupe ::after : à ne pas poser sur un élément qui s'en sert déjà. */
[data-glare] { position: relative; isolation: isolate; }
[data-glare]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(var(--fx-glare-size) circle at var(--mx, 50%) var(--my, 0%), var(--fx-glare), transparent 45%);
  opacity: 0;
  transition: opacity .4s ease;
}
[data-glare]:hover::after, [data-glare].fx-touch::after { opacity: 1; }

/* ─── Reflet qui balaie un bouton (data-sheen) ───
   En boucle lente, pas au survol : il se voit aussi au doigt (repris de Tous à
   bord). Glisse par background-position et non translate : le calque ne sort
   jamais de la boîte (Safari ne le découpait pas quand le bouton bouge).
   Occupe ::after. */
[data-sheen] { position: relative; overflow: hidden; isolation: isolate; }
[data-sheen]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 40%, rgb(255 255 255 / 55%) 50%, transparent 60%) no-repeat;
  background-size: 300% 100%;
  background-position: 100% 0;
  animation: fxSheen 5.5s ease-in-out 1.5s infinite;
}
@keyframes fxSheen { 0%, 74% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ─── Liseré de lumière qui fait le tour au survol (data-glow) ───
   Occupe ::before. --fx-glow-tint (couleur) teinte le liseré. */
@property --fx-ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
[data-glow] { position: relative; }
[data-glow]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--fx-ang), transparent 0 55%,
    color-mix(in srgb, var(--fx-glow-tint, var(--fx-b)) 90%, transparent) 72%,
    color-mix(in srgb, var(--fx-a) 95%, transparent) 84%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease;
  animation: fxBorderSpin 4.5s linear infinite;
}
[data-glow]:hover::before, [data-glow].fx-touch::before { opacity: 1; }
@keyframes fxBorderSpin { to { --fx-ang: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-words] .w > span, [data-magnetic], [data-glare]::after,
  [data-sheen]::after, [data-glow]::before { animation: none !important; transition: none !important; }
  /* Sans animation liée au défilement, la barre resterait pleine. */
  .fx-progress, .fx-spotlight { display: none !important; }
  [data-tilt] { transform: none; }
}
