/* =========================================================
   CGT Alkor — Motion premium (Lenis + Motion frame)
   Parallaxe via CSS vars — zéro layout thrash au scroll
   ========================================================= */

html.motion-site {
  scroll-behavior: auto;
}

html.lenis,
html.lenis body,
html.motion-site.lenis,
html.motion-site.lenis body {
  height: auto;
}

html.lenis.lenis-smooth,
html.motion-site.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

html.lenis [data-lenis-prevent],
html.lenis [data-lenis-prevent-wheel],
html.lenis [data-lenis-prevent-touch] {
  overscroll-behavior: contain;
}

/* ── Rideau d'entrée ── */
.motion-curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(165deg, #020c18 0%, #041730 50%, #061e3d 100%);
}

/* ── Progression scroll (pilotée par JS, GPU) ── */
.motion-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 200;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.05);
}

.motion-scroll-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0% 50%;
  will-change: transform;
  background: linear-gradient(90deg, var(--accent, #61b1bc), var(--accent-soft, #9ad4dc));
  box-shadow: 0 0 16px rgba(97, 177, 188, 0.45);
}

/* ── Parallaxe Lenis (CSS vars — zéro reflow) ── */
html.motion-site [data-parallax] {
  will-change: transform;
  transform: translate3d(
    0,
    calc(var(--scroll-y, 0) * var(--parallax-speed, 0.12) * -0.35 * 1px),
    0
  );
}

/* ── Anti-flash avant runtime ── */
html.motion-site:not(.motion-entered) .hero-badge,
html.motion-site:not(.motion-entered) .hero h1,
html.motion-site:not(.motion-entered) .hero-sub,
html.motion-site:not(.motion-entered) .hero-cta > *,
html.motion-site:not(.motion-entered) .scroll-cue,
html.motion-site:not(.motion-entered) .project-hero-inner > *,
html.motion-site:not(.motion-entered) .category-hero-inner > *,
html.motion-site:not(.motion-entered) .contact-hero-inner > *,
html.motion-site:not(.motion-entered) .legal-hero .container > *,
html.motion-site:not(.motion-entered) .cfg-head-text > * {
  opacity: 0;
}

html.motion-site:not(.motion-entered) .hero-media,
html.motion-site:not(.motion-entered) .project-hero-bg,
html.motion-site:not(.motion-entered) .category-hero-bg,
html.motion-site:not(.motion-entered) .contact-hero-bg,
html.motion-site:not(.motion-entered) .legal-hero-bg,
html.motion-site:not(.motion-entered) .hero-overlay,
html.motion-site:not(.motion-entered) .project-hero-veil,
html.motion-site:not(.motion-entered) .category-hero-fade,
html.motion-site:not(.motion-entered) .contact-hero-veil,
html.motion-site:not(.motion-entered) .legal-hero-veil {
  opacity: 0;
}

html.motion-site .hero-media img,
html.motion-site .hero-media video {
  animation: none;
}

/* ── Titres découpés ── */
.motion-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.05em;
}

.motion-word-inner {
  display: inline-block;
}

/* ── Reveals Motion ── */
html.motion-site [data-reveal]:not(.motion-revealed) {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition: none;
}

html.motion-site [data-reveal].motion-revealed {
  will-change: auto;
}

/* ── Cartes premium (CSS, pas de JS par mousemove) ── */
html.motion-site .motion-card {
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  html.motion-site .motion-card:hover {
    transform: translate3d(0, -8px, 0) scale(1.012);
  }

  html.motion-site .motion-card:hover img {
    transform: scale(1.05);
  }

  html.motion-site .motion-magnetic {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  html.motion-site .motion-magnetic:hover {
    transform: translate3d(0, -2px, 0) scale(1.02);
  }
}

html.motion-site .duo-card:hover,
html.motion-site .product-card:hover,
html.motion-site .hub-card:hover {
  transform: none;
}

html.motion-site .product-card-media img,
html.motion-site .duo-card img {
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

html.motion-site .product-card:hover .product-card-media img {
  transform: none;
}

/* ── Header ── */
html.motion-site .header {
  transition:
    box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.45s ease;
}

html.motion-site .header.motion-header-compact {
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.22);
}

/* ── Marquee ── */
html.motion-site .marquee-track {
  animation-duration: calc(40s / var(--marquee-boost, 1));
}

/* ── Main transition sortie ── */
html.motion-site #main-content {
  will-change: opacity, transform;
}

/* ── Accessibilité ── */
@media (prefers-reduced-motion: reduce) {
  .motion-curtain,
  .motion-scroll-progress {
    display: none !important;
  }

  html.motion-site [data-reveal],
  html.motion-site [data-parallax],
  html.motion-site .hero-media,
  html.motion-site .hero-overlay,
  html.motion-site .project-hero-inner > *,
  html.motion-site .category-hero-inner > *,
  html.motion-site .contact-hero-inner > *,
  html.motion-site .cfg-head-text > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  html.motion-site .marquee-track {
    animation-duration: 40s;
  }
}

@media (max-width: 720px) {
  html.motion-site [data-parallax] {
    transform: none;
  }
}
