/* animations.css — CSS-анимации для сайта AI Agents (ARB-53) */
/* Все анимации на чистом CSS, 60fps, с respect prefers-reduced-motion */

/* ── Переменные (дублируют root из index.html) ── */
:root {
  --bg: #0b0f14;
  --fg: #e8e6df;
  --accent: #6ee7b7;
  --accent2: #7dd3fc;
  --muted: #6b7a8a;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════
   1. Анимированный градиентный фон
   ═══════════════════════════════════════════ */

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Класс для применения к секциям с градиентным фоном:
   .gradient-section {
     background: linear-gradient(135deg, #0b0f14, #0d1a1a, #0b0f14, #0d1420);
     background-size: 400% 400%;
     animation: gradientShift 15s ease infinite;
   }
*/

/* ═══════════════════════════════════════════
   2. Парящие элементы (floating)
   ═══════════════════════════════════════════ */

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

/* Применить к иллюстрациям:
   .floating {
     animation: float 6s ease-in-out infinite;
   }
*/

@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

/* .floating-slow — для больших SVG-иллюстраций */

/* ═══════════════════════════════════════════
   3. Scroll-triggered анимации
   ═══════════════════════════════════════════ */

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

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

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

/* Классы для элементов секций:
   .fade-in {
     opacity: 0;
     animation: fadeIn 0.8s ease forwards;
   }
   .slide-up {
     opacity: 0;
     animation: slideUp 0.8s ease forwards;
   }
   .scale-in {
     opacity: 0;
     animation: scaleIn 0.6s ease forwards;
   }
*/

/* Задержки для каскадного появления карточек */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }

/* ═══════════════════════════════════════════
   4. Hover-эффекты
   ═══════════════════════════════════════════ */

/* Усиление hover на карточках (дополнение к существующему) */
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(110, 231, 183, 0.1);
  transform: translateY(-2px);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

/* Hover на SVG-иллюстрациях */
.svg-container:hover svg {
  filter: drop-shadow(0 0 8px rgba(110, 231, 183, 0.2));
  transition: filter 0.3s ease;
}

/* Кнопка CTA — пульсация */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(110, 231, 183, 0);
  }
}

/* Применить к CTA-кнопке:
   .cta-pulse {
     animation: pulseGlow 2s ease-in-out infinite;
   }
*/

/* ═══════════════════════════════════════════
   5. Плавная прокрутка
   ═══════════════════════════════════════════ */

html {
  scroll-behavior: smooth;
}

/* Fallback для браузеров без поддержки scroll-behavior */
/* (JS-фолбэк подключается отдельно, если нужен) */

/* ═══════════════════════════════════════════
   6. Пульсирующий эффект для CTA
   ═══════════════════════════════════════════ */

/* Дублирует pulseGlow с бОльшим радиусом для CTA */
@keyframes ctaPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.3);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(110, 231, 183, 0);
  }
}

/* ═══════════════════════════════════════════
   7. Анимация для SVG-элементов
   ═══════════════════════════════════════════ */

/* Пульсация узлов в hero-иллюстрации */
@keyframes nodePulse {
  0%, 100% {
    r: 5;
    opacity: 0.8;
  }
  50% {
    r: 7;
    opacity: 1;
  }
}

/* Мигание связей */
@keyframes linkPulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.7;
  }
}

/* Анимация прогресса на timeline */
@keyframes timelineProgress {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ═══════════════════════════════════════════
   8. prefers-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;
  }

  /* Отключаем градиентную анимацию */
  .gradient-section {
    background-size: 100% 100%;
    animation: none;
  }

  /* Отключаем парящие элементы */
  .floating,
  .floating-slow {
    animation: none;
    transform: none;
  }

  /* Отключаем пульсацию CTA */
  .cta-pulse,
  .cta-pulse::before {
    animation: none;
  }
}

/* ═══════════════════════════════════════════
   9. Утилитарные классы для SVG
   ═══════════════════════════════════════════ */

/* Контейнер для SVG-иллюстраций */
.svg-container {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  display: block;
}

.svg-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Парящая иллюстрация */
.svg-container.floating {
  animation: float 6s ease-in-out infinite;
}

.svg-container.floating-slow {
  animation: floatSlow 8s ease-in-out infinite;
}

/* Стили для секций с иллюстрациями */
.section-illustration {
  text-align: center;
  margin-bottom: 2rem;
}