/* ============================================================
   NEBULA ANIMATIONS — nebula-animations.css
   CSS keyframes, transition utilities, scroll-reveal classes,
   entrance animations, and micro-interaction definitions.
   ============================================================ */

/* ─── Hero Mesh Gradient Background ─── */
@keyframes mesh-gradient {
  0%, 100% {
    background-position: 0% 50%;
  }
  25% {
    background-position: 100% 50%;
  }
  50% {
    background-position: 100% 0%;
  }
  75% {
    background-position: 0% 100%;
  }
}

.mesh-gradient-bg {
  background: linear-gradient(
    -45deg,
    #030303 0%,
    #0a0a0a 15%,
    #141414 30%,
    #0a0a0a 45%,
    #030303 60%,
    #0a0a0a 75%,
    #030303 100%
  );
  background-size: 400% 400%;
  animation: mesh-gradient 20s ease infinite;
}

/* ─── Floating Orbs (Hero decoration) ─── */
@keyframes float-slow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, -80px) scale(0.95); }
  75% { transform: translate(-40px, -30px) scale(1.02); }
}

@keyframes float-medium {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-50px, 30px) scale(1.08); }
  66% { transform: translate(40px, -50px) scale(0.92); }
}

@keyframes float-fast {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -30px); }
}

.float-slow { animation: float-slow 12s ease-in-out infinite; }
.float-medium { animation: float-medium 8s ease-in-out infinite; }
.float-fast { animation: float-fast 5s ease-in-out infinite; }

/* ─── Decorative Orbs ─── */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  will-change: transform;
}

.orb--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08), transparent 70%);
  top: -10%;
  right: -5%;
  animation: float-slow 15s ease-in-out infinite;
}

.orb--2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08), transparent 70%);
  bottom: 10%;
  left: -8%;
  animation: float-medium 10s ease-in-out infinite;
}

.orb--3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.05), transparent 70%);
  top: 40%;
  left: 50%;
  animation: float-slow 18s ease-in-out infinite reverse;
}

/* ─── Entrance Animations (used by GSAP as fallback / initial states) ─── */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
}

.fade-in-down {
  opacity: 0;
  transform: translateY(-30px);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
}

.scale-in {
  opacity: 0;
  transform: scale(0.9);
}

/* Revealed state (added by GSAP or IntersectionObserver) */
.revealed {
  opacity: 1 !important;
  transform: translate(0, 0) scale(1) !important;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Stagger Children (for grids) ─── */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children.revealed > *:nth-child(1) { transition-delay: 0s; }
.stagger-children.revealed > *:nth-child(2) { transition-delay: 0.08s; }
.stagger-children.revealed > *:nth-child(3) { transition-delay: 0.16s; }
.stagger-children.revealed > *:nth-child(4) { transition-delay: 0.24s; }
.stagger-children.revealed > *:nth-child(5) { transition-delay: 0.32s; }
.stagger-children.revealed > *:nth-child(6) { transition-delay: 0.40s; }
.stagger-children.revealed > *:nth-child(7) { transition-delay: 0.48s; }
.stagger-children.revealed > *:nth-child(8) { transition-delay: 0.56s; }

.stagger-children.revealed > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* ─── Scroll Indicator (Hero) ─── */
@keyframes scroll-indicator {
  0% { opacity: 1; transform: translateY(0); }
  50% { opacity: 0.5; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.scroll-indicator {
  animation: scroll-indicator 2s ease-in-out infinite;
}

/* ─── Pulse Glow (Live indicators) ─── */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* ─── Line Draw (decorative) ─── */
@keyframes draw-line {
  from { width: 0; }
  to { width: 60px; }
}

.line-draw {
  height: 2px;
  background: var(--color-accent);
  animation: draw-line 0.8s ease forwards;
}

/* ─── Typewriter Cursor ─── */
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.typewriter-cursor::after {
  content: '|';
  animation: blink-cursor 0.8s ease-in-out infinite;
  font-weight: var(--weight-light);
  margin-left: 2px;
  color: var(--color-accent);
}

/* ─── Counter Animation ─── */
@keyframes count-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Ripple Effect (buttons) ─── */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  width: 100px;
  height: 100px;
  margin-top: -50px;
  margin-left: -50px;
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ─── Card Hover Lift ─── */
.hover-lift {
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

/* ─── Slide Transitions (Page / Panel switching) ─── */
.slide-enter {
  opacity: 0;
  transform: translateX(20px);
}

.slide-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.slide-exit {
  opacity: 1;
  transform: translateX(0);
}

.slide-exit-active {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ─── Panel Fade ─── */
.panel-fade-enter {
  opacity: 0;
  transform: translateY(10px);
}

.panel-fade-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* ─── Auth Panel Flip ─── */
@keyframes flip-in {
  from {
    opacity: 0;
    transform: rotateY(-15deg) scale(0.95);
  }
  to {
    opacity: 1;
    transform: rotateY(0) scale(1);
  }
}

.flip-enter {
  animation: flip-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: center center;
}

/* ─── Marquee (continuous scroll) ─── */
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.marquee {
  display: flex;
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: flex;
  gap: var(--space-xl);
  animation: marquee 30s linear infinite;
}

/* ─── Number Count Animation ─── */
.number-count {
  display: inline-block;
  transition: all 0.3s ease;
}

/* ─── Dot Grid Pattern ─── */
.dot-grid {
  background-image: radial-gradient(circle, var(--color-border) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ─── Hover Underline Effect ─── */
.hover-underline {
  position: relative;
  display: inline-block;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background-color: var(--color-accent);
  transition: width var(--transition-smooth);
}

.hover-underline:hover::after {
  width: 100%;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .orb,
  .float-slow,
  .float-medium,
  .float-fast {
    animation: none !important;
  }
}
