/*
  Clichir (clichir.site) — animations.css
  Partie 1 : SOCLE commun (templates/one-page). Partie 2 : animations propres au site (logo, signature).
  Sans JavaScript, rien n'est masqué : le script de tête pose data-motion="full" avant le premier dessin,
  et les entrées ne jouent qu'avec ce repère. Aucun mode d'animation réduit (décision de l'utilisateur).
*/

@keyframes entree-monter {
  from {
    opacity: 0;
    transform: translateY(var(--depart, 26px));
  }
}

@keyframes entree-descendre {
  from {
    opacity: 0;
    transform: translateY(-26px);
  }
}

@keyframes entree-fondu {
  from {
    opacity: 0;
  }
}

@keyframes entree-echelle {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

/* Barre du haut : elle descend au premier affichage */
[data-motion="full"] .barre__inner {
  animation: entree-descendre 0.8s var(--ease-sortie) 0.1s backwards;
}

/* Premier écran : chaque élément [data-entree] monte, décalé par --d (en secondes) */
[data-motion="full"] [data-entree] {
  animation: entree-monter 0.9s var(--ease-sortie) calc(0.15s + var(--d, 0) * 1s) backwards;
}

[data-motion="full"] [data-entree="fondu"] {
  animation-name: entree-fondu;
}

[data-motion="full"] [data-entree="echelle"] {
  animation-name: entree-echelle;
}

/* Titre découpé en mots dans le HTML (<span class="mot" style="--i:n">) */
.mot {
  display: inline-block;
}

[data-motion="full"] [data-entree-titre] .mot {
  --depart: 0.6em;
  animation: entree-monter 0.9s var(--ease-sortie) calc(0.25s + var(--i, 0) * 0.06s) backwards;
}

/* Boucles décoratives arrêtées hors écran */
.hors-ecran .boucle,
.hors-ecran .boucle * {
  animation-play-state: paused !important;
}

/* ============================================================================================
   PARTIE 2 — ANIMATIONS DU SITE (logo en boucle, slogan, signature)
   ============================================================================================ */

/*
  Clichir : la croix verte du logo se trace, se resserre en un point de précision puis revient (en boucle) ;
  un fin trait souligne le slogan de gauche à droite et les lettres apparaissent sous son passage ; le
  réticule du premier écran se cale sur l'image.
*/
[data-motion="full"] .cl-croix {
  animation: cl-croix 5s var(--ease-sortie) infinite;
}

@keyframes cl-croix {
  0% {
    opacity: 1;
    stroke-dashoffset: 1;
    transform: scale(1);
  }
  30%,
  42% {
    stroke-dashoffset: 0;
    transform: scale(1);
  }
  58%,
  86% {
    opacity: 1;
    stroke-dashoffset: 0;
    transform: scale(0.24);
  }
  100% {
    stroke-dashoffset: 0;
    transform: scale(0.24);
    opacity: 0;
  }
}

[data-motion="full"] .cl-point {
  animation: cl-point 5s var(--ease-sortie) infinite;
}

/* Le point blanc de précision n'apparaît que lorsque la croix est entière */
@keyframes cl-point {
  0%,
  26% {
    opacity: 0;
  }
  32%,
  46% {
    opacity: 1;
  }
  54%,
  100% {
    opacity: 0;
  }
}

/* Slogan : un trait passe sous les lettres, qui apparaissent derrière lui */
.barre .marque__slogan::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: var(--vert-vif);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

[data-motion="full"] .barre .marque__slogan::after {
  animation: cl-trait 9s var(--ease-sortie) 0.7s infinite both;
}

@keyframes cl-trait {
  0% {
    transform: scaleX(0);
    transform-origin: 0 50%;
  }
  14% {
    transform: scaleX(1);
    transform-origin: 0 50%;
  }
  22% {
    transform: scaleX(1);
    transform-origin: 100% 50%;
  }
  32%,
  100% {
    transform: scaleX(0);
    transform-origin: 100% 50%;
  }
}

[data-motion="full"] .barre .marque__slogan span {
  animation: cl-lettre 9s ease-out calc(0.75s + var(--i) * 0.036s) infinite both;
}

@keyframes cl-lettre {
  0% {
    opacity: 0;
  }
  4%,
  84% {
    opacity: 1;
  }
  92%,
  100% {
    opacity: 0;
  }
}

/* Le réticule se cale : les coins se referment sur l'image, la croix apparaît */
[data-motion="full"] .reticule__coin {
  animation: cl-calage 1.3s var(--ease-sortie) 0.6s backwards;
}

[data-motion="full"] .reticule__coin--hg {
  --dx: -18px;
  --dy: -18px;
}

[data-motion="full"] .reticule__coin--hd {
  --dx: 18px;
  --dy: -18px;
}

[data-motion="full"] .reticule__coin--bg {
  --dx: -18px;
  --dy: 18px;
}

[data-motion="full"] .reticule__coin--bd {
  --dx: 18px;
  --dy: 18px;
}

@keyframes cl-calage {
  from {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 0));
  }
}

