/* Niuweb — 05. Chorégraphie : discrète, progressive, fluide. */
:root {
  --reveal-duration: 820ms;
  --reveal-fade-duration: 580ms;
  --reveal-ease: cubic-bezier(.22, 1, .36, 1);
}
@keyframes float {
  0%,100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}
@keyframes orbit { to { rotate: 360deg; } }
@keyframes cue-drift { 0%,100% { translate: 0 0; opacity: .8; } 50% { translate: 0 6px; opacity: 1; } }
@keyframes header-appear { from { opacity: 0; translate: 0 -12px; } to { opacity: 1; translate: 0 0; } }

/* Les éléments n'ont aucune opacité masquante sans JavaScript. */
@media (prefers-reduced-motion: no-preference) {
  .has-motion [data-reveal] {
    opacity: 0;
    translate: var(--reveal-x, 0px) var(--reveal-y, 28px);
    scale: var(--reveal-scale, 1);
  }
  .has-motion [data-reveal="left"] { --reveal-x: -28px; --reveal-y: 10px; }
  .has-motion [data-reveal="right"] { --reveal-x: 28px; --reveal-y: 10px; }
  .has-motion [data-reveal="scale"] { --reveal-y: 28px; --reveal-scale: .95; }
  .has-motion :is(.service-card,.commitment-card,.project-card,.price-card,.advice-card,.service-offer__panel)[data-reveal] {
    --reveal-y: 44px;
    --reveal-scale: .965;
  }
  .has-motion [data-reveal]:is(.is-visible,:focus-within) {
    opacity: 1;
    translate: none;
    scale: none;
    transition:
      opacity var(--reveal-fade-duration) ease-out,
      translate var(--reveal-duration) var(--reveal-ease),
      scale var(--reveal-duration) var(--reveal-ease);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .has-motion [data-reveal]:focus-within { transition: none; }

  /* Masque du titre, avec une marge pour les accents et les jambages. */
  .has-motion [data-reveal] h2 {
    clip-path: inset(-.1em -.06em 100% -.06em);
    translate: 0 22px;
  }
  .has-motion [data-reveal]:is(.is-visible,:focus-within) h2 {
    clip-path: inset(-.1em -.06em -.26em -.06em);
    translate: none;
    transition: clip-path var(--reveal-duration) var(--reveal-ease), translate var(--reveal-duration) var(--reveal-ease);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .has-motion [data-reveal]:focus-within h2 { transition: none; }

  /* Les images convergent doucement vers leur cadrage final. */
  .has-motion :is(.project-card,.price-card)[data-reveal] :is(.project-card__media img,.price-card__photo) {
    scale: 1.05;
  }
  .has-motion :is(.project-card,.price-card)[data-reveal]:is(.is-visible,:focus-within) :is(.project-card__media img,.price-card__photo) {
    scale: none;
    transition: scale 950ms var(--reveal-ease), transform .48s var(--reveal-ease);
    transition-delay: var(--reveal-delay, 0ms), 0ms;
  }

  .site-header { animation: header-appear .65s both; }
  .scroll-cue .icon { animation: cue-drift 2.2s ease-in-out infinite; }

  /* Les nappes défilent doucement, sans re-dessiner le grain. */
  [data-scroll-float] { translate: 0 var(--scroll-shift, 0px); }
  .hero__aura, .atmosphere, .approach__orb, .contact__decoration { will-change: auto; }

  /* Accents typographiques, activés au moment de la révélation. */
  .has-motion [data-reveal] .eyebrow__line { scale: 0 1; transform-origin: left; transition: scale .65s var(--reveal-ease) .12s; }
  .has-motion [data-reveal].is-visible .eyebrow__line { scale: 1 1; }

  /* Interactions légères, uniquement sur les états survolés. */
  .service-card .icon-tile { transition: transform .45s var(--reveal-ease), background-color .35s; }
  .service-card:hover .icon-tile { transform: translateY(-3px) rotate(-5deg); background-color:var(--icon-tile-fill, rgba(117,231,204,.34)); }
  .project-card__arrow { transition: transform .35s var(--reveal-ease), background .35s; }
  .project-card:hover .project-card__arrow { transform: translate(3px,-3px); background: rgba(146,233,208,.23); }
  .browser-window { transform: translate3d(var(--pointer-x,0px),var(--pointer-y,0px),0) rotate(calc(-4deg + var(--scroll-tilt,0deg))); }
}

/* Contrôle d'accessibilité : respect total du système, y compris en cours de session. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .has-motion [data-reveal] { opacity: 1 !important; translate: none !important; scale: 1 !important; }
  .hero__orbit, .glass-chip, .hero__glow { animation: none !important; }
  [data-scroll-float] { translate: none !important; }
}

/* Fondu sans déplacement lorsque le navigateur demande des animations réduites. */
@keyframes reveal-fade { from { opacity:0; } to { opacity:1; } }
.has-reveal-fade [data-reveal]:not(.is-visible,:focus-within) { opacity:0; }
.has-reveal-fade [data-reveal].is-fading-in:not(:focus-within) {
  animation:reveal-fade .42s ease-out min(var(--reveal-delay,0ms),120ms) both;
  animation-duration:.42s !important;
}

/* Progression de la lecture et header vitré qui apparaît au défilement. */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 90;
  pointer-events: none;
  overflow: hidden;
}
.scroll-progress::after {
  content: '';
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(var(--progress, 0));
  background: linear-gradient(90deg, #0a8b7b, #72dfd4 48%, #b48dea 80%, #f5a23c);
  box-shadow: 0 1px 9px rgba(13, 130, 117, .28);
}
.site-header { position: fixed; transition: background-color .35s ease, box-shadow .35s ease, border-color .35s ease; border-bottom: 1px solid transparent; }
.site-header.is-scrolled {
  background: rgba(248, 249, 246, .76);
  border-bottom-color: rgba(255,255,255,.7);
  box-shadow: 0 8px 35px rgba(19, 76, 69, .055);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.site-header.is-scrolled .nav-shell { min-height: 76px; }
.site-header .nav-shell { transition: min-height .35s ease; }
:root[data-theme="dark"] .site-header.is-scrolled {
  background: var(--background);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: rgba(191, 248, 234, .13);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
@media (max-width: 1000px) {
  .site-header.is-scrolled .nav-shell { min-height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-progress::after { transition: none; }
}
