.landing-motion-page {
  position: relative;
  isolation: isolate;
  --landing-grid: #0ea5e314;
  --landing-beam: #38bdf87d;
  --landing-glow-blue: #2563eb50;
  --landing-glow-cyan: #0ea5e94d;
  --landing-glow-teal: #06b6d438;
  --landing-glow-indigo: #4f46e544;
}

html:not([data-theme="dark"]) .landing-motion-localized {
  --landing-grid: #255ecc20;
  --landing-beam: #317ade65;
  --landing-glow-blue: #2563eb26;
  --landing-glow-cyan: #0ea5e92b;
  --landing-glow-teal: #06b6d425;
  --landing-glow-indigo: #4f46e523;
}

.landing-motion-localized .hero { background: #102b50df; }
.landing-motion-localized > footer { background: #e8eff9b8; }
html[data-theme="dark"] .landing-motion-localized > footer { background: #182332c9; }

.landing-motion {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.landing-motion-grid,
.landing-motion-beam,
.landing-motion-glow,
landing-motion-mesh,
landing-motion-mesh canvas {
  position: absolute;
}

.landing-motion-grid {
  inset: -60px 0;
  background-image: linear-gradient(var(--landing-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--landing-grid) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at 50% 35%, #000 30%, #0003 90%);
  animation: landing-grid-drift 28s linear infinite;
}

.landing-motion-beam {
  top: 18%;
  inset-inline: -20%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--landing-beam) 60%, transparent);
  box-shadow: 0 0 28px var(--landing-beam);
  animation: landing-beam-sweep 14s ease-in-out infinite alternate;
}

.landing-motion-glow {
  inset: -18% -8%;
  background: radial-gradient(ellipse at 23% 18%, var(--landing-glow-cyan), transparent 34%),
    radial-gradient(ellipse at 88% 52%, var(--landing-glow-blue), transparent 37%),
    radial-gradient(ellipse at 19% 83%, var(--landing-glow-teal), transparent 32%),
    radial-gradient(ellipse at 68% 84%, var(--landing-glow-indigo), transparent 32%);
  animation: landing-glow-drift 20s ease-in-out infinite alternate;
}

landing-motion-mesh,
landing-motion-mesh canvas {
  inset: 0;
  width: 100%;
  height: 100%;
}

.landing-motion-toggle {
  position: fixed;
  z-index: 11;
  inset-block-end: max(12px, env(safe-area-inset-bottom));
  inset-inline-start: max(12px, env(safe-area-inset-left));
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #91bdff70;
  border-radius: 8px;
  background: #09182d;
  color: #c0d8f5;
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
}

.landing-motion-toggle input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.landing-motion-toggle:focus-within { outline: 2px solid #91bdff; outline-offset: 2px; }
.landing-motion-toggle span + span,
.landing-motion-toggle:has(input:checked) span:first-of-type { display: none; }
.landing-motion-toggle:has(input:checked) span + span { display: inline; }
.landing-motion-toggle:has(input:checked) ~ .landing-motion > div { animation-play-state: paused; }

@keyframes landing-grid-drift {
  to { transform: translateY(60px); }
}

@keyframes landing-beam-sweep {
  from { transform: translateY(0) rotate(-1.5deg); opacity: .4; }
  to { transform: translateY(55vh) rotate(1deg); opacity: .7; }
}

@keyframes landing-glow-drift {
  from { transform: translate(-4%, -3%); }
  to { transform: translate(5%, 5%); }
}

@media (max-width: 600px) {
  .landing-motion-glow { opacity: .75; }
}

@media (prefers-reduced-motion: reduce), print {
  .landing-motion > div { animation: none; }
  .landing-motion-toggle, landing-motion-mesh { display: none; }
}

@media print {
  .landing-motion { display: none; }
}
