/* ==========================================================================
   BAHE Safaris - cinematic motion
   Opening curtain, page transitions, scroll progress, letter-by-letter
   headlines, photo wipes, the drifting place-name band and magnetic buttons.
   ========================================================================== */

/* 1. Opening curtain (first page of each visit)
   -------------------------------------------------------------------------- */
.intro-curtain { display: none; }
.intro-playing .intro-curtain, .intro-curtain.is-lifting {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(circle at 50% 62%, #2f4d3b 0%, #1a2d22 55%, #0f1c15 100%);
  clip-path: inset(0 0 0 0);
}
.intro-curtain.is-lifting {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1s cubic-bezier(.76, 0, .24, 1);
}
.intro-inner { text-align: center; color: #fff; }
.intro-sun { display: inline-block; animation: sun-rise 1.2s cubic-bezier(.16, 1, .3, 1) both; }
.intro-sun img {
  width: clamp(72px, 9vw, 104px); height: auto; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(240, 197, 139, .5); animation: sun-glow 2s ease-out .4s both;
}
@keyframes sun-rise { from { transform: translateY(60px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sun-glow { 0% { box-shadow: 0 0 0 0 rgba(240, 197, 139, .55); } 100% { box-shadow: 0 0 0 46px rgba(240, 197, 139, 0); } }
.intro-word {
  font-family: var(--bh-font-display); font-weight: 600; letter-spacing: .22em;
  font-size: clamp(2.8rem, 2rem + 4vw, 5rem); line-height: 1; margin: 1.1rem 0 .7rem; padding-left: .22em;
}
.intro-word span { display: inline-block; animation: letter-up .9s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.45s + var(--li) * .09s); }
@keyframes letter-up { from { transform: translateY(70%) rotate(8deg); opacity: 0; filter: blur(8px); } to { transform: none; opacity: 1; filter: none; } }
.intro-tag {
  font-size: .78rem; letter-spacing: .38em; text-transform: uppercase; color: #f0c58b;
  animation: fade-in .8s ease 1s both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Hold the banner animations until the curtain lifts */
.intro-playing .hero-inner *, .intro-playing .page-hero * { animation-play-state: paused !important; }

/* 2. Page transitions and scroll progress
   -------------------------------------------------------------------------- */
.page-veil {
  position: fixed; inset: 0; z-index: 1999; pointer-events: none; background: #1a2d22;
  opacity: 0; transition: opacity .4s ease;
}
body.is-leaving .page-veil { opacity: 1; }
.js body { animation: page-in .6s ease both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1100; pointer-events: none; }
.scroll-progress span {
  display: block; height: 100%; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--bh-ochre), #f3c37a, var(--bh-clay));
}

/* 3. Letter-by-letter headlines
   -------------------------------------------------------------------------- */
h1.is-split { animation: none !important; }
.split-word { display: inline-block; white-space: nowrap; }
.split-char {
  display: inline-block; animation: char-rise 1s cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: calc(.15s + var(--ci) * .025s);
}
@keyframes char-rise {
  from { transform: translateY(.9em) rotate(10deg); opacity: 0; filter: blur(8px); }
  to { transform: none; opacity: 1; filter: none; }
}
h1.is-split .hero-word { animation: char-rise 1.1s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(.25s + var(--ci, 20) * .025s); }

/* 4. Photo wipes
   -------------------------------------------------------------------------- */
.motion-ready .wipe {
  clip-path: inset(100% 0 0 0 round var(--bh-radius-lg));
  transition: clip-path 1s cubic-bezier(.76, 0, .24, 1) var(--reveal-delay, 0ms);
}
.motion-ready .wipe.is-visible { clip-path: inset(0 0 0 0 round var(--bh-radius-lg)); }
.motion-ready .split-band .band-media.wipe { clip-path: inset(0 0 0 100%); }
.motion-ready .split-band .band-media.wipe.is-visible { clip-path: inset(0 0 0 0); }
.motion-ready .wipe img { transition: scale 1.8s cubic-bezier(.16, 1, .3, 1); }
/* Only zoom photos that sit inside a clipped frame; a bare image would bleed past the screen edge */
.motion-ready .wipe:not(.is-visible) img { scale: 1.25; }

/* 5. Drifting place names on a sunset poster
   -------------------------------------------------------------------------- */
.drift-band {
  position: relative; overflow: hidden; isolation: isolate; color: #fff7ea;
  padding-block: clamp(2.5rem, 1.8rem + 2.5vw, 4.25rem);
  display: grid; gap: clamp(.3rem, .15rem + .5vw, .75rem); justify-items: center;
  grid-template-columns: minmax(0, 1fr);
  background: radial-gradient(120% 95% at 50% 118%, #f6c27a 0%, #e0893a 20%, #b4512d 42%, #6b2c24 68%, #2a1512 100%);
}
/* faint scan lines, like an old travel poster */
.drift-band::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .1; pointer-events: none;
  background: repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 4px);
}
.drift-band::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%; z-index: -1; pointer-events: none;
  background: linear-gradient(0deg, rgba(30, 14, 10, .5), transparent);
}
.drift-sun {
  position: absolute; left: 50%; bottom: -30%; z-index: -1; pointer-events: none;
  width: clamp(220px, 34vw, 600px); aspect-ratio: 1; border-radius: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, #ffe7b3 0%, #f9b85e 58%, rgba(249, 184, 94, 0) 71%);
  -webkit-mask: repeating-linear-gradient(0deg, #000 0 16px, transparent 16px 22px);
  mask: repeating-linear-gradient(0deg, #000 0 16px, transparent 16px 22px);
  opacity: .8; animation: band-sun 10s ease-in-out infinite alternate;
}
@keyframes band-sun { from { translate: 0 12%; } to { translate: 0 -4%; } }
.drift-kicker {
  display: inline-flex; align-items: center; gap: .75rem; margin-bottom: .35rem;
  font-size: .74rem; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: #ffe2b0;
}
.drift-kicker::before, .drift-kicker::after { content: ""; width: 28px; height: 1px; background: currentColor; opacity: .7; }
.drift-row {
  display: flex; align-items: center; gap: .85em; width: max-content; white-space: nowrap;
  line-height: 1.1; will-change: transform;
}
.drift-row i { font-size: .6em; color: #ffd08a; opacity: .85; }
.drift-row-1, .drift-row-3 {
  font-family: var(--bh-font-body); font-weight: 800; text-transform: uppercase; letter-spacing: .16em;
  font-size: clamp(.95rem, .7rem + 1.25vw, 1.9rem);
}
.drift-row-1 { color: #fff3e0; }
.drift-row-3 span { color: transparent; -webkit-text-stroke: 1px rgba(255, 243, 224, .85); }
.drift-row-2 {
  font-family: var(--bh-font-display); font-style: italic; font-weight: 400; letter-spacing: -.01em;
  font-size: clamp(1.8rem, 1.15rem + 2.9vw, 3.8rem); color: #ffe2b0;
  text-shadow: 0 4px 24px rgba(60, 20, 10, .35);
}
.drift-row-2 i { font-size: .38em; }
.drift-cta { margin-top: clamp(1.25rem, 1rem + 1.5vw, 2.25rem); }
.drift-cta.btn-light {
  --bs-btn-bg: #fff7ea; --bs-btn-border-color: #fff7ea; --bs-btn-color: var(--bh-clay-dark);
  --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #fff; --bs-btn-hover-color: var(--bh-ink);
  --bs-btn-active-bg: #fff; --bs-btn-active-color: var(--bh-ink);
}

/* 6. Magnetic buttons settle back smoothly
   -------------------------------------------------------------------------- */
.btn-lg.btn-clay, .rail-btn, .hero-inner .btn { transition: transform .35s cubic-bezier(.16, 1, .3, 1), background-color .25s, color .25s, box-shadow .25s; }

/* 7. Calm mode
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .intro-curtain, .page-veil, .scroll-progress { display: none !important; }
  .motion-ready .wipe, .motion-ready .wipe.is-visible { clip-path: none !important; }
  .motion-ready .wipe img { scale: 1 !important; }
  .split-char { animation: none !important; }
  .drift-row { transform: none !important; width: auto; white-space: normal; flex-wrap: wrap; justify-content: center; padding-inline: 1rem; }
  .drift-sun { animation: none; }
}
