/**
 * HR Lighthouse scroll-story slider  —  page: /hr-lighthouse/
 * Section markup lives in Bricks (#hrlighthouse-slider). JS: assets/js/custom-sections/hr-lighthouse-slider.js
 * Loaded via inc/enqueue-assets.php (handle: hr-lighthouse-slider).
 */
:root {
  --hrlighthouse-bg-image: url('/wp-content/uploads/2026/07/bg-img-scaled-e1783599281397.webp');
  --hrlighthouse-text-color: #ffffff;
  --hrlighthouse-subtext-color: rgba(255, 255, 255, 0.75);
  --hrlighthouse-bigword-color: #ffffff;
  --hrlighthouse-bigword-opacity: 0.08;
  --hrlighthouse-max-width: 760px;
}

/* Bricks wraps custom code blocks in .brxe-code, which sizes itself to
   its content. Once GSAP pins #hrlighthouse-slider (position: fixed),
   the section stops contributing width to that wrapper, so the wrapper
   — and the pinned section + its spacer — collapse to 0 and the pin
   distance goes haywire. Forcing an explicit width fixes it. */
.brxe-code:has(#hrlighthouse-slider) {
  width: 100%;
}

.hrlighthouse-scroll-story {
  position: relative;
  width: 100%;
  min-width: 100%;
  height: 100vh;   /* fallback for old browsers */

  overflow: hidden;
  z-index: 1;
  /* NEW: solid purple (matches the bg image's average colour) so the section is
     never plain white while the large background image is still decoding/painting
     after the pin switches it to position: fixed. */
  background-color: #9a3cd2;
  font-family: 'BagossCondensed-TRIAL-Medium', sans-serif;
}

.hrlighthouse-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: var(--hrlighthouse-bg-image);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: 1;
  transform: translate3d(0,0,0);
}

.hrlighthouse-overlay {
  display: none;
}

/* NEW: starting state before GSAP runs. All slides are absolutely stacked, and the
   script (which also has to load GSAP from the CDN first) only hides slides 2+ once
   it initialises — until then every slide's text shows on top of slide 1 for a
   moment, which looks broken. Hide slides 2+ in CSS; GSAP's inline opacity (set by
   gsap.set / the timeline) overrides this, so the animation is unchanged. */
.hrlighthouse-slide:not(:first-child) .hrlighthouse-bigword,
.hrlighthouse-slide:not(:first-child) .hrlighthouse-heading,
.hrlighthouse-slide:not(:first-child) .hrlighthouse-paragraph,
.hrlighthouse-slide:not(:first-child) .hrlighthouse-subtext {
  opacity: 0;
}

.hrlighthouse-slides {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 3;
}

/* Slide fills the whole section (not the old 80%/70%) and centers its
   content with flexbox — that's what actually keeps this responsive.
   The old approach shrank this box and top-anchored it, then shoved
   content down with a fixed margin-top (18rem desktop / 10rem tablet /
   3rem mobile) to compensate. A fixed rem value doesn't know how tall
   the viewport actually is: on shorter laptop screens (common below
   ~1400px wide) it ate into the shrunk box and got clipped by this
   section's overflow: hidden; on phones, once the box was resized down
   at that breakpoint, the same offset left a large dead gap between
   the text and the bottom of the screen. True flex centering scales
   correctly at any viewport size without a hardcoded offset. */
.hrlighthouse-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1.5rem;
}

.hrlighthouse-bigword {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  margin: 0;
  font-family: 'BagossCondensed-TRIAL-Medium', sans-serif;
  font-size: 20rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 20.9rem;
  text-align: center;
  color: var(--hrlighthouse-bigword-color);
  opacity: var(--hrlighthouse-bigword-opacity);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  /* GSAP animates this element's scale, not just opacity/filter — without
     "transform" in will-change the browser wasn't necessarily promoting
     it to its own GPU layer ahead of time for that property. */
  will-change: transform, opacity, filter;
}

.hrlighthouse-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 55%;
  max-width: var(--hrlighthouse-max-width);
  padding: 0 1rem;
  will-change: transform, opacity, filter;
}

