/* ================================================================
   MayaFusion — Global Animation System  v2.0
   ================================================================ */

/* ── Keyframes ──────────────────────────────────────────────────── */

@keyframes mft-float {
  0%,100% { transform: translateY(0px) rotate(0deg) scale(1); }
  33%      { transform: translateY(-22px) rotate(2deg) scale(1.02); }
  66%      { transform: translateY(-10px) rotate(-1.5deg) scale(0.98); }
}

@keyframes mft-morph {
  0%,100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  20%     { border-radius: 40% 60% 55% 45% / 40% 55% 45% 60%; }
  40%     { border-radius: 55% 45% 40% 60% / 50% 40% 60% 50%; }
  60%     { border-radius: 30% 70% 60% 40% / 50% 60% 30% 60%; }
  80%     { border-radius: 50% 50% 35% 65% / 65% 35% 65% 35%; }
}

@keyframes mft-aurora {
  0%,100% { transform: translate(0%,0%)   scale(1);    opacity: 0.55; }
  20%     { transform: translate(3%,2%)   scale(1.07); opacity: 0.75; }
  40%     { transform: translate(-2%,4%)  scale(0.95); opacity: 0.50; }
  60%     { transform: translate(4%,-2%)  scale(1.04); opacity: 0.70; }
  80%     { transform: translate(-3%,3%)  scale(1.02); opacity: 0.60; }
}

@keyframes mft-aurora-2 {
  0%,100% { transform: translate(0%,0%)   scale(1);    opacity: 0.45; }
  25%     { transform: translate(-3%,3%)  scale(1.06); opacity: 0.65; }
  50%     { transform: translate(2%,-3%)  scale(0.93); opacity: 0.40; }
  75%     { transform: translate(-2%,2%)  scale(1.03); opacity: 0.60; }
}

@keyframes mft-particle-rise {
  0%   { transform: translateY(0px) rotate(0deg) scale(1);          opacity: 0; }
  8%   { opacity: 1; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-105vh) rotate(540deg) scale(0.4);   opacity: 0; }
}

@keyframes mft-ring-pulse {
  0%   { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(3.2); opacity: 0;   }
}

@keyframes mft-grid-breathe {
  0%,100% { opacity: 0.60; }
  50%     { opacity: 1;    }
}

/* ── Scroll-reveal keyframes ────────────────────────────────────── */

