/* ─────────────────────────────────────────────────────────────
   Flyball Vision · motion layer (prototype, 26 Nov 2026)
   Brings the promo video's moves to the marketing page: app screens
   assemble from their own parts, key parts lift out and slam back.
   Everything here is additive: without motion.js (or with reduced
   motion) the page shows the finished screens.
   Easing and timing tokens are the promo design draft's.
   ───────────────────────────────────────────────────────────── */
:root {
  --ease-enter: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-slam: cubic-bezier(0.5, 0, 0.75, 0);
  --ease-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-punch: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-slide: 600ms;
  --fvm-socket: #0b0b0c;
}

/* ───────── An app screen built from its parts ───────── */
.fvm-screen {
  position: relative;
  width: 100%;
  background: var(--fvm-socket);
  border-radius: 16.5% / 7.6%;          /* the phone screen's corner, as baked into the parts */
  perspective: 900px;
  perspective-origin: 50% 45%;
  isolation: isolate;
}
.fvm-screen.is-flat { border-radius: 16px; }  /* iPad crop and other non-phone screens */
.fvm-screen.is-landscape { border-radius: 7.6% / 16.5%; }
.fvm-screen > img {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  backface-visibility: hidden;
  transform-origin: 50% 50%;
}
.fvm-screen > .fvm-full {
  inset: 0; width: 100%; height: 100%;
  border-radius: inherit;
  opacity: 0;
  z-index: 0;
}
.fvm-screen.is-locked > .fvm-full { opacity: 1; }
.fvm-screen.is-lifting > .fvm-full { opacity: 0; }
.fvm-screen > .fvm-piece { z-index: 1; }
.fvm-screen > .fvm-piece.is-up { z-index: 3; }
.fvm-screen .fvm-flash {
  position: absolute; inset: 0; z-index: 4;
  border-radius: inherit;
  background: radial-gradient(80% 60% at 50% 40%, rgba(255,255,255,0.22), rgba(255,255,255,0.06));
  opacity: 0; pointer-events: none;
}
.fvm-screen.flash .fvm-flash { animation: fvm-flash 520ms var(--ease-punch); }
@keyframes fvm-flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }

/* The phone's green edge lights flare as the screen locks (as in the promo). */
.fvm-phone { transition: box-shadow 600ms ease; }
.fvm-phone.flare { animation: fvm-flare 900ms var(--ease-punch); }
@keyframes fvm-flare {
  0%   { box-shadow: 0 0 0 1px rgba(0,229,168,0.9), 0 0 36px rgba(0,200,150,0.55), 0 20px 60px rgba(0,0,0,0.6); }
  100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.0), 0 0 0 rgba(0,200,150,0), 0 20px 60px rgba(0,0,0,0.6); }
}

