/* HBB Groep: reveal states.
   Everything here is zero-specificity (:where), so theme and Elementor classes
   always win on transition timing and hover transforms. Elements that also
   transition on their own (buttons, cards) should use transition longhands
   and include var(--reveal-delay) in transition-delay, so the stagger survives. */

/* Hidden start state before motion.js runs. html.hbb-motion is set by an
   inline script in <head> (only when motion is allowed). */
:where(html.hbb-motion) :where([data-reveal], [data-reveal-group] > *, .anim-fade-up, .anim-stagger > *, [class*="anim-stagger-"] > *) {
  opacity: 0;
  transform: translateY(28px);
}

:where(.reveal) {
  opacity: 0;
  transform: translateY(28px);
  transition-property: opacity, transform;
  transition-duration: 0.4s, 0.4s;
  transition-timing-function: var(--ease-out, cubic-bezier(.22, .61, .36, 1)), var(--ease-out, cubic-bezier(.22, .61, .36, 1));
  transition-delay: var(--reveal-delay, 0ms), var(--reveal-delay, 0ms);
}

:where(.reveal.is-visible) {
  opacity: 1;
  transform: translateY(0);
}

/* Elementor gives every .elementor-element (section, column, widget) its own
   transition (background, border, border-radius, box-shadow, transform), which
   beats the zero-specificity rule above: opacity would pop in at once and the
   delay would be lost. Elementor's own properties are kept. :root raises the
   specificity above Elementor 4's `.elementor-element:where(...):not(:has(...))`,
   which loads after this file. */
:root .elementor-element.reveal {
  transition-property: opacity, transform, background, border, border-radius, box-shadow;
  transition-duration: 0.4s, 0.4s, 0.3s, 0.3s, 0.3s, 0.3s;
  transition-timing-function: var(--ease-out, cubic-bezier(.22, .61, .36, 1));
  transition-delay: var(--reveal-delay, 0ms);
}

/* Listing grid cards (JetEngine) also grow from 85% to 100% while they come in.
   A bit longer than the other reveals, so the growth reads. */
.jet-listing-grid__item.reveal {
  transform: translateY(28px) scale(0.85);
  transition-duration: 0.55s, 0.55s;
}

.jet-listing-grid__item.reveal.is-visible {
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  :where(.reveal),
  :root .elementor-element.reveal,
  .jet-listing-grid__item.reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }
}


/* ---- Parallax backgrounds (parallax.js) -----------------------------------
   Page headers and sections with .anim-parallax. The start framing stays exactly
   as Elementor shows it.
   - Image layer: same box as the section; parallax.js sets its cover size, position,
     top and height in px from the room the image has above the visible crop.
   - Video: the container is taller by --parallax-range and centred, so the video keeps
     its framing; it moves down by at most half the range. Set here (not by JS), so
     Elementor sizes the video for this container from the start. On mobile the range
     is smaller, so the (16:9) video is not zoomed in further. */
.page-header,
.anim-parallax {
  --parallax-range: 110px;
  overflow: hidden;
}

@media (max-width: 767px) {
  .page-header,
  .anim-parallax {
    --parallax-range: 80px;
  }
}

/* :root beats Elementor's later-loaded `.elementor .elementor-background-video-container { inset: 0 }`. */
:root .page-header > .elementor-background-video-container,
:root .anim-parallax > .elementor-background-video-container {
  top: calc(var(--parallax-range) / -2);
  bottom: auto;
  height: calc(100% + var(--parallax-range));
  will-change: transform;
}

.hbb-parallax-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: inherit;
  pointer-events: none;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .hbb-parallax-layer {
    display: none;
  }

  :root .page-header > .elementor-background-video-container,
  :root .anim-parallax > .elementor-background-video-container {
    top: 0;
    height: 100%;
  }
}


/* ---- Lenis smooth scroll (recommended base styles) ---------------------- */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
  overflow: clip;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}


/* ---- Project image page transition (cross-document View Transitions) --------
   Opt in on every page; transition.js skips every navigation except
   "project card → its project page". Browsers without support just navigate. */
@view-transition {
  navigation: auto;
}

::view-transition-group(project-image) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(.22, .61, .36, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

/* On arrival the project image is shown at once (it is part of a reveal stagger),
   so the transition has something to land on. */
html.vt-arrive .featured-image {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
