/* ==========================================================================
   Home (Figma: Content › Home 6251:3978 → 6251:5217 → 6251:6510)
   The hero is sticky inside a taller "stage"; scrolling switches it from the
   intro (Default) → list (Missions + Éducation) → Q&A, then the footer follows.
   ========================================================================== */

.hero-stage {
  position: relative;
  height: calc(max(100svh, 640px) + 2 * 70svh); /* 70svh of pinned scroll per step: intro → list → Q&A */
}
.hero-stage > .hero {
  position: sticky;
  top: 0;
  height: max(100svh, 640px);
}

/* --------------------------------------------------------------------------
   Ambient motion — the whales of the main image swim (not in Figma).
   Only the whale photo moves; the other backgrounds shown on hover / Q&A stay still.
   Three layers, all transform/opacity only (GPU-composited):
   1. glide  — the herd travels along an elliptical path, mostly toward the
               upper-left where the whales are heading (24 s loop, never reverses)
   2. stroke — a short rhythmic rise / dip with a slight pitch, like tail beats (3.8 s)
   3. light  — slanted sun rays drift through the water above them
   -------------------------------------------------------------------------- */
.hero-stage .hero__bg[src$="zone-mer-mediterranee.jpg"] {
  scale: 1.18;
  transform-origin: 60% 45%;
  animation:
    whale-glide 24s linear infinite,
    whale-stroke 3.8s ease-in-out infinite alternate;
  will-change: translate, transform;
}
@keyframes whale-glide {            /* ellipse, long axis along the heading */
  0%    { translate:  3.0%   2.0%; }
  12.5% { translate:  1.2%   0.4%; }
  25%   { translate: -1.0%  -1.2%; }
  37.5% { translate: -3.0%  -2.4%; }
  50%   { translate: -3.6%  -1.6%; }
  62.5% { translate: -2.2%   0.4%; }
  75%   { translate:  0.0%   1.8%; }
  87.5% { translate:  2.0%   2.6%; }
  100%  { translate:  3.0%   2.0%; }
}
@keyframes whale-stroke {           /* tail beat: dip, pitch up, rise */
  0%   { transform: translateY(0.9%)  rotate(0.8deg); }
  100% { transform: translateY(-0.9%) rotate(-0.8deg); }
}

.hero-stage .hero__bgs::after {     /* sun rays from the surface */
  content: "";
  position: absolute;
  inset: -20% -10%;
  background:
    repeating-linear-gradient(105deg,
      rgba(188, 234, 253, 0) 0 6%,
      rgba(188, 234, 253, 0.22) 8%,
      rgba(188, 234, 253, 0) 11% 17%,
      rgba(188, 234, 253, 0.12) 19%,
      rgba(188, 234, 253, 0) 22% 30%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.4) 55%, transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.4) 55%, transparent 85%);
  mix-blend-mode: screen;
  opacity: 0.35;
  animation: sun-rays 14s ease-in-out infinite alternate;
  pointer-events: none;
  transition: visibility 0s linear 300ms;
}
/* rays only on the intro (main whale image) */
.hero-stage .hero:not([data-state="intro"]) .hero__bgs::after { visibility: hidden; animation-play-state: paused; }
@keyframes sun-rays {
  0%   { transform: translateX(-3%) skewX(-3deg); opacity: 0.25; }
  100% { transform: translateX(3%)  skewX(3deg);  opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-stage .hero__bg[src$="zone-mer-mediterranee.jpg"],
  .hero-stage .hero__bgs::after { animation: none; }
}
