/**
 * Стили для горизонтальной галереи (карусель с динамическим количеством видимых элементов)
 * Поддержка лайтбокса
 * 
 * @package Twenty_Twenty_Five_Child
 */

/* ============================================
   ОСНОВНЫЕ СТИЛИ ГАЛЕРЕИ
   ============================================ */

/* Обертка галереи */
.horizontal-gallery-wrapper {
    position: relative;
    margin: 30px 0;
    padding: 0 50px;
}

/* Контейнер с каруселью */
.gallery-container {
    overflow: hidden;
    position: relative;
}

/* Трек с миниатюрами */
.gallery-track {
    display: flex;
    gap: 20px;
    transition: transform 0.3s ease-out;
    will-change: transform;
    justify-content: flex-start;
}

/* Элемент галереи */
.gallery-item {
    flex-shrink: 0;
    cursor: pointer;
}

/* Квадратная миниатюра */
.gallery-thumb {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ============================================
   НАВИГАЦИОННЫЕ КНОПКИ
   ============================================ */

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
    color: white;
}

.gallery-nav:hover {
    background: rgba(0,0,0,0.9);
}

.gallery-nav-prev {
    left: 0;
}

.gallery-nav-next {
    right: 0;
}

/* Скрытые кнопки - полностью убираем с экрана */
.gallery-nav.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Отключенные кнопки - полупрозрачные и неактивные */
.gallery-nav.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ============================================
   ДОТЫ (НАВИГАЦИОННЫЕ ТОЧКИ)
   ============================================ */

.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 10px 0;
}

.gallery-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.gallery-dot:hover {
    background: #999;
    transform: scale(1.2);
}

.gallery-dot.active {
    background: #0073aa;
    transform: scale(1.2);
}

/* ============================================
   ЛАЙТБОКС
   ============================================ */

/* Затемнение */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Контейнер для изображения */
.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
}

/* Изображение в лайтбоксе */
.lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Кнопка закрытия */
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000000;
    color: white;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
}

/* Кнопки навигации лайтбокса */
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000000;
    color: white;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-prev {
    left: 20px;
}

.lightbox-nav-next {
    right: 20px;
}

/* Отключенные кнопки в лайтбоксе */
.lightbox-nav.disabled {
    opacity: 0.3 !important;
    cursor: default !important;
    pointer-events: none !important;
}

.lightbox-nav.disabled:hover {
    transform: translateY(-50%) !important;
    background: rgba(0, 0, 0, 0.6) !important;
}

/* Доты в лайтбоксе */
.lightbox-dots {
    display: none;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 10px 0;
    position: relative;
    z-index: 1000000;
}

.lightbox-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.lightbox-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.2);
}

.lightbox-dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* Подпись в лайтбоксе */
.lightbox-caption {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    z-index: 1000000;
}

/* ============================================
   МОБИЛЬНЫЕ УСТРОЙСТВА
   ============================================ */

@media (max-width: 768px) {
    /* Основная галерея */
    .horizontal-gallery-wrapper {
        padding: 0 40px;
    }
    
    .gallery-nav {
        width: 32px;
        height: 32px;
    }
    
    .gallery-track {
        gap: 15px;
    }
    
    .gallery-dots {
        gap: 8px;
    }
    
    .gallery-dot {
        width: 8px;
        height: 8px;
    }
    
    /* Лайтбокс - на мобильных скрываем кнопки, показываем доты */
    .lightbox-nav {
        display: none !important;
    }
    
    .lightbox-dots {
        display: flex !important;
    }
    
    .lightbox-container {
        max-width: 95vw;
        max-height: 80vh;
    }
    
    .lightbox-image {
        max-width: 95vw;
        max-height: 80vh;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .lightbox-dots {
        gap: 10px;
        margin-top: 15px;
    }
    
    .lightbox-dot {
        width: 8px;
        height: 8px;
    }
    
    .lightbox-caption {
        bottom: 15px;
        left: 15px;
        right: 15px;
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    /* Основная галерея */
    .horizontal-gallery-wrapper {
        padding: 0 30px;
    }
    
    .gallery-nav {
        width: 28px;
        height: 28px;
    }
    
    .gallery-track {
        gap: 10px;
    }
    
    /* Лайтбокс */
    .lightbox-dots {
        gap: 8px;
    }
    
    .lightbox-dot {
        width: 8px;
        height: 8px;
    }
    
    .lightbox-caption {
        font-size: 11px;
    }
}

/* ============================================
   ОПТИМИЗАЦИЯ ДЛЯ TOUCH-УСТРОЙСТВ
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Увеличиваем область касания для кнопок на мобильных */
    .gallery-nav {
        width: 44px;
        height: 44px;
    }
    
    /* Увеличиваем область касания для дотов */
    .gallery-dot {
        width: 12px;
        height: 12px;
        margin: 4px;
    }
    
    .lightbox-dot {
        width: 12px;
        height: 12px;
        margin: 0 2px;
    }
    
    /* Отключаем эффекты наведения на мобильных */
    .gallery-nav:hover {
        transform: translateY(-50%);
        background: rgba(0,0,0,0.7);
    }
    
    .gallery-dot:hover {
        transform: scale(1);
    }
    
    .lightbox-dot:hover {
        transform: scale(1);
    }
}

/* ============================================
   ВСПОМОГАТЕЛЬНЫЕ СТИЛИ
   ============================================ */

/* Запрещаем выделение текста при свайпе */
.gallery-container {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Отключение выделения текста при клике на кнопки */
.gallery-nav,
.gallery-dot,
.lightbox-close,
.lightbox-nav,
.lightbox-dot {
    user-select: none;
    -webkit-user-select: none;
}

/* Блокировка скролла страницы при открытом лайтбоксе */
body.lightbox-open {
    overflow: hidden;
}