/* =========================================================
   BILGIN YACHT — Cinematic Scroll Experience Styles
   Scroll hero · Chapters · Parallax · Cinematic reveals
   ========================================================= */

/* ── SCROLL HERO SECTION ────────────────────────────────────
   The section element is the pin trigger.
   Height: 100vh (GSAP adds a spacer for the full pin distance).
   ──────────────────────────────────────────────────────── */
.scroll-hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: var(--navy);
}

/* ── Particle canvas ── */
.scroll-hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Ambient radial gradient ── */
.scroll-hero__ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 60% at 15% 25%, rgba(200,169,81,0.045) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 85% 75%, rgba(200,169,81,0.025) 0%, transparent 70%);
  pointer-events: none;
}

/* ── AI video background ── */
.scroll-hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
}
.scroll-hero__video.is-ready {
  opacity: 0.88;
}
/* Frame canvas covers video when loaded — keep video hidden beneath */
.scroll-hero__frame-canvas.is-ready ~ .scroll-hero__video,
.scroll-hero__video.is-behind {
  opacity: 0 !important;
}

/* ── Frame sequence canvas (Apple-style pre-decoded JPEG rendering) ──
   Sits at z-index 2 above video — hidden until FrameSequencePlayer
   fires the 'renderable' event and adds the .is-ready class.
   The video element is then hidden to avoid double-compositing.
   ── */
.scroll-hero__frame-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0;
  transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
  pointer-events: none;
  display: block;
}
.scroll-hero__frame-canvas.is-ready {
  opacity: 0.86;
}
.scroll-hero__frame-canvas.is-three-ready {
  background: radial-gradient(circle at 50% 42%, rgba(22, 43, 58, 0.9), #07111f 72%);
}

/* ── Mobile fallback image ── */
.scroll-hero__fallback {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.scroll-hero__fallback.is-ready {
  opacity: 0.88;
}

/* ── Cinematic vignette + bottom fade ── */
.scroll-hero__vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 110% 90% at 50% 50%, rgba(7,17,31,0.08) 24%, rgba(7,17,31,0.68) 100%),
    linear-gradient(
      to bottom,
      rgba(7,17,31,0.46) 0%,
      rgba(7,17,31,0.08) 22%,
      rgba(7,17,31,0.16) 62%,
      rgba(7,17,31,0.82) 100%
    );
}

/* ── Vessel SVG silhouette ── */
.scroll-hero__vessel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 7vh;
  opacity: 0;          /* kept as fallback if WebGL is unavailable */
  pointer-events: none;
}
.scroll-hero__vessel .vessel-svg {
  width: min(90vw, 1200px);
  height: auto;
}

/* ══════════════════════════════════════════════════════════
   CHAPTERS
   Each chapter is absolutely positioned over the full hero.
   Visibility driven entirely by GSAP scroll timeline.
   ══════════════════════════════════════════════════════════ */
.chapters {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* Base chapter layout */
.chapter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 clamp(2rem, 8vw, 10rem);
  will-change: opacity;
}

/* Chapter 0 is visible by default (CSS) — GSAP fades it out */
.chapter[data-chapter="0"] {
  opacity: 1;
  pointer-events: auto;
}

/* ── Chapter inner containers ── */
.chapter__inner {
  max-width: 680px;
  will-change: transform;
}
.chapter__inner--center {
  max-width: 900px;
  text-align: center;
  margin: 0 auto;
}
.chapter__inner--left {
  margin-right: auto;
}
.chapter__inner--right {
  margin-left: auto;
  text-align: right;
}

/* ── Chapter eyebrow ── */
.chapter__eyebrow {
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 0.85vw, 0.7rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.4rem;
  opacity: 0.9;
  display: block;
}

/* ── Chapter headline ── */
.chapter__headline {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6.5vw, 7rem);
  font-weight: 300;
  line-height: 1.03;
  color: var(--warm-white);
  margin: 0 0 1.8rem;
  letter-spacing: -0.01em;
  text-shadow:
    0 2px 40px rgba(7,17,31,0.5),
    0 8px 80px rgba(7,17,31,0.3);
}

