/* =========================================================
   Сброс и глобальные настройки
   ========================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    background: #0a0a0a;
}

/* =========================================================
   Фон
   ========================================================= */
.gallery-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/background-img/glemping.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    filter: blur(8px);
}

/* Затемнение */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: -1;
}

/* =========================================================
   Шапка галереи
   ========================================================= */
.gallery-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #fff;
}

.gallery-header h1 {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.photo-count {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* =========================================================
   Контейнер галереи
   ========================================================= */
.gallery-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* =========================================================
   Masonry сетка (адаптивная)
   ========================================================= */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    grid-auto-flow: dense;
}

/* Элемент галереи */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* Ориентации */
.gallery-item.horizontal {
    grid-column: span 2;
    grid-row: span 1;
}

.gallery-item.vertical {
    grid-column: span 1;
    grid-row: span 2;
}

.gallery-item.square {
    grid-column: span 1;
    grid-row: span 1;
}

/* Изображение */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Подпись */
.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 40px 16px 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .image-caption {
    opacity: 1;
}

.image-caption span {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* Нет изображений */
.no-images {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.no-images p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
}

/* =========================================================
   Планшеты (768px - 1024px)
   ========================================================= */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 12px;
    }

    .gallery-item.horizontal {
        grid-column: span 2;
    }

    .gallery-item.vertical {
        grid-row: span 2;
    }
}

/* =========================================================
   Мобильные устройства (до 768px)
   ========================================================= */
@media (max-width: 768px) {
    .gallery-header {
        padding: 16px 20px;
    }

    .gallery-header h1 {
        font-size: 22px;
        position: static;
        transform: none;
    }

    .back-link,
    .photo-count {
        font-size: 14px;
    }

    .gallery-container {
        padding: 24px 12px;
    }

    /* Одна колонка на мобилке */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Все изображения занимают одну ячейку */
    .gallery-item.horizontal,
    .gallery-item.vertical,
    .gallery-item.square {
        grid-column: span 1;
        grid-row: span 1;
    }

    /* Высота адаптивная */
    .gallery-item.horizontal img {
        aspect-ratio: 16/9;
    }

    .gallery-item.vertical img {
        aspect-ratio: 3/4;
    }

    .gallery-item.square img {
        aspect-ratio: 1/1;
    }

    /* Подпись всегда видна на мобилке */
    .image-caption {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    }
}

/* =========================================================
   Малые мобильные (до 480px)
   ========================================================= */
@media (max-width: 480px) {
    .gallery-container {
        padding: 20px 8px;
    }

    .gallery-grid {
        gap: 8px;
    }

    .gallery-header h1 {
        font-size: 20px;
    }
}

/* =========================================================
   Smooth scroll
   ========================================================= */
html {
    scroll-behavior: smooth;
}

/* =========================================================
   Lightbox кастомизация (опционально)
   ========================================================= */
.lb-data .lb-caption {
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 500;
}

.lb-data .lb-number {
    font-family: 'Roboto', sans-serif;
}