/* =====================================================================
   BURL — MOTION LAYER
   Added 2026-10-24. Reference: EXT Production x Claude motion reel.

   Design rules this follows:
   - Uses the page's OWN tokens (--night, --a-l1, --field-line, --ease).
     Nothing here invents a colour.
   - Everything is GPU-cheap: transform, opacity, filter only. No layout
     thrash, no animating width/height/top/left.
   - Honours prefers-reduced-motion: every effect collapses to a plain
     static state. Nothing is only reachable through motion.
   - Nothing hides content. If JS fails, every element is visible —
     the reveal classes START visible and JS opts them INTO animating.
   ===================================================================== */

/* ---------------------------------------------------------------------
   0. REVEAL — opt-in, so a JS failure can never hide the page
   --------------------------------------------------------------------- */
html.bw-motion [data-rise] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity 0.75s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.75s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
html.bw-motion [data-rise].bw-seen {
  opacity: 1;
  transform: none;
}
/* Stagger children of a group */
html.bw-motion [data-rise-group] > * {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.bw-motion [data-rise-group].bw-seen > * {
  opacity: 1;
  transform: none;
}
html.bw-motion [data-rise-group].bw-seen > *:nth-child(1) { transition-delay: 0.00s; }
html.bw-motion [data-rise-group].bw-seen > *:nth-child(2) { transition-delay: 0.07s; }
html.bw-motion [data-rise-group].bw-seen > *:nth-child(3) { transition-delay: 0.14s; }
html.bw-motion [data-rise-group].bw-seen > *:nth-child(4) { transition-delay: 0.21s; }
html.bw-motion [data-rise-group].bw-seen > *:nth-child(5) { transition-delay: 0.28s; }
html.bw-motion [data-rise-group].bw-seen > *:nth-child(6) { transition-delay: 0.35s; }

/* ---------------------------------------------------------------------
   1. HEADLINE — words assemble on load (the EXT "type builds itself" beat)
   --------------------------------------------------------------------- */
.bw-word {
  display: inline-block;
  white-space: pre;
}
html.bw-motion .bw-word {
  opacity: 0;
  transform: translate3d(0, 0.5em, 0) rotateX(-55deg);
  transform-origin: 50% 100%;
  filter: blur(6px);
  animation: bw-word-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--bw-d, 0s);
}
@keyframes bw-word-in {
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* A light sweep that crosses the headline once it has assembled */
html.bw-motion .bw-sheen {
  position: relative;
  background-image: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.55) 48%,
    transparent 66%
  );
  background-size: 220% 100%;
  background-repeat: no-repeat;
  background-position: -140% 0;
  -webkit-background-clip: text;
  background-clip: text;
  animation: bw-sheen 2.4s 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes bw-sheen {
  to { background-position: 240% 0; }
}

/* ---------------------------------------------------------------------
   2. AURORA — slow volumetric light behind the hero.
      Two counter-drifting radial blooms. This is the depth the flat
      version was missing.
   --------------------------------------------------------------------- */
.bw-aurora {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 130%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: paint;
}
.bw-aurora i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}
.bw-aurora i:nth-child(1) {
  width: 52vw; height: 52vw; left: -8%; top: -6%;
  background: radial-gradient(circle at 50% 50%, #2866a8 0%, rgba(40, 102, 168, 0) 68%);
  opacity: 0.62;
  animation: bw-drift-a 26s ease-in-out infinite alternate;
}
.bw-aurora i:nth-child(2) {
  width: 44vw; height: 44vw; right: -4%; top: 6%;
  background: radial-gradient(circle at 50% 50%, #7d55d8 0%, rgba(125, 85, 216, 0) 68%);
  opacity: 0.55;
  animation: bw-drift-b 32s ease-in-out infinite alternate;
}
.bw-aurora i:nth-child(3) {
  width: 34vw; height: 34vw; left: 30%; top: 42%;
  background: radial-gradient(circle at 50% 50%, #d4607c 0%, rgba(212, 96, 124, 0) 68%);
  opacity: 0.34;
  animation: bw-drift-c 38s ease-in-out infinite alternate;
}
@keyframes bw-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vw, 4vh, 0) scale(1.18); }
}
@keyframes bw-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.1); }
  to   { transform: translate3d(-7vw, 6vh, 0) scale(0.92); }
}
@keyframes bw-drift-c {
  from { transform: translate3d(0, 0, 0) scale(0.9); }
  to   { transform: translate3d(4vw, -5vh, 0) scale(1.25); }
}

/* ---------------------------------------------------------------------
   3. GRAIN — the film texture that makes the EXT reel feel expensive
   --------------------------------------------------------------------- */
