/* =====================================================================
   BC Intro (v3) — Banyan Courtyard
   Figma: section H-02, frame 2359 × 1066.
   Desktop sizes = Figma px × --bc-u. ≤1024px uses fixed px.

   Motion: the hero stays where it is and this section dissolves in over
   it as you scroll — blur, then white, then the claim and its line.
   Everything follows the scroll (forward and back); nothing is timed.
   ==================================================================== */

/* The Elementor container around it: no padding, full width. */
.e-con:has(> .elementor-widget-bc-intro),
.e-con:has(> .e-con-inner > .elementor-widget-bc-intro) {
  padding: 0 !important;
  --padding-top: 0px;
  --padding-right: 0px;
  --padding-bottom: 0px;
  --padding-left: 0px;
}
.e-con:has(> .e-con-inner > .elementor-widget-bc-intro) > .e-con-inner {
  max-width: none !important;
  padding: 0 !important;
}
.elementor-widget-bc-intro {
  width: 100%;
}

.bc-intro {
  --bc-u: calc(100vw / 2359);
  --bc-h: 100svh;
  --bc-hold: 120svh;                  /* scroll length of the change + a short rest */
  --bc-bg: #fff;
  --bc-ink: #000;
  --bc-ls: 0.56em;                    /* heading tracking (Figma 56%) */

  position: relative;
  display: block;
  width: 100%;
  height: var(--bc-h);
  min-height: 420px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow: clip;
  color: var(--bc-ink);
}

.bc-intro .bc-intro__stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow: clip;
}

/* Layers: blur of what's behind, then the paper (background colour). */
.bc-intro .bc-intro__haze,
.bc-intro .bc-intro__paper {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bc-intro .bc-intro__haze {
  display: none;
}
.bc-intro .bc-intro__paper {
  background: var(--bc-bg);
}

/* ---------- Guide line ---------- */
.bc-intro .bc-intro__guide {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: calc(50% - 140 * var(--bc-u));
  margin-left: -0.5px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.2) 45%,
    rgba(0, 0, 0, 0.2) 100%
  );
  transform-origin: 50% 0;
  pointer-events: none;
}

/* ---------- Text ---------- */
.bc-intro .bc-intro__inner {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  padding: 0 24px;
  text-align: center;
}
.bc-intro .bc-intro__title,
.bc-intro h1.bc-intro__title,
.bc-intro h2.bc-intro__title,
.bc-intro h3.bc-intro__title {
  /* line-height 1: Inter's cap middle = the box middle, so -0.5em puts
     the capitals exactly on the centre line (as in Figma) */
  margin: -0.5em 0 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: max(calc(36 * var(--bc-u)), 18px);
  line-height: 1;
  letter-spacing: var(--bc-ls);
  text-transform: uppercase;
  text-align: center;
  font-variation-settings: "opsz" 14;
  font-kerning: none;
  color: var(--bc-ink);
}
.bc-intro .bc-intro__name {
  display: block;
  word-spacing: var(--bc-ls);
}
.bc-intro .bc-intro__word {
  display: inline-block;
  white-space: nowrap;
}
.bc-intro .bc-intro__ch {
  display: inline-block;
  margin-right: calc(var(--k, 0) * 1em);
}
/* No trailing tracking after a word — keeps the line truly centred. */
.bc-intro .bc-intro__word .bc-intro__ch:last-child {
  margin-right: calc(-1 * var(--bc-ls));
}

.bc-intro p.bc-intro__text,
.bc-intro .bc-intro__text {
  margin: calc(56.82 * var(--bc-u)) auto 0;
  padding: 0;
  max-width: 40em;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: max(calc(20 * var(--bc-u)), 14px);
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  font-variation-settings: "opsz" 14;
  color: var(--bc-ink);
}


/* =====================================================================
   OVER-THE-HERO MODE (v3) — pure CSS layout, so the very first paint is
   already right; no script moves anything.
   Applies when a BC Hero container is directly followed by the container
   holding this widget (with "Dissolve over the section above" on).
   - the hero container is sticky: it stays where it is
   - this container is pulled up over it (-100svh) and its stage is
     pinned for --bc-hold of scrolling
   - intro.js only writes --p (0 → 1 as you scroll through the change,
     softly smoothed); every layer below is a function of --p, so it
     builds as you scroll down and rewinds as you scroll up.
   ===================================================================== */
