/* ------------------------------------------------------------------
   Scroll-scrubbed hero, added on top of styles.css.
   styles.css itself is byte-identical to the live site: every rule for
   this hero lives here, so the original design file stays untouched.
   ------------------------------------------------------------------ */

/* A scrubbed hero cannot live with smooth anchor scrolling: an anchor jump
   would animate the whole journey instead of arriving. */
html { scroll-behavior: auto; }

/* The hero becomes a tall pinned region. The stage keeps the exact size the
   original hero had, so nothing below it moves. */
.hero--scrub {
  display: block;
  height: 420vh;
  min-height: 0;
  align-items: initial;
  overflow: visible;
}

.hero__stage {
  position: sticky;
  top: 72px;
  display: grid;
  align-items: end;
  height: calc(100vh - 72px);
  min-height: min(820px, calc(100vh - 72px));
  overflow: hidden;
  background: #0c0c0b;
}

/* Three stacked layers inside the original figure: the poster that the video
   fades over, the composed still for everyone who gets no video, and the video. */
.hero__poster,
.hero__still {
  position: absolute;
  inset: 0;
  background-position: 70% center;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero__poster {
  transition: opacity 700ms var(--ease-out);
}

.hero__still {
  display: none;
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% center;
  opacity: 0;
  transition: opacity 700ms var(--ease-out);
  will-change: transform;
  transform: translateZ(0);
}

.hero__stage.is-video-ready .hero__video { opacity: 1; }
.hero__stage.is-video-ready .hero__poster { opacity: 0; }

/* The loading ring, and the scroll cue it becomes if the video never lands. */
.hero__ring,
.hero__cue {
  position: absolute;
  right: var(--page-pad);
  bottom: var(--page-pad);
  z-index: 3;
  width: 46px;
  height: 46px;
  color: #f5f0e4;
}

.hero__ring {
  transform: rotate(-90deg);
  opacity: 0.9;
}

.hero__ring circle { transition: stroke-dashoffset 180ms linear; }

.hero__cue {
  opacity: 0.8;
  animation: hero-cue-bob 3.4s var(--ease-out) -1s infinite;
}

@keyframes hero-cue-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(7px); }
}

/* The hero copy sits above the figure's gradient, exactly as it already did. */
.hero--scrub .hero__copy { z-index: 2; }

/* The film is lit straw at night and the headline sits over it the whole way
   down. styles.css's scrim left the worst pixel at 2.5:1, under the 3.5:1 floor,
   so the scrubbed hero carries a deeper one. Scoped here; styles.css is untouched
   and every other page keeps the original. */
.hero--scrub .hero__media::after {
  background:
    linear-gradient(90deg, rgba(12, 12, 11, 0.74) 0%, rgba(12, 12, 11, 0.48) 48%, rgba(12, 12, 11, 0.14) 78%),
    linear-gradient(0deg, rgba(12, 12, 11, 0.60) 0%, rgba(12, 12, 11, 0.22) 45%, rgba(12, 12, 11, 0) 75%);
}

/* The original entrance animations assume a hero that arrives once. Inside a
   pinned stage they would replay oddly, so the copy keeps its rise-in and the
   media drops its wipe, which would fight the scrub. */
.js .hero--scrub .hero__media { animation: none; }

/* ------------------------------------------------------------------
   The five static-hero gates. These selectors must stay character for
   character identical to the GATES array in hero-scrub.js.
   In every one of them the hero returns to the original design exactly:
   one still image, normal height, no video fetched at all.
   ------------------------------------------------------------------ */
@media (max-width: 720px),
       (orientation: portrait) and (max-width: 1024px),
       (orientation: portrait) and (pointer: coarse),
       (orientation: landscape) and (pointer: coarse) and (max-height: 560px),
       (prefers-reduced-motion: reduce) {
  .hero--scrub {
    height: auto;
  }

  .hero__stage {
    position: relative;
    top: 0;
    height: auto;
    min-height: min(820px, calc(100vh - 72px));
  }

  .hero__video,
  .hero__poster,
  .hero__ring,
  .hero__cue {
    display: none;
  }

  .hero__still {
    display: block;
  }

  /* The still is a bright close-up of the goat, while styles.css's scrim was
     tuned for the darker, wider hero photo. White copy over lit straw measured
     1.0:1, so the static hero gets its own, heavier cover. */
  .hero--scrub .hero__media::after {
    background:
      linear-gradient(90deg, rgba(12, 12, 11, 0.62) 0%, rgba(12, 12, 11, 0.42) 55%, rgba(12, 12, 11, 0.26) 100%),
      linear-gradient(0deg, rgba(12, 12, 11, 0.74) 0%, rgba(12, 12, 11, 0.52) 45%, rgba(12, 12, 11, 0.22) 80%, rgba(12, 12, 11, 0.16) 100%);
  }
}

@media (max-width: 640px) {
  .hero--scrub .hero__stage { min-height: 560px; }
  .hero__still { background-position: 62% center; }
}

/* A short desktop window has no room for the cue. */
@media (max-height: 560px) {
  .hero__ring,
  .hero__cue { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__cue { animation: none; }
}

/* A quiet credit line for the photographs the hero film was generated from.
   It rides under the existing copyright rather than adding a row of its own. */
.site-footer__credit {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
}
