/* ─── DEPTH & MOTION ─────────────────────────────────
   Scroll reveals, hero parallax and embers, 3D tilt cards, scroll progress.
   Everything here is gated on html.depth-js (set by scripts/depth.js only when
   the visitor has not asked for reduced motion), so the page is complete
   without JavaScript and for reduced-motion visitors.                         */

:root {
  --depth-ease: cubic-bezier(0.16, 1, 0.3, 1);   /* soft snap, same feel as the AI site */
}

/* Scroll progress */
.depth-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1100;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(194, 82, 43, 0.7);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Reveals */
html.depth-js [data-rv] {
  opacity: 0;
  transform: translate3d(0, 34px, 0);
  transition:
    opacity 0.6s linear,
    transform 0.9s var(--depth-ease);
  transition-delay: var(--d, 0ms);
}
html.depth-js [data-rv="left"]  { transform: translate3d(-48px, 0, 0); }
html.depth-js [data-rv="right"] { transform: translate3d(48px, 0, 0); }
html.depth-js [data-rv="zoom"]  { transform: scale(0.94); }
html.depth-js [data-rv].in {
  opacity: 1;
  transform: none;
}

/* Section titles: a hard burnt-orange bar sweeps across, then the title is revealed */
html.depth-js .section-title[data-rv] {
  clip-path: inset(0 100% 0 0);
  opacity: 1;
  transform: none;
  transition: clip-path 0.9s var(--depth-ease);
  transition-delay: var(--d, 0ms);
}
html.depth-js .section-title[data-rv].in { clip-path: inset(0 -4% 0 0); }

/* Hero entrance (runs once on load) */
html.depth-js .hero-eyebrow,
html.depth-js .hero-title,
html.depth-js .hero-tagline,
html.depth-js .hero-actions,
html.depth-js .hero-proof {
  opacity: 0;
  animation: depth-rise 1s var(--depth-ease) forwards;
}
html.depth-js .hero-eyebrow { animation-delay: 0.15s; }
html.depth-js .hero-title   { animation-delay: 0.3s; }
html.depth-js .hero-tagline { animation-delay: 0.6s; }
html.depth-js .hero-actions { animation-delay: 0.8s; }
html.depth-js .hero-proof   { animation-delay: 1s; }
@keyframes depth-rise {
  from { opacity: 0; transform: translate3d(0, 40px, 0); }
  to   { opacity: 1; transform: none; }
}

/* Hero layers. JS writes --hx/--hy (pointer) and --hs (scroll) on #hero. */
#hero .hero-bg img {
  transform: translate3d(calc(var(--hx, 0) * -14px), calc(var(--hs, 0) * 0.28px + var(--hy, 0) * -10px), 0) scale(1.12);
  transition: transform 0.25s linear;
}
#hero .hero-content {
  transform: translate3d(calc(var(--hx, 0) * 10px), calc(var(--hs, 0) * -0.12px + var(--hy, 0) * 6px), 0);
  opacity: calc(1 - var(--hp, 0) * 1.1);
}

/* Slow light sweep and film vignette across the stage photo */
.hero-sweep,
.hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-sweep {
  inset: -30%;
  background: linear-gradient(
    115deg,
    rgba(194, 82, 43, 0) 35%,
    rgba(194, 82, 43, 0.16) 50%,
    rgba(194, 82, 43, 0) 65%
  );
  mix-blend-mode: screen;
  animation: depth-sweep 14s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes depth-sweep {
  from { transform: translate3d(-18%, 0, 0); }
  to   { transform: translate3d(18%, 0, 0); }
}
.hero-vignette {
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%);
}
.hero-embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Tilt cards */
html.depth-js [data-tilt] {
  transform: perspective(900px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) translateZ(0);
  transition: transform 0.45s var(--depth-ease), box-shadow 0.45s;
  will-change: transform;
}
html.depth-js [data-tilt].is-tilting {
  transition: transform 0.08s linear, box-shadow 0.45s;
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(194, 82, 43, 0.35);
}
.depth-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(
    circle at var(--gx, 50%) var(--gy, 50%),
    rgba(232, 227, 219, 0.22),
    rgba(194, 82, 43, 0.08) 35%,
    rgba(0, 0, 0, 0) 60%
  );
  z-index: 2;
}
.single-card .depth-glare {
  inset: 0 0 auto 0;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}
[data-tilt].is-tilting .depth-glare { opacity: 1; }
/* Single cards sit in a grid and tilt as a whole; give the glare something to anchor to */
.single-card { position: relative; }

/* Parallax planes: JS sets --par-y from scroll position */
html.depth-js [data-par] {
  transform: translate3d(0, var(--par-y, 0px), 0);
  will-change: transform;
}

/* Touch screens and small phones: keep reveals, drop the pointer effects */
@media (hover: none) {
  html.depth-js [data-tilt] { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .depth-progress, .hero-sweep, .hero-embers { display: none; }
}

/* ─── Layer 2: ghost words, cursor spotlight, magnetic buttons ─── */
.depth-host { position: relative; overflow: clip; }
.depth-host > .container { position: relative; z-index: 1; }

/* Oversized outlined word behind each section, drifting slower than the content */
.depth-ghost {
  position: absolute;
  top: 6%;
  right: -2%;
  font-family: var(--font-display);
  font-size: clamp(120px, 24vw, 340px);
  line-height: 0.8;
  letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(232, 227, 219, 0.07);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.depth-host.in-view .depth-ghost { opacity: 1; }
html.depth-js .depth-ghost[data-par] { transform: translate3d(0, var(--par-y, 0px), 0); }

/* Warm light that follows the cursor across the dark sections */
.depth-spot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(194, 82, 43, 0.12),
    rgba(194, 82, 43, 0) 70%
  );
}
.depth-host.spot-on .depth-spot { opacity: 1; }

/* Magnetic buttons use the individual translate property so hover transforms still work */
html.depth-js .btn {
  translate: var(--mbx, 0px) var(--mby, 0px);
  transition: translate 0.35s var(--depth-ease), background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
html.depth-js .btn.is-magnet { transition: translate 0.08s linear, background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .depth-ghost, .depth-spot { display: none; }
}
