/* ==========================================================================
   Animations — STSERVER Technologies
   Keyframes, transitions, scroll-triggered animations
   ========================================================================== */

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

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes draw-line {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

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

/* Network node pulse animation */
@keyframes node-pulse {
  0%, 100% {
    r: 3;
    opacity: 0.4;
  }
  50% {
    r: 5;
    opacity: 0.8;
  }
}

@keyframes line-flow {
  0% {
    stroke-dashoffset: 20;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* ── Scroll-Triggered Animation Classes ──────────────────────────────────── */

/* Base state: elements start hidden */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: 
    opacity var(--duration-slower) var(--ease-out),
    transform var(--duration-slower) var(--ease-out);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Variants */
.animate-on-scroll.from-left {
  transform: translateX(-24px);
}

.animate-on-scroll.from-left.visible {
  transform: translateX(0);
}

.animate-on-scroll.from-right {
  transform: translateX(24px);
}

.animate-on-scroll.from-right.visible {
  transform: translateX(0);
}

.animate-on-scroll.scale-up {
  transform: scale(0.95);
}

.animate-on-scroll.scale-up.visible {
  transform: scale(1);
}

/* Staggered delays for groups */
.animate-on-scroll.delay-1 { transition-delay: 100ms; }
.animate-on-scroll.delay-2 { transition-delay: 200ms; }
.animate-on-scroll.delay-3 { transition-delay: 300ms; }
.animate-on-scroll.delay-4 { transition-delay: 400ms; }
.animate-on-scroll.delay-5 { transition-delay: 500ms; }
.animate-on-scroll.delay-6 { transition-delay: 600ms; }

/* ── Hero Specific Animations ────────────────────────────────────────────── */

.hero__title {
  animation: fade-in-up 0.8s var(--ease-out) 0.2s both;
}

.hero__subtitle {
  animation: fade-in-up 0.8s var(--ease-out) 0.4s both;
}

.hero__description {
  animation: fade-in-up 0.8s var(--ease-out) 0.6s both;
}

.hero__actions {
  animation: fade-in-up 0.8s var(--ease-out) 0.8s both;
}

/* ── Network Visualization ───────────────────────────────────────────────── */

.hero-network {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hero-network svg {
  width: 100%;
  height: 100%;
  opacity: 0.4;
}

.hero-network .node {
  animation: node-pulse 3s ease-in-out infinite;
}

.hero-network .node:nth-child(2n) {
  animation-delay: 0.5s;
}

.hero-network .node:nth-child(3n) {
  animation-delay: 1s;
}

.hero-network .node:nth-child(5n) {
  animation-delay: 1.5s;
}

.hero-network .connection {
  stroke-dasharray: 5 5;
  animation: line-flow 2s linear infinite;
}

.hero-network .connection:nth-child(2n) {
  animation-duration: 3s;
}

/* ── Gradient Text Shimmer ───────────────────────────────────────────────── */

.text-shimmer {
  background: linear-gradient(
    90deg, 
    var(--color-accent-blue) 0%, 
    var(--color-accent-cyan) 25%, 
    var(--color-accent-blue) 50%, 
    var(--color-accent-cyan) 75%, 
    var(--color-accent-blue) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s linear infinite;
}

/* ── Hover Micro-interactions ────────────────────────────────────────────── */

.hover-lift {
  transition: transform var(--duration-base) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-3px);
}

.hover-glow {
  transition: box-shadow var(--duration-base) var(--ease-out);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}
