/* ================================================================
   HERO-PARALLAX.CSS — 2.5D Immersive Therapy Room
   Bright · Warm · Airy  (daylight atmosphere, never dark)
   Architecture: CSS sticky  +  GSAP ScrollTrigger scrub timeline
   Fallbacks: prefers-reduced-motion → static  |  mobile → static
   ================================================================ */

/* ---------------------------------------------------------------
   1. Scroll container
   200vh = 100vh visible stage + 100vh of scroll travel
   overflow: visible is critical — do NOT clip the sticky child
   --------------------------------------------------------------- */
#hero-3d {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

/* ---------------------------------------------------------------
   2. Sticky stage — pinned to top while user scrolls inside
      the 200vh container. Height matches the viewport so it
      fills the screen during the entire scroll range.
   --------------------------------------------------------------- */
.hero-sticky {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #FFF9F0;
}

/* ---------------------------------------------------------------
   3. Shared layer base
   All layers fill the sticky stage; GPU-promoted for scroll perf.
   --------------------------------------------------------------- */
.hero-layer {
  position: absolute;
  inset: 0;
  will-change: transform, opacity;
}

/* ---------------------------------------------------------------
   4. Layer 0 — Sky / ambient background
   Warm cream-to-gold gradient visible before the room image loads
   --------------------------------------------------------------- */
.layer-sky {
  z-index: 0;
  background: linear-gradient(
    155deg,
    #FFFAF5 0%,
    #FFF5E5 30%,
    #FFEFD5 60%,
    #F8E8C0 100%
  );
}

/* ---------------------------------------------------------------
   5. Layer 1 — Close-up room interior (background, deep/slow)
   concept-room.png: the "destination" — you're moving TOWARD it.
   Moves slowest → feels furthest away → creates 3D back-plane.
   --------------------------------------------------------------- */
.layer-room-img {
  z-index: 1;
  background-image: url('/static/hero/concept-room.png');
  background-size: cover;
  background-position: center 18%;
  filter: brightness(1.06) saturate(0.90);
  transform-origin: center center;
}

/* ---------------------------------------------------------------
   5b. Layer 1.5 — Doorway/entry frame (foreground, fast)
   concept-entry.png: taken from the hallway looking INTO the room.
   Moves FASTER than the room behind it — this differential speed
   is the source of the 3D depth illusion.
   The dark walls / doorframe edges slide past you as you "enter".
   At scroll=0: you're standing at the threshold.
   At scroll end: the hallway walls have "passed by", you're inside.
   --------------------------------------------------------------- */
.layer-entry {
  z-index: 2;
  background-image: url('/static/hero/concept-entry.png');
  background-size: cover;
  background-position: center 25%;
  /* Slightly warm, preserves the golden hour light of the entry */
  filter: brightness(1.02) saturate(0.95);
  transform-origin: center center;
}

/* ---------------------------------------------------------------
   6. Layer 2 — Text-side warm wash
   A gradient that "bleaches" the right side of the screen so the
   Hebrew headline stays readable over the concept image.
   In RTL layouts the text sits on the physical-right side, so
   the gradient fades LEFT (toward the image focal point).
   --------------------------------------------------------------- */
.layer-text-wash {
  z-index: 3;
  background: linear-gradient(
    to left,
    rgba(255, 250, 240, 0.92) 0%,
    rgba(255, 250, 240, 0.78) 22%,
    rgba(255, 250, 240, 0.42) 48%,
    rgba(255, 250, 240, 0.08) 70%,
    transparent 90%
  );
  pointer-events: none;
}

/* ---------------------------------------------------------------
   7. Layer 3 — Window light shafts (CSS only, no image needed)
   Two overlapping radial gradients simulate warm afternoon light
   streaming in from a window on the left side of the room.
   --------------------------------------------------------------- */
.layer-light {
  z-index: 4;
  background:
    radial-gradient(
      ellipse 60% 80% at 18% -5%,
      rgba(255, 232, 130, 0.28) 0%, transparent 68%
    ),
    radial-gradient(
      ellipse 38% 55% at 5% 20%,
      rgba(255, 246, 195, 0.18) 0%, transparent 58%
    );
  opacity: 0.65;
  pointer-events: none;
}

/* ---------------------------------------------------------------
   8. Layer 4 — Floating teal stat card
   Positioned in the center-left area so it sits naturally over
   the room imagery (not on the text side).
   GSAP will drift it upward and fade it during scroll.
   --------------------------------------------------------------- */
