/* --- ГЛАВНОЕ ФОТО ПОД H1 --- */
.main-featured-image {
    width: 100%;
    margin: 15px 0 25px 0;
    text-align: left;
}

.main-featured-image img {
    max-width: 100%;
    height: auto;
    max-height: 550px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    background: #fff;
    padding: 4px;
    border: 1px solid #eee;
}

/* --- СЕТКА ГАЛЕРЕИ ВНИЗУ --- */

.gallery-section-wrapper {
    background: #f9f9f9 !important; /* Фон серый */
    display: flex !important;
    flex-direction: column !important;
    padding: 20px !important; 
    border-radius: 10px !important; /* СКРУГЛИЛИ КРАЯ (не острые) */
    border: 1px solid #eee !important; /* Тонкая рамка для границ */
    margin-top: 40px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
    clear: both !important;
}
/* МАГИЯ: Скрываем весь блок целиком, если внутри нет ни одной картинки <img> */
.gallery-section-wrapper:not(:has(img)) {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.gallery-main-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    font-size: 26px;
    margin-bottom: 25px;
    color: #333;
    border: none !important;
}

.content-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.content-gallery-item {
    background: #fff;
    padding: 4px;
    border: 1px solid #ddd;
    line-height: 0;
    transition: 0.3s;
}

.content-gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.clickable-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

/* --- LIGHTBOX (ОКНО ПРОСМОТРА) --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    /* Делаем белый фон полупрозрачным (0.8) */
    background-color: rgba(255, 255, 255, 0.8) !important;
    /* МАГИЯ РАЗМЫТИЯ: размываем то, что ПОД лайтбоксом */
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%); /* Для Safari */
    
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- ПОДПИСЬ В ЛАЙТБОКСЕ (Безопасная правка для ПК) --- */
.lightbox-caption {
    color: #333 !important; /* Делаем текст черным */
    font-family: 'Oswald', sans-serif !important;
    font-weight: 300 !important;
    font-size: 18px !important;
    margin-top: 15px !important;
    text-align: center !important;
    text-shadow: none !important; /* Убираем тени, чтобы на белом было чисто */
    width: 100% !important;
    display: block !important;
}

.lightbox-content {
    max-width: 90%;
    max-height: 75%;
    border: 4px solid #fff;
    /* box-shadow: 0 0 40px rgba(0,0,0,0.6);*/
}

.close-lightbox {
    position: absolute;
    top: 20px; right: 30px;
    color: var(--main-color) !important; /* АКЦЕНТНЫЙ ЦВЕТ ИЗ АДМИНКИ */
	font-size: 50px;
    cursor: pointer;
}

/* --- АККУРАТНЫЕ КНОПКИ ЛАЙТБОКСА (ПК) --- */
.prev-btn, .next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%); /* Центрируем строго по середине */
    background: var(--main-color) !important; 
    color: white !important; 
    
    /* Делаем их круглыми */
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    
    /* Центрируем иконку внутри круга */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 4px 0 0 !important; /* Микро-сдвиг для оптического центра */
    
    border: none; 
    cursor: pointer;
    font-size: 24px !important; 
    transition: all 0.3s ease;
    z-index: 10010;
}

/* Сдвиг вправо для иконки "вперед" */
.next-btn { right: 20px !important; padding: 0 0 0 4px !important; }
.prev-btn { left: 20px !important; }

.prev-btn:hover, .next-btn:hover { 
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.1); /* Легкое увеличение при наведении */
}

.lightbox-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    overflow-x: auto;
    padding: 5px;
}

/* --- ОБНОВЛЕННЫЕ СТИЛИ МИНИАТЮР --- */
.thumb-mini {
    width: 60px; height: 60px;
    object-fit: cover;
    cursor: pointer;
    /* Базовая серенькая рамка для неактивных */
    border: 2px solid #979797; 
    opacity: 0.6;
    transition: 0.2s;
}

/* При наведении — рамка становится чуть светлее */
.thumb-mini:hover {
    border-color: #aaa;
    opacity: 0.9;
}

/* Активная (выбранная) миниатюра — белая рамка */
.thumb-mini.active {
    border-color: #fff;
    opacity: 1;
}

