/* =========================================================
   Salon du Chocolat Tarbes : animations des pages (charte v1)
   Durées ≤ 450 ms. Tout est coupé si « réduire les animations ».
   ========================================================= */

/* ---------- 1. Transition entre les pages (View Transitions, sans JS) ----------
   Chrome, Edge, Safari récents. Ailleurs : chargement normal. */
@view-transition { navigation: auto; }

.sct-header { view-transition-name: sct-header; }

/* Page quittée : s'estompe en remontant légèrement ; nouvelle page : arrive par le bas, léger flou qui se dissipe */
::view-transition-old(root) { animation: sct-vt-sortie .28s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: sct-vt-entree .42s cubic-bezier(.2, .8, .2, 1) .06s both; }

@keyframes sct-vt-sortie { to { opacity: 0; transform: translateY(-10px); } }
@keyframes sct-vt-entree { from { opacity: 0; transform: translateY(14px); } }

/* Header : reste en place, sans fondu entre l'ancien et le nouveau */
::view-transition-group(sct-header) { animation-duration: .35s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); z-index: 10; }
::view-transition-old(sct-header) { animation: none; opacity: 0; }
::view-transition-new(sct-header) { animation: none; }

/* Photo exposant : morphing carte <-> fiche (script sct-transitions) */
::view-transition-group(sct-expo-photo) { animation-duration: .5s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); z-index: 5; }
::view-transition-old(sct-expo-photo), ::view-transition-new(sct-expo-photo) { height: 100%; width: 100%; object-fit: cover; overflow: clip; animation-duration: .5s; }
::view-transition-image-pair(sct-expo-photo) { border-radius: var(--radius-lg, 20px); overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------- 2. Apparitions v2 (script animations.js, automatique) ----------
   Même courbe partout, cascade par type : surtitre, titre mot par mot, texte, cartes, photos en rideau, boutons.
   Exclure un élément : classe sct-sans-anim dans Elementor. */
.sct-anim-active .sct-a {
  transition: opacity .55s ease var(--sct-a-delai, 0ms), transform .65s cubic-bezier(.2, .8, .2, 1) var(--sct-a-delai, 0ms);
}
.sct-anim-active .sct-a:not(.est-vu) { opacity: 0; transform: translateY(16px); }
.sct-anim-active .sct-a--sur:not(.est-vu) { transform: translateY(8px); }
/* Titre : chaque mot surgit de derrière une ligne invisible */
.sct-anim-active .sct-a--titre, .sct-anim-active .sct-a--titre:not(.est-vu) { opacity: 1; transform: none; transition: none; }
.sct-mot-a { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .12em; margin-bottom: -.12em; }
.sct-mot-a > span { display: inline-block; transition: transform .75s cubic-bezier(.2, .8, .2, 1); }
.sct-a--titre:not(.est-vu) .sct-mot-a > span { transform: translateY(110%); }
/* Photos : dévoilées en rideau de bas en haut, avec un léger dézoom */
.sct-anim-active .sct-a--image, .sct-anim-active .sct-a--image:not(.est-vu) { opacity: 1; transform: none; }
/* La découpe porte sur l'image, pas sur son cadre : le cadre reste détectable par le navigateur */
.sct-anim-active .sct-a--image img { clip-path: inset(0 0 0 0); transition: clip-path .9s cubic-bezier(.7, 0, .2, 1) var(--sct-a-delai, 0ms), transform 1.2s cubic-bezier(.2, .8, .2, 1) var(--sct-a-delai, 0ms); }
.sct-anim-active .sct-a--image:not(.est-vu) img { clip-path: inset(100% 0 0 0); transform: scale(1.08); }
/* Coulures des bandeaux sombres : les gouttes s'écoulent */
.sct-a-coulure::after { transform: scaleY(0); transform-origin: top center; transition: transform 1.1s cubic-bezier(.5, 0, .2, 1) .15s; }
.sct-a-coulure.est-coulee::after { transform: scaleY(1); }
/* Jamais masqué dans l'éditeur Elementor */
.elementor-editor-active .sct-a, .elementor-editor-active .sct-a img { opacity: 1 !important; transform: none !important; clip-path: none !important; }

/* Micro-interactions : liens isolés à flèche, soulignement qui se dessine au survol */
p > a.sct-lien:only-child { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 calc(100% - 6px) / 0 1.5px no-repeat; transition: background-size .3s cubic-bezier(.2, .8, .2, 1), color .15s ease; }
p > a.sct-lien:only-child:hover, p > a.sct-lien:only-child:focus-visible { background-size: 100% 1.5px; }
/* Liens dans les textes : soulignement conservé (accessibilité), qui s'épaissit au survol */
.elementor-widget-text-editor p a:not(.sct-lien):not(.sct-btn) { text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-thickness .2s ease, text-underline-offset .2s ease; }
.elementor-widget-text-editor p a:not(.sct-lien):not(.sct-btn):hover { text-decoration-thickness: 2px; text-underline-offset: 4px; }
/* Photo des cartes exposants : léger zoom au survol */
.sct-exposant__media { overflow: hidden; }
.sct-exposant__media img { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
@media (hover: hover) { .sct-exposant:hover .sct-exposant__media img { transform: scale(1.04); } }
/* ---------- 3. Survol des cartes ---------- */
@media (hover: hover) {
  .sct-exposant, .sct-carte--survol, .sct-partenaire, .sct-info-pratique {
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease;
  }
  .sct-exposant:hover, .sct-carte--survol:hover, .sct-partenaire:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
}

/* ---------- 4. Boutons : légère pression au clic ---------- */
:is(a.sct-btn, button.sct-btn, .sct-btn .elementor-button) { transition: background-color .15s ease, color .15s ease, transform .1s ease; }
:is(a.sct-btn, button.sct-btn, .sct-btn .elementor-button):active { transform: scale(.97); }

/* Mobile : transitions entre pages plus courtes (moins de mémoire mobilisée, changement de page plus vif) */
@media (max-width: 767px) {
  ::view-transition-old(root) { animation-duration: .18s; }
  ::view-transition-new(root) { animation-duration: .28s; animation-delay: 0s; }
  ::view-transition-group(sct-expo-photo), ::view-transition-old(sct-expo-photo), ::view-transition-new(sct-expo-photo) { animation-duration: .35s; }
}
