/* ===========================
   VIDEO SECTION STYLES
   Стили для видео-секции главной страницы
   =========================== */

.video-section {
    position: relative;
    width: 100%;
    height: 800px;
    /* Базовая высота для экранов 1920px */
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-sizing: border-box;
    background-color: #1a1a1a;
}

/* ===== МЕДИА-КОНТЕЙНЕР ===== */

.video-media-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background-color: #1a1a1a;
}

/* ===== ФОНОВОЕ ИЗОБРАЖЕНИЕ/ВИДЕО ===== */

.video-background-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Фоновое видео iframe */
.video-background-iframe {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 0;
}

.video-background-iframe iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    /* 16:9 соотношение */
    min-height: 100%;
    min-width: 177.77vh;
    /* 16:9 соотношение */
    transform: translate(-50%, -50%);
    pointer-events: none;
    /* Отключаем взаимодействие с iframe */
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    outline: none !important;
}

/* Темный оверлей для лучшей читаемости текста */
.video-background-image::before,
.video-background-iframe::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3;
}

/* Убираем оверлей для изображений без текста */
.video-section.has-image:not(.has-text-content) .video-background-image::before {
    background: rgba(0, 0, 0, 0.1);
}

/* ===== ТЕКСТОВЫЙ ОВЕРЛЕЙ ===== */

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
}

.video-content {
    max-width: 800px;
    padding: 0 20px;
    position: relative;
    z-index: 3;
}

/* ===== ЗАГОЛОВКИ ===== */

.video-title {
    font-size: clamp(28px, 2.5vw, 48px);
    line-height: 1.2;
    margin: 0 0 20px 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: -1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.video-subtitle {
    font-size: clamp(14px, 2vw, 17px);
    font-weight: 400;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== КОНТЕЙНЕРЫ ===== */

/* Убираем ограничения контейнера для video секции */
.video-section .container {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Корректируем контейнер для текстового контента */
.video-overlay .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== СОСТОЯНИЯ СЕКЦИИ ===== */

/* Когда секция содержит только изображение */
.video-section.has-image:not(.has-text-content) .video-background-image {
    cursor: default;
}

/* Убираем ненужные стили для кнопок воспроизведения */
.video-section.has-video .video-background-image,
.video-section.has-video .video-background-iframe {
    cursor: default;
}

/* ===== АДАПТИВНОСТЬ ДЛЯ IFRAME ВИДЕО ===== */

/* Для мобильных устройств корректируем размеры iframe */
@media screen and (max-width: 768px) {
    .video-background-iframe iframe {
        width: 100vw;
        height: 56.25vw;
        min-height: 100%;
        min-width: 177.77vh;
    }
}

/* Для очень широких экранов */
@media screen and (min-aspect-ratio: 16/9) {
    .video-background-iframe iframe {
        width: 100vw;
        height: 56.25vw;
    }
}

/* Для очень высоких экранов */
@media screen and (max-aspect-ratio: 16/9) {
    .video-background-iframe iframe {
        width: 100vw;
        height: 56.25vw;
    }
}

/* ===== АНИМАЦИИ И ЭФФЕКТЫ ===== */

/* Плавная анимация при загрузке */
.video-section {
    animation: videoSectionFadeIn 0.8s ease-out;
}

@keyframes videoSectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ ===== */

/* Использование GPU для анимаций */
.video-background-iframe,
.video-overlay {
    will-change: transform, opacity;
}

/* Оптимизация для retina дисплеев */
@media screen and (-webkit-min-device-pixel-ratio: 2),
screen and (min-resolution: 192dpi) {
    .video-background-image {
        background-size: cover;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== ACCESSIBILITY ===== */

/* Для пользователей, которые предпочитают уменьшенную анимацию */
@media (prefers-reduced-motion: reduce) {
    .video-section {
        animation: none;
        transition: none;
    }
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ УТИЛИТЫ ===== */

/* Скрытие элементов для SEO */
.video-section img[style*="left: -9999px"] {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* ===== АДАПТИВНАЯ ВЫСОТА ===== */

/* Для экранов меньше 1920px пропорционально уменьшаем высоту */
@media screen and (max-width: 1920px) {
    .video-section {
        height: calc(100vw * 800 / 1920);
        /* Пропорциональная высота */
        min-height: 400px;
        /* Минимальная высота */
        max-height: 800px;
        /* Максимальная высота */
    }
}

/* Для очень маленьких экранов */
@media screen and (max-width: 768px) {
    .video-section {
        height: 60vh;
        min-height: 350px;
    }
}

@media screen and (max-width: 480px) {
    .video-section {
        height: 50vh;
        min-height: 300px;
    }
}