/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
  opacity: 0;
}

/* Section animations */
.about-section h2,
.services-section h2,
.advantages-section h2,
.case-studies-section h2,
.testimonials-section h2,
.contact-section h2 {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

/* Пульсация кнопки */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(75, 20, 85, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(75, 20, 85, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(75, 20, 85, 0);
  }
}

.submit-button {
  animation: pulse 2s infinite;
}

/* Service card animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.service-card {
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: calc(var(--animation-order) * 0.2s);
}

.service-card:nth-child(1) {
  --animation-order: 1;
}

.service-card:nth-child(2) {
  --animation-order: 2;
}

.service-card:nth-child(3) {
  --animation-order: 3;
}

/* Анимация преимуществ */
@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.advantage-item {
  opacity: 0;
  animation: scaleIn 0.5s ease forwards;
  animation-delay: calc(var(--animation-order) * 0.2s);
}

.advantage-item:nth-child(1) {
  --animation-order: 1;
}

.advantage-item:nth-child(2) {
  --animation-order: 2;
}

.advantage-item:nth-child(3) {
  --animation-order: 3;
}

.advantage-item:nth-child(4) {
  --animation-order: 4;
}

/* Case study card animations */
.case-study-card {
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: calc(var(--animation-order) * 0.2s);
}

.case-study-card:nth-child(1) {
  --animation-order: 1;
}

.case-study-card:nth-child(2) {
  --animation-order: 2;
}

.case-study-card:nth-child(3) {
  --animation-order: 3;
}

/* Анимация слайдера отзывов */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50px);
  }
}

.testimonial-slide {
  opacity: 0;
}

.testimonial-slide.active {
  animation: slideIn 0.5s ease forwards;
}

.testimonial-slide.inactive {
  animation: slideOut 0.5s ease forwards;
}

/* CSS-only automatic testimonial slider */
@keyframes testimonialSlide {
  0%, 30% {
    opacity: 1;
    transform: translateX(0);
    z-index: 2;
  }
  33%, 97% {
    opacity: 0;
    transform: translateX(-50px);
    z-index: 1;
  }
  98%, 100% {
    opacity: 0;
    transform: translateX(50px);
    z-index: 1;
  }
}

.testimonials-slider:hover .testimonial-slide {
  animation-play-state: paused;
}

.testimonial-slide:nth-child(1) {
  animation: testimonialSlide 15s infinite;
}

.testimonial-slide:nth-child(2) {
  animation: testimonialSlide 15s infinite 5s;
}

.testimonial-slide:nth-child(3) {
  animation: testimonialSlide 15s infinite 10s;
}

/* Form animations */
@keyframes formLabelFloat {
  from {
    transform: translateY(0);
    font-size: 16px;
  }
  to {
    transform: translateY(-20px);
    font-size: 14px;
  }
}

.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label,
.floating-label select:focus + label,
.floating-label select:valid + label {
  animation: formLabelFloat 0.2s ease forwards;
  color: var(--primary-color);
}

/* Gradient border animation */
@keyframes gradientBorder {
  0% {
    border-image-source: linear-gradient(to right, var(--secondary-color), var(--tertiary-color));
  }
  50% {
    border-image-source: linear-gradient(to right, var(--tertiary-color), var(--secondary-color));
  }
  100% {
    border-image-source: linear-gradient(to right, var(--secondary-color), var(--tertiary-color));
  }
}

.floating-label input:focus,
.floating-label select:focus {
  border-width: 2px;
  border-image-slice: 1;
  border-image-source: linear-gradient(to right, var(--secondary-color), var(--tertiary-color));
  animation: gradientBorder 3s infinite;
}

/* CTA button hover effect */
.cta-button {
  position: relative;
  overflow: hidden;
}

.cta-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.cta-button:hover::after {
  left: 100%;
}

/* Logo animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.logo, .logo-small, .footer-logo {
  background: linear-gradient(90deg, var(--secondary-color), var(--tertiary-color), var(--secondary-color));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 3s ease infinite;
}