.layer-float-card {
  z-index: 8;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  /* In RTL, padding-right pushes the card leftward toward the room */
  padding: 0 52% 22% 0;
  pointer-events: none;
}

/* Glassmorphism card — teal/mint palette */
.hero-float-card {
  background: rgba(10, 195, 172, 0.13);
  backdrop-filter: blur(20px) saturate(1.7);
  -webkit-backdrop-filter: blur(20px) saturate(1.7);
  border: 1px solid rgba(30, 209, 179, 0.38);
  border-radius: 24px;
  padding: 24px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow:
    0 12px 44px rgba(30, 209, 179, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.hero-float-pct {
  font-size: 3rem;
  font-weight: 800;
  color: #0D9488;
  line-height: 1;
  font-family: Heebo, sans-serif;
  letter-spacing: -0.03em;
}

.hero-float-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0F766E;
  font-family: Heebo, sans-serif;
  white-space: nowrap;
}

/* ---------------------------------------------------------------
   9. Layer 5 — Hero text (physical right side in RTL)
   padding-left: 50% leaves the left half free for the room image.
   The text is naturally RTL so it flows right-to-left within its
   container on the right side of the screen.
   --------------------------------------------------------------- */
.layer-text {
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 88px 5% 0 50%;
  /* 88px top = below fixed navbar (~68px) + breathing room */
}

.hero-text-inner {
  max-width: 100%;   /* fills the right ~45% of the screen */
  text-align: right;
  direction: rtl;
}

/* Pill badge */
.hero-badge {
  display: inline-block;
  background: rgba(192, 110, 79, 0.08);
  border: 1px solid rgba(192, 110, 79, 0.22);
  color: #C06E4F;
  padding: 6px 18px;
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 22px;
  font-family: Heebo, sans-serif;
  letter-spacing: 0.01em;
}

/* Main headline */
.hero-title {
  font-size: clamp(1.9rem, 3.8vw, 3.1rem);
  font-weight: 900;
  line-height: 1.18;
  color: #1A1040;
  margin: 0 0 18px;
  font-family: Heebo, sans-serif;
  letter-spacing: -0.025em;
  /* Soft halo keeps text readable over bright bg */
  text-shadow:
    0 2px 24px rgba(255, 250, 235, 0.85),
    0 0 40px rgba(255, 250, 235, 0.6);
}

/* Gradient accent span */
.hero-accent {
  background: linear-gradient(135deg, #C06E4F 0%, #A85838 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sub-headline */
.hero-sub {
  font-size: clamp(0.95rem, 1.7vw, 1.08rem);
  line-height: 1.85;
  color: #2D2060;
  margin: 0 0 32px;
  font-family: Heebo, sans-serif;
  text-shadow: 0 1px 10px rgba(255, 250, 235, 0.75);
}

/* CTA button — purple gradient pill */
.hero-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #C06E4F 0%, #A85838 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 16px 38px;
  font-size: 1.075rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 8px 28px rgba(192, 110, 79, 0.28),
    0 2px 8px rgba(192, 110, 79, 0.18);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  font-family: Heebo, sans-serif;
  margin-bottom: 26px;
  white-space: nowrap;
}

.hero-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 14px 38px rgba(192, 110, 79, 0.38),
    0 4px 12px rgba(192, 110, 79, 0.22);
}

/* Trust row */
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.84rem;
  color: #4A3880;
  font-family: Heebo, sans-serif;
  font-weight: 600;
  direction: rtl;
  justify-content: flex-start; /* RTL flex-start = visual right */
}

.hero-trust span::before {
  content: '✓ ';
  color: #1ED1B3;
  font-weight: 800;
}

/* ---------------------------------------------------------------
   10. Layer 6 — Foreground depth vignette
   Subtle dark edges deepen the sense of a physical space.
   --------------------------------------------------------------- */
.layer-fg-vignette {
  z-index: 11;
  background:
    linear-gradient(to top,   rgba(15, 8, 35, 0.10) 0%,  transparent 25%),
    linear-gradient(to right, rgba(15, 8, 35, 0.05) 0%,  transparent 20%),
    linear-gradient(to left,  rgba(15, 8, 35, 0.05) 0%,  transparent 20%);
  pointer-events: none;
}

