/* ============================================================
   Safa Othman — MOTION LAYER
   Premium motion system: cursor, reveals, magnetic, tilt,
   aurora, parallax, scroll-progress.
   ============================================================ */

:root {
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ------------------------------------------------------------
   1. SCROLL PROGRESS BAR
   ------------------------------------------------------------ */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), #e7ff8c);
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 200;
  will-change: transform;
}

/* ------------------------------------------------------------
   2. CUSTOM CURSOR (desktop, fine pointer only)
   ------------------------------------------------------------ */
.cursor-ring,
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 250;
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: transform;
}
.cursor-ring {
  width: 38px; height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid rgba(198, 242, 78, 0.7);
  transition: opacity 0.4s ease, width 0.35s var(--ease-expo),
              height 0.35s var(--ease-expo), margin 0.35s var(--ease-expo),
              background 0.35s var(--ease-expo), border-color 0.35s var(--ease-expo);
  backdrop-filter: invert(4%);
}
.cursor-dot {
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--accent);
}
.cursor-ready .cursor-ring,
.cursor-ready .cursor-dot { opacity: 1; }

/* grow state on interactive hover */
.cursor-ring.is-hot {
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  background: rgba(198, 242, 78, 0.10);
  border-color: rgba(198, 242, 78, 0.9);
}
.cursor-dot.is-hot { opacity: 0; }

@media (hover: none), (pointer: coarse) {
  .cursor-ring, .cursor-dot { display: none; }
}

/* ------------------------------------------------------------
   3. UPGRADED REVEALS — blur + lift, with stagger
   ------------------------------------------------------------ */
.js .reveal {
  opacity: 0;
  transform: translateY(34px);
  filter: blur(8px);
  transition: opacity 0.9s var(--ease-expo),
              transform 1s var(--ease-expo),
              filter 0.9s var(--ease-expo);
  will-change: opacity, transform, filter;
}
.js .reveal.in {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* ------------------------------------------------------------
   4. LINE MASK REVEAL (hero headline + section titles)
   ------------------------------------------------------------ */
.line-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.04em;   /* avoid clipping descenders */
}
.line-inner {
  display: block;
  transform: translateY(115%);
  transition: transform 1.05s var(--ease-expo);
  will-change: transform;
}
.js .line-host.in .line-inner { transform: translateY(0); }
.line-host .line-mask:nth-child(2) .line-inner { transition-delay: 0.09s; }
.line-host .line-mask:nth-child(3) .line-inner { transition-delay: 0.18s; }

/* ------------------------------------------------------------
   5. WORD REVEAL (taglines / leads)
   ------------------------------------------------------------ */
.word-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.02em;
}
.word {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0.2;
  transition: transform 0.8s var(--ease-expo), opacity 0.8s var(--ease-expo);
  transition-delay: calc(var(--wi, 0) * 0.028s);
  will-change: transform;
}
.js .word-host.in .word { transform: translateY(0); opacity: 1; }

/* ------------------------------------------------------------
   6. AURORA — living background in hero
   ------------------------------------------------------------ */
.aurora {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 120%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 30%, #000 30%, transparent 75%);
          mask-image: radial-gradient(70% 70% at 50% 30%, #000 30%, transparent 75%);
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  mix-blend-mode: screen;
}
.aurora .a1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(198,242,78,0.35), transparent 65%);
  top: -8%; left: 18%;
  animation: drift1 18s var(--ease) infinite alternate;
}
.aurora .a2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(120,200,255,0.18), transparent 65%);
  top: 12%; right: 8%;
  animation: drift2 22s var(--ease) infinite alternate;
}
.aurora .a3 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(198,242,78,0.18), transparent 65%);
  bottom: -10%; left: 42%;
  animation: drift3 26s var(--ease) infinite alternate;
}
@keyframes drift1 { to { transform: translate(80px, 60px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-70px, 40px) scale(1.1); } }
@keyframes drift3 { to { transform: translate(40px, -50px) scale(1.2); } }

.hero { position: relative; z-index: 1; }
.hero-grid, .marquee { position: relative; z-index: 2; }

/* ------------------------------------------------------------
   7. PARALLAX / FLOAT on hero visual
   ------------------------------------------------------------ */
.hero-visual { will-change: transform; }
.hero-avatar {
  transition: transform 0.5s var(--ease-expo), box-shadow 0.5s var(--ease-expo);
}
.hero-visual:hover .hero-avatar {
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.8), 0 0 0 1px var(--line);
}
.float {
  animation: float 7s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ------------------------------------------------------------
   8. MAGNETIC BUTTONS
   ------------------------------------------------------------ */
[data-magnetic] { will-change: transform; }
[data-magnetic] > span.mag-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  will-change: transform;
}

/* ------------------------------------------------------------
   9. 3D TILT on service cards + sheen
   ------------------------------------------------------------ */
.service {
  transform-style: preserve-3d;
  transition: background 0.3s var(--ease), transform 0.45s var(--ease-expo);
  will-change: transform;
}
.service .tilt-layer {
  position: relative;
  z-index: 2;
  transform: translateZ(40px);
  transform-style: preserve-3d;
}
.service-sheen {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
              rgba(198,242,78,0.10), transparent 60%);
  transition: opacity 0.4s var(--ease);
}
.service:hover .service-sheen { opacity: 1; }

/* ------------------------------------------------------------
   10. STAT cards hover glow + magnetic count pop
   ------------------------------------------------------------ */
.stat { transition: background 0.4s var(--ease); position: relative; }
.stat::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(160px circle at 50% 0%, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.stat:hover { background: var(--ink-800); }
.stat:hover::after { opacity: 1; }
.num.counting { color: var(--accent); }

/* ------------------------------------------------------------
   11. NAV link underline sweep
   ------------------------------------------------------------ */
.nav-links a { position: relative; overflow: hidden; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 5px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.4s var(--ease-expo);
}
.nav-links a:hover::after { transform: scaleX(1); }

/* brand mark pulse on load */
.brand-mark { position: relative; }

/* ------------------------------------------------------------
   12. CHANNEL row icon spin-in + arrow
   ------------------------------------------------------------ */
.channel { position: relative; }
.channel-ic { transition: transform 0.4s var(--ease-back), background 0.3s var(--ease), color 0.3s var(--ease); }
.channel:hover .channel-ic { transform: scale(1.08) rotate(-6deg); background: var(--accent); color: var(--accent-ink); }

/* eyebrow line grow */
.eyebrow::before { transition: width 0.6s var(--ease-expo); }
.in .eyebrow::before { width: 22px; }

/* ------------------------------------------------------------
   13. BUTTON shimmer
   ------------------------------------------------------------ */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-18deg);
  transition: left 0.7s var(--ease-expo);
}
.btn-primary:hover::before { left: 130%; }

/* ------------------------------------------------------------
   14. MARQUEE pause on hover, speed feel
   ------------------------------------------------------------ */
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ------------------------------------------------------------
   15. SECTION number watermark drift
   ------------------------------------------------------------ */
.service-ic { transition: transform 0.45s var(--ease-back), background 0.3s var(--ease); }
.service:hover .service-ic { transform: translateY(-4px) rotate(-8deg) scale(1.05); }

/* ------------------------------------------------------------
   REDUCED MOTION
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .line-inner,
  .word,
  .aurora span,
  .float,
  .marquee-track {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
  }
  .scroll-progress, .cursor-ring, .cursor-dot { display: none; }
}
