/* ==========================================================================
   Video Hero - Scroll Reveal
   Full-bleed looping video; the headline panel + CTAs fade/slide in over it as
   the visitor scrolls, while the stage stays pinned (sticky) for a runway.
   Everything is scoped to .rq-vh.

   Text, panel, buttons and placement copy the theme's Hero Banner v2
   (theme-hs-parkour3/modules/home-hero.module): white 80% panel, 2rem padding,
   half the content width; 800 H1 at 2.4rem/3.2rem; uppercase 1.2rem overtitle;
   theme .button_max--wrapper buttons (primary hover = dark blue). Desktop: copy
   centred and nudged 55px down for the header; <= 1024px: 60px top padding;
   <= 767px: copy at the bottom, panel full width, buttons stacked.

   Public tokens (set on :root or an ancestor; a Style field wins when set):
     --rq-vh-heading     H1                     (theme --secondary_color)
     --rq-vh-text        overtitle + subheading (theme --secondary_color)
     --rq-vh-panel       panel background       (rgba(255,255,255,.8))
     --rq-vh-container   content max width      (theme max content width, 1240px)
     --rq-vh-gutter      container side padding (theme --spacing, 12px)
     --rq-vh-duration    reveal smoothing       (400ms)
   Set by module.html (fields): --rq-vh-h, --rq-vh-pin (unitless, % of the
     viewport), --rq-vh-overlay (0..1), --rq-vh-container
   Set by module.js: --r (reveal 0..1), --cue (scroll cue 0..1),
     --rq-vh-sbw (scrollbar width, keeps the full bleed exact)
   States: .is-armed (text waits for scroll; never in the editor, with reduced
     motion or without JS), .rq-vh--no-sticky (a parent breaks sticky: no pin)
   ========================================================================== */

.rq-vh {
  --_h: var(--rq-vh-h, 100);
  --_pin: 0;
  --_overlay: var(--rq-vh-overlay, 0.2);
  --_heading: var(--rq-vh-heading, var(--secondary_color, #1f5fa8));
  --_text: var(--rq-vh-text, var(--secondary_color, #1f5fa8));
  --_panel: var(--rq-vh-panel, rgba(255, 255, 255, 0.8));
  --_container: var(--rq-vh-container, 1240px);
  --_gutter: var(--rq-vh-gutter, var(--spacing, 12px));
  --_dur: var(--rq-vh-duration, 400ms);
  --_ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --_bleed: calc(100vw - var(--rq-vh-sbw, 0px));
  --r: 1;
  --cue: 0;

  position: relative;
  display: block;
  /* Full bleed: break out of whatever container the module sits in. */
  width: var(--_bleed);
  max-width: none;
  margin: 0 0 0 calc(50% - var(--_bleed) / 2);
  padding: 0;
  /* Height is reserved up front: no layout shift when the video arrives. */
  height: calc((var(--_h) + var(--_pin)) * 1vh);
  background: #000;
  color: var(--_text);
  font-family: inherit;
}

.rq-vh *,
.rq-vh *::before,
.rq-vh *::after {
  box-sizing: border-box;
}

.rq-vh.is-armed {
  --_pin: var(--rq-vh-pin, 60);
  --r: 0;
}

.rq-vh.rq-vh--no-sticky,
.rq-vh.rq-vh--editor {
  --_pin: 0;
}

/* ---------- Stage (pinned) ---------- */

.rq-vh__stage {
  position: sticky;
  top: 0;
  height: calc(var(--_h) * 1vh);
  overflow: hidden;
  background: #000;
}

/* svh = the stable mobile viewport (browser bars shown), so nothing jumps. */
@supports (height: 1svh) {
  .rq-vh {
    height: calc((var(--_h) + var(--_pin)) * 1svh);
  }

  .rq-vh__stage {
    height: calc(var(--_h) * 1svh);
  }
}

/* ---------- Media ---------- */

.rq-vh__media {
  position: absolute;
  inset: 0;
}

.rq-vh__poster,
.rq-vh__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  border: 0;
}

.rq-vh__video {
  display: block;
}

@media (max-width: 767px) {
  .rq-vh--mobile-poster-only .rq-vh__video {
    display: none;
  }
}

/* Lighter on first load (the video is the hero), full strength once the text
   is in. Gradient is darkest behind the panel. */
.rq-vh__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.3) 100%);
  opacity: calc(var(--_overlay) * (0.35 + 0.65 * var(--r)));
  transition: opacity var(--_dur) ease-out;
  pointer-events: none;
}

