/* ═══════════════════════════════════════════════════════════════
   SS BUILDERS MVS — CINEMATIC SCROLL-DRIVEN HERO CSS
   Awwwards-caliber scroll-driven storytelling experience
   ═══════════════════════════════════════════════════════════════ */

/* ── Section Container — Pinnable ──────────────────────────── */
.ch {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 700px;
  overflow: hidden;
  background: #000000;
  z-index: 1;
}

/* Spacer injected by ScrollTrigger for pin duration */
.ch-pin-spacer { background: #000000 !important; }

/* ── Layer 0: Black Base ───────────────────────────────────── */
.ch-base {
  position: absolute;
  inset: 0;
  background: #000000;
  z-index: 0;
  transition: background 0.6s ease;
}

/* Subtle architectural grid texture to give grounding */
.ch-base::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center;
  opacity: 0.6;
  pointer-events: none;
}

/* Cinematic vignette — adds photographic depth framing */
.ch::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 48%, transparent 40%, rgba(2,2,2,0.6) 100%);
}

/* ── Layer 1: Cinematic Fog ────────────────────────────────── */
.ch-fog {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.ch-fog__far {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 60% 80%, rgba(180,150,80,0.06) 0%, transparent 55%);
  will-change: transform, opacity;
}
.ch-fog__mid {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 60% at 40% 70%, rgba(200,170,100,0.05) 0%, transparent 45%);
  will-change: transform, opacity;
}
.ch-fog__near {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(to top, rgba(5,5,5,0.95) 0%, rgba(5,5,5,0.4) 40%, transparent 100%);
}

/* ── Layer 2: Main Building Canvas ─────────────────────────── */
.ch-canvas {
  position: absolute;
  top: 50%;
  left: 58%;
  transform: translate(-35%, -50%);
  width: 78%;
  max-width: 1100px;
  height: 90%;
  z-index: 2;
  pointer-events: none;
  image-rendering: auto;
  will-change: transform, opacity, filter;
  filter: contrast(1.06) saturate(1.12) brightness(1.02);
}

/* ── Layer 3: Energy Canvas ────────────────────────────────── */
.ch-energy {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ── Layer 4: Volumetric Rays ──────────────────────────────── */
.ch-rays {
  position: absolute;
  top: 5%;
  left: 35%;
  width: 65%;
  height: 95%;
  z-index: 4;
  pointer-events: none;
  background: conic-gradient(
    from 200deg at 50% 20%,
    transparent 0deg,
    rgba(212,175,85,0.05) 15deg,
    transparent 30deg,
    rgba(212,175,85,0.07) 50deg,
    transparent 65deg,
    rgba(212,175,85,0.04) 80deg,
    transparent 100deg,
    rgba(212,175,85,0.06) 140deg,
    transparent 160deg,
    rgba(212,175,85,0.04) 200deg,
    transparent 220deg,
    rgba(212,175,85,0.03) 280deg,
    transparent 360deg
  );
  opacity: 0;
  filter: blur(30px);
  will-change: opacity, transform;
}

/* ── Layer 5: Bloom + Lens Flare ───────────────────────────── */
.ch-bloom {
  position: absolute;
  top: 12%;
  right: 18%;
  width: 450px;
  height: 450px;
  z-index: 5;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,85,0.18) 0%, transparent 70%);
  filter: blur(60px);
  opacity: 0;
  will-change: opacity, transform;
}

.ch-flare {
  position: absolute;
  top: 18%;
  right: 24%;
  width: 10px;
  height: 10px;
  z-index: 6;
  pointer-events: none;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 20px 10px rgba(255,255,255,0.3),
    0 0 60px 30px rgba(212,175,85,0.2),
    0 0 120px 60px rgba(212,175,85,0.1);
  opacity: 0;
  will-change: opacity, transform;
}

/* ── Layer 6: Floor Reflection & Shadow ─────────────────────────────── */
/* Deep grounding shadow directly under the villa */
.ch-shadow {
  position: absolute;
  bottom: 15%;
  left: 45%;
  width: 40%;
  height: 40px;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 40%, transparent 70%);
  filter: blur(12px);
  opacity: 0.8;
}

