/* =========================================================
   Animations Yshira 2026
   Actives seulement quand <html> porte la classe .motion
   (ajoutée en tête de page, jamais si l'utilisateur a demandé
   moins d'animations dans son système).
   Écrit en mobile first, mêmes points de rupture que style.css.
   ========================================================= */
:root {
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-soft: cubic-bezier(.33, 1, .68, 1);
}

/* ---------- Ouverture de page : un seul moment orchestré ---------- */
@keyframes ysh-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes ysh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ysh-porthole { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes ysh-window { from { transform: scale(1.14); } to { transform: scale(1); } }
@keyframes ysh-slide-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

/* Accueil : texte ligne par ligne, puis le hublot s'ouvre, puis la route se dessine (déjà en place) */
.motion .home-hero-copy > * { animation: ysh-rise .8s var(--ease-out) both; }
.motion .home-hero-copy > :nth-child(1) { animation-delay: .05s; }
.motion .home-hero-copy > :nth-child(2) { animation-delay: .18s; }
.motion .home-hero-copy > :nth-child(3) { animation-delay: .3s; }
.motion .hublot { animation: ysh-porthole 1s var(--ease-soft) .15s both; }
.motion .hublot img { animation: ysh-window 2.4s var(--ease-soft) .15s both; }
.motion .hublot figcaption { animation: ysh-rise .6s var(--ease-out) .9s both; }
/* La route du voyage : lente et lisible. Elle démarre quand elle entre à l'écran,
   l'avion avance à vitesse constante et chaque étape s'allume à son passage. */
@keyframes ysh-route-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ysh-route-down { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ysh-route-plane { 0% { right: calc(100% - 26px); opacity: 0; } 6% { opacity: 1; } 100% { right: 0; opacity: 1; } }
@keyframes ysh-route-stop {
  0% { transform: scale(0); box-shadow: 0 0 0 0 #f6a21c00; }
  55% { transform: scale(1.45); box-shadow: 0 0 0 12px #f6a21c33; }
  100% { transform: scale(1); box-shadow: 0 0 0 2px #f6a21c66; }
}
@keyframes ysh-route-text { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.motion .route::before { animation: ysh-route-draw 5.2s linear .4s both; }
.motion .route-plane { animation: ysh-route-plane 5.2s linear .4s both; }
.motion .route li::before { animation: ysh-route-stop .8s var(--ease-out) both; }
.motion .route li :is(b, small) { animation: ysh-route-text .9s var(--ease-out) both; }
/* Téléphone et tablette : chaque tronçon se trace d'une étape à la suivante (vers le bas sur téléphone) */
.motion .route li::after { animation: ysh-route-down 1.1s linear both; }
.motion .route li:nth-child(1)::before { animation-delay: .4s; }
.motion .route li:nth-child(2)::before { animation-delay: 1.7s; }
.motion .route li:nth-child(3)::before { animation-delay: 3s; }
.motion .route li:nth-child(4)::before { animation-delay: 4.3s; }
.motion .route li:nth-child(1)::after { animation-delay: .7s; }
.motion .route li:nth-child(2)::after { animation-delay: 2s; }
.motion .route li:nth-child(3)::after { animation-delay: 3.3s; }
.motion .route li:nth-child(4)::after { animation-delay: 4.6s; }
.motion .route li:nth-child(1) b { animation-delay: .6s; }
.motion .route li:nth-child(2) b { animation-delay: 1.9s; }
.motion .route li:nth-child(3) b { animation-delay: 3.2s; }
.motion .route li:nth-child(4) b { animation-delay: 4.5s; }
.motion .route li:nth-child(1) small { animation-delay: .8s; }
.motion .route li:nth-child(2) small { animation-delay: 2.1s; }
.motion .route li:nth-child(3) small { animation-delay: 3.4s; }
.motion .route li:nth-child(4) small { animation-delay: 4.7s; }
@media (min-width: 681px) {
  .motion .route li::after { animation-name: ysh-route-draw; }
}
/* Ordinateur (981 px et +) : la route est une seule ligne, l'avion la parcourt à vitesse constante */
@media (min-width: 981px) {
  .motion .route li:nth-child(1)::before { animation-delay: .4s; }
  .motion .route li:nth-child(2)::before { animation-delay: 1.76s; }
  .motion .route li:nth-child(3)::before { animation-delay: 3.13s; }
  .motion .route li:nth-child(4)::before { animation-delay: 4.49s; }
  .motion .route li:nth-child(1) b { animation-delay: .6s; }
  .motion .route li:nth-child(2) b { animation-delay: 1.96s; }
  .motion .route li:nth-child(3) b { animation-delay: 3.33s; }
  .motion .route li:nth-child(4) b { animation-delay: 4.69s; }
  .motion .route li:nth-child(1) small { animation-delay: .8s; }
  .motion .route li:nth-child(2) small { animation-delay: 2.16s; }
  .motion .route li:nth-child(3) small { animation-delay: 3.53s; }
  .motion .route li:nth-child(4) small { animation-delay: 4.89s; }
}

/* Tant que la route n'est pas visible, tout reste en attente au point de départ */
.motion .route:not(.is-in)::before,
.motion .route:not(.is-in) .route-plane,
.motion .route:not(.is-in) li::before,
.motion .route:not(.is-in) li::after,
.motion .route:not(.is-in) li :is(b, small) { animation-play-state: paused; }

/* Pages intérieures : bandeau, image ronde et étapes du parcours */
.motion .page-hero-copy > * { animation: ysh-rise .75s var(--ease-out) both; }
.motion .page-hero-copy > :nth-child(1) { animation-delay: .05s; }
.motion .page-hero-copy > :nth-child(2) { animation-delay: .15s; }
.motion .page-hero-copy > :nth-child(3) { animation-delay: .25s; }
.motion .page-hero-copy > :nth-child(4) { animation-delay: .35s; }
.motion .page-hero-image > img { animation: ysh-porthole 1.1s var(--ease-soft) .1s both; }
.motion .route-mini li { animation: ysh-rise .5s var(--ease-out) both; }
.motion .route-mini li:nth-child(1) { animation-delay: .45s; }
.motion .route-mini li:nth-child(2) { animation-delay: .55s; }
.motion .route-mini li:nth-child(3) { animation-delay: .65s; }
.motion .route-mini li:nth-child(4) { animation-delay: .75s; }
.motion .ysh-next-event { animation: ysh-slide-in .9s var(--ease-out) .3s both; }
.motion .ysh-event-media { animation: ysh-porthole .9s var(--ease-soft) .05s both; }
.motion .ysh-event-head > * { animation: ysh-rise .7s var(--ease-out) both; }
.motion .ysh-event-head > :nth-child(1) { animation-delay: .1s; }
.motion .ysh-event-head > :nth-child(2) { animation-delay: .2s; }
.motion .ysh-event-head > :nth-child(3) { animation-delay: .3s; }
.motion .ysh-event-head > :nth-child(4) { animation-delay: .4s; }

/* ---------- Apparition au défilement ---------- */
.motion :is(
  .section-heading, .booking, .destination-card, .service-card, .stage, .journey-image, .journey-copy,
  .quote-banner, .after-visa, .content-panel, .steps > li, .faq details,
  .event-feature, .event-more > li, .ysh-event-trip, .reading-copy > h2, .reading-copy > p, .post-item
) {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease-out) var(--d, 0ms), transform .7s var(--ease-out) var(--d, 0ms), box-shadow .2s;
}
.motion :is(
  .section-heading, .booking, .destination-card, .service-card, .stage, .journey-image, .journey-copy,
  .quote-banner, .after-visa, .content-panel, .steps > li, .faq details,
  .event-feature, .event-more > li, .ysh-event-trip, .reading-copy > h2, .reading-copy > p, .post-item
).is-in { opacity: 1; transform: none; }

/* La photo du parcours se découvre comme un rideau */
.motion .journey-image img { transform: scale(1.08); transition: transform 1.6s var(--ease-soft); }
.motion .journey-image.is-in img { transform: none; }

/* Les étapes se relient l'une après l'autre */
.motion .steps > li::after { transform: scaleY(0); transform-origin: top; transition: transform .6s var(--ease-out) calc(var(--d, 0ms) + .35s); }
.motion .steps > li.is-in::after { transform: none; }
.motion .steps > li::before { transition: transform .45s var(--ease-out) var(--d, 0ms); transform: scale(.6); }
.motion .steps > li.is-in::before { transform: none; }

/* ---------- Petites interactions (avec ou sans .motion) ---------- */
.button > svg:last-child:not(:first-child), .text-link > svg:last-child { transition: transform .25s var(--ease-out); }
.button:hover > svg:last-child:not(:first-child), .text-link:hover > svg:last-child { transform: translateX(4px); }
.destination-card { transition: opacity .7s var(--ease-out) var(--d, 0ms), transform .45s var(--ease-out), box-shadow .2s; }
.motion .destination-card.is-in:hover, .destination-card:hover { transform: translateY(-4px); }
.event-poster img, .ysh-event-poster img { transition: transform .6s var(--ease-soft); }
.event-poster:hover img, .ysh-event-poster:hover img { transform: scale(1.03); }

/* Coeur des favoris */
@keyframes ysh-pop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.favorite-button[aria-pressed="true"] svg { animation: ysh-pop .4s var(--ease-out); }

/* En-tête : une ombre dès qu'on fait défiler */
.site-header { transition: box-shadow .3s, background-color .3s; }
.site-header.is-scrolled { background: #fffffff5; box-shadow: 0 14px 30px -24px #14213d80; }

/* Clôture des inscriptions : un point qui bat, seul mouvement en boucle du site */
@keyframes ysh-beat { 0% { box-shadow: 0 0 0 0 #ee5a1f66; } 70% { box-shadow: 0 0 0 7px #ee5a1f00; } 100% { box-shadow: 0 0 0 0 #ee5a1f00; } }
:is(.ysh-list-urgency, .ysh-event-urgency, .ysh-next-urgency, .event-deadline b) { position: relative; }
:is(.ysh-list-urgency, .ysh-event-urgency, .ysh-next-urgency, .event-deadline b)::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--soleil, #ee5a1f);
  vertical-align: .08em;
  content: "";
  animation: ysh-beat 1.8s ease-out infinite;
}
.ysh-event-urgency { align-items: center; }
.ysh-event-urgency::before { vertical-align: 0; }

@media (prefers-reduced-motion: reduce) {
  .motion :is(.section-heading, .booking, .destination-card, .service-card, .stage, .journey-image, .journey-copy, .quote-banner, .after-visa, .content-panel, .steps > li, .faq details, .event-feature) { opacity: 1 !important; transform: none !important; }
}