/* GSAP animates heading/paragraph/subtext individually (their own y and
   opacity), not just their .hrlighthouse-content parent. Without their
   own will-change hint, the browser had no reason to pre-promote these
   specific elements to the compositor and could fall back to laying out
   and repainting them on every scrubbed scroll frame — a likely source
   of the remaining stutter, independent of the blur fix. */
.hrlighthouse-heading,
.hrlighthouse-paragraph,
.hrlighthouse-subtext {
  will-change: transform, opacity;
}

.hrlighthouse-heading {
  margin: 0rem 0 1.2rem 0;
  font-family: 'BagossCondensed-TRIAL-Medium', sans-serif;
  font-size: 4rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 4.8rem;
  color: var(--hrlighthouse-text-color);
}

.hrlighthouse-paragraph {
  margin: 0 0 1rem 0;
  font-family: 'BagossCondensed-TRIAL-Medium', sans-serif;
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 3.2rem;
  color: var(--hrlighthouse-text-color);
}

.hrlighthouse-subtext {
  margin: 0;
  font-family: 'BagossCondensed-TRIAL-Medium', sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 2.2rem;
  color: var(--hrlighthouse-subtext-color);
}

/* Tablet — the old CSS jumped straight from desktop (55% width,
   20rem bigword) to a 480px phone breakpoint, so anything between
   481–768px (small tablets, large phones landscape) rendered the full
   desktop sizes: a 20rem bigword on a 600px-wide screen overflows the
   viewport badly. This tier fixes that gap. */
@media (max-width: 768px) {
  .hrlighthouse-bigword {
    font-size: 10rem;
    line-height: 11rem;
    top: 6%;
  }
  .hrlighthouse-content {
    width: 85%;
  }
  .hrlighthouse-heading {
    font-size: 3.2rem;
    line-height: 3.8rem;
  }
  .hrlighthouse-paragraph {
    font-size: 1.9rem;
    line-height: 2.6rem;
  }
}

@media (max-width: 480px) {
  .hrlighthouse-heading {
    line-height: 4rem;
    font-size: 3.4rem;
  }
  .hrlighthouse-bigword {
    font-size: 7rem;
    /* Pulled back up a bit from 13% — that put the ghost word right on
       top of the heading with too little breathing room. This trades a
       little visibility (a sliver may sit behind the header again) for
       more separation from the heading below. */
    top: 9%;
    line-height: 8rem;
    align-items: center;
    justify-content: center;
  }
  /* True centering (align-items: center) puts the heading at the
     screen's dead center, which on a full-height phone viewport is
     far below the ghost "bigword" text. Anchoring to the top instead
     and pulling the offset in tight (15vh, viewport-relative so it
     scales with actual screen height) keeps the heading right behind/
     below the bigword instead of a screen-height away from it. */
  .hrlighthouse-slide {
    align-items: flex-start;
    padding-top: 20vh;
  }
  .hrlighthouse-content {
    line-height: 3.2rem;
    font-size: 2.6rem;
    gap: 0.6rem;
    width: 95%;
  }
  .hrlighthouse-paragraph {
    margin: 0 0 1rem 0;
    font-family: 'BagossCondensed-TRIAL-Medium', sans-serif;
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 2.6rem;
    color: var(--hrlighthouse-text-color);
  }
  .hrlighthouse-bg {
    position: absolute;
    width: 100%;
    height: 90%;
    /* mobile-cropped version of the hero background, framed for a
       narrow/tall viewport instead of the wide desktop image */
    background-image: url('/wp-content/uploads/2026/07/vision-section-mobile-bg.webp');
  }
}

/* Respect the OS-level "reduce motion" setting — skip the scroll-jacked
   pin/blur animation entirely for these users instead of forcing it. */
@media (prefers-reduced-motion: reduce) {
  .hrlighthouse-bigword,
  .hrlighthouse-heading,
  .hrlighthouse-paragraph,
  .hrlighthouse-subtext {
    transition: none !important;
  }
}
