/* The motion layer: 3D polish for every public page (lab test, owner 2026-12-02; grew out of Media 2).
   Loaded in the head by public/partials/site-head.html on public pages only; the module
   lives in site-header.html. Remove both motion tags to switch the layer off.
   Motion rules: nothing hides content for longer than half a second, and
   prefers-reduced-motion gets a still page with the same look. */

/* ── Hero: a deep stage behind the headline ─────────────────────────────────── */

.media-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: min(82vh, 760px);
  display: flex;
  align-items: center;
  background:
    radial-gradient(60% 70% at 18% 30%, rgba(99, 102, 241, 0.22), transparent 70%),
    radial-gradient(50% 60% at 85% 70%, rgba(56, 189, 248, 0.14), transparent 70%),
    var(--bg);
}
.media-hero > .container { position: relative; z-index: 2; width: 100%; }

/* Without WebGL (or before it starts) the two glows drift very slowly. */
.media-hero::before {
  content: '';
  position: absolute;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(35% 40% at 30% 40%, rgba(129, 140, 248, 0.18), transparent 70%),
    radial-gradient(30% 35% at 70% 60%, rgba(56, 189, 248, 0.12), transparent 70%);
  animation: m3d-drift 24s ease-in-out infinite alternate;
}
/* A soft dark pool under the words keeps the headline readable over moving cards. */
.media-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(48% 46% at 50% 50%, rgba(24, 24, 27, 0.82), rgba(24, 24, 27, 0.35) 70%, transparent),
    linear-gradient(to bottom, transparent 75%, var(--bg));
}
.m3d-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.has-scene .m3d-canvas { opacity: 1; }

@keyframes m3d-drift {
  to { transform: translate3d(4%, -3%, 0) scale(1.08); }
}

/* Every other page's top section gets the same stage, at its own height (layout unchanged). */
.page-hero,
.hero.hero2 { position: relative; isolation: isolate; overflow: hidden; }
.page-hero > .container,
.hero.hero2 > .container { position: relative; z-index: 2; }
.page-hero::before {
  content: '';
  position: absolute;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(30% 45% at 75% 45%, rgba(129, 140, 248, 0.16), transparent 70%),
    radial-gradient(25% 35% at 90% 75%, rgba(56, 189, 248, 0.10), transparent 70%);
  animation: m3d-drift 24s ease-in-out infinite alternate;
}
/* A soft dark pool behind the words (left-aligned on these pages). */
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(60% 90% at 20% 50%, rgba(28, 28, 31, 0.85), rgba(28, 28, 31, 0.3) 70%, transparent);
}
.hero.hero2 .m3d-canvas { z-index: 0; }

/* Headline, line and buttons rise in, staggered, done in about half a second. */
.media-hero .section-header > *,
.page-hero .container > *,
.hero2-grid > * {
  animation: m3d-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.media-hero .section-header > :nth-child(2),
.page-hero .container > :nth-child(2),
.hero2-grid > :nth-child(2) { animation-delay: 0.06s; }
.media-hero .section-header > :nth-child(3),
.page-hero .container > :nth-child(3),
.hero2-grid > :nth-child(3) { animation-delay: 0.12s; }
.media-hero .section-header > :nth-child(4),
.page-hero .container > :nth-child(4),
.hero2-grid > :nth-child(4) { animation-delay: 0.18s; }
.media-hero .section-title {
  font-size: clamp(34px, 5.6vw, 64px);
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, var(--white) 30%, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes m3d-rise {
  from { opacity: 0; translate: 0 18px; filter: blur(6px); }
}

/* ── Buttons: a lift, a deeper glow and a light sweep ──────────────────────── */

.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.25s, background 0.25s, border-color 0.25s, color 0.25s;
}
.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  translate: -110% 0;
  transition: translate 0.6s ease;
  pointer-events: none;
}
.btn--primary:hover::after { translate: 110% 0; }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 34px rgba(99, 102, 241, 0.5); }
.btn--outline:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--green), 0 8px 24px rgba(99, 102, 241, 0.18); }
.btn:active { transform: translateY(0) scale(0.98); }

/* ── Pointer effects: small cards tilt, big panels catch the light ─────────── */

.media-piece,
.media-still img,
.series-stage {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s;
}
.is-tilting { transition: transform 0.12s linear, box-shadow 0.3s; }
.media-piece { border-radius: var(--radius); }
.media-piece.is-tilting,
.media-still img.is-tilting {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 24px rgba(99, 102, 241, 0.25);
}

/* Big panels stay put: a soft light follows the pointer and the edge glows. */
.service-card,
.compare-card { transition: border-color 0.3s, box-shadow 0.3s; }
.service-card:hover { transform: none; }
.service-card.is-lit,
.compare-card.is-lit {
  background:
    radial-gradient(440px circle at var(--mx, 50%) var(--my, 50%), rgba(129, 140, 248, 0.045), transparent 45%),
    var(--surface);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

/* The phone holding the latest ad stands a little turned, and faces you on hover. */
.series-stage {
  --rx: 3deg;
  --ry: -9deg;
  box-shadow: 30px 30px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(99, 102, 241, 0.18);
}
.series-stage:hover:not(.is-tilting) { --rx: 0deg; --ry: 0deg; }

/* The stepper icons pop forward on hover. */
.step-ic { transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s, border-color 0.3s; }
.step:hover .step-ic { transform: translateY(-4px) scale(1.06); border-color: var(--green); box-shadow: 0 10px 26px rgba(99, 102, 241, 0.35); }

/* ── Product bands: a slow light runs along the top line ───────────────────── */

.product-band { position: relative; border-top-color: transparent; }
.product-band::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--green-light), var(--green));
  background-size: 300% 100%;
  animation: m3d-band 8s linear infinite;
}
@keyframes m3d-band { to { background-position: 300% 0; } }

/* ── Scroll reveal, where the browser supports scroll-driven animation ─────── */
/* Uses translate and opacity only, so it never fights the tilt transform.
   Browsers without support simply show everything at once. */

@supports (animation-timeline: view()) {
  main .section .section-header,
  main .service-card,
  main .media-slot,
  main .media-still,
  main .step {
    animation: m3d-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }
  @keyframes m3d-reveal {
    from { opacity: 0.35; translate: 0 28px; }
  }
}
/* Print and full-page captures get the settled page. */
@media print {
  main * { animation: none !important; }
}

/* ── Reduced motion: same look, nothing moves ──────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  body *,
  body *::before,
  body *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .series-stage { --rx: 0deg; --ry: 0deg; }
}

/* ── Phones: shorter hero, lighter glows ───────────────────────────────────── */

@media (max-width: 720px) {
  .media-hero { min-height: min(72svh, 620px); }
  .media-hero::after {
    background:
      radial-gradient(70% 50% at 50% 50%, rgba(24, 24, 27, 0.85), rgba(24, 24, 27, 0.4) 75%, transparent),
      linear-gradient(to bottom, transparent 75%, var(--bg));
  }
  .series-stage { --rx: 0deg; --ry: 0deg; }
}
