/* ═══════════════════════════════════════════════════════════════
   SEOKit — Animations & Keyframes
   animations.css
   ═══════════════════════════════════════════════════════════════ */

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

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

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(10px) scale(0.95); }
}

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -20px) scale(1.05); }
  66%       { transform: translate(-15px, 15px) scale(0.96); }
}

@keyframes sparkleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.6; }
  50%       { transform: translateY(-12px) rotate(180deg); opacity: 1; }
}

@keyframes sparkleScale {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50%       { transform: scale(1.4); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.85; }
}

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

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

@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.4; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes iconWiggle {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-8deg); }
  75%       { transform: rotate(8deg); }
}

@keyframes iconPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(124,108,240,0.30); }
  50%       { box-shadow: 0 0 24px rgba(124,108,240,0.60); }
}

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

@keyframes nodeConnect {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes count {
  from { transform: scale(1.2); }
  to   { transform: scale(1); }
}

/* ── Animation Utilities ────────────────────────────────────── */
.animate-fade-in      { animation: fadeIn 0.4s ease forwards; }
.animate-fade-in-up   { animation: fadeInUp 0.5s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.4s ease forwards; }
.animate-scale-in     { animation: scaleIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.animate-slide-right  { animation: slideInRight 0.4s ease forwards; }
.animate-spin         { animation: spin 1s linear infinite; }
.animate-pulse        { animation: pulse 2s ease-in-out infinite; }
.animate-bounce       { animation: bounce 1s ease-in-out infinite; }
.animate-float        { animation: float 4s ease-in-out infinite; }

/* Staggered children */
.stagger-children > * { opacity: 0; animation: fadeInUp 0.5s ease forwards; }
.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.40s; }

/* Delayed fade-in for page content */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ── SVG Icon Animations ────────────────────────────────────── */

/* Meta/document icon — sparkle animation */
.icon-meta-sparkle {
  animation: sparkleScale 2.5s ease-in-out infinite;
  transform-origin: center;
}
.icon-meta-doc {
  transition: transform var(--transition-base);
}
.tool-card:hover .icon-meta-doc {
  transform: translateY(-2px);
}

/* Robot/technical icon wiggle */
.icon-robot-body {
  transition: transform var(--transition-base);
  transform-origin: bottom center;
}
.tool-card:hover .icon-robot-body { animation: iconWiggle 0.6s ease; }

/* Magnifying glass sweep */
.icon-search-glass {
  transition: transform var(--transition-base);
  transform-origin: center;
}
.tool-card:hover .icon-search-glass { transform: rotate(15deg) scale(1.1); }

/* Network/schema nodes */
.icon-node {
  animation: nodeConnect 0.8s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.icon-node:nth-child(1) { animation-delay: 0s; }
.icon-node:nth-child(2) { animation-delay: 0.1s; }
.icon-node:nth-child(3) { animation-delay: 0.2s; }

/* Link chain */
.icon-link-chain {
  transition: transform var(--transition-base);
}
.tool-card:hover .icon-link-chain { transform: scaleX(1.15); }

/* Image frame */
.icon-image-frame {
  transition: all var(--transition-base);
}
.tool-card:hover .icon-image-frame { transform: scale(1.05) rotate(-3deg); }

/* Social share icon */
.icon-share-dot {
  transition: transform var(--transition-bounce);
}
.tool-card:hover .icon-share-dot:nth-child(1) { transform: translate(-4px, -4px); }
.tool-card:hover .icon-share-dot:nth-child(2) { transform: translate(4px, 0); }
.tool-card:hover .icon-share-dot:nth-child(3) { transform: translate(-4px, 4px); }

/* Sitemap branching */
.icon-sitemap-branch {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset var(--transition-slow);
}
.tool-card:hover .icon-sitemap-branch { stroke-dashoffset: 0; }

/* UTM/link builder */
.icon-utm-arrow {
  transition: transform var(--transition-base);
}
.tool-card:hover .icon-utm-arrow { transform: translateX(4px); }

/* Keyword sparkle */
.icon-keyword-sparkle {
  transform-origin: center;
  transition: transform var(--transition-base);
}
.tool-card:hover .icon-keyword-sparkle {
  animation: sparkleScale 1s ease-in-out infinite;
}

/* ── Button ripple effect ────────────────────────────────────── */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

/* ── Decorative floating sparkles ──────────────────────────── */
.sparkle-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  opacity: 0;
  animation: sparkleFloat 4s ease-in-out infinite;
}

.sparkle-star {
  position: absolute;
  opacity: 0.5;
  animation: sparkleScale 3s ease-in-out infinite;
}

/* ── Loading spinner ────────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* ── Reduced motion overrides ────────────────────────────────── */
@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;
  }

  .hero-blob,
  .sparkle,
  .sparkle-dot,
  .sparkle-star {
    display: none;
  }

  .stagger-children > * {
    opacity: 1;
    animation: none;
  }
}