@keyframes mft-fade-up {
  from { opacity: 0; transform: translateY(70px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes mft-fade-left {
  from { opacity: 0; transform: translateX(-60px); }
  to   { opacity: 1; transform: translateX(0);     }
}

@keyframes mft-fade-right {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0);    }
}

@keyframes mft-scale-in {
  from { opacity: 0; transform: scale(0.82) translateY(24px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

@keyframes mft-slide-down {
  from { opacity: 0; transform: translateY(-48px); }
  to   { opacity: 1; transform: translateY(0);     }
}

/* ── Hero load-specific keyframes ───────────────────────────────── */

/* Big blur-rise for hero headings */
@keyframes mft-text-rise {
  0%   { opacity: 0; transform: translateY(100px); filter: blur(8px);  }
  50%  { filter: blur(0); }
  100% { opacity: 1; transform: translateY(0);     filter: blur(0);     }
}

/* Springy pop — badges, CTAs, stat numbers */
@keyframes mft-pop {
  0%   { opacity: 0; transform: scale(0.50) translateY(18px); }
  55%  { opacity: 1; transform: scale(1.12) translateY(-6px); }
  75%  { transform: scale(0.95) translateY(3px); }
  100% { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* Swing-in — hero right visual */
@keyframes mft-swing-in {
  0%   { opacity: 0; transform: scale(0.68) rotate(-8deg) translateY(60px); }
  55%  { transform: scale(1.06) rotate(2deg)  translateY(-10px); }
  75%  { transform: scale(0.97) rotate(-1deg) translateY(4px);   }
  100% { opacity: 1; transform: scale(1)    rotate(0deg)  translateY(0);    }
}

/* Overlay logo entrance */
@keyframes mft-logo-in {
  0%   { opacity: 0; transform: translateY(28px) scale(0.88); letter-spacing: 0.8em; }
  100% { opacity: 1; transform: translateY(0)    scale(1);    letter-spacing: -0.03em; }
}

/* Separator line grow */
@keyframes mft-line-grow {
  0%   { width: 0;     opacity: 0; }
  50%  { opacity: 1; }
  100% { width: 200px; opacity: 1; }
}

/* Subtitle typewriter fade */
@keyframes mft-sub-in {
  0%   { opacity: 0; letter-spacing: 0.5em; }
  100% { opacity: 0.45; letter-spacing: 0.28em; }
}

/* Overlay wipe out (applied via JS) */
@keyframes mft-overlay-out {
  0%   { transform: translateY(0%); }
  100% { transform: translateY(-100%); }
}

/* Shimmer */
@keyframes mft-shimmer-move {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

/* Misc */
@keyframes mft-blink    { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes mft-spin-slow{ to{transform:rotate(360deg)} }
@keyframes mft-dash     { to{stroke-dashoffset:0} }

/* ── Branded Intro Overlay ──────────────────────────────────────── */

#mft-intro {
  position: fixed;
  top: 0;
  left: 0;
  /* Use 100vw/100vh instead of inset:0 so the overlay always fills the
     full visual viewport including any scrollbar track area */
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #030712 0%, #0f172a 45%, #0c1445 100%);
  will-change: transform;
  overflow: hidden;
}

#mft-intro .mft-overlay-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  color: #fff;
  animation: mft-logo-in 0.75s cubic-bezier(0.16,1,0.3,1) 0.1s both;
}

#mft-intro .mft-overlay-line {
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #3b82f6 40%, #14b8a6 60%, transparent);
  margin: 20px auto 0;
  animation: mft-line-grow 0.65s cubic-bezier(0.16,1,0.3,1) 0.55s both;
}

#mft-intro .mft-overlay-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  margin-top: 18px;
  text-align: center;
  animation: mft-sub-in 0.6s ease 0.8s both;
}

/* ── Permanent Background Layer ─────────────────────────────────── */

.mft-bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.mft-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: mft-morph 20s ease-in-out infinite,
             mft-aurora 26s ease-in-out infinite;
}

.mft-blob-1 {
  width: min(720px,70vw); height: min(720px,70vw);
  top: -18%; right: -12%;
  background: radial-gradient(circle,
    rgba(37,99,235,0.22) 0%, rgba(99,102,241,0.10) 55%, transparent 100%);
  animation-delay: 0s, 0s;
}

.mft-blob-2 {
  width: min(620px,60vw); height: min(620px,60vw);
  bottom: -12%; left: -10%;
  background: radial-gradient(circle,
    rgba(20,184,166,0.16) 0%, rgba(37,99,235,0.07) 55%, transparent 100%);
  animation-delay: -7s, -9s;
  animation-name: mft-morph, mft-aurora-2;
}

.mft-blob-3 {
  width: min(380px,40vw); height: min(380px,40vw);
  top: 38%; left: 28%;
  background: radial-gradient(circle,
    rgba(168,85,247,0.13) 0%, transparent 70%);
  filter: blur(110px);
  animation: mft-morph 28s ease-in-out infinite,
             mft-float 14s ease-in-out infinite;
  animation-delay: -14s, -4s;
}

.mft-blob-4 {
  width: min(300px,35vw); height: min(300px,35vw);
  top: 60%; right: 15%;
  background: radial-gradient(circle,
    rgba(20,184,166,0.11) 0%, transparent 70%);
  filter: blur(80px);
  animation: mft-morph 22s ease-in-out infinite,
             mft-float 10s ease-in-out infinite;
  animation-delay: -5s, -7s;
}

/* Animated grid overlay */
.mft-grid-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: mft-grid-breathe 7s ease-in-out infinite;
}

.dark .mft-grid-layer {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
}

/* Floating particles */
.mft-particle {
  position: absolute;
  border-radius: 50%;
  animation: mft-particle-rise linear infinite;
  background: rgba(37,99,235,0.25);
}
.dark .mft-particle { background: rgba(255,255,255,0.18); }

/* Pulse rings */
.mft-pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(37,99,235,0.35);
  animation: mft-ring-pulse 5s ease-out infinite;
}

/* ── Scroll Reveal ──────────────────────────────────────────────── */

[data-mft-animate] {
  opacity: 0;
  transition: opacity 0.90s cubic-bezier(0.16,1,0.3,1),
              transform 0.90s cubic-bezier(0.16,1,0.3,1);
}

[data-mft-animate="fade-up"]    { transform: translateY(70px); }
[data-mft-animate="fade-left"]  { transform: translateX(-60px); }
[data-mft-animate="fade-right"] { transform: translateX(60px); }
[data-mft-animate="scale-in"]   { transform: scale(0.82) translateY(20px); }
[data-mft-animate="slide-down"] { transform: translateY(-40px); }
[data-mft-animate="fade-in"]    { transform: none; }

[data-mft-animate].mft-in {
  opacity: 1 !important;
  transform: none !important;
}

/* Staggered grid children */
[data-mft-stagger] > * {
  opacity: 0;
  transform: translateY(50px) scale(0.96);
  transition: opacity 0.80s cubic-bezier(0.16,1,0.3,1),
              transform 0.80s cubic-bezier(0.16,1,0.3,1);
}

[data-mft-stagger].mft-in > *:nth-child(1)   { transition-delay: 0.04s; }
[data-mft-stagger].mft-in > *:nth-child(2)   { transition-delay: 0.12s; }
[data-mft-stagger].mft-in > *:nth-child(3)   { transition-delay: 0.20s; }
[data-mft-stagger].mft-in > *:nth-child(4)   { transition-delay: 0.28s; }
[data-mft-stagger].mft-in > *:nth-child(5)   { transition-delay: 0.36s; }
[data-mft-stagger].mft-in > *:nth-child(6)   { transition-delay: 0.44s; }
[data-mft-stagger].mft-in > *:nth-child(7)   { transition-delay: 0.52s; }
[data-mft-stagger].mft-in > *:nth-child(8)   { transition-delay: 0.60s; }
[data-mft-stagger].mft-in > *:nth-child(n+9) { transition-delay: 0.66s; }

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

/* ── Misc helpers ───────────────────────────────────────────────── */

.mft-float     { animation: mft-float 8s ease-in-out infinite; }
.mft-float-2   { animation: mft-float 11s ease-in-out infinite 2s; }
.mft-float-3   { animation: mft-float 14s ease-in-out infinite 4s; }
.mft-spin-slow { animation: mft-spin-slow 18s linear infinite; }

/* ── Accessibility ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  #mft-intro { display: none !important; }

  .mft-blob, .mft-particle, .mft-pulse-ring,
  .mft-grid-layer, .mft-float, .mft-float-2, .mft-float-3, .mft-spin-slow {
    animation: none !important;
  }

  [data-mft-animate],
  [data-mft-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