/* --- СТИЛИ ДЛЯ МОБИЛЬНОЙ ГАЛЕРЕИ В СТИЛЕ WB --- */
@media (max-width: 1000px) {
	
	/* СИЛОВОЙ ПОКАЗ СЕТКИ В 2 КОЛОНКИ */
    .content-gallery {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* Ровно две колонки */
        gap: 10px !important;
        visibility: visible !important;
    }

    /* Настройка элементов сетки */
    .content-gallery-item {
        display: block !important;
        line-height: normal !important;
    }

    .content-gallery-item img {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important; /* Делаем картинки ровными квадратами */
        object-fit: cover !important;
    }
	
    .mobile-gallery-container {
        max-height: 55vh; 
        overflow: hidden;
        background: #f9f9f9;
        position: relative; /* Чтобы кнопка и счетчик не улетали */
    }
    
    .mobile-scroll-wrapper {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 5px !important; 
        padding: 0 5px !important;
        box-sizing: border-box !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-scroll-wrapper::-webkit-scrollbar { display: none; }

    .mobile-scroll-item {
        flex: 0 0 100% !important; 
        width: 100% !important;
        scroll-snap-align: center !important; /* Просто добавь это для идеальной точности */
    }

    .mobile-scroll-item img {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important; /* Пропорция WB */
        object-fit: cover !important; 
        height: auto !important;
        display: block;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Кнопка назад */
    .wb-back-btn {
        position: absolute;
        top: 15px;
        left: 15px;
        z-index: 10;
        background: rgba(255, 255, 255, 0.8);
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
	
	.wb-share-btn {
    position: absolute;
    top: 15px;
    right: 15px; /* Справа */
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}
.wb-share-btn img { 
    width: 20px !important; 
    height: 20px !important; 
    object-fit: contain !important;
}
	.wb-back-btn img { 
    width: 20px !important;    /* Устанавливаем четкую ширину иконки */
    height: 20px !important;   /* Устанавливаем четкую высоту */
    object-fit: contain !important; /* Чтобы иконка не деформировалась */
    display: block;
    margin: 0;
    padding: 0;
    border: none !important;   /* Убираем рамки, если они наследуются */
    box-shadow: none !important; /* Убираем тени, если они наследуются */
}

    /* Счетчик 1/X */
    .wb-count-badge {
        position: absolute;
        bottom: 15px;
        left: 15px;
        z-index: 10;
        background: rgba(255, 255, 255, 0.8);
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 14px;
        color: #333;
        font-weight: bold;
    }
	/* --- ПОЛНОЭКРАННОЕ ОКНО (WB-STYLE) ФИНАЛ --- */
#wbZoomViewer {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important; 
    height: 100vh !important;
    background: #ffffff !important;
    z-index: 2000000 !important;
    overflow: hidden !important;
    touch-action: none; /* Запрещаем системный скролл фона */
}

/* Кнопка закрыть (крестик) — Изолирована от зума */
.close-wb-zoom {
    position: fixed !important;
    top: 20px !important; 
    right: 20px !important;
    font-size: 35px !important;
    color: #333 !important;
    z-index: 2000005 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    /* Аппаратная фиксация размера */
    transform: translateZ(0) scale(1) !important;
    will-change: transform;
}

/* Счетчик внизу (черный овал) — Изолирован от зума */
.wb-zoom-badge {
    position: fixed !important;
    bottom: 30px !important; 
    left: 50% !important;
    transform: translateX(-50%) translateZ(0) scale(1) !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: #ffffff !important;
    padding: 8px 20px !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    z-index: 2000005 !important;
    pointer-events: none !important;
    font-family: Arial, sans-serif !important;
    will-change: transform;
}

/* Лента для свайпа */
.zoom-scroll-wrapper {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    width: 100% !important;
    height: 100% !important;
    background: #ffffff !important;
    scrollbar-width: none !important;
    /* ПОПРАВКА: pan-x разрешает свайп, а pinch-zoom разрешает системный зум */
    touch-action: pan-x pinch-zoom !important; 
    -webkit-overflow-scrolling: touch !important;
	
	gap: 5px !important; /* Белая полоса между фото (20px) */
    padding: 0 10px !important; /* Небольшой зазор по краям, чтобы полоса была видна */
    box-sizing: border-box !important;
}
.zoom-scroll-wrapper::-webkit-scrollbar { display: none !important; }

/* Контейнер картинки */
.zoom-scroll-item {
    flex: 0 0 100% !important;
    width: 100% !important;
    height: 100% !important;
    scroll-snap-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: auto !important; /* Важно для скролла при увеличении */
}

/* Сама картинка */
.wb-target-img {
    max-width: 100% !important;
    max-height: 85vh !important;
    object-fit: contain !important;
    /* ПОПРАВКА: разрешаем браузеру обрабатывать свайп (pan-x) самостоятельно, 
       пока JS не скажет обратное */
    touch-action: pan-x pinch-zoom !important;
    will-change: transform;
}

/* --------- Исправленная прокрутка для мобил ----------- */

/* Силовое разрешение листания для мобильного зума */
    .zoom-scroll-wrapper {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        touch-action: pan-x !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* 1. Скрываем стрелки (они мешают пальцам) */
    .prev-btn, .next-btn {
        display: none !important;
    }

    /* 2. Делаем подпись под фото компактнее, чтобы не мешала */
    .lightbox-caption {
        font-size: 16px !important;
        margin-top: 10px !important;
        padding: 0 15px !important;
    }

    /* 3. Оживляем ленту миниатюр (она будет главным инструментом свайпа) */
    .lightbox-thumbnails {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 12px !important; /* Увеличили зазор, чтобы удобнее попадать пальцем */
        padding: 10px 20px !important;
        width: 100% !important;
        /* Разрешаем нативный свайп только здесь */
        touch-action: pan-x !important; 
    }

    /* 4. Увеличиваем размер миниатюр для мобилок (чтобы было легче листать) */
    .thumb-mini {
        width: 80px !important;
        height: 80px !important;
        flex-shrink: 0 !important;
        border-radius: 6px !important;
    }	

}