/* Контейнер на всю высоту экрана */
#main-page-gym-gallery {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

/* Обёртка для трёх карточек в виде мозаики */
.gallery-grid {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
}

/* Большой блок слева, два малых справа (верх/низ) */
.gallery-card.large {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

.gallery-card.small.top {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.gallery-card.small.bottom {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

/* Одно фото на всю ширину и высоту */
.gallery-card.full-width {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

/* Два фото пополам */
.gallery-card.half-width {
    grid-column: auto;
    grid-row: 1 / 3;
}

.gallery-card.half-width:first-child {
    grid-column: 1 / 2;
}

.gallery-card.half-width:last-child {
    grid-column: 2 / 3;
}

.gallery-card {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(0,0,0,0.05);
}

.gallery-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.gallery-image {
    width: 100%;
    height: 100%;
    display: block;
}

/* Два слоя для прогрессивной загрузки */
.gallery-image.low {
    filter: blur(12px);
    transform: scale(1.03);
    transition: opacity 0.4s ease;
}

.gallery-image.high {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-image.high.loaded {
    opacity: 1;
}

.gallery-description {
    position: absolute;
    left: 12px;
    bottom: 12px;
    margin: 0;
    padding: 6px 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.3;
}

/* Навигационные стрелки */
.gallery-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(-50%);
    pointer-events: none;
}

.gallery-nav button {
    pointer-events: all;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.gallery-nav button:hover {
    background: rgba(0,0,0,0.7);
}

/* Индикаторы страниц (точки) */
.gallery-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
}

.gallery-dot.active {
    background: rgba(0,0,0,0.7);
}

/* Служебные элементы */
.gallery-loading,
.gallery-error {
    color: #333;
}

@media (max-width: 900px) {
    #main-page-gym-gallery {
        height: calc(100vh - 40px);
        padding: 20px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr 1fr;
    }
    
    /* Только для одного и двух фото используем flex */
    .gallery-grid.single-photo,
    .gallery-grid.two-photos {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .gallery-card.large {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    .gallery-card.small.top {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    .gallery-card.small.bottom {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .gallery-card.full-width {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    .gallery-card.half-width {
        grid-column: 1 / 2;
        grid-row: auto;
        height: 50vh;
    }
    .gallery-card.half-width:first-child {
        grid-row: 1 / 2;
    }
    .gallery-card.half-width:last-child {
        grid-row: 2 / 3;
    }
    
    /* Стили для одного фото на мобилках - центрирование */
    .gallery-card.full-width {
        position: relative;
        aspect-ratio: 1;
        margin: auto;
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        width: 300px;
        height: 300px;
        max-width: 80%;
        max-height: 80%;
    }
    
    /* Специальные стили для одного фото - полное центрирование */
    .gallery-grid.single-photo {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .gallery-grid.single-photo .gallery-card.full-width {
        width: 250px;
        height: 250px;
        max-width: 70%;
        max-height: 70%;
    }
    
    .gallery-grid.single-photo .gallery-card.full-width .gallery-image {
        width: 100%;
        height: 100%;
    }
    
    /* Стили для двух фото на мобилках - делят экран по высоте */
    .gallery-grid.two-photos {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 40px);
        padding: 30px 0;
        box-sizing: border-box;
    }
    
    .gallery-grid.two-photos .gallery-card.half-width {
        height: calc(50vh - 20px);
        width: 100%;
        margin-bottom: 10px;
    }


}


