/* CORPORALITER · motion design. Tout ce qui bouge est ici, et tout s'arrête si le visiteur demande moins d'animations.
   Règle : rien n'est caché sans JavaScript (les états de départ ne s'appliquent que sous html.motion, posée par boot.js et retirée si motion.js ne démarre pas). */

/* Transitions entre pages (navigateurs récents) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .45s var(--ease-io) both vt-out; }
::view-transition-new(root) { animation: .6s var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }

/* ---------- Intro : l'étoile, le nom, puis le rideau. Une fois par visite, en CSS pur (s'efface même si le script échoue). ---------- */
.intro { display: none; }
html.intro .intro { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg); color: var(--fg); animation: intro-curtain 1s var(--ease-io) 2.1s forwards; pointer-events: none; }


.intro-inner { display: grid; justify-items: center; gap: 22px; }
.intro-star { width: 64px; height: 64px; animation: intro-star 1.9s var(--ease) both; }
.intro-word { display: flex; overflow: hidden; font-family: var(--display); font-size: clamp(2rem, 9vw, 5rem); letter-spacing: .06em; line-height: 1; }
.intro-word span { display: inline-block; transform: translateY(105%); animation: intro-letter .9s var(--ease) .35s forwards; }
.intro-word span:nth-child(2) { animation-delay: .395s; } .intro-word span:nth-child(3) { animation-delay: .44s; }
.intro-word span:nth-child(4) { animation-delay: .485s; } .intro-word span:nth-child(5) { animation-delay: .53s; }
.intro-word span:nth-child(6) { animation-delay: .575s; } .intro-word span:nth-child(7) { animation-delay: .62s; }
.intro-word span:nth-child(8) { animation-delay: .665s; } .intro-word span:nth-child(9) { animation-delay: .71s; }
.intro-word span:nth-child(10) { animation-delay: .755s; } .intro-word span:nth-child(11) { animation-delay: .8s; }
.intro-word span:nth-child(12) { animation-delay: .845s; } .intro-word span:nth-child(13) { animation-delay: .89s; }
.intro-bar { width: min(240px, 50vw); height: 1px; background: var(--line); position: relative; overflow: hidden; }
.intro-bar::after { content: ""; position: absolute; inset: 0; background: var(--fg); transform: scaleX(0); transform-origin: left; animation: intro-load 1.7s var(--ease-io) .2s forwards; }
@keyframes intro-star { from { transform: rotate(-180deg) scale(.2); opacity: 0; } 60% { opacity: 1; } to { transform: rotate(0) scale(1); opacity: 1; } }
@keyframes intro-letter { to { transform: translateY(0); } }
@keyframes intro-load { to { transform: scaleX(1); } }
@keyframes intro-curtain { to { clip-path: inset(0 0 100% 0); visibility: hidden; } }
html.intro .intro { clip-path: inset(0 0 0 0); }

/* ---------- Le hero entre en scène ---------- */
html.motion .hero-video, html.motion .hero-img { animation: hero-zoom 2.4s var(--ease) both; }
html.intro .hero-video, html.intro .hero-img { animation-delay: 2.2s; }
@keyframes hero-zoom { from { transform: scale(1.18); filter: brightness(.4); } to { transform: scale(1); filter: none; } }
html.motion .hero-title .char { display: inline-block; transform: translateY(102%); }
html.motion .hero-title .line { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .02em; }html.motion .hero.is-in .hero-title .char { transform: none; transition: transform 1.1s var(--ease); transition-delay: calc(.15s + var(--i) * .04s); }
html.motion .hero-kicker, html.motion .hero-sub, html.motion .hero-note, html.motion .hero-actions, html.motion .hero .countdown-big { opacity: 0; transform: translateY(18px); }
html.motion .hero.is-in .hero-kicker, html.motion .hero.is-in .hero-sub, html.motion .hero.is-in .hero-note, html.motion .hero.is-in .hero-actions, html.motion .hero.is-in .countdown-big { opacity: 1; transform: none; transition: opacity 1s var(--ease), transform 1s var(--ease); }
html.motion .hero.is-in .hero-kicker { transition-delay: .1s; }
html.motion .hero.is-in .hero-sub { transition-delay: .7s; }
html.motion .hero.is-in .hero-note, html.motion .hero.is-in .countdown-big { transition-delay: .8s; }
html.motion .hero.is-in .hero-actions { transition-delay: .9s; }

