/* ---------- SVG OPTIMIZATION STYLES ---------- */

.svg-inline-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.svg-inline-container svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* КРИТИЧЕСКИ ВАЖНО: стили для анимации как в оригинале */
#detail-svg-container {
  position: relative;
  min-height: 400px;
  opacity: 1;
  transition: opacity 0.3s ease-in-out; /* Плавный переход для fade */
}

#detail-svg-container.fade-out {
  opacity: 0;
}

#detail-svg-container.fade-in {
  opacity: 1;
}

/* Анимация загрузки SVG */
.svg-loaded {
  animation: svgFadeIn 0.3s ease-out;
}

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

/* Скелетон загрузки */
#detail-svg-container:empty::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Предотвращение layout shift */
.project-card {
  will-change: transform;
}

.project-card:hover {
  transform: translateY(-5px);
  transition: transform 0.2s ease-out;
}

/* Оптимизация рендеринга для мобильных */
@media (max-width: 768px) {
  .svg-inline-container {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
  }
  
  /* Упрощаем анимации на слабых устройствах */
  @media (prefers-reduced-motion: reduce) {
    .svg-loaded,
    #detail-svg-container.fade-out,
    #detail-svg-container.fade-in {
      animation: none !important;
      transition: none !important;
    }
  }
}

/* Оптимизация для сервисов */
#service-image {
  transition: opacity 0.3s ease-in-out;
  will-change: opacity; /* Подсказка браузеру для оптимизации */
}

#service-text {
  transition: opacity 0.3s ease-in-out;
}

.fade-out {
  opacity: 0 !important;
}

.fade-in {
  opacity: 1 !important;
}

/* Предотвращение layout shift */
.service-item {
  will-change: transform;
}

.service-item:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease-out;
}