/* ─── Motion design tokens & realistic timing ─── */
:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-smooth: cubic-bezier(0.45, 0, 0.55, 1);
  --ease-drift: cubic-bezier(0.33, 0, 0.2, 1);
  --ease-settle: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.28, 0.64, 1);

  --dur-instant: 0.2s;
  --dur-fast: 0.45s;
  --dur-medium: 0.85s;
  --dur-slow: 1.4s;
  --dur-crawl: 22s;
  --dur-drift: 18s;

  --parallax-range: 120px;
}

/* ─── Scene architecture ─── */
.scene {
  position: relative;
  isolation: isolate;
}

.scene-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.scene-content {
  position: relative;
  z-index: 4;
}

.layer {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.layer-media {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  transform-origin: center center;
}

/* Ken Burns: slow pan + zoom */
.layer-media--kenburns {
  animation: kenBurns var(--dur-crawl) var(--ease-drift) infinite alternate;
}

.layer-media--kenburns-alt {
  animation: kenBurnsAlt calc(var(--dur-crawl) * 1.1) var(--ease-drift) infinite alternate;
}

.layer-media--pan-left {
  animation: panLeft var(--dur-drift) var(--ease-in-out-smooth) infinite alternate;
}

/* Mist / color motion blends between photo layers */
.layer-mist {
  z-index: 2;
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(1, 70, 226, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 50%);
  mix-blend-mode: soft-light;
  animation: mistDrift 14s var(--ease-in-out-smooth) infinite alternate;
}

.layer-brand-gradient {
  z-index: 3;
  background: linear-gradient(
    135deg,
    rgba(1, 70, 226, 0.78) 0%,
    rgba(1, 53, 176, 0.55) 45%,
    rgba(15, 23, 42, 0.35) 100%
  );
}

/* Section transition bridges (mask + fade) */
.scene-bridge {
  position: absolute;
  left: 0;
  right: 0;
  height: 140px;
  z-index: 10;
  pointer-events: none;
}

.scene-bridge--top {
  top: 0;
  background: linear-gradient(to bottom, var(--bridge-color, #f8fafc) 0%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
}

.scene-bridge--bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--bridge-color, #f8fafc) 0%, transparent 100%);
  mask-image: linear-gradient(to top, #000 25%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, #000 25%, transparent 100%);
}

.scene-bridge--wave {
  height: 100px;
  bottom: -1px;
  background: var(--bridge-color, #f8fafc);
  clip-path: ellipse(120% 100% at 50% 100%);
}

/* Cutout subject — masked edges, depth shadow */
.cutout-wrap {
  position: absolute;
  pointer-events: none;
}

.cutout-subject {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 98%),
    radial-gradient(ellipse 90% 80% at 50% 35%, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 72%, transparent 98%),
    radial-gradient(ellipse 90% 80% at 50% 35%, #000 55%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  filter: drop-shadow(0 28px 48px rgba(15, 23, 42, 0.45));
  transform: translateZ(0);
}

.cutout-subject--soft {
  -webkit-mask-image: radial-gradient(ellipse 85% 90% at 50% 40%, #000 50%, transparent 100%);
  mask-image: radial-gradient(ellipse 85% 90% at 50% 40%, #000 50%, transparent 100%);
}

/* Depth stacks */
.depth-stack {
  position: relative;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.depth-stack__bg {
  position: relative;
  z-index: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: translateZ(0) scale(1);
  transition: transform var(--dur-slow) var(--ease-out-expo);
}

.depth-stack__bg .layer-media {
  position: relative;
  inset: auto;
  aspect-ratio: 4/3;
  width: 100%;
  border-radius: inherit;
}

.depth-stack__fg {
  position: absolute;
  z-index: 3;
  width: 48%;
  bottom: -8%;
  right: -4%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 32px 64px rgba(1, 70, 226, 0.22), 0 8px 24px rgba(15, 23, 42, 0.18);
  transform: translateZ(40px) rotate(-2deg);
  transition: transform var(--dur-slow) var(--ease-out-expo);
}

.depth-stack:hover .depth-stack__bg {
  transform: translateZ(0) scale(1.02);
}

.depth-stack:hover .depth-stack__fg {
  transform: translateZ(60px) rotate(0deg) translateY(-6px);
}

.depth-stack__fg .cutout-subject {
  aspect-ratio: 3/4;
  min-height: 220px;
}

/* Destination depth layers */
.card-depth {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.card-depth__bg {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center;
  transition: transform 1.2s var(--ease-out-expo);
}

.card-depth__fg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  opacity: 0;
  mix-blend-mode: overlay;
  -webkit-mask-image: linear-gradient(to top, transparent 40%, #000 85%);
  mask-image: linear-gradient(to top, transparent 40%, #000 85%);
  transition: opacity var(--dur-medium) var(--ease-out-quart),
    transform 1.4s var(--ease-out-expo);
  transform: scale(1.08) translateY(8%);
}

.destination-card:hover .card-depth__bg,
.destination-card.is-visible .card-depth__bg {
  transform: scale(1.12) translate(-2%, -3%);
}

.destination-card:hover .card-depth__fg {
  opacity: 0.35;
  transform: scale(1) translateY(0);
}

/* Scroll-driven tilt (set via JS --tilt-x/y) */
[data-tilt] {
  transform: rotateX(var(--tilt-y, 0deg)) rotateY(var(--tilt-x, 0deg));
  transition: transform 0.15s var(--ease-drift);
}

/* Parallax layers use CSS variables from JS */
[data-parallax] {
  transform: translate3d(
    var(--px, 0),
    var(--py, 0),
    0
  ) scale(var(--pscale, 1));
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity var(--dur-slow) var(--ease-out-expo),
    transform var(--dur-slow) var(--ease-out-expo);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--fade {
  transform: none;
}

.reveal--scale {
  transform: scale(0.94);
}

.reveal--scale.is-visible {
  transform: scale(1);
}

.reveal--tilt {
  transform: perspective(800px) rotateX(8deg) translateY(40px);
}

.reveal--tilt.is-visible {
  transform: perspective(800px) rotateX(0) translateY(0);
}

.reveal-stagger > * {
  transition-delay: calc(var(--i, 0) * 0.1s);
}

/* Cinematic divider between sections */
.section-divider {
  position: relative;
  height: 0;
  margin: 0;
  z-index: 5;
}

.section-divider__curve {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 140%;
  height: 80px;
  background: var(--divider-fill, #fff);
  border-radius: 50%;
  top: -40px;
  box-shadow: 0 -20px 60px rgba(1, 70, 226, 0.06);
}

/* Instagram tiles — individual motion */
.ig-tile-inner {
  position: absolute;
  inset: -15%;
  background-size: cover;
  background-position: center;
  transition: transform 1.1s var(--ease-out-expo);
}

.ig-tile:hover .ig-tile-inner,
.ig-tile.is-visible .ig-tile-inner {
  transform: scale(1.14) translate(var(--pan-x, 0), var(--pan-y, 0));
}

.ig-tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, #000 85%, transparent 100%);
  mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, #000 85%, transparent 100%);
}

/* Experience cards parallax float */
.experience-card {
  transition:
    transform var(--dur-medium) var(--ease-out-expo),
    box-shadow var(--dur-medium) var(--ease-out-expo),
    border-color var(--transition);
}

.experience-card.is-visible:hover {
  transform: translateY(-8px) rotateX(2deg);
}

/* Hero content entrance */
.hero-content > * {
  opacity: 0;
  transform: translateY(24px);
  animation: heroEnter var(--dur-slow) var(--ease-out-expo) forwards;
}

.hero-content .hero-eyebrow { animation-delay: 0.1s; }
.hero-content h1 { animation-delay: 0.22s; }
.hero-content .hero-lead { animation-delay: 0.34s; }
.hero-content .hero-actions { animation-delay: 0.46s; }
.hero-content .hero-stats { animation-delay: 0.58s; }

/* Floating accent orbs (motion blend) */
.scene-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: orbFloat 12s var(--ease-in-out-smooth) infinite alternate;
  z-index: 2;
}

.scene-orb--1 {
  width: 280px;
  height: 280px;
  background: rgba(61, 110, 240, 0.5);
  top: 15%;
  right: 10%;
}

.scene-orb--2 {
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.15);
  bottom: 25%;
  left: 5%;
  animation-delay: -4s;
}

/* ─── Keyframes ─── */
@keyframes kenBurns {
  0% {
    transform: scale(1.05) translate(0, 0);
  }
  100% {
    transform: scale(1.18) translate(-3%, -2%);
  }
}

@keyframes kenBurnsAlt {
  0% {
    transform: scale(1.08) translate(2%, 1%);
  }
  100% {
    transform: scale(1.2) translate(-2%, -3%);
  }
}

@keyframes panLeft {
  0% {
    transform: scale(1.1) translateX(2%);
  }
  100% {
    transform: scale(1.15) translateX(-4%);
  }
}

@keyframes mistDrift {
  0% {
    opacity: 0.7;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 1;
    transform: translate(3%, -2%) scale(1.05);
  }
}

@keyframes orbFloat {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(20px, -30px);
  }
}

@keyframes heroEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes subtleTilt {
  0%, 100% {
    transform: rotate(-1.5deg) translateY(0);
  }
  50% {
    transform: rotate(1deg) translateY(-8px);
  }
}

.cutout-wrap--float {
  animation: subtleTilt 8s var(--ease-in-out-smooth) infinite;
}

/* Interstitial motion scene (photo blend strip) */
.motion-strip {
  position: relative;
  height: 42vh;
  min-height: 280px;
  max-height: 420px;
  overflow: hidden;
}

.motion-strip__track {
  display: flex;
  height: 100%;
  width: max-content;
  animation: stripScroll 40s linear infinite;
}

.motion-strip__slide {
  flex: 0 0 38vw;
  min-width: 280px;
  height: 100%;
  margin-right: 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.motion-strip__slide .layer-media {
  position: relative;
  inset: auto;
  height: 100%;
  animation: none;
}

.motion-strip__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-alt) 0%, transparent 15%, transparent 85%, var(--bg-alt) 100%);
  z-index: 2;
  pointer-events: none;
}

@keyframes stripScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  [data-parallax] {
    transform: none !important;
  }

  .layer-media--kenburns,
  .layer-media--kenburns-alt,
  .layer-media--pan-left,
  .layer-mist,
  .scene-orb,
  .motion-strip__track,
  .cutout-wrap--float {
    animation: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