@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"]) {
    position: sticky;
    top: 0;
    z-index: 0;
  }
  /* everything after the hero is painted above it */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) ~ .e-con {
    position: relative;
    z-index: 1;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con {
    margin-top: -100svh;
    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 .elementor-widget-bc-intro {
    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 .bc-intro {
    --p: 0;
    height: calc(100svh + var(--bc-hold));
    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 .bc-intro .bc-intro__stage {
    position: sticky;
    top: 0;
    height: 100svh;
  }
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro.is-in .bc-intro__stage {
    pointer-events: auto;
  }

  /* 1. the hero softens into blur            p 0.00 → 0.25 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__haze {
    --x: clamp(0, calc(var(--p) / 0.25), 1);
    display: block;
    opacity: var(--x);
    -webkit-backdrop-filter: blur(18px) saturate(0.9);
    backdrop-filter: blur(18px) saturate(0.9);
  }
  /* 2. white dissolves over it               p 0.08 → 0.45 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__paper {
    --x: clamp(0, calc((var(--p) - 0.08) / 0.37), 1);
    opacity: calc(var(--x) * var(--x) * (3 - 2 * var(--x)));
  }
  /* 3. the guide line lowers                 p 0.35 → 0.60 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__guide {
    --x: clamp(0, calc((var(--p) - 0.35) / 0.25), 1);
    opacity: var(--x);
    transform: scaleY(calc(var(--x) * var(--x) * (3 - 2 * var(--x))));
  }
  /* 4. the claim dissolves out of blur, centre letters first
                                             p 0.40 → 0.82 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__ch {
    --lp: clamp(0, calc((var(--p) - 0.4 - var(--d) * 0.12) / 0.3), 1);
    --e: calc(1 - (1 - var(--lp)) * (1 - var(--lp)));
    opacity: var(--lp);
    filter: blur(calc((1 - var(--e)) * 0.45em));
    transform: translate3d(calc(var(--o) * 0.08em * (1 - var(--e))), 0, 0);
  }
  /* 5. the line beneath follows              p 0.62 → 0.90 */
  .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__text {
    --tp: clamp(0, calc((var(--p) - 0.62) / 0.28), 1);
    --te: calc(1 - (1 - var(--tp)) * (1 - var(--tp)));
    opacity: var(--tp);
    filter: blur(calc((1 - var(--te)) * 10px));
    transform: translate3d(0, calc((1 - var(--te)) * 10 * var(--bc-u)), 0);
  }

  @media (max-width: 1024px) {
    .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__text {
      transform: translate3d(0, calc((1 - var(--te)) * 8px), 0);
    }
  }
  /* phones: two lines, so the letters settle upwards instead of sideways */
  @media (max-width: 600px) {
    .e-con:has(> .elementor-widget-bc-hero, > .e-con-inner > .elementor-widget-bc-hero):has(+ .e-con .bc-intro[data-anim="1"]) + .e-con .bc-intro .bc-intro__ch {
      transform: translate3d(0, calc((1 - var(--e)) * 0.35em), 0);
    }
  }
}


/* =====================================================================
   TABLETS (601–1024px)
   ===================================================================== */
@media (max-width: 1024px) {
  .bc-intro .bc-intro__guide {
    height: calc(50% - 90px);
  }
  .bc-intro .bc-intro__title,
  .bc-intro h1.bc-intro__title,
  .bc-intro h2.bc-intro__title,
  .bc-intro h3.bc-intro__title {
    font-size: clamp(16px, calc((100vw - 96px) / 34), 26px);
  }
  .bc-intro p.bc-intro__text,
  .bc-intro .bc-intro__text {
    margin-top: 30px;
    font-size: 16px;
    line-height: 1.5;
  }
}

/* =====================================================================
   PHONES (≤600px) — heading wraps onto two balanced lines
   ===================================================================== */
@media (max-width: 600px) {
  .bc-intro .bc-intro__inner {
    transform: translateY(-50%);
  }
  .bc-intro .bc-intro__guide {
    height: calc(50% - 120px);
  }
  .bc-intro .bc-intro__title,
  .bc-intro h1.bc-intro__title,
  .bc-intro h2.bc-intro__title,
  .bc-intro h3.bc-intro__title {
    margin: 0;
    font-size: clamp(14px, calc((100vw - 48px) / 19), 18px);
    line-height: 2;
    text-wrap: balance;
  }
  .bc-intro p.bc-intro__text,
  .bc-intro .bc-intro__text {
    margin-top: 18px;
    font-size: 15px;
    text-wrap: balance;
  }
}