/* Exarh — Motion graphics layer (Apple-style)
 * Scroll-driven, parallax, mask reveals, count-ups, magnetic CTAs.
 */

/* ===== Scroll reveal (fade-up) ===== */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.22,1,0.36,1), transform 0.9s cubic-bezier(0.22,1,0.36,1);
}
[data-reveal].in {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s cubic-bezier(0.22,1,0.36,1), transform 0.8s cubic-bezier(0.22,1,0.36,1);
}
[data-reveal-stagger].in > * { opacity: 1; transform: translateY(0); }
[data-reveal-stagger].in > *:nth-child(1) { transition-delay: 0s; }
[data-reveal-stagger].in > *:nth-child(2) { transition-delay: 0.08s; }
[data-reveal-stagger].in > *:nth-child(3) { transition-delay: 0.16s; }
[data-reveal-stagger].in > *:nth-child(4) { transition-delay: 0.24s; }
[data-reveal-stagger].in > *:nth-child(5) { transition-delay: 0.32s; }
[data-reveal-stagger].in > *:nth-child(6) { transition-delay: 0.40s; }

/* ===== Word-by-word reveal for big headlines (Apple-style) ===== */
.mw-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  filter: blur(8px);
  transition: opacity 1s cubic-bezier(0.22,1,0.36,1),
              transform 1s cubic-bezier(0.22,1,0.36,1),
              filter 0.8s cubic-bezier(0.22,1,0.36,1);
}
.mw-word.in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* ===== Count-up numbers ===== */
.mg-count {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: filter 0.4s;
}
.mg-count.counting { filter: blur(0.4px); }

/* ===== Magnetic CTA glow + ripple ===== */
.mg-magnet {
  position: relative;
  transition: transform 0.18s cubic-bezier(0.22,1,0.36,1);
}
.mg-magnet::before {
  content: '';
  position: absolute; inset: -8px;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(196,147,63,0.32), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: -1;
}
.mg-magnet:hover::before { opacity: 1; }

/* ===== Parallax (CSS-only fallback; JS enhances) ===== */
.mg-parallax {
  will-change: transform;
}

/* ===== Outcome counter (specifically targets v3-outcome-n) ===== */
.v3-outcome-n.mg-count-up {
  display: inline-block;
  position: relative;
}

/* ===== Hero "live" indicator pulse ring ===== */
.mg-live-ring {
  position: relative;
  display: inline-flex;
}
.mg-live-ring::after {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid #5BCA8A;
  animation: mg-ring 1.8s ease-out infinite;
  opacity: 0;
}
@keyframes mg-ring {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ===== Marquee / ticker for feed-style scrolls ===== */
.mg-ticker {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.mg-ticker-track {
  display: flex; gap: 56px;
  animation: mg-scroll 38s linear infinite;
  width: max-content;
}
@keyframes mg-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ===== Floating orb / shape ambient ===== */
.mg-float-1 { animation: mg-float-1 11s ease-in-out infinite; }
.mg-float-2 { animation: mg-float-2 14s ease-in-out infinite; }
@keyframes mg-float-1 {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  50%      { transform: translate(20px, -16px) rotate(4deg); }
}
@keyframes mg-float-2 {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-22px, 18px); }
}

/* ===== Scroll-linked hero matrix scale (Apple iPhone hero feel) =====
   Set via JS: --mg-progress = 0..1 */
.mg-hero-scroll {
  transform: scale(calc(1 - var(--mg-progress, 0) * 0.04))
             translateY(calc(var(--mg-progress, 0) * -20px));
  transition: transform 0.1s linear;
}

/* ===== Spotlight cursor (Apple keynote style) ===== */
.mg-spotlight {
  position: relative;
}
.mg-spotlight::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle 240px at var(--mx, 50%) var(--my, 50%), rgba(196,147,63,0.10), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: inherit;
  z-index: 1;
}
.mg-spotlight:hover::after { opacity: 1; }

/* ===== Industry tiles: stagger reveal + zoom hover with delay ===== */
.ind-grid[data-reveal-stagger] > * {
  transition-duration: 0.7s;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal-stagger] > *, .mw-word {
    opacity: 1 !important; transform: none !important; filter: none !important;
  }
  .mg-live-ring::after, .mg-float-1, .mg-float-2, .mg-ticker-track { animation: none !important; }
}
