/* ===================================================================
   FX.CSS — Cursor, Tilt, Ripple & Scroll-Assemble Effects
   PromithicAI v1.1
   
   STYLE CONTRACT (preserve in all future updates):
   ─────────────────────────────────────────────────
   • All FX selectors are prefixed with .fx- or [data-fx-*]
   • Never override existing hover/transition rules — only ADD
   • Tilt intensity: 5°–8° max. Magnetic shift: 22% of delta.
   • Spotlight size: 480px, opacity ~0.07 dark / 0.04 light
   • Scroll reveal threshold: 0.10, rootMargin -30px bottom
   • Stagger per child: 110ms step, max cap 700ms
   • Reveal easing: cubic-bezier(0.16, 1, 0.3, 1) — Power4-out
   • Reduced motion: all FX collapse to instant/opacity-only
   =================================================================== */

/* ══════════════════════════════════════
   1. CURSOR SPOTLIGHT
   ══════════════════════════════════════ */
.fx-spotlight {
  pointer-events: none;
  position: fixed;
  z-index: 9990;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(0, 212, 255, 0.07) 0%,
    rgba(124, 58, 237, 0.03) 40%,
    transparent 70%
  );
  mix-blend-mode: screen;
  transition: opacity 0.4s ease;
  will-change: transform;
}

[data-theme="light"] .fx-spotlight {
  background: radial-gradient(
    circle,
    rgba(0, 119, 230, 0.05) 0%,
    rgba(109, 40, 217, 0.02) 40%,
    transparent 70%
  );
  mix-blend-mode: multiply;
}

/* ══════════════════════════════════════
   2. CLICK RIPPLE
   ══════════════════════════════════════ */
.fx-ripple {
  pointer-events: none;
  position: fixed;
  z-index: 9989;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 212, 255, 0.5);
  transform: translate(-50%, -50%) scale(0);
  animation: fxRippleExpand 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fxRippleExpand {
  0%   { width: 0px;   height: 0px;   opacity: 0.9; }
  100% { width: 110px; height: 110px; opacity: 0;   }
}

[data-theme="light"] .fx-ripple {
  border-color: rgba(0, 119, 230, 0.45);
}

/* ══════════════════════════════════════
   3. CARD 3D TILT
   ══════════════════════════════════════ */
.fx-tilt {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

/* Shine overlay that follows cursor inside card */
.fx-tilt::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(255, 255, 255, 0.045) 50%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.35s ease, background-position 0.1s ease;
  z-index: 2;
}

.fx-tilt:hover::after {
  opacity: 1;
}

/* ══════════════════════════════════════
   4. MAGNETIC BUTTON
   ══════════════════════════════════════ */
.fx-magnetic {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.22s ease !important;
}

/* ══════════════════════════════════════
   5. SCROLL ASSEMBLE — BASE STATES
   Elements start hidden/offset; become
   visible when .fx-in is added by JS.
   ══════════════════════════════════════ */

/* Single-element reveals */
[data-fx="up"] {
  opacity: 0;
  transform: translateY(56px);
  transition: opacity 0.92s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-fx="down"] {
  opacity: 0;
  transform: translateY(-40px);
  transition: opacity 0.92s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-fx="left"] {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.92s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-fx="right"] {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.92s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.92s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-fx="scale"] {
  opacity: 0;
  transform: scale(0.78);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.85s cubic-bezier(0.34, 1.4, 0.64, 1);
}

[data-fx="fade"] {
  opacity: 0;
  transition: opacity 0.90s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Triggered state — all directions collapse to natural position */
[data-fx].fx-in {
  opacity: 1 !important;
  transform: none !important;
}

/* ══════════════════════════════════════
   6. SCROLL ASSEMBLE — STAGGER GROUPS
   Children assemble one-by-one.
   ══════════════════════════════════════ */
[data-fx-group] > * {
  opacity: 0;
  transform: translateY(40px) scale(0.94);
  transition: opacity 0.80s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.80s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-fx-group].fx-in > * {
  opacity: 1;
  transform: none;
}

/* Stagger delays — up to 12 children, 110ms step */
[data-fx-group].fx-in > *:nth-child(1)  { transition-delay:   0ms; }
[data-fx-group].fx-in > *:nth-child(2)  { transition-delay: 110ms; }
[data-fx-group].fx-in > *:nth-child(3)  { transition-delay: 220ms; }
[data-fx-group].fx-in > *:nth-child(4)  { transition-delay: 330ms; }
[data-fx-group].fx-in > *:nth-child(5)  { transition-delay: 440ms; }
[data-fx-group].fx-in > *:nth-child(6)  { transition-delay: 550ms; }
[data-fx-group].fx-in > *:nth-child(7)  { transition-delay: 660ms; }
[data-fx-group].fx-in > *:nth-child(8)  { transition-delay: 700ms; }
[data-fx-group].fx-in > *:nth-child(9)  { transition-delay: 700ms; }
[data-fx-group].fx-in > *:nth-child(10) { transition-delay: 700ms; }
[data-fx-group].fx-in > *:nth-child(11) { transition-delay: 700ms; }
[data-fx-group].fx-in > *:nth-child(12) { transition-delay: 700ms; }

/* ══════════════════════════════════════
   7. PARALLAX ORBS
   Background orbs gently follow cursor.
   ══════════════════════════════════════ */
.fx-orb {
  will-change: transform;
  transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ══════════════════════════════════════
   8. REDUCED MOTION — All FX disabled
   ══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .fx-spotlight,
  .fx-ripple          { display: none !important; }

  [data-fx],
  [data-fx-group] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .fx-tilt,
  .fx-tilt::after,
  .fx-magnetic        { transform: none !important; transition: none !important; }
}
