/* ---------- Galeria (app/ui/gallery.php → ms_gallery) i podgląd zdjęć (assets/js/home.js) ---------- */
.ms-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.ms-gallery__item img {
    width: 100%;
    aspect-ratio: 6 / 5;
    object-fit: cover;
    border-radius: var(--ms-radius);
    transition: opacity 0.15s;
}

.ms-gallery__item:hover img {
    opacity: 0.85;
}

/* Podgląd: okno <dialog> tworzone przez skrypt przy pierwszym kliknięciu w [data-ms-lightbox] */
.ms-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.ms-lightbox::backdrop {
    background: rgba(0, 10, 20, 0.88);
}

.ms-lightbox__stage {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    align-items: center;
    height: 100%;
    padding: 56px 16px 24px;
}

.ms-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    height: 100%;
    margin: 0;
    min-height: 0;
    justify-content: center;
}

.ms-lightbox__img {
    max-width: 100%;
    max-height: calc(100% - 32px);
    object-fit: contain;
    border-radius: var(--ms-radius);
}

.ms-lightbox__count {
    color: rgba(255, 255, 255, 0.8);
    font: 400 14px var(--ms-font);
}

.ms-lightbox__btn {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.ms-lightbox__btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

.ms-lightbox__btn svg {
    width: 26px;
    height: 26px;
}

.ms-lightbox__btn[hidden] {
    display: none;
}

.ms-lightbox__close {
    position: absolute;
    top: 12px;
    right: 16px;
}

@media (max-width: 600px) {
    .ms-lightbox__stage {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        padding: 56px 4px 16px;
    }
    .ms-lightbox__btn {
        width: 40px;
        height: 40px;
    }
}
