/* 090 — Scroll Reveal
   Blocs révélés à l'entrée dans le scroller interne : translateY + fondu +
   léger blur, pilotés par animation-timeline: view() avec animation-range
   (la progression suit la position dans le cadre — reculer rembobine).
   Fallback (Firefox) : anim.js pose .scroll-reveal--io et un
   IntersectionObserver ajoute .is-in. Sans JS ni support : tout est visible. */

.scroll-reveal {
  position: relative;
  width: min(340px, 100%);
}

/* Le scroller interne — la card de la galerie ne scrolle pas,
   c'est CE conteneur qui porte la timeline. */
.scroll-reveal__viewport {
  height: 230px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 0;
  border-radius: 14px;
  border: 1px solid color-mix(in oklab, var(--ml-fg, #e8eaf2) 8%, transparent);
  background: var(--ml-surface, #151a24);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--ml-fg, #e8eaf2) 16%, transparent) transparent;
}

.scroll-reveal__viewport:focus-visible {
  outline: 2px solid var(--ml-accent-2, #2dd4bf);
  outline-offset: 2px;
}

.scroll-reveal__viewport::-webkit-scrollbar { width: 6px; }
.scroll-reveal__viewport::-webkit-scrollbar-track { background: transparent; }
.scroll-reveal__viewport::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: color-mix(in oklab, var(--ml-fg, #e8eaf2) 16%, transparent);
}

.scroll-reveal__item {
  margin: 0 0 22px;
}

.scroll-reveal__kicker {
  margin: 0 0 3px;
  font: 600 10px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.16em;
  color: var(--ml-accent, #7c8cff);
}

.scroll-reveal__title {
  margin: 0 0 4px;
  font: 600 15px/1.3 system-ui, -apple-system, sans-serif;
  letter-spacing: -0.01em;
  color: var(--ml-fg, #e8eaf2);
}

.scroll-reveal__text {
  margin: 0;
  font: 400 12.5px/1.55 system-ui, -apple-system, sans-serif;
  color: var(--ml-muted, #8b91a3);
}

/* Indice « faites défiler », épinglé en bas du scrollport */
.scroll-reveal__hint {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 -18px;
  padding: 22px 0 10px;
  pointer-events: none;
  font: 500 10.5px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ml-muted, #8b91a3);
  background: linear-gradient(to top, var(--ml-surface, #151a24) 35%, transparent);
}

.scroll-reveal__hint::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid var(--ml-accent, #7c8cff);
  border-bottom: 1.5px solid var(--ml-accent, #7c8cff);
  transform: rotate(45deg);
  animation: scroll-reveal-nudge 1.5s ease-in-out infinite;
}

@keyframes scroll-reveal-nudge {
  0%, 100% { transform: translateY(-2px) rotate(45deg); opacity: 0.55; }
  50%      { transform: translateY(2px) rotate(45deg); opacity: 1; }
}

/* ——— Scroll-driven (Chrome/Edge 115+, Safari 26+) ——— */

@supports (animation-timeline: view()) {
  .scroll-reveal__item {
    animation-name: scroll-reveal-in;
    animation-timing-function: linear; /* mappé sur la progression */
    animation-fill-mode: both;
    animation-timeline: view();
    animation-range: entry 0% entry 75%;
  }

  /* L'indice s'efface sur les premiers 15 % de défilement */
  .scroll-reveal__hint {
    animation-name: scroll-reveal-hint-out;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: scroll(nearest);
    animation-range: 0% 15%;
  }
}

@keyframes scroll-reveal-in {
  from {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes scroll-reveal-hint-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* ——— Fallback IntersectionObserver (classe posée par anim.js) ——— */

@supports not (animation-timeline: view()) {
  .scroll-reveal--io .scroll-reveal__item {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(5px);
    transition:
      opacity 0.55s ease,
      transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
      filter 0.55s ease;
  }

  .scroll-reveal--io .scroll-reveal__item.is-in {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.scroll-reveal__hint.is-hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

/* ——— Reduced motion : contenu visible, zéro mouvement.
   Le fondu de l'indice (opacité mappée sur le scroll) est conservé,
   seul le chevron en boucle est coupé ——— */

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal__item {
    animation: none;
    transition: none;
  }
  .scroll-reveal__hint::after {
    animation: none;
  }
}
