/*
 * YukoLabs — animations du site public (chargé après yukolabs.css)
 * Déploiement : /home/yukolabs.com/public_html/assets/css/animations.css
 *
 * La classe « yl-js » est posée sur <html> par un petit script de l'en-tête,
 * sauf si le visiteur a demandé moins d'animations dans son système.
 * Sans elle, tout le site s'affiche normalement, sans rien de caché.
 *
 * Sommaire
 *  1. Arrivée de la page          6. Rayon des codes
 *  2. Apparitions au défilement   7. Formes flottantes, confettis
 *  3. Titres lettre par lettre    8. Fiole de retour en haut
 *  4. Mascotte                    9. Changement de page
 *  5. Bandeaux, boutons, survols 10. Images clés
 */

/* 1. Arrivée de la page ---------------------------------------------------- */

/* Les tuiles de l'accueil tombent en place l'une après l'autre */
.yl-js .yl-mosaique > * { animation: yl-tombe 0.75s cubic-bezier(0.2, 1.35, 0.4, 1) backwards; }
.yl-js .yl-mosaique > :nth-child(1) { animation-delay: 0.05s; }
.yl-js .yl-mosaique > :nth-child(2) { animation-delay: 0.18s; }
.yl-js .yl-mosaique > :nth-child(3) { animation-delay: 0.28s; }
.yl-js .yl-mosaique > :nth-child(4) { animation-delay: 0.36s; }
.yl-js .yl-mosaique > :nth-child(5) { animation-delay: 0.46s; }
.yl-js .yl-mosaique > :nth-child(6) { animation-delay: 0.56s; }

/* Le contenu de la grande tuile suit */
.yl-js .yl-accroche > .yl-sticker { animation: yl-tampon 0.5s 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) backwards; }
.yl-js .yl-accroche__titre > span:not(.yl-pop) { animation: yl-glisse 0.6s cubic-bezier(0.2, 1.2, 0.4, 1) backwards; }
.yl-js .yl-accroche__titre > span:nth-child(1) { animation-delay: 0.4s; }
.yl-js .yl-accroche__titre > span:nth-child(2) { animation-delay: 0.52s; }
.yl-js .yl-accroche__texte { animation: yl-monte 0.6s 0.95s ease-out backwards; }
.yl-js .yl-accroche__boutons > * { animation: yl-tombe 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) backwards; }
.yl-js .yl-accroche__boutons > :nth-child(1) { animation-delay: 1.1s; }
.yl-js .yl-accroche__boutons > :nth-child(2) { animation-delay: 1.2s; }
.yl-js .yl-accroche .yl-mascotte svg { animation: yl-mascotte-arrive 0.9s 0.9s cubic-bezier(0.2, 1.5, 0.4, 1) backwards; }

/* Le bouton principal fait signe de temps en temps */
.yl-js .yl-accroche__boutons .yl-btn--jaune { animation: yl-tombe 0.6s 1.1s cubic-bezier(0.2, 1.5, 0.4, 1) backwards, yl-coucou 6s 4s infinite; }

/* En-têtes des autres pages */
.yl-js .yl-page-tete > *,
.yl-js .yl-compte-tete > *,
.yl-js .yl-boite:not(.yl-boite--large),
.yl-js .yl-produit__visuel,
.yl-js .yl-achat,
.yl-js .yl-introuvable { animation: yl-tombe 0.7s cubic-bezier(0.2, 1.35, 0.4, 1) backwards; }
.yl-js .yl-page-tete > :nth-child(2),
.yl-js .yl-compte-tete > :nth-child(2),
.yl-js .yl-achat { animation-delay: 0.14s; }

/* 2. Apparitions au défilement --------------------------------------------- */

.yl-js .yl-section__tete,
.yl-js .yl-real,
.yl-js .yl-fenetre,
.yl-js .yl-rayon__tete,
.yl-js .yl-cartouche,
.yl-js .yl-rayon__fiches,
.yl-js .yl-rayon__tous,
.yl-js .yl-vide,
.yl-js .yl-appel,
.yl-js .yl-filtres,
.yl-js .yl-carte,
.yl-js .yl-atout,
.yl-js .yl-bloc,
.yl-js .yl-achat-ligne,
.yl-js .yl-compte-formulaires > *,
.yl-js .yl-pied__ligne { opacity: 0; }