/* Frames from the live page, adjusted to hold a built screen. */
.iphone-frame .fvm-screen { border-radius: 16.5% / 7.6%; }
.hero-a-devices .device-cluster .iphone-frame.fvm-phone { width: 210px; bottom: -64px; right: -28px; }
@media (max-width: 600px) {
  .hero-a-devices .device-cluster .iphone-frame.fvm-phone { width: 140px; bottom: -36px; right: -10px; }
}
.fvm-phone-solo { width: min(300px, 78%); margin: 0 auto; }
.fvm-phone-solo.iphone-frame { width: min(300px, 78%); }
.fvm-landscape-frame {
  position: relative;
  border-radius: 30px;
  background: #1c1c1e;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  margin-bottom: 18px;
}
.screen-figure .fvm-screen { border-radius: 16px; }
.ai-figure video { display: block; width: 100%; border-radius: 16px; aspect-ratio: 16 / 9; background: #000; }

/* Hero devices follow the pointer a little. */
.hero-a-devices .device-cluster {
  transform: perspective(1600px) rotateX(var(--fvm-rx, 0deg)) rotateY(var(--fvm-ry, 0deg));
  transition: transform 500ms var(--ease-enter);
}

/* ───────── Start lights in the hero eyebrow (red, amber, amber, green) ───────── */
.fvm-lights { display: inline-flex; gap: 4px; align-items: center; }
.fvm-lights i {
  width: 7px; height: 7px; border-radius: 999px;
  background: rgba(255,255,255,0.14);
  transition: background 90ms linear, box-shadow 90ms linear;
}
.fvm-lights i.on:nth-child(1) { background: #FF3B30; box-shadow: 0 0 8px #FF3B30; }
.fvm-lights i.on:nth-child(2),
.fvm-lights i.on:nth-child(3) { background: #FF9500; box-shadow: 0 0 8px #FF9500; }
.fvm-lights i.on:nth-child(4) { background: var(--color-primary); box-shadow: 0 0 10px var(--color-primary); }
.fvm-lights.go i:nth-child(4) { animation: pulse 1.6s ease-in-out 600ms infinite; }

/* "Frame-perfect." sweeps in on green. */
.fvm-on .hero-h1 em { background-size: 250% 100%; background-position: 100% 0; }
.fvm-on .hero-h1 em.is-go { animation: fvm-sweep 1100ms var(--ease-enter) forwards; }
@keyframes fvm-sweep {
  0%   { background-position: 100% 0; opacity: 0.25; filter: blur(4px); }
  40%  { opacity: 1; filter: blur(0); }
  100% { background-position: 0 0; opacity: 1; }
}

/* ───────── Reveals ───────── */
.fvm-on .fvm-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slide) var(--ease-enter), transform var(--duration-slide) var(--ease-enter);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.fvm-on .fvm-reveal.is-in { opacity: 1; transform: none; }

.fvm-on .spark .bar { transform: scaleY(0); transform-origin: 50% 100%; transition: transform 700ms var(--ease-overshoot); }
.fvm-on .spark.is-in .bar { transform: scaleY(1); }

/* ───────── Closing band: the 3D eye, then the line ───────── */
.fvm-finale {
  position: relative;
  padding: 40px 0 110px;
  text-align: center;
  background: #000;
  overflow: hidden;
}
.fvm-finale::after {           /* the floor glow under the eye, as in the end card */
  content: ""; position: absolute; left: 10%; right: 10%; bottom: 0; height: 160px;
  background: radial-gradient(50% 60% at 50% 100%, rgba(0,200,150,0.16), transparent 70%);
  pointer-events: none;
}
.fvm-eye {
  display: block;
  width: min(560px, 92vw);
  aspect-ratio: 720 / 454;
  margin: 0 auto -10px;
  -webkit-mask: radial-gradient(60% 62% at 50% 50%, #000 70%, transparent 100%);
          mask: radial-gradient(60% 62% at 50% 50%, #000 70%, transparent 100%);
}
/* The end card's line, set in Barlow Condensed Bold Italic and saved as an image (no font file to ship). */
.fvm-finale h2 { margin: 0 0 18px; line-height: 0; }
.fvm-finale h2 img { display: inline-block; width: min(420px, 74vw); height: auto; }
.fvm-finale p { color: rgba(255,255,255,0.7); font-size: 18px; margin: 0 0 28px; }
.fvm-on .fvm-finale .fvm-line { opacity: 0; transform: translateY(18px) scale(0.98); transition: opacity 500ms var(--ease-enter), transform 500ms var(--ease-overshoot); }
.fvm-on .fvm-finale.is-done .fvm-line { opacity: 1; transform: none; }
.fvm-on .fvm-finale.is-done .fvm-line:nth-child(3) { transition-delay: 120ms; }
.fvm-on .fvm-finale.is-done .fvm-line:nth-child(4) { transition-delay: 240ms; }

/* ───────── Reduced motion: finished screens, nothing moves ───────── */
@media (prefers-reduced-motion: reduce) {
  .fvm-on .fvm-reveal, .fvm-on .spark .bar, .fvm-on .fvm-finale .fvm-line { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hero-a-devices .device-cluster { transform: none !important; }
  .fvm-on .hero-h1 em { animation: none !important; background-position: 0 0 !important; }
}

/* Without motion.js the original screenshot stays in the frame. */
.fvm-screen > img:only-child { position: static; width: 100%; height: auto; border-radius: inherit; }

/* Parts in flight stay inside their own section. */
.section:has(.fvm-screen) { overflow: clip; }
