/* ==========================================================================
   Wicker — the depth sequence
   One payment flown past the camera, layer by layer, on scroll.

   Two layouts share this markup:
   · Default — a flowing two-column collage. This is what no-JS, reduced
     motion and narrow screens get, and it needs nothing from a script.
   · .is-3d — depth.js opts in on wide screens with motion available. The
     pin block becomes a viewport-height stage with real perspective and
     GSAP owns every layer transform from there.
   ========================================================================== */

.depth {
  position: relative;
  background: var(--navy);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Flowing fallback
   -------------------------------------------------------------------------- */

.depth__stage {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--section-pad) var(--gutter);
}

.depth__head { max-width: 780px; }

.depth__title { margin: 1.1rem 0 1.4rem; }

.depth__lede {
  max-width: 56ch;
  font-size: clamp(1rem, 1.4vw, 1.1875rem);
  line-height: 1.6;
  color: var(--c-mute);
}

.depth__layers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
  margin-top: clamp(2.5rem, 6vh, 4.5rem);
}

@media (max-width: 640px) { .depth__layers { grid-template-columns: 1fr; } }

.depth__layer { margin: 0; }

.depth__layer img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.5));
}

/* The receipt is tall; cap it so the collage row heights stay sane. */
.depth__layer--receipt img { max-width: 300px; margin: 0 auto; }

.depth__cap {
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.depth__cap b {
  font-weight: 400;
  color: var(--gray-300);
}

/* Progress rail — only means anything while pinned. */
.depth__nav { display: none; }

/* --------------------------------------------------------------------------
   3D stage — depth.js adds .is-3d only when it can actually drive it
   -------------------------------------------------------------------------- */

.depth.is-3d .depth__pin {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.depth.is-3d .depth__stage {
  position: relative;
  height: 100%;
  max-width: none;
  padding: 0;
  perspective: 1200px;
  perspective-origin: 50% 42%;
}

.depth.is-3d .depth__head {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 1;
  width: min(880px, 84vw);
  transform: translate(-50%, -50%);
  text-align: center;
  will-change: transform, opacity;
}

.depth.is-3d .depth__lede { margin: 0 auto; }

/* A perspective floor: two crossed line grids laid flat below the camera.
   Pure CSS, no image, and it sells the depth more than the layers do. */
.depth.is-3d .depth__floor {
  position: absolute;
  left: 50%;
  bottom: -12vh;
  width: 240vw;
  height: 90vh;
  transform: translateX(-50%) rotateX(76deg);
  transform-origin: 50% 100%;
  background-image:
    linear-gradient(to right, var(--line-dark-soft) 1px, transparent 1px),
    linear-gradient(to top, var(--line-dark-soft) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 58% 82% at 50% 100%, #000 32%, transparent 78%);
  mask-image: radial-gradient(ellipse 58% 82% at 50% 100%, #000 32%, transparent 78%);
  pointer-events: none;
}

.depth.is-3d .depth__layers {
  position: absolute;
  inset: 0;
  display: block;
  margin: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.depth.is-3d .depth__layer {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0; /* GSAP fades each layer through its pass */
  will-change: transform, opacity;
}

.depth.is-3d .depth__layer img { width: 100%; }

/* Per-layer footprint and drift off the lens axis. The x/y offsets are what
   keeps the fly-through from reading as a slideshow — every layer passes the
   camera on its own line. */
.depth.is-3d .depth__layer--card     { width: min(30vw, 480px); margin-left: -24vw; margin-top: -22vh; }
.depth.is-3d .depth__layer--approved { width: min(24vw, 420px); margin-left: 6vw;   margin-top: -26vh; }
.depth.is-3d .depth__layer--receipt  { width: min(15vw, 260px); margin-left: -18vw; margin-top: -26vh; }
.depth.is-3d .depth__layer--webhook  { width: min(25vw, 430px); margin-left: 3vw;   margin-top: -8vh;  }
.depth.is-3d .depth__layer--payout   { width: min(26vw, 440px); margin-left: -13vw; margin-top: -20vh; }

.depth.is-3d .depth__cap { text-align: left; }

/* Progress rail, mirrored on .rails__nav so the two pinned sequences read
   as one motion vocabulary. */
.depth.is-3d .depth__nav {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(1.75rem, 5vh, 3.5rem);
  z-index: 3;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.depth__nav-item {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.4s var(--ease-out);
}

.depth__nav-item.is-active { color: var(--on-navy); }

.depth__nav-item i {
  display: block;
  width: 34px;
  height: 2px;
  background: var(--gray-700);
  overflow: hidden;
  position: relative;
}

.depth__nav-item i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease-out);
}

.depth__nav-item.is-active i::after,
.depth__nav-item.is-done i::after { transform: scaleX(1); }

/* Scroll hint in the opposite corner. */
.depth.is-3d .depth__hint {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(1.75rem, 5vh, 3.5rem);
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.depth__hint { display: none; }
.depth.is-3d .depth__hint { display: block; }

/* ==========================================================================
   Hero scene — floating payment artifacts in perspective
   Sits between the hero background (z 0) and the copy (z 2). depth.js gives
   each object an idle float, pointer parallax and a scroll-out in Z; without
   motion they simply hang where the CSS puts them.
   ========================================================================== */

.hero__scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  perspective: 1400px;
  perspective-origin: 50% 42%;
  transform-style: preserve-3d;
}

.hero__obj {
  position: absolute;
  will-change: transform, opacity;
  transform-style: preserve-3d;
}

.hero__obj img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.55));
}

/* Placement + a depth-of-field grade: far objects are dimmer and softer,
   the near coin is crisp. The blur/dim carries the depth even before any
   transform runs. */
.hero__obj--card {
  right: 4%;
  top: 9%;
  width: clamp(220px, 19vw, 320px);
  opacity: 0.6;
}
.hero__obj--card img { filter: blur(2px) brightness(0.8) drop-shadow(0 30px 60px rgba(0, 0, 0, 0.55)); }

.hero__obj--key {
  left: 2%;
  top: 45%;
  width: clamp(210px, 16vw, 280px);
  opacity: 0.55;
}
.hero__obj--key img { filter: blur(1.4px) brightness(0.85) drop-shadow(0 24px 48px rgba(0, 0, 0, 0.5)); }

.hero__obj--link {
  left: 53%;
  top: 57%;
  width: clamp(230px, 20vw, 330px);
  opacity: 0.75;
}
.hero__obj--link img { filter: blur(0.7px) drop-shadow(0 24px 48px rgba(0, 0, 0, 0.5)); }

.hero__obj--terminal {
  right: 1%;
  top: 31%;
  width: clamp(120px, 11vw, 180px);
  opacity: 0.92;
}

.hero__obj--coin {
  left: 47%;
  top: 38%;
  width: clamp(64px, 6vw, 104px);
  opacity: 1;
}

/* Decoration is the first thing to go when space is short. */
@media (max-width: 950px) { .hero__scene { display: none; } }

/* Reduced motion keeps the composition but nothing drifts. */
.motion-off .hero__obj { opacity: 0.5; }
