/* Контейнер галереи */
.gallery-container {
    max-width: 1100px;
    margin: auto;
    background: rgba(255, 255, 255, 0.85);
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Сетка */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* Карточка */
.gallery-grid .item {
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    background: #fff;
    cursor: pointer;
    justify-content: center;
    display: grid;
    place-items: center;
}

/* Картинка — ГЛАВНОЕ ИСПРАВЛЕНИЕ */
.gallery-grid img {
    max-width: 100%;
    height: auto; /* сохраняем оригинальные пропорции */
    display: block;
    transition: transform .25s ease;
}

/* Hover‑zoom */
.gallery-grid .item:hover img {
    transform: scale(1.08);
}

/* LIGHTBOX — окно поверх страницы */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Картинка в лайтбоксе */
.lightbox img {
    max-width: 95%;
    max-height: 95%;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255,255,255,0.3);
}

/* Кнопка закрытия */
.lightbox:target {
    display: flex;
}


/* Скрываем шапку и футер */ 
body.hide-header .site-header { display: none;
}
body.hide-footer .site-footer { display: none;
}


/* Чтобы контейнер мог позиционировать кнопку */
.gallery-container {
    position: relative;
}

/* Кнопка "Наверх" справа от галереи */
.scroll-top-btn {
    position: absolute;
    top: 20px;
    right: -80px; /* ← смещение за пределы галереи */
    padding: 10px 16px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 2000;
}

.scroll-top-btn.show {
    opacity: 1;
    pointer-events: auto;
}