/* Scroll-driven hero: scrolling scrubs the pour video (assets/hero/hero-scrub.js).
 *
 * Scroll length: --hero-length is the height of the whole hero. The pour plays over
 * (--hero-length - one screen) of scrolling, so 400vh gives about three screens of pour;
 * the clip's fade to black plays during the last screen, as the hero scrolls off.
 * Raise it for a slower, longer pour; lower it for a quicker one.
 *
 * The site nav comes straight after the hero in the page. It rides the bottom of the video
 * (sticky to the bottom of the screen), then docks at the top once the pour is over.
 * hero-scrub.js measures it into --nav-h and marks it .nav--over while it sits on the video.
 */
.scrub-hero {
  --hero-length: 400vh;
  --hero-end: #1a120b;            /* the colour the clip fades into; the next band starts on it */
  position: relative;
  height: 100vh;                  /* static until the script takes over (no JS, reduced motion) */
  height: 100svh;
  background: var(--hero-end);
}
.scrub-hero.is-live { height: var(--hero-length); }

.scrub-hero__stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--hero-end);
  isolation: isolate;
}

/* Fills the bands above and below the video on tall, narrow screens,
   where the video is shown wider than the screen so the logo stays whole. */
.scrub-hero__backdrop {
  position: absolute;
  inset: -8%;
  background: var(--hero-end) url("brewpy-hero-poster.jpg") center / cover no-repeat;
  filter: blur(36px) brightness(0.72) saturate(1.1);
  transform: translateZ(0);
}
@media (max-width: 767px) {
  .scrub-hero__backdrop { background-image: url("brewpy-hero-poster-mobile.jpg"); }
}

.scrub-hero__media {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  background: transparent;
}
.scrub-hero__frames[hidden] { display: none; }
.scrub-hero__logo { max-width: none; max-height: none; }   /* sized like the video by hero-scrub.js; sits over it, under the vignette and shade */
.has-bands .scrub-hero__media {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
}

.scrub-hero__vignette,
.scrub-hero__floor,
.scrub-hero__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.scrub-hero__vignette {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 58%, rgba(14, 8, 4, 0.42) 100%);
}
/* The faded foot of the video the nav sits on. */
.scrub-hero__floor {
  top: auto;
  height: max(38%, 220px);
  background: linear-gradient(to bottom, rgba(26, 18, 11, 0) 0%, rgba(26, 18, 11, 0.55) 55%, rgba(26, 18, 11, 0.92) 100%);
}
.scrub-hero__shade {
  background: var(--hero-end);
  opacity: 0;
}

.scrub-hero__cue {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-h, 77px) + 26px);
  z-index: 1;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255, 248, 240, 0.92);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  white-space: nowrap;
}
.scrub-hero__cue svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.4));
  animation: scrub-hero-nudge 1.8s ease-in-out infinite;
}
@keyframes scrub-hero-nudge {
  0%, 100% { transform: translateY(0); opacity: 0.75; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* Hands the page from the dark end of the clip back to the ivory page. */
.scrub-hero-handoff {
  height: clamp(72px, 14vh, 160px);
  background: linear-gradient(to bottom,
    #1a120b 0%, #2b1a14 22%, #5a4034 48%, #b9aa9d 76%, var(--ivory, #f5f2ee) 100%);
}

/* ── The nav, riding the foot of the video ── */
.scrub-hero ~ .nav {
  bottom: 0;                                         /* sticks to the bottom of the screen during the pour, to the top after it */
  margin-top: calc(-1 * var(--nav-h, 77px));         /* overlaps the foot of the video instead of sitting below it */
  padding-bottom: env(safe-area-inset-bottom);
  transition: background-color .35s ease, border-color .35s ease;
}
.scrub-hero ~ .nav .logo { transition: opacity .35s ease, visibility .35s; }
.nav.nav--over { background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.nav.nav--over::before {
  content: '';
  position: absolute;
  left: var(--gutter, 20px);
  right: var(--gutter, 20px);
  top: 0;
  height: 1px;
  background: rgba(245, 242, 238, 0.22);
}
.nav--over .logo { opacity: 0; visibility: hidden; }  /* the video carries the logo; the nav's own shows once docked */
.nav--over .nav-cta { background: var(--ivory, #f5f2ee); color: var(--void, #2b1a14); }
.nav--over .nav-cta:hover { background: #fff; }
.nav--over .nav-toggle { color: var(--ivory, #f5f2ee); border-color: rgba(245, 242, 238, 0.5); }
.nav--over .nav-drop-menu { top: auto; bottom: 100%; padding-top: 0; padding-bottom: 14px; }   /* open upwards */
@media (min-width: 861px) {
  .nav--over .nav-links > a, .nav--over .nav-drop-btn { color: var(--ivory, #f5f2ee); }
  .nav--over .nav-links > a::after { background: var(--ivory, #f5f2ee); }
  /* On the video the links and Brew Timer sit as one centred group; hero-scrub.js glides them
     back to their usual places when the nav docks, and the logo fades in. */
  .nav--over .logo { display: none; }
  .nav--over .nav-inner { justify-content: center; gap: 44px; }
  .nav--over .nav-links { gap: 40px; }
  .scrub-hero ~ .nav:not(.nav--over) .logo { animation: scrub-hero-logo-in .45s ease both; }
}
@keyframes scrub-hero-logo-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 860px) {
  .nav--over.open .nav-links {                       /* the phone menu opens upwards from the bottom bar */
    top: auto;
    bottom: 100%;
    max-height: calc(100svh - var(--nav-h, 77px) - 24px);
    border-bottom: 0;
    border-top: 1px solid rgba(75, 46, 35, 0.16);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -24px 40px -24px rgba(0, 0, 0, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scrub-hero, .scrub-hero.is-live { height: 100vh; height: 100svh; }
  .scrub-hero__cue { display: none; }
  .scrub-hero__shade { opacity: 0 !important; }
  .scrub-hero-handoff { display: none; }
}

.scrub-hero__title {                                 /* the page heading, for screen readers and search; the logo is in the video */
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