/* ---------------------------------------------------------------
   11. Scroll cue — pinned inside the sticky stage, bottom center
   --------------------------------------------------------------- */
.hero-scroll-cue {
  display: none;
}

.scroll-arrow {
  width: 14px;
  height: 14px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

@keyframes scrollCuePulse {
  0%, 100% { opacity: 0.38; transform: translateX(-50%) translateY(0); }
  50%       { opacity: 0.75; transform: translateX(-50%) translateY(5px); }
}

/* ================================================================
   REDUCED-MOTION — completely static, no GSAP loading
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  #hero-3d {
    height: auto;
    overflow: hidden;
  }
  .hero-sticky {
    position: relative;
    min-height: 88vh;
    overflow: hidden;
  }
  .hero-scroll-cue { display: none; }
}

/* ================================================================
   MOBILE ≤ 768px
   Dedicated PORTRAIT room image (concept-room-mobile.png, 1024×1536,
   2:3 ratio). At height 150vw the full portrait shows at full width
   with ZERO crop (390×585px). Text overlays the lower third with a
   gradient wash — same immersive concept as desktop.
   ================================================================ */
@media (max-width: 768px) {
  #hero-3d {
    height: auto;
    overflow: hidden;
  }

  .hero-sticky {
    position: relative;
    min-height: calc(150vw * 0.70 + 304px);
    overflow: hidden;
    background: #F5F3FF; /* match the next section → seamless, no warm band */
  }

  /* ── Sky: SOLID lavender-white (matches next section) ───────── */
  .hero-sticky .layer-sky {
    position: absolute;
    inset: 0;
    background: #F5F3FF;
  }

  /* ── Room: swap to dedicated portrait image, full & uncropped ─ */
  .hero-sticky .layer-room-img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: auto;
    height: 150vw;
    background-image: url('/static/hero/concept-room-mobile.png');
    background-position: center top;
    background-size: cover;
    filter: brightness(1.04) saturate(0.94);
  }

  /* ── Entry layer: portrait doorway → dissolves to reveal room ─ */
  .hero-sticky .layer-entry {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: auto;
    height: 150vw;
    background-image: url('/static/hero/concept-entry-mobile.png');
    background-position: center top;
    background-size: cover;
    filter: brightness(1.03) saturate(0.95);
  }

  /* ── Decorative layers: clip to image area ──────────────────── */
  .hero-sticky .layer-light,
  .hero-sticky .layer-fg-vignette {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: auto;
    height: 150vw;
  }

  /* ── Gradient: fades the image into the lavender-white page AND
        extends ~90px below the image box so no scaled layer ever
        peeks past the seam, and the bottom matches the next section ─ */
  .hero-sticky .layer-text-wash {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: auto;
    height: calc(150vw + 90px);
    background: linear-gradient(
      to bottom,
      transparent 52%,
      rgba(245, 243, 255, 0.40) 66%,
      rgba(245, 243, 255, 0.90) 80%,
      rgba(245, 243, 255, 1.00) 88%,
      #F5F3FF 100%
    );
  }

  /* ── Text: sits over the lower floor area + continues on cream ─ */
  .hero-sticky .layer-text {
    position: absolute;
    top: calc(150vw * 0.70);
    left: 0; right: 0; bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 6% 28px;
    background: none;
    will-change: opacity, transform;
    z-index: 10;
  }

  .hero-text-inner {
    text-align: center;
    direction: rtl;
    width: 100%;
    max-width: 100%;
  }

  .hero-badge {
    font-size: 0.8rem;
    padding: 5px 14px;
    margin-bottom: 12px;
  }

  .hero-title {
    font-size: clamp(1.7rem, 7vw, 2.1rem);
    margin-bottom: 10px;
  }

  .hero-sub {
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 18px;
  }

  .hero-cta-btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 15px 24px;
    margin-bottom: 14px;
  }

  .hero-trust {
    justify-content: center;
    gap: 10px;
    font-size: 0.78rem;
  }

  /* Float card and scroll cue: hidden */
  .layer-float-card { display: none; }
  .hero-scroll-cue  { display: none; }
}

/* ================================================================
   TABLET 769px–1024px — hybrid layout
   ================================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .layer-text {
    padding: 88px 4% 0 44%;
  }

  .layer-float-card {
    padding: 0 46% 18% 0;
  }

  .hero-float-pct {
    font-size: 2.4rem;
  }
}
