/* Shared photo grid (partials/_gallery.php) and gallery album polish. shadcn/ui neutral. */

.mbff-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.mbff-gallery-item {
    position: relative;
    display: block;
    aspect-ratio: var(--mbff-gallery-ratio, 1 / 1);
    overflow: hidden;
    border-radius: calc(var(--radius, 0.5rem) - 2px);
    background: hsl(var(--muted, 240 4.8% 95.9%));
    border: 1px solid hsl(var(--border, 240 5.9% 90%));
    cursor: zoom-in;
}

.mbff-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

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

.mbff-gallery-item:focus-visible {
    outline: 2px solid hsl(var(--ring, 240 5.9% 10%));
    outline-offset: 2px;
}

.mbff-gallery-item.is-broken {
    cursor: default;
}

.mbff-gallery-item.is-broken::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 28px;
    height: 28px;
    opacity: 0.35;
    background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3C/svg%3E");
}

.mbff-gallery-item.has-more {
    cursor: pointer;
}

.mbff-gallery-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9, 9, 11, 0.55);
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.mbff-gallery-hidden {
    display: none !important;
}

.mbff-gallery-empty {
    border: 1px dashed hsl(var(--border, 240 5.9% 90%));
    border-radius: calc(var(--radius, 0.5rem) - 2px);
}

@media (prefers-reduced-motion: reduce) {
    .mbff-gallery-item img {
        transition: none;
    }

    .mbff-gallery-item:hover img {
        transform: none;
    }
}

/* ── Gallery album page (classic/gallery/album.php) ── */
.page-gallery .masonry-grid-item {
    border-radius: calc(var(--radius, 0.5rem) - 2px);
    overflow: hidden;
}

.page-gallery .masonry-grid-item:focus-visible,
.page-gallery .gallery-item:focus-visible {
    outline: 2px solid hsl(var(--ring, 240 5.9% 10%));
    outline-offset: 2px;
}

.page-gallery .gallery-item {
    border-radius: calc(var(--radius, 0.5rem) + 4px);
    overflow: hidden;
}

/* ── Post coverflow: active slide opens the lightbox ── */
.post-extra-images .swiper-slide-active .pex-card,
.post-extra-images.is-single .pex-card {
    cursor: zoom-in;
}