.ch-reflection {
  position: absolute;
  bottom: 0;
  left: 28%;
  width: 50%;
  height: 25%;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(to top,
    rgba(212,175,85,0.12) 0%,
    rgba(212,175,85,0.05) 20%,
    rgba(200,180,120,0.02) 40%,
    transparent 100%
  );
  filter: blur(10px);
  opacity: 0;
  will-change: opacity;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

/* ── Layer 7: Floating Dust ────────────────────────────────── */
.ch-dust {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
}

/* ── Layer 8: Camera Wrapper ───────────────────────────────── */
.ch-camera {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 10;
  perspective: 1200px;
  will-change: transform;
}

/* Black background fade behind the text for maximum contrast */
.ch-camera::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 55%;
  height: 100%;
  background: linear-gradient(to right, #000000 0%, rgba(0,0,0,0.85) 45%, transparent 100%);
  z-index: 14;
  pointer-events: none;
}

/* ── Phase Indicator — Refined Glass Panel ─────────────────── */
.ch-phase {
  position: absolute;
  top: 96px;
  right: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 20;
  opacity: 0;
  transform: translateY(-8px);
  will-change: opacity, transform;
}
.ch-phase.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.ch-phase__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d4af55;
  box-shadow: 0 0 8px rgba(212,175,85,0.5);
  animation: phasePulse 2.5s ease-in-out infinite;
}
.ch-phase__text {
  font-family: 'Inter', 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  transition: opacity 0.3s ease;
}

@keyframes phasePulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.3); opacity: 0.4; }
}

/* ── End Sequence Logo ────────────────────────────────────────── */
.ch-end-logo {
  position: absolute;
  top: 50%;
  left: 6%;
  transform: translateY(-50%);
  z-index: 25;
  opacity: 0; /* Hidden initially, revealed by GSAP */
  pointer-events: none;
}
.ch-end-logo__text {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(3rem, 5vw, 4.5rem);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ch-end-logo__sub {
  display: block;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--electric-blue);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 12px;
}

/* ── Content Block (Foreground Layer) ─────────────────────── */
.ch-content {
  position: absolute;
  top: 56%;
  left: 4%;
  transform: translateY(-50%);
  max-width: 480px;
  z-index: 15;
  will-change: transform, opacity;
}

/* Overline */
.ch-overline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
}
.ch-overline__bar {
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, var(--electric-blue), var(--electric-blue-light));
  flex-shrink: 0;
}
.ch-overline__text {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--electric-blue);
}

/* Title — villa is hero, type supports it */
.ch-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: 0em;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}
.ch-title__line {
  display: block;
  margin-bottom: 4px;
}
.ch-title__word {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  margin-right: 0.15em;
  visibility: hidden;
}

/* GSAP-generated character spans for letter-by-letter reveal */
.ch-char {
  display: inline-block;
  will-change: opacity, transform;
}
.ch-title__accent {
  color: var(--electric-blue-dark);
  font-style: normal;
}

/* Apply gradient only to the GSAP-generated chars to prevent transform WebKit bugs */
.ch-title__accent .ch-char {
  background: linear-gradient(135deg, var(--electric-blue-dark) 0%, var(--electric-blue) 40%, var(--electric-blue-dark) 60%, #C85A4A 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldShimmer 4s ease-in-out infinite;
}

@keyframes goldShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Subtitle */
.ch-sub {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
}

/* Actions */
.ch-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(24px);
  visibility: hidden;
}

/* Buttons - Dynamic & Vibrant */
.ch-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 36px;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  z-index: 1;
}

/* Primary Button - Animated Aurora Gradient */
.ch-btn--primary {
  background: linear-gradient(-45deg, var(--electric-blue-dark), #ff7a59, var(--electric-blue), #ff9b7d, var(--electric-blue-dark));
  background-size: 300% 300%;
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(245, 143, 124, 0.4);
  animation: auroraBG 4s ease infinite;
}
@keyframes auroraBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.ch-btn--primary:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 35px rgba(245, 143, 124, 0.6), 0 0 20px rgba(245, 143, 124, 0.4);
}
.ch-btn__arrow { 
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); 
  font-size: 1.2em;
}
.ch-btn--primary:hover .ch-btn__arrow { 
  transform: translateX(8px); 
}

/* Glass Button - Angled Swipe Reveal */
.ch-btn--glass {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ch-btn--glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: skewX(-15deg);
  transform-origin: left;
  transition: left 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: -1;
}
.ch-btn--glass:hover {
  color: var(--deep-navy);
  border-color: #fff;
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}
.ch-btn--glass:hover::before {
  left: 0;
  transform: skewX(0deg);
}

/* Unique Price Badge */
.ch-price {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
  margin-top: 10px;
  visibility: hidden;
}
.ch-price__inner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 8px 12px;
  background: var(--glass-white);
  border: 1px solid var(--glass-white-border);
  border-radius: 100px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-body);
  font-size: 0.85rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}
