/* =====================================================
   IMAGES STYLES - Scommesse Serie A Guida
   CSS для SEO-оптимизированных изображений
   ===================================================== */

/* Базовые стили для всех изображений статьи */
.article-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--raggio-lg, 12px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.4s ease;
}

/* =====================================================
   HERO IMAGE - Главное изображение в хедере
   ===================================================== */
.hero-image-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: var(--spazio-lg, 2.5rem) auto 0;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.hero-image {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-image-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 50%,
    rgba(13, 61, 46, 0.3) 100%
  );
  pointer-events: none;
}

.hero-image-container:hover .hero-image {
  transform: scale(1.03);
}

/* =====================================================
   SECTION IMAGES - Изображения в секциях контента
   ===================================================== */
.section-image-wrapper {
  position: relative;
  width: 100%;
  margin: var(--spazio-lg, 2.5rem) 0;
  overflow: hidden;
  border-radius: var(--raggio-lg, 12px);
  box-shadow: 0 8px 40px var(--ombra, rgba(21, 88, 67, 0.08));
  background: var(--crema-scuro, #f0e8dc);
}

.section-image-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    var(--verde-italia, #155843),
    var(--oro, #c9a227),
    var(--rosso-italia, #8B1538)
  );
  z-index: 2;
  border-radius: 4px 0 0 4px;
}

.section-image {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  filter: saturate(0.95);
}

.section-image-wrapper:hover .section-image {
  transform: scale(1.02);
  filter: saturate(1.05);
}

.section-image-wrapper:hover {
  box-shadow: 0 12px 50px var(--ombra-forte, rgba(21, 88, 67, 0.15));
}

/* =====================================================
   FIGURE & FIGCAPTION - Подписи к изображениям
   ===================================================== */
.image-figure {
  margin: var(--spazio-lg, 2.5rem) 0;
  padding: 0;
}

.image-figure figcaption {
  padding: var(--spazio-sm, 1rem) var(--spazio-md, 1.5rem);
  background: linear-gradient(
    135deg,
    rgba(21, 88, 67, 0.04),
    rgba(21, 88, 67, 0.02)
  );
  border-bottom-left-radius: var(--raggio-lg, 12px);
  border-bottom-right-radius: var(--raggio-lg, 12px);
  font-size: 0.9rem;
  color: var(--testo-secondario, #5a5a5a);
  font-style: italic;
  text-align: center;
  border-top: 1px solid rgba(21, 88, 67, 0.08);
}

.image-figure .section-image-wrapper {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* =====================================================
   АНИМАЦИЯ ПОЯВЛЕНИЯ - Fade In при прокрутке
   ===================================================== */
.image-fade-in {
  opacity: 0;
  transform: translateY(30px);
  animation: imageFadeIn 0.8s ease-out forwards;
}

@keyframes imageFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Задержка анимации для последовательного появления */
.image-delay-1 { animation-delay: 0.1s; }
.image-delay-2 { animation-delay: 0.2s; }
.image-delay-3 { animation-delay: 0.3s; }

/* =====================================================
   SKELETON LOADER - Placeholder при загрузке
   ===================================================== */
.image-skeleton {
  background: linear-gradient(
    90deg,
    var(--crema-scuro, #f0e8dc) 25%,
    var(--crema, #faf6f0) 50%,
    var(--crema-scuro, #f0e8dc) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* =====================================================
   АДАПТИВНЫЕ СТИЛИ - Mobile First
   ===================================================== */

/* Планшеты */
@media (max-width: 1024px) {
  .hero-image-container {
    max-width: 100%;
    margin: var(--spazio-md, 1.5rem) auto 0;
    border-radius: 12px;
  }
  
  .hero-image {
    aspect-ratio: 16 / 8;
  }
  
  .section-image-wrapper {
    margin: var(--spazio-md, 1.5rem) 0;
  }
}

/* Мобильные устройства */
@media (max-width: 768px) {
  .hero-image-container {
    border-radius: 8px;
    margin-top: var(--spazio-md, 1.5rem);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  }
  
  .hero-image {
    aspect-ratio: 16 / 10;
  }
  
  .section-image-wrapper {
    border-radius: 8px;
    margin: var(--spazio-md, 1.5rem) 0;
  }
  
  .section-image-wrapper::before {
    width: 3px;
  }
  
  .section-image {
    aspect-ratio: 16 / 10;
  }
  
  .image-figure figcaption {
    padding: var(--spazio-xs, 0.5rem) var(--spazio-sm, 1rem);
    font-size: 0.85rem;
  }
  
  /* Отключаем hover эффекты на тач-устройствах */
  .section-image-wrapper:hover .section-image,
  .hero-image-container:hover .hero-image {
    transform: none;
  }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
  .hero-image {
    aspect-ratio: 4 / 3;
  }
  
  .section-image {
    aspect-ratio: 4 / 3;
  }
  
  .hero-image-container,
  .section-image-wrapper {
    border-radius: 6px;
  }
}

/* =====================================================
   DARK MODE - Тёмная тема
   ===================================================== */
@media (prefers-color-scheme: dark) {
  .hero-image-container {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  }
  
  .hero-image-container::after {
    background: linear-gradient(
      to bottom,
      transparent 0%,
      transparent 50%,
      rgba(0, 0, 0, 0.4) 100%
    );
  }
  
  .section-image-wrapper {
    background: var(--crema-scuro, #242424);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  }
  
  .section-image {
    filter: saturate(0.9) brightness(0.95);
  }
  
  .section-image-wrapper:hover .section-image {
    filter: saturate(1) brightness(1);
  }
  
  .image-figure figcaption {
    background: linear-gradient(
      135deg,
      rgba(42, 157, 118, 0.06),
      rgba(42, 157, 118, 0.02)
    );
    border-top-color: rgba(42, 157, 118, 0.1);
  }
  
  .image-skeleton {
    background: linear-gradient(
      90deg,
      #242424 25%,
      #2a2a2a 50%,
      #242424 75%
    );
    background-size: 200% 100%;
  }
}

/* =====================================================
   PRINT STYLES - Стили для печати
   ===================================================== */
@media print {
  .hero-image-container,
  .section-image-wrapper {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  
  .hero-image-container::after,
  .section-image-wrapper::before {
    display: none;
  }
  
  .section-image,
  .hero-image {
    filter: none;
  }
}

/* =====================================================
   REDUCED MOTION - Для пользователей с ограничениями
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .article-image,
  .section-image,
  .hero-image {
    transition: none;
  }
  
  .image-fade-in {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .image-skeleton {
    animation: none;
  }
  
  .section-image-wrapper:hover .section-image,
  .hero-image-container:hover .hero-image {
    transform: none;
  }
}

/* =====================================================
   HIGH CONTRAST MODE - Высокая контрастность
   ===================================================== */
@media (prefers-contrast: high) {
  .section-image-wrapper::before {
    width: 6px;
  }
  
  .section-image-wrapper,
  .hero-image-container {
    border: 2px solid var(--testo, #2c2c2c);
  }
  
  .image-figure figcaption {
    background: var(--bianco, #ffffff);
    border: 1px solid var(--testo, #2c2c2c);
  }
}