.bw-grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: var(--bw-grain-url);
  background-size: 180px 180px;
  animation: bw-grain-shift 0.7s steps(4) infinite;
}
@keyframes bw-grain-shift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(-2%, 1%, 0); }
  50%  { transform: translate3d(1%, -2%, 0); }
  75%  { transform: translate3d(-1%, -1%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ---------------------------------------------------------------------
   4. CONTOUR PARALLAX — the existing field pattern gains depth
   --------------------------------------------------------------------- */
html.bw-motion .bw-parallax {
  will-change: transform;
  transform: translate3d(0, var(--bw-py, 0px), 0);
}

/* ---------------------------------------------------------------------
   5. DEMO PANEL — 3D tilt toward the cursor, with a lit edge
   --------------------------------------------------------------------- */
.bw-tilt {
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.bw-motion .bw-tilt.bw-tilting {
  transition: transform 0.12s linear;
  transform:
    perspective(1400px)
    rotateX(var(--bw-rx, 0deg))
    rotateY(var(--bw-ry, 0deg))
    translate3d(0, 0, 0);
}
/* A specular edge that follows the pointer across the panel */
.bw-tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease, ease);
  background: radial-gradient(
    560px circle at var(--bw-mx, 50%) var(--bw-my, 0%),
    rgba(255, 255, 255, 0.14),
    transparent 42%
  );
}
html.bw-motion .bw-tilt.bw-tilting::after { opacity: 1; }

/* ---------------------------------------------------------------------
   6. MAGNETIC BUTTONS — pull toward the cursor, lit from the pointer
   --------------------------------------------------------------------- */
html.bw-motion .bw-mag {
  position: relative;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  overflow: hidden;
}
html.bw-motion .bw-mag::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(
    140px circle at var(--bw-mx, 50%) var(--bw-my, 50%),
    rgba(255, 255, 255, 0.22),
    transparent 60%
  );
}
html.bw-motion .bw-mag:hover::before { opacity: 1; }

/* ---------------------------------------------------------------------
   7. SCROLL PROGRESS — a hairline that fills as you read
   --------------------------------------------------------------------- */
.bw-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(90deg, #1d4e82, #6b4bb8 55%, #c4566f);
  transform: scaleX(var(--bw-progress, 0));
  transform-origin: 0 50%;
  opacity: 0.9;
}

/* ---------------------------------------------------------------------
   8. LIVE DOT — a soft pulse on the "live" indicator
   --------------------------------------------------------------------- */
html.bw-motion .bw-pulse {
  position: relative;
}
html.bw-motion .bw-pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
  animation: bw-pulse 2.6s ease-out infinite;
}
@keyframes bw-pulse {
  0%   { opacity: 0.5; transform: scale(0.65); }
  70%  { opacity: 0;   transform: scale(1.5); }
  100% { opacity: 0;   transform: scale(1.5); }
}

/* ---------------------------------------------------------------------
   9. SECTION RULE DRAW — the hairlines draw themselves in
   --------------------------------------------------------------------- */
html.bw-motion [data-draw]::before {
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.bw-motion [data-draw].bw-seen::before {
  transform: scaleX(1);
}

/* ---------------------------------------------------------------------
   REDUCED MOTION — everything collapses to static. Nothing is lost.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html.bw-motion [data-rise],
  html.bw-motion [data-rise-group] > *,
  html.bw-motion .bw-word {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
    transition: none !important;
  }
  html.bw-motion [data-draw]::before { transform: scaleX(1) !important; }
  .bw-aurora i,
  .bw-grain,
  html.bw-motion .bw-pulse::after,
  html.bw-motion .bw-sheen { animation: none !important; }
  .bw-grain { display: none; }
  .bw-aurora i { opacity: 0.32; }
  html.bw-motion .bw-tilt.bw-tilting { transform: none !important; }
}

/* Small screens: drop the heaviest effects rather than drop frames */
@media (max-width: 760px) {
  .bw-aurora i:nth-child(3) { display: none; }
  .bw-aurora i { filter: blur(50px); }
  .bw-grain { opacity: 0.04; }
  html.bw-motion .bw-tilt.bw-tilting { transform: none; }
}

/* ---------------------------------------------------------------------
   10. DEMO PANEL RIM — a lit edge so the product shot lifts off the page.
       This is the single biggest "expensive" cue from the EXT reel.
   --------------------------------------------------------------------- */
html.bw-motion .bw-tilt {
  border-radius: 16px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.10) inset,
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 40px 90px -30px rgba(0, 0, 0, 0.85),
    0 0 110px -40px rgba(125, 85, 216, 0.55);
  transition:
    transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.bw-motion .bw-tilt.bw-tilting {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 0 0 1px rgba(255, 255, 255, 0.11),
    0 50px 110px -30px rgba(0, 0, 0, 0.9),
    0 0 150px -40px rgba(125, 85, 216, 0.75);
}

/* 11. HERO FIELD — let the contour breathe so it reads as depth */
html.bw-motion .bw-hero__field {
  animation: bw-breathe 18s ease-in-out infinite alternate;
}
@keyframes bw-breathe {
  from { opacity: 0.85; transform: scale(1); }
  to   { opacity: 1;    transform: scale(1.035); }
}

/* 12. EYEBROW — a slow travelling highlight on the beta pill */
html.bw-motion .bw-eyebrow {
  position: relative;
  overflow: hidden;
}
html.bw-motion .bw-eyebrow::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    100deg, transparent 35%, rgba(255,255,255,0.14) 50%, transparent 65%
  );
  transform: translateX(-120%);
  animation: bw-eyebrow-sweep 6.5s 2s ease-in-out infinite;
}
@keyframes bw-eyebrow-sweep {
  0%, 72% { transform: translateX(-120%); }
  100%    { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
  html.bw-motion .bw-hero__field,
  html.bw-motion .bw-eyebrow::after { animation: none !important; }
  html.bw-motion .bw-eyebrow::after { display: none; }
}