.yl-js .yl-vu {
  opacity: 1;
  animation: yl-entre-bas 0.75s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
  animation-delay: var(--retard, 0ms);
}
.yl-js .yl-appel.yl-vu { animation-name: yl-entre-zoom; animation-duration: 0.8s; }
.yl-js .yl-cartouche.yl-vu { animation-name: yl-entre-gauche; }
.yl-js .yl-real--yuko .yl-fenetre.yl-vu { animation-name: yl-fenetre-droite; animation-duration: 0.9s; animation-delay: 0.2s; }
.yl-js .yl-real--p2r .yl-fenetre.yl-vu { animation-name: yl-fenetre-gauche; animation-duration: 0.9s; animation-delay: 0.2s; }

/* Le mot surligné se dessine de gauche à droite */
.yl-js .yl-section__tete.yl-vu .yl-surligne { animation: yl-surligne 0.55s 0.45s ease-out backwards; }

/* 3. Titres lettre par lettre ---------------------------------------------- */

.yl-lettre,
.yl-accroche__titre .yl-lettre { display: inline-block; }   /* (les lignes du titre sont des blocs, pas ses lettres) */
.yl-js .yl-accroche__titre .yl-lettre {
  animation: yl-lettre 0.55s cubic-bezier(0.2, 1.7, 0.4, 1) backwards, yl-vague 7s infinite;
  animation-delay: calc(var(--i) * 55ms + 0.7s), calc(var(--i) * 70ms + 4.5s);
}
.yl-js .yl-appel .yl-lettre { opacity: 0; }
.yl-js .yl-appel.yl-vu .yl-lettre {
  opacity: 1;
  animation: yl-lettre 0.55s cubic-bezier(0.2, 1.7, 0.4, 1) backwards, yl-vague 7s infinite;
  animation-delay: calc(var(--i) * 55ms + 0.45s), calc(var(--i) * 70ms + 3.5s);
}

/* Le grand YUKOLABS du pied de page */
.yl-js .yl-pied__nom .yl-lettre { opacity: 0; transition: translate 0.25s cubic-bezier(0.2, 1.8, 0.4, 1), rotate 0.25s cubic-bezier(0.2, 1.8, 0.4, 1), color 0.2s ease; }
.yl-js .yl-pied__nom.yl-vu .yl-lettre {
  opacity: 1;
  animation: yl-lettre-chute 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
  animation-delay: calc(var(--i) * 70ms);
}
@media (hover: hover) {
  .yl-pied__nom .yl-lettre:hover { translate: 0 -12%; rotate: -6deg; color: var(--violet); }
  .yl-pied__nom .yl-lettre:nth-child(odd):hover { rotate: 6deg; color: var(--rose); }
}

/* 4. Mascotte --------------------------------------------------------------- */

.yl-liquide { animation: yl-houle 2.6s linear infinite; }
.yl-js .yl-bulle { animation: yl-bulle-monte 2.8s ease-in infinite; }
.yl-js .yl-bulle--2 { animation-delay: 0.9s; }
.yl-js .yl-bulle--3 { animation-delay: 1.8s; }
.yl-pupilles { transition: transform 0.12s ease-out; }

/* 5. Bandeaux, boutons, survols --------------------------------------------- */

/* Deux bandeaux qui se croisent et défilent en sens inverse */
.yl-defile { position: relative; height: 178px; margin: 62px 0 -34px; overflow: hidden; pointer-events: none; }
/* On coupe ce qui dépasse sur les côtés, pas en hauteur (les bandeaux sont penchés) */
@supports (overflow: clip) { .yl-defile { overflow-x: clip; overflow-y: visible; } }
.yl-defile__rang {
  position: absolute;
  left: -6vw;
  width: 112vw;
  padding: 12px 0 11px;
  overflow: hidden;
  border-top: var(--trait);
  border-bottom: var(--trait);
  box-shadow: 0 6px 0 var(--encre);
  white-space: nowrap;
}
.yl-defile__rang--a { top: 26px; background: var(--violet); color: var(--blanc); transform: rotate(-2.4deg); }
.yl-defile__rang--b { top: 74px; background: var(--jaune); color: var(--encre); transform: rotate(1.8deg); }
.yl-defile__piste { display: inline-flex; animation: yl-defile 34s linear infinite; }
.yl-defile__rang--b .yl-defile__piste { animation-direction: reverse; animation-duration: 40s; }
.yl-defile__piste span {
  display: inline-flex;
  align-items: center;
  font-family: var(--titre);
  font-weight: 900;
  font-size: clamp(20px, 2.4vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.yl-defile__piste span::after {
  content: '';
  width: 0.62em;
  height: 0.62em;
  margin: 0 0.7em;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: yl-tourne 5s linear infinite;
}

@media (max-width: 760px) {
  .yl-defile { height: 148px; margin: 40px 0 -30px; }
  .yl-defile__rang { padding: 9px 0 8px; box-shadow: 0 5px 0 var(--encre); }
  .yl-defile__rang--a { top: 22px; }
  .yl-defile__rang--b { top: 62px; }
}

/* Reflet qui traverse les boutons au survol */
.yl-js .yl-btn { position: relative; overflow: hidden; }
.yl-js .yl-btn::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -60%;
  width: 40%;
  height: 140%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
.yl-js .yl-btn[disabled]::after { display: none; }

/* Cartes et tuiles qui s'inclinent sous le curseur (posé par animations.js) */
.yl-js .yl-incline,
.yl-js .yl-incline:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--leve, 0px));
  box-shadow: var(--ox, 0px) calc(8px + var(--oy, 0px)) 0 var(--encre);
  transition: transform 0.14s ease-out, box-shadow 0.14s ease-out;
}
.yl-js .yl-incline:hover { --leve: -6px; }
.yl-js .yl-fenetre.yl-incline,
.yl-js .yl-fenetre.yl-incline:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotate(var(--angle, 2deg));
  box-shadow: none;
}

