/* =========================================================
   animations.css — transitions de page et effets de défilement
   Tous les effets sont désactivés si l'utilisateur a demandé
   « réduire les animations » dans son système.
   ========================================================= */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

/* ---------- 1. Transition entre les pages ----------
   Navigateurs récents (Chrome, Edge, Samsung Internet) : fondu
   enchaîné natif, l'en-tête reste fixe pendant le changement. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out .28s var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-in .55s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px); } }

/* Autres navigateurs (Safari, Firefox) : rideau laiton à la sortie,
   apparition douce du contenu à l'arrivée. */
.page-curtain { position: fixed; inset: 0; z-index: 200; pointer-events: none; background: var(--charcoal); transform: scaleY(0); transform-origin: bottom; }
.page-curtain::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gold); }
html.is-leaving .page-curtain { transform: scaleY(1); transition: transform .38s var(--ease-in-out); }
html.no-vt main { animation: page-in .7s var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- 2. Barre de progression de lecture ---------- */
.progress { position: fixed; left: 0; top: 0; z-index: 70; height: 3px; width: 100%; background: var(--gold); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); pointer-events: none; }

/* ---------- 3. En-tête qui se resserre au défilement ---------- */
.site-header { transition: box-shadow .35s var(--ease-out), background .35s; }
.site-header__in { transition: min-height .35s var(--ease-out); }
.brand img { transition: width .35s var(--ease-out); }
html.is-scrolled .site-header { box-shadow: 0 10px 30px -18px rgba(0,0,0,.35); background: rgba(245, 241, 232, .985); }
html.is-scrolled .site-header__in { min-height: 64px; }
html.is-scrolled .brand img { width: 44px; }

/* ---------- 4. Entrée du hero ---------- */
.js .hero__in > div > *, .js .page-hero__in > * { animation: rise .9s var(--ease-out) both; }
.js .hero__in > div > *:nth-child(2), .js .page-hero__in > *:nth-child(2) { animation-delay: .08s; }
.js .hero__in > div > *:nth-child(3), .js .page-hero__in > *:nth-child(3) { animation-delay: .16s; }
.js .hero__in > div > *:nth-child(4), .js .page-hero__in > *:nth-child(4) { animation-delay: .24s; }
.js .hero__in > div > *:nth-child(5), .js .page-hero__in > *:nth-child(5) { animation-delay: .32s; }
.js .cartouche { animation: rise 1s .4s var(--ease-out) both; }
.hero__bg img, .page-hero__bg img { animation: settle 2.2s var(--ease-out) both; will-change: transform; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }
@keyframes settle { from { transform: scale(1.12); } to { transform: scale(1.04); } }
.hero__bg, .page-hero__bg { overflow: hidden; }

/* ---------- 5. Apparitions au défilement ---------- */
.reveal { transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), clip-path 1.1s var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms); }
.js .reveal.is-pending { opacity: 0; transform: translateY(34px); }
/* Les images se dévoilent comme un rideau qui se lève */
.js .media-frame.reveal.is-pending, .js .band__card.reveal.is-pending { opacity: 1; transform: none; clip-path: inset(100% 0 0 0); }
.media-frame.reveal, .band__card.reveal { clip-path: inset(0 0 0 0); }
/* Traits de cote de la frise qui se tracent */
.process__line { transform-origin: 0 50%; transition: transform 1s var(--ease-out); transition-delay: calc(var(--i, 0) * 120ms + 150ms); }
.js .is-pending .process__line { transform: scaleX(0); }
/* Index de section : le trait s'allonge */
.sec-index::after { transition: flex-basis 1s .2s var(--ease-out); }
.js .sec-head.is-pending .sec-index::after { flex-basis: 0; }
.sec-head.reveal { transition-delay: 0s; }

/* Filtres de projets : réapparition douce */
.pj { transition: box-shadow .25s, transform .45s var(--ease-out), opacity .45s var(--ease-out); }
.pj.is-entering { opacity: 0; transform: translateY(16px) scale(.98); }

/* Cartes : légère élévation au survol */
.svc, .prod { transition: background .25s, transform .35s var(--ease-out), box-shadow .35s var(--ease-out); }
.prod:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

/* Envoi de formulaire */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--stone); border-top-color: var(--charcoal); border-radius: 50%; vertical-align: -2px; margin-right: 6px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form__out.is-ok { border-left-color: #1f7a45; background: #eef7f1; animation: rise .6s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .progress, .page-curtain { display: none; }
  .js .reveal.is-pending, .js .media-frame.reveal.is-pending, .js .band__card.reveal.is-pending { opacity: 1; transform: none; clip-path: none; }
}