.rq-vh--panel-right .rq-vh__overlay {
  background: linear-gradient(270deg, #000 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.3) 100%);
}

.rq-vh--panel-center .rq-vh__overlay {
  background: radial-gradient(ellipse at center, #000 0%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0.35) 100%);
}

.rq-vh__placeholder {
  position: absolute;
  right: 16px;
  bottom: 16px;
  margin: 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
}

/* ---------- Content (Hero Banner v2 layout) ---------- */

.rq-vh__content {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
}

.rq-vh__container {
  position: relative;
  top: 55px; /* v2: clears the fixed header */
  display: flex;
  justify-content: flex-start;
  width: 100%;
  max-width: var(--_container);
  margin: 0 auto;
  padding: 20px 100px 20px var(--_gutter);
}

.rq-vh--panel-center .rq-vh__container {
  justify-content: center;
  padding-right: var(--_gutter);
}

.rq-vh--panel-right .rq-vh__container {
  justify-content: flex-end;
  padding-right: var(--_gutter);
}

.rq-vh__block {
  width: 100%;
}

.rq-vh__panel {
  max-width: 50%;
  margin-bottom: 2rem;
  padding: 2rem;
  border-radius: 0;
  background: var(--_panel);
}

/* Center/right: the block shrinks to the panel so it can be positioned. */
.rq-vh--panel-center .rq-vh__block,
.rq-vh--panel-right .rq-vh__block {
  width: 50%;
}

.rq-vh--panel-center .rq-vh__panel,
.rq-vh--panel-right .rq-vh__panel {
  max-width: none;
}

.rq-vh--align-center .rq-vh__panel {
  text-align: center;
}

.rq-vh .rq-vh__eyebrow {
  margin: 0 0 0.5rem;
  color: var(--_text);
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 145%;
  text-transform: uppercase;
}

.rq-vh .rq-vh__title {
  margin: 0 0 0.5rem;
  color: var(--_heading);
  font-family: inherit;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 3.2rem;
  letter-spacing: normal;
  text-transform: none;
}

.rq-vh .rq-vh__sub {
  margin: 0;
  color: var(--_text);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 145%;
}

.rq-vh .rq-vh__sub p {
  margin: 0;
  color: inherit;
  font: inherit;
}

.rq-vh .rq-vh__sub p + p {
  margin-top: 0.75em;
}

.rq-vh .rq-vh__sub a {
  color: inherit;
  text-decoration: underline;
}

/* ---------- Buttons ---------- */
/* Styled by the theme (.button_max--wrapper-all / .button_max--wrapper /
   .button_color-*), exactly like Hero Banner v2. Only alignment and focus
   are added here. */

.rq-vh--align-center .rq-vh__actions {
  justify-content: center;
}

.rq-vh .rq-vh__actions a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--secondary_color, #0b66a3);
}

.rq-vh__toggle:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.6);
}

/* ---------- Reveal (only while .is-armed) ---------- */

.rq-vh.is-armed .rq-vh__panel,
.rq-vh.is-armed .rq-vh__actions {
  --_k: var(--r);
  opacity: var(--_k);
  transform: translate3d(0, calc((1 - var(--_k)) * 24px), 0);
  transition:
    opacity var(--_dur) ease-out,
    transform var(--_dur) var(--_ease);
  will-change: opacity, transform;
}

/* CTAs trail the panel slightly. */
.rq-vh.is-armed .rq-vh__actions {
  --_k: clamp(0, calc(var(--r) * 1.4 - 0.4), 1);
}

.rq-vh.is-armed.is-concealed .rq-vh__block {
  pointer-events: none;
}

/* Keyboard users tabbing into hidden copy see it at once. */
.rq-vh.is-armed .rq-vh__block:focus-within .rq-vh__panel,
.rq-vh.is-armed .rq-vh__block:focus-within .rq-vh__actions {
  opacity: 1;
  transform: none;
}

/* ---------- Scroll cue ---------- */

.rq-vh__cue {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 2;
  display: none;
  color: #fff;
  opacity: var(--cue);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
  transform: translateX(-50%);
  transition: opacity 250ms ease-out;
  pointer-events: none;
}

.rq-vh.is-armed .rq-vh__cue {
  display: block;
}

.rq-vh__cue svg {
  display: block;
  animation: rq-vh-cue 1.8s ease-in-out infinite;
}

@keyframes rq-vh-cue {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ---------- Pause / play ---------- */

.rq-vh__toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  transition: background-color 150ms linear;
}

.rq-vh__toggle[hidden] {
  display: none;
}

.rq-vh__toggle:hover,
.rq-vh__toggle:focus {
  border-color: #fff;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

.rq-vh__icon-play,
.rq-vh__toggle[aria-pressed="true"] .rq-vh__icon-pause {
  display: none;
}

.rq-vh__toggle[aria-pressed="true"] .rq-vh__icon-play {
  display: block;
}

/* ---------- Tablet & phone (Hero Banner v2 breakpoints) ---------- */

@media (max-width: 1024px) {
  .rq-vh__container,
  .rq-vh--panel-center .rq-vh__container,
  .rq-vh--panel-right .rq-vh__container {
    top: 0;
    padding: 60px var(--_gutter) 20px;
  }
}

@media (max-width: 767px) {
  .rq-vh__content {
    align-items: flex-end;
  }

  .rq-vh__container,
  .rq-vh--panel-center .rq-vh__container,
  .rq-vh--panel-right .rq-vh__container {
    justify-content: flex-start;
  }

  .rq-vh__block,
  .rq-vh--panel-center .rq-vh__block,
  .rq-vh--panel-right .rq-vh__block {
    width: 100%;
  }

  .rq-vh__panel {
    max-width: 100%;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
  }

  .rq-vh .rq-vh__title {
    font-size: 1.5rem;
    line-height: 2.2rem;
  }
}

/* ---------- Reduced motion (JS also never arms the reveal) ---------- */

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

  .rq-vh__overlay,
  .rq-vh .rq-vh__panel,
  .rq-vh .rq-vh__actions {
    transition: none;
  }
}
