/* =====================================================================
   BC Gallery (v2.1) — Banyan Courtyard
   Figma: section H-03, frame 2359 × 1066: four full-height photographs
   (591 / 590 / 589 / 589). ≤600px: two by two.

   Motion (when its container comes right after the BC Intro container,
   which itself sits over the BC Hero): the intro stays where it is and
   blurs into white, then the photographs slide up one by one, left to
   right, as you scroll; once the last has landed, gallery.js tells the
   booking dock to rise in. Everything follows the scroll both ways.
   ===================================================================== */

/* The Elementor container around it: no padding, full width. */
.e-con:has(> .elementor-widget-bc-gallery),
.e-con:has(> .e-con-inner > .elementor-widget-bc-gallery) {
  padding: 0 !important;
  --padding-top: 0px;
  --padding-right: 0px;
  --padding-bottom: 0px;
  --padding-left: 0px;
}
.e-con:has(> .e-con-inner > .elementor-widget-bc-gallery) > .e-con-inner {
  max-width: none !important;
  padding: 0 !important;
}
.elementor-widget-bc-gallery {
  width: 100%;
}

.bc-gal {
  --bc-h: 100svh;
  --bc-ghold: 160svh;   /* stage mode: scroll length of the entrance + a short rest */

  position: relative;
  display: block;
  width: 100%;
  height: var(--bc-h);
  min-height: 560px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow: clip;
}

.bc-gal .bc-gal__stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow: clip;
  background: #0d0b09;
}

/* stage mode only: blur of the section behind, then white */
.bc-gal .bc-gal__haze,
.bc-gal .bc-gal__paper {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bc-gal .bc-gal__paper {
  background: #fff;
}

.bc-gal .bc-gal__panel {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  overflow: hidden;
  min-width: 0;
}
.bc-gal .bc-gal__media {
  position: absolute;
  inset: 0;
}
.bc-gal img.bc-gal__img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  object-position: var(--bc-fx, 50%) 50%;
  transition: scale 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* hover: the other photographs dim a little, the one you point at leans in */
.bc-gal .bc-gal__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #0d0b09;
  opacity: 0;
  transition: opacity 0.7s ease;
}
@media (hover: hover) and (pointer: fine) {
  .bc-gal .bc-gal__stage:hover .bc-gal__panel:not(:hover)::after {
    opacity: 0.32;
  }
  .bc-gal .bc-gal__panel:hover img.bc-gal__img {
    scale: 1.04;
  }
}


/* =====================================================================
   STAGE MODE — pure CSS layout (first paint is already right).
   Chain: BC Hero container → BC Intro container → this container,
   all with their motion on.
   - the intro container stays where it is: sticky, bottom-aligned
     (-120svh = 100svh screen − 220svh tall: the intro's --bc-hold is 120svh)
   - this container is pulled up over it and its stage is pinned for
     --bc-ghold of scrolling; gallery.js writes --p (0 → 1 over 1.3 screens)
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {

  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) {
    position: sticky;
    top: -120svh;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con {
    margin-top: -100svh;
    z-index: 1;   /* same level as every later section: DOM order stacks them */
    pointer-events: none;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .elementor-widget-bc-gallery {
    pointer-events: none;
  }

  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal {
    --p: 0;
    height: calc(100svh + var(--bc-ghold));
    min-height: 0;
    overflow: visible;
    pointer-events: none;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__stage {
    position: sticky;
    top: 0;
    height: 100svh;
    background: none;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal.is-in .bc-gal__stage {
    pointer-events: auto;
  }

  /* 1. the intro softens into blur …           p 0.00 → 0.18 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__haze {
    --x: clamp(0, calc(var(--p) / 0.18), 1);
    display: block;
    opacity: var(--x);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }
  /* … and becomes white                         p 0.05 → 0.30 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__paper {
    --x: clamp(0, calc((var(--p) - 0.05) / 0.25), 1);
    display: block;
    opacity: calc(var(--x) * var(--x) * (3 - 2 * var(--x)));
  }

  /* 2. the photographs slide up one by one, left to right
        photo i: p 0.30 + i·0.11 → +0.24 (the 4th lands at 0.87) */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__panel {
    --q: clamp(0, calc((var(--p) - 0.3 - var(--i) * 0.11) / 0.24), 1);
    --e: calc(1 - (1 - var(--q)) * (1 - var(--q)) * (1 - var(--q)));
    transform: translate3d(0, calc((1 - var(--e)) * 100svh), 0);   /* always from below the screen (phones: top row too) */
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__media {
    transform: translate3d(0, calc((1 - var(--e)) * -30%), 0) scale(calc(1.08 - 0.08 * var(--e)));
  }
  /* (3. the booking dock rises in at p 0.9 — gallery.js → dock.js) */
}


/* =====================================================================
   PHONES (≤600px) — two by two
   ===================================================================== */
@media (max-width: 600px) {
  .bc-gal {
    height: auto;
    min-height: 0;
  }
  .bc-gal .bc-gal__stage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }
  .bc-gal .bc-gal__panel {
    height: max(calc(var(--bc-h) / 2), 280px);
  }
}
@media (max-width: 600px) and (prefers-reduced-motion: no-preference) {
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal {
    height: calc(100svh + var(--bc-ghold));
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__stage {
    height: 100svh;
    grid-template-rows: 1fr 1fr;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con:has(+ .e-con .bc-gal[data-anim="1"]) + .e-con .bc-gal .bc-gal__panel {
    height: auto;
  }
}