/* Stickers de la stack : on peut les attraper */
.yl-js .yl-stack__liste li { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.yl-js .yl-stack__liste li.yl-attrape { cursor: grabbing; z-index: 5; position: relative; scale: 1.12; box-shadow: 0 10px 0 var(--encre); }
.yl-js .yl-stack__liste li.yl-secoue { animation: yl-secoue 0.5s ease; }

/* Le terminal écrit tout seul (les lignes sont gérées par animations.js) */
.yl-terminal--tape .yl-terminal__ecran div { opacity: 1; animation: none; }

@media (hover: hover) {
  .yl-js .yl-btn:hover::after { left: 130%; transition: left 0.55s ease; }
  .yl-js .yl-puce { transition: transform 0.18s cubic-bezier(0.2, 1.8, 0.4, 1); }
  .yl-js .yl-puce:hover { transform: translateY(-3px) rotate(-3deg); }
  .yl-js .yl-chiffre:hover strong { animation: yl-rebond 0.5s ease; }
  .yl-js .yl-logo:hover svg { animation: yl-secoue 0.5s ease; }
}

/* 6. Rayon des codes -------------------------------------------------------- */

.yl-fiche.yl-entre .yl-visuel__fantome { animation: yl-numero 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards; }
.yl-fiche.yl-entre .yl-visuel img { animation: yl-zoom-image 0.55s ease-out backwards; }
.yl-fiche.yl-entre .yl-visuel .yl-sticker { animation: yl-tampon 0.45s 0.18s cubic-bezier(0.2, 1.6, 0.4, 1) backwards; }
.yl-fiche.yl-entre .yl-fiche__nom { animation: yl-glisse 0.4s 0.05s ease-out backwards; }
.yl-fiche.yl-entre .yl-prix strong { animation: yl-rebond 0.5s 0.15s ease backwards; }

/* 7. Formes flottantes, confettis ------------------------------------------- */

.yl-js .yl-section, .yl-js .yl-rayon { position: relative; }
.yl-js .yl-section > .yl-wrap, .yl-js .yl-rayon > .yl-wrap { position: relative; z-index: 1; }
.yl-forme { position: absolute; z-index: 0; width: var(--t, 46px); height: var(--t, 46px); pointer-events: none; will-change: transform; }
.yl-forme svg { width: 100%; height: 100%; overflow: visible; animation: yl-tourne var(--duree, 14s) linear infinite; }
.yl-forme--balance svg { animation: yl-balance 4s ease-in-out infinite; }
@media (max-width: 1379px) { .yl-forme { display: none; } }

.yl-confettis { position: fixed; inset: 0; z-index: 300; overflow: hidden; pointer-events: none; }
.yl-confetti { position: absolute; top: 0; left: 0; border: 2px solid var(--encre); will-change: transform, opacity; }

/* 8. Fiole de retour en haut ------------------------------------------------ */

.yl-remonte {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 45;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  background: var(--blanc);
  border: var(--trait);
  border-radius: 50%;
  box-shadow: 0 5px 0 var(--encre);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(26px) scale(0.6);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1), visibility 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.yl-remonte--visible { opacity: 1; visibility: visible; transform: none; }
.yl-remonte svg { width: 30px; height: 36px; overflow: visible; }
.yl-remonte__niveau { transform: translateY(calc((1 - var(--progres, 0)) * 46px)); transition: transform 0.15s linear; }
.yl-remonte:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--encre); }
@media (hover: hover) { .yl-remonte:hover svg { animation: yl-secoue 0.5s ease; } }
@media (max-width: 760px) {
  .yl-remonte { right: 14px; bottom: 14px; width: 54px; height: 54px; }
  .yl-remonte svg { width: 26px; height: 31px; }
  .yl-avec-barre .yl-remonte { bottom: calc(92px + env(safe-area-inset-bottom)); }
}