/* ---------- Révélations au défilement ---------- */
html.motion [data-reveal] { opacity: 0; transform: translateY(48px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); transition-delay: calc(var(--d, 0) * 1s); }
html.motion [data-reveal].is-in { opacity: 1; transform: none; }
html.motion [data-reveal="fade"] { transform: none; }
/* Dévoilement par un rideau qui se retire : l'image reste « visible » pour le navigateur, donc elle se charge normalement. */
html.motion [data-reveal="clip"] { opacity: 1; transform: none; }
html.motion [data-reveal="clip"]::after { content: ""; position: absolute; inset: 0; z-index: 3; background: var(--bg); transform-origin: top; transition: transform 1.4s var(--ease); pointer-events: none; }
html.motion [data-reveal="clip"].is-in::after { transform: scaleY(0); }
html.motion [data-reveal="clip"] img, html.motion [data-reveal="clip"] .ph { transform: scale(1.25); transition: transform 1.8s var(--ease), opacity .6s var(--ease); }
html.motion [data-reveal="clip"].is-in img, html.motion [data-reveal="clip"].is-in .ph { transform: scale(1); }
html.motion [data-reveal="clip"].is-in:hover .product-img { transform: scale(1.04); }
html.motion [data-reveal="lines"] { opacity: 1; transform: none; }
/* Les accents des majuscules dépassent la hauteur de ligne serrée : on leur laisse de la place au-dessus. */
html.motion [data-reveal="lines"] .w { display: inline-block; overflow: hidden; vertical-align: top; padding: .16em 0 .04em; margin-top: -.16em; }
html.motion .hero-title .line { padding-top: .16em; margin-top: -.16em; }
html.motion [data-reveal="lines"] .w > span { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i) * .035s); }
html.motion [data-reveal="lines"].is-in .w > span { transform: none; }

/* Manifeste : les mots s'allument un à un avec le défilement */
html.motion .manifesto-text .word { opacity: .14; transition: opacity .25s linear; }
html.motion .manifesto-text .word.is-lit { opacity: 1; }

/* ---------- Bandeau défilant ---------- */
.marquee-track { animation: marquee var(--marquee-speed, 38s) linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-star { animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Barre de progression de lecture ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 65; background: var(--fg); transform: scaleX(var(--p, 0)); transform-origin: left; pointer-events: none; mix-blend-mode: difference; }

/* ---------- Curseur (souris uniquement) ---------- */
.cursor, .cursor-dot { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.has-cursor .cursor, html.has-cursor .cursor-dot { display: grid; position: fixed; left: 0; top: 0; z-index: 250; pointer-events: none; border-radius: 50%; mix-blend-mode: difference; }
  html.has-cursor .cursor { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1px solid #fff; place-items: center; transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background .3s, opacity .3s; }
  html.has-cursor .cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
  html.has-cursor .cursor span { font-size: .62rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: #000; opacity: 0; transition: opacity .25s; }
  html.has-cursor .cursor.is-link { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(255, 255, 255, .12); }
  html.has-cursor .cursor.is-view { width: 96px; height: 96px; margin: -48px 0 0 -48px; background: #fff; }
  html.has-cursor .cursor.is-view span { opacity: 1; }
  html.has-cursor .cursor.is-hidden, html.has-cursor .cursor-dot.is-hidden { opacity: 0; }
}

/* ---------- Petites réactions ---------- */
.bar-count.is-bump { animation: bump .6s var(--ease); }
@keyframes bump { 30% { transform: scale(1.6); } }
.btn.is-done { pointer-events: none; }
.btn.is-done::before { transform: scaleY(1); background: var(--fg); }
.fold > :not(summary) { animation: fold-in .5s var(--ease); }
@keyframes fold-in { from { opacity: 0; transform: translateY(-6px); } }

/* Panier et fenêtres : entrée en glissé */
.drawer:not([hidden]) { animation: fade-in .4s var(--ease) both; }
.drawer:not([hidden]) .drawer-panel { animation: slide-in .7s var(--ease) both; }
.drawer:not([hidden]) .lines li { animation: rise .7s var(--ease) both; }
.drawer:not([hidden]) .lines li:nth-child(2) { animation-delay: .06s; }
.drawer:not([hidden]) .lines li:nth-child(3) { animation-delay: .12s; }
.dialog[open] { animation: rise .6s var(--ease) both; }
.dialog[open]::backdrop { animation: fade-in .4s var(--ease) both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* Pages simples : apparition douce */
html.motion .plain > * { animation: rise .9s var(--ease) both; }
html.motion .plain > :nth-child(2) { animation-delay: .06s; }
html.motion .plain > :nth-child(3) { animation-delay: .12s; }
html.motion .plain > :nth-child(n+4) { animation-delay: .18s; }

/* Moins d'animations demandé : tout est immédiatement visible et immobile */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.intro .intro { display: none; }
  html.motion [data-reveal], html.motion .hero-title .char, html.motion .hero-kicker, html.motion .hero-sub, html.motion .hero-note, html.motion .hero-actions, html.motion .hero .countdown-big,
  html.motion [data-reveal="lines"] .w > span, html.motion .manifesto-text .word { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .cursor, .cursor-dot, .progress { display: none !important; }
  @view-transition { navigation: none; }
}