.ch-price__inner:hover {
  background: var(--glass-white-hover);
  border-color: var(--electric-blue-glow);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.ch-price__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--electric-blue-subtle);
  border-radius: 50%;
  color: var(--electric-blue);
  font-size: 0.6rem;
  box-shadow: 0 0 12px var(--shadow-blue);
}
.ch-price__label {
  color: var(--text-secondary);
  font-weight: 400;
}
.ch-price strong { 
  color: #fff; 
  font-weight: 700; 
  letter-spacing: 0.02em;
}

/* ── Stats Bar ─────────────────────────────────────────────── */
.ch-stats {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  display: flex;
  align-items: center;
  padding: 16px 40px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 80px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 15;
  opacity: 0;
  will-change: transform, opacity;
}
.ch-stats.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ch-stat { text-align: center; padding: 0 24px; }
.ch-stat__num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem; font-weight: 700;
  color: #fff; line-height: 1;
}
.ch-stat__unit {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem; font-weight: 600;
  color: #d4af55; margin-left: 2px;
}
.ch-stat__label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin-top: 4px;
}
.ch-stat__divider {
  width: 1px; height: 32px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* ── Progress Bar ──────────────────────────────────────────── */
.ch-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  z-index: 20;
  background: rgba(255,255,255,0.03);
}
.ch-progress__fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #d4af55, #f0d78c);
  will-change: width;
}
.ch-progress__glow {
  position: absolute;
  top: -4px; right: 0;
  width: 60px; height: 10px;
  background: radial-gradient(ellipse, rgba(212,175,85,0.6) 0%, transparent 70%);
  filter: blur(4px);
  will-change: left;
}

/* ── Scroll Cue ────────────────────────────────────────────── */
.ch-scroll {
  position: absolute;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 15;
  opacity: 0;
}
.ch-scroll.visible { opacity: 1; transition: opacity 1s ease; }
.ch-scroll__text {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
}
.ch-scroll__line {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, rgba(212,175,85,0.4), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1); opacity: 0.4; }
  50%      { transform: scaleY(0.6); opacity: 0.8; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ch-canvas { left: 55%; transform: translate(-45%, -52%); width: 82%; }
  .ch-content { left: 4%; max-width: 420px; }
  .ch-phase { top: 88px; right: 24px; }
  .ch-stats { padding: 14px 32px; }
  .ch-stat { padding: 0 18px; }
  .ch-stat__num { font-size: 1.4rem; }
}

@media (max-width: 768px) {
  .ch { min-height: 100vh; min-height: 100svh; }
  .ch-canvas {
    top: 28%; left: 50%;
    transform: translate(-50%, -50%);
    width: 95%; height: 45%;
  }
  .ch-content {
    top: auto; bottom: 180px;
    left: 5%; right: 5%;
    transform: none; max-width: 100%;
  }
  .ch-title { font-size: clamp(2rem, 8vw, 3rem); }
  .ch-sub { font-size: 0.85rem; }
  .ch-sub br { display: none; }
  .ch-phase { top: 75px; right: 15px; padding: 6px 14px; }
  .ch-phase__text { font-size: 0.6rem; }
  .ch-stats {
    bottom: 60px; padding: 14px 20px;
    border-radius: 20px; width: 90%;
  }
  .ch-stat { padding: 0 12px; }
  .ch-stat__num { font-size: 1.2rem; }
  .ch-stat__label { font-size: 0.55rem; }
  .ch-bloom, .ch-flare { display: none; }
}

@media (max-width: 480px) {
  .ch-title { font-size: clamp(1.8rem, 9vw, 2.5rem); }
  .ch-actions { flex-direction: column; gap: 10px; }
  .ch-btn { justify-content: center; padding: 12px 24px; }
  .ch-stats { flex-wrap: wrap; border-radius: 16px; justify-content: center; }
  .ch-stat__divider:nth-child(4) { display: none; }
  .ch-stat { padding: 6px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-phase__dot, .ch-scroll__line { animation: none !important; }
  .ch-title__accent { animation: none !important; }
}

/* ── No-JS Fallback ──────────────────────────────────────────── */
/* When JavaScript fails to load or is disabled, ensure hero      */
/* content is still visible. JS adds .js-loaded to <html>.        */
html:not(.js-loaded) .ch-overline,
html:not(.js-loaded) .ch-title__word,
html:not(.js-loaded) .ch-sub,
html:not(.js-loaded) .ch-actions,
html:not(.js-loaded) .ch-price {
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
}