[data-motion="full"] .reticule__croix {
  animation: cl-croix-reticule 4s ease-in-out 1.6s infinite;
}

@keyframes cl-croix-reticule {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(0.7);
    opacity: 1;
  }
}

/* Le point du fil s'allume en douceur */
.fil a[aria-current] .fil__point {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--vert-vif) 18%, transparent);
}

/* ============================================================================================
   T50 (27/10/2026) — premier écran en CSS (il n'attend aucun script) et boucles des écrans
   ============================================================================================ */

/* L'anneau laqué se pose, ses LED tournent comme sur un scanner, l'arc lumineux fait le tour */
[data-motion="full"] .anneau {
  animation: cl-anneau 1.6s var(--ease-sortie) 0.35s backwards;
}

@keyframes cl-anneau {
  from {
    opacity: 0;
    transform: scale(0.86) rotate(-14deg);
  }
}

[data-motion="full"] .anneau__led {
  animation: cl-led 18s linear infinite;
}

@keyframes cl-led {
  to {
    stroke-dashoffset: -100;
  }
}

[data-motion="full"] .anneau__arc {
  animation: cl-arc 7s linear infinite;
}

@keyframes cl-arc {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -100;
  }
}

/* Le comptoir laqué monte du bas de l'écran */
[data-motion="full"] .ouverture::before {
  animation: cl-comptoir 1.4s var(--ease-sortie) 0.15s backwards;
}

@keyframes cl-comptoir {
  from {
    opacity: 0;
    transform: translateY(70px);
  }
}

/* Les deux filets lumineux du surtitre du premier écran se tirent */
[data-motion="full"] .ouverture .surtitre::after {
  animation: cl-filets 1.1s var(--ease-sortie) 0.7s backwards;
}

@keyframes cl-filets {
  from {
    transform: scaleX(0);
  }
}

/* L'écran du schéma : une ligne de balayage passe en boucle */
[data-motion="full"] .schema::after {
  animation: cl-balayage 5.5s cubic-bezier(0.45, 0, 0.55, 1) 1s infinite;
}

@keyframes cl-balayage {
  0% {
    transform: translateY(-110%);
  }
  70%,
  100% {
    transform: translateY(300%);
  }
}

/* ---------- Nouvelle section héros (T53, 02/11/2026) ----------
   L'appareil et sa photo entrent ensemble (jamais de double image) : ils montent de 32 px et se posent en
   descendant de l'échelle 1,04 à 1, sur une courbe de ressort sans rebond. Le mot géant glisse en sens inverse.
   Le halo respire, la lèvre de la turbine pulse, la molette de l'indicateur descend. */
@keyframes heros-plan {
  from {
    opacity: 0;
    transform: translateY(32px) scale(1.04);
  }
}

@keyframes heros-mot {
  from {
    opacity: 0;
    transform: translateX(6%);
  }
}

@keyframes heros-respire {
  50% {
    opacity: 0.55;
    transform: scale(0.94);
  }
}

@keyframes heros-turbine {
  50% {
    opacity: 0.45;
  }
}

@keyframes heros-molette {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(9px);
  }
}

[data-motion="full"] [data-entree="plan"] {
  animation: heros-plan 1.6s cubic-bezier(0.16, 1, 0.3, 1) calc(0.15s + var(--d, 0) * 1s) backwards;
}

[data-motion="full"] .heros__mot > [data-entree] {
  animation: heros-mot 1.9s cubic-bezier(0.16, 1, 0.3, 1) calc(0.15s + var(--d, 0) * 1s) backwards;
}

.heros__halo {
  animation: heros-respire 7s ease-in-out infinite;
}

.heros__lueur {
  animation: heros-turbine 1.8s ease-in-out infinite;
}

.heros__souris::after {
  animation: heros-molette 1.8s ease-in-out infinite;
}

html.a-intro [data-entree="plan"],
html.a-intro .heros__mot > [data-entree] {
  animation-play-state: paused;
}
