/* ==========================================================================
   Lighting & motion effects
   1. Aurora backgrounds (CSS keyframes)
   2. Cursor-following spotlight (.spotlight, driven by --spot-x/--spot-y/--spot-o)
   3. Pointer-tracked luminous borders on cards (.glow-card, --gx/--gy)
   4. Magnetic buttons (--mx/--my set by JS) + shimmer (components.css)
   5. Scroll reveal & content-flow sequence
   All motion is disabled for prefers-reduced-motion; pointer effects only run
   on fine pointers (JS checks), so touch devices get calm static styles.
   ========================================================================== */

/* ---- 1. Aurora ------------------------------------------------------------ */
.aurora {
  position: absolute; inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.aurora span:nth-child(1) { width: 46vw; height: 40vw; max-width: 720px; max-height: 620px; left: 42%; top: -22%; background: radial-gradient(circle, #7c3aed, transparent 65%); }
.aurora span:nth-child(2) { width: 38vw; height: 34vw; max-width: 600px; max-height: 520px; left: 68%; top: 28%; background: radial-gradient(circle, #0891b2, transparent 65%); opacity: 0.45; }
.aurora span:nth-child(3) { width: 34vw; height: 30vw; max-width: 520px; max-height: 460px; left: -8%; top: 40%; background: radial-gradient(circle, #db2777, transparent 65%); opacity: 0.22; }
.aurora span:nth-child(4) { width: 26vw; height: 26vw; max-width: 420px; max-height: 420px; left: 20%; top: -10%; background: radial-gradient(circle, #2dd4bf, transparent 65%); opacity: 0.18; }
.aurora--soft span { opacity: 0.32; }
.aurora--soft span:nth-child(2) { opacity: 0.25; }

@media (prefers-reduced-motion: no-preference) {
  .aurora span:nth-child(1) { animation: aurora-a 22s ease-in-out infinite alternate; }
  .aurora span:nth-child(2) { animation: aurora-b 26s ease-in-out infinite alternate; }
  .aurora span:nth-child(3) { animation: aurora-c 30s ease-in-out infinite alternate; }
  .aurora span:nth-child(4) { animation: aurora-b 34s ease-in-out infinite alternate-reverse; }
}
@keyframes aurora-a { to { transform: translate3d(-12%, 10%, 0) scale(1.15) rotate(12deg); } }
@keyframes aurora-b { to { transform: translate3d(-18%, -8%, 0) scale(0.9) rotate(-10deg); } }
@keyframes aurora-c { to { transform: translate3d(14%, -12%, 0) scale(1.2); } }

/* ---- 2. Spotlight ---------------------------------------------------------- */
.spotlight {
  --spot-x: 50%;
  --spot-y: 35%;
  --spot-o: 0;
  position: relative;
  isolation: isolate;
}
.spotlight::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(560px circle at var(--spot-x) var(--spot-y), rgb(139 92 246 / 0.22), rgb(34 211 238 / 0.08) 35%, transparent 62%);
  opacity: var(--spot-o);
  transition: opacity 0.6s var(--ease-out);
}

/* ---- 3. Glow cards ---------------------------------------------------------- */
.glow-card {
  --gx: 50%;
  --gy: 0%;
  --glow-o: 0;
  position: relative;
  isolation: isolate;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) ease, box-shadow var(--dur) ease;
}
/* Luminous border: a radial gradient masked to the 1px border ring. */
.glow-card::before {
  content: "";
  position: absolute; inset: -1px;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--gx) var(--gy), rgb(165 243 252 / 0.95), rgb(139 92 246 / 0.7) 32%, transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--glow-o);
  transition: opacity 0.45s var(--ease-out);
  pointer-events: none;
}
/* Soft interior light following the pointer. */
.glow-card::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--gx) var(--gy), rgb(139 92 246 / 0.12), transparent 55%);
  opacity: var(--glow-o);
  transition: opacity 0.45s var(--ease-out);
  pointer-events: none;
}
.glow-card.is-glowing { --glow-o: 1; border-color: rgb(255 255 255 / 0.14); }
/* Keyboard users get the lit border too (static, centred at the top edge). */
.glow-card:focus-within { --glow-o: 1; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .glow-card.is-glowing { transform: translateY(-3px); box-shadow: 0 24px 60px -28px rgb(139 92 246 / 0.55); }
}

/* ---- 5. Reveal on scroll ------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal.reveal-pending { opacity: 0; transform: translate3d(0, 18px, 0); }
  .js .reveal.is-visible {
    opacity: 1; transform: none;
    transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .js .bento > .reveal:nth-child(2) { --reveal-delay: 80ms; }
  .js .bento > .reveal:nth-child(3) { --reveal-delay: 160ms; }
  .js .bento > .reveal:nth-child(4) { --reveal-delay: 80ms; }
  .js .bento > .reveal:nth-child(5) { --reveal-delay: 160ms; }
  .js .bento > .reveal:nth-child(6) { --reveal-delay: 240ms; }
  .js .pathway > .reveal:nth-child(n) { --reveal-delay: 60ms; }
}

/* Floating decorations */
@media (prefers-reduced-motion: no-preference) {
  .float-card--article { animation: floaty 7s ease-in-out infinite; }
  .float-card--wp { animation: floaty 8s ease-in-out -2s infinite; }
  .float-card--social { animation: floaty 9s ease-in-out -4s infinite; }
}
@keyframes floaty {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -10px, 0); }
}

/* Hero tentacle pulses travel from the core to each channel. */
.hv-pulses .pulse { stroke-dasharray: 7 93; stroke-dashoffset: 100; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .hv-pulses .pulse { animation: pulse-travel 4.2s var(--ease-out) infinite; }
  .hv-pulses .p2 { animation-delay: 0.6s; }
  .hv-pulses .p3 { animation-delay: 1.2s; }
  .hv-pulses .p4 { animation-delay: 1.8s; }
  .hv-pulses .p5 { animation-delay: 2.4s; }
  .hv-pulses .p6 { animation-delay: 3s; }
  .hv-pulses .p7 { animation-delay: 3.6s; }
  .hv-halo { animation: halo 5s ease-in-out infinite; transform-origin: 280px 260px; }
}
@keyframes pulse-travel {
  0% { stroke-dashoffset: 100; opacity: 0; }
  10% { opacity: 1; }
  70% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes halo { 0%, 100% { transform: scale(1); opacity: 0.45; } 50% { transform: scale(1.12); opacity: 0.7; } }

/* Parallax depth (fine pointers only; JS sets --px/--py in the range -1..1). */
.hero-visual { --px: 0; --py: 0; }
.hero-visual .float-card { translate: calc(var(--px) * var(--depth, 8px)) calc(var(--py) * var(--depth, 8px)); transition: translate 0.4s var(--ease-out); }
.hero-visual .float-card--wp { --depth: 14px; }
.hero-visual .float-card--social { --depth: -10px; }
.hero-visual__web { translate: calc(var(--px) * -6px) calc(var(--py) * -6px); transition: translate 0.5s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-visual .float-card, .hero-visual__web { translate: none !important; }
  .btn { transform: none !important; }
}