/* Italic word variant */
.chapter__headline em,
.chapter__italic {
  font-style: italic;
  font-weight: 300;
  color: rgba(245,243,238,0.88);
}

/* Unit superscript (chapter 5 — specs) */
.chapter__unit {
  font-size: 0.45em;
  vertical-align: super;
  font-family: var(--font-sans);
  font-weight: 300;
  letter-spacing: 0;
  opacity: 0.55;
  margin-left: 0.05em;
}

/* Separator dot */
.chapter__dot-sep {
  font-size: 0.6em;
  opacity: 0.35;
  margin: 0 0.3em;
  vertical-align: middle;
}

/* ── Chapter subtext ── */
.chapter__sub {
  font-family: var(--font-sans);
  font-size: clamp(0.88rem, 1.35vw, 1.05rem);
  font-weight: 300;
  line-height: 1.75;
  color: rgba(245,243,238,0.62);
  max-width: 44ch;
}
.chapter__inner--center .chapter__sub  { margin: 0 auto; }
.chapter__inner--right  .chapter__sub  { margin-left: auto; }

/* ── Scroll cue (chapter 0 only) ── */
.chapter__scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 3rem;
  gap: 0.6rem;
  opacity: 0.45;
}
.chapter__scroll-cue span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: var(--warm-white);
  text-transform: uppercase;
}
.chapter__scroll-line {
  width: 1px;
  height: 3.5rem;
  background: linear-gradient(to bottom, rgba(200,169,81,0.6), transparent);
  animation: scrollCuePulse 2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes scrollCuePulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.8); }
  50%       { opacity: 1;   transform: scaleY(1.15); }
}

/* ── Chapter 6 CTA button ── */
.chapter__btn {
  display: inline-block;
  margin-top: 2.8rem;
  padding: 1rem 2.6rem;
  border: 1px solid rgba(200,169,81,0.45);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm-white);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition:
    color       0.4s ease,
    border-color 0.4s ease;
}
.chapter__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(200,169,81,0.10);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.chapter__btn:hover {
  color: var(--gold);
  border-color: rgba(200,169,81,0.85);
}
.chapter__btn:hover::before {
  transform: scaleX(1);
}

/* ══════════════════════════════════════════════════════════
   SCROLL PROGRESS BAR
   ══════════════════════════════════════════════════════════ */
.scroll-hero__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(200,169,81,0.12);
  z-index: 25;
  overflow: hidden;
}
.scroll-hero__progress-fill {
  height: 100%;
  background: linear-gradient(to right, rgba(200,169,81,0.6), var(--gold));
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* ══════════════════════════════════════════════════════════
   CHAPTER DOT NAVIGATION
   ══════════════════════════════════════════════════════════ */
.chapter-dots {
  position: absolute;
  right: 2.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: auto;
}
.chapter-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(200,169,81,0.22);
  border: 1px solid rgba(200,169,81,0.18);
  cursor: pointer;
  padding: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.chapter-dot.is-active {
  background: var(--gold);
  border-color: var(--gold);
  transform: scale(1.5);
  box-shadow: 0 0 8px rgba(200,169,81,0.4);
}
.chapter-dot:hover:not(.is-active) {
  background: rgba(200,169,81,0.5);
  transform: scale(1.25);
}

/* ══════════════════════════════════════════════════════════
   CHAPTER COUNTER
   ══════════════════════════════════════════════════════════ */
.chapter-counter {
  position: absolute;
  bottom: 2.2rem;
  right: 2.2rem;
  z-index: 25;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: rgba(200,169,81,0.45);
  pointer-events: none;
  line-height: 1;
}
.chapter-counter__cur {
  color: rgba(200,169,81,0.85);
  font-size: 0.9rem;
  display: inline-block;
  min-width: 1.4ch;
  transition: color 0.3s ease;
}
.chapter-counter__sep {
  margin: 0 0.3rem;
  opacity: 0.35;
}

/* ══════════════════════════════════════════════════════════
   PARALLAX WRAPPERS
   Overflow hidden on the wrap clips the scaled-up image.
   ══════════════════════════════════════════════════════════ */
[data-parallax-wrap] {
  overflow: hidden;
}
[data-parallax] {
  will-change: transform;
}

/* ══════════════════════════════════════════════════════════
   CINEMATIC CLIP-PATH UTILITY
   Used by initCinematicSections for wipe-in reveals.
   ══════════════════════════════════════════════════════════ */
.clip-none  { clip-path: inset(0 0   0 0); }
.clip-right { clip-path: inset(0 100% 0 0); }

/* ══════════════════════════════════════════════════════════
   BUTTON SHIMMER
   ══════════════════════════════════════════════════════════ */
.btn__shimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(200,169,81,0.28) 50%,
    transparent 70%
  );
  transform: skewX(-15deg);
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   GALLERY IMAGE — inner scale on scroll
   Applied via JS, needs overflow: hidden on the wrap.
   ══════════════════════════════════════════════════════════ */