/* 9. Changement de page ----------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .yl-entete { view-transition-name: yl-entete; }
  ::view-transition-old(root) { animation: yl-page-sort 0.2s ease-in both; }
  ::view-transition-new(root) { animation: yl-page-entre 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
}

/* 10. Images clés ----------------------------------------------------------- */

@keyframes yl-tombe          { from { opacity: 0; transform: translateY(46px) scale(0.86) rotate(-3deg); } }
@keyframes yl-glisse         { from { opacity: 0; transform: translateX(-34px); } }
@keyframes yl-monte          { from { opacity: 0; transform: translateY(18px); } }
@keyframes yl-tampon         { from { opacity: 0; transform: scale(2.4) rotate(14deg); } }
@keyframes yl-mascotte-arrive { from { opacity: 0; transform: translateY(120px) rotate(24deg) scale(0.5); } }
@keyframes yl-coucou         { 0%, 9%, 100% { rotate: 0deg; } 1.5% { rotate: -5deg; } 3% { rotate: 4deg; } 4.5% { rotate: -3deg; } 6% { rotate: 2deg; } 7.5% { rotate: -1deg; } }
@keyframes yl-entre-bas      { from { opacity: 0; transform: translateY(54px) scale(0.94) rotate(-1.2deg); } }
@keyframes yl-entre-zoom     { from { opacity: 0; transform: scale(0.8) rotate(-2deg); } }
@keyframes yl-entre-gauche   { from { opacity: 0; transform: translateX(-70px) rotate(-3deg); } }
@keyframes yl-fenetre-droite { from { opacity: 0; transform: translateX(140px) rotate(14deg); } }
@keyframes yl-fenetre-gauche { from { opacity: 0; transform: translateX(-140px) rotate(-14deg); } }
@keyframes yl-surligne       { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes yl-lettre         { from { opacity: 0; transform: translateY(0.5em) rotate(12deg) scale(0.4); } }
@keyframes yl-lettre-chute   { from { opacity: 0; transform: translateY(-0.7em) rotate(-10deg); } }
@keyframes yl-vague          { 0%, 7%, 100% { translate: 0 0; rotate: 0deg; } 3.5% { translate: 0 -0.16em; rotate: -4deg; } }
@keyframes yl-houle          { to { transform: translateX(-100px); } }
@keyframes yl-bulle-monte    { 0% { transform: translateY(14px) scale(0.5); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-34px) scale(1.15); opacity: 0; } }
@keyframes yl-defile         { to { transform: translateX(-50%); } }
@keyframes yl-tourne         { to { transform: rotate(360deg); } }
@keyframes yl-balance        { 0%, 100% { transform: rotate(-10deg) translateY(0); } 50% { transform: rotate(10deg) translateY(-8px); } }
@keyframes yl-secoue         { 0%, 100% { rotate: 0deg; } 20% { rotate: -10deg; } 40% { rotate: 8deg; } 60% { rotate: -5deg; } 80% { rotate: 3deg; } }
@keyframes yl-rebond         { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.22, 0.86); } 65% { transform: scale(0.92, 1.1); } }
@keyframes yl-numero         { from { opacity: 0; transform: translateY(60%) rotate(-8deg) scale(0.7); } }
@keyframes yl-zoom-image     { from { transform: scale(1.12); } }
@keyframes yl-page-sort      { to { opacity: 0; transform: translateY(-14px) scale(0.985); } }
@keyframes yl-page-entre     { from { opacity: 0; transform: translateY(30px) scale(0.985); } }

/* Moins d'animations demandées par le visiteur : on coupe tout */
@media (prefers-reduced-motion: reduce) {
  .yl-defile__piste, .yl-liquide { animation: none !important; }
  .yl-remonte { transition: none; }
}