.gallery__img-wrap {
  overflow: hidden;
}
.gallery__img-wrap img {
  will-change: transform;
}

/* ══════════════════════════════════════════════════════════
   INTERIOR SHOWCASE — overflow hidden for clip-path wipe
   ══════════════════════════════════════════════════════════ */
.interior__showcase-img {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   EXTERIOR PANELS — overflow hidden for clip-path reveal
   ══════════════════════════════════════════════════════════ */
.exterior__img-wrap {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  /* ── Hide counter on mobile, keep dots + progress bar ── */
  .chapter-counter {
    display: none;
  }

  /* ── Chapter dots: proportional size, invisible tap area ── */
  .chapter-dots {
    right: 1rem;
    gap: 0.6rem;
  }
  .chapter-dot {
    width: 5px;
    height: 5px;
    position: relative;
  }
  /* Invisible touch zone — 44px tall stack via ::before on each dot */
  .chapter-dot::before {
    content: '';
    position: absolute;
    inset: -10px;
  }
  .chapter-dot.is-active {
    transform: scale(1.5);
  }

  /* ── Smaller headline on mobile ── */
  .chapter__headline {
    font-size: clamp(2.4rem, 9vw, 3.8rem);
    margin-bottom: 1rem;
    text-shadow:
      0 2px 24px rgba(7,17,31,0.7),
      0 4px 60px rgba(7,17,31,0.5);
  }

  /* ── Chapter subtext on mobile ── */
  .chapter__sub {
    font-size: clamp(0.85rem, 3.5vw, 1rem);
    max-width: 100%;
    line-height: 1.7;
  }

  /* ── Chapter eyebrow ── */
  .chapter__eyebrow {
    font-size: 0.6rem;
    margin-bottom: 1rem;
  }

  /* ── Align chapters to bottom third on mobile, safe-area aware ── */
  .chapter {
    align-items: flex-end;
    padding: 0 max(1.5rem, env(safe-area-inset-left, 1.5rem))
               max(6rem, calc(5.5rem + env(safe-area-inset-bottom, 0px)))
               max(1.5rem, env(safe-area-inset-left, 1.5rem));
  }
  .chapter__inner,
  .chapter__inner--right {
    text-align: left;
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
  }
  .chapter__inner--center {
    text-align: left;
    margin: 0;
  }

  /* ── Chapter CTA button ── */
  .chapter__btn {
    padding: 0.9rem 2rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    margin-top: 2rem;
  }

  /* ── Smaller vessel on mobile ── */
  .scroll-hero__vessel .vessel-svg {
    width: 100vw;
    opacity: 0.5;
  }

  /* ── Scroll cue hidden on mobile (no scroll control) ── */
  .chapter__scroll-cue { display: none; }

  /* ── Progress bar stays visible as thin swipe indicator ── */
  .scroll-hero__progress {
    display: block;
    height: 2px;
  }
  .scroll-hero__progress-fill {
    background: linear-gradient(to right, rgba(200,169,81,0.4), var(--gold));
  }
}

/* ══════════════════════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .scroll-hero__video  { transition: opacity 0.3s ease; }
  .chapter__scroll-line { animation: none; opacity: 0.4; }
  .chapter-dot         { transition: background 0.2s, border-color 0.2s; }
  [data-parallax]      { transform: none !important; }
}
