/* ── Masonry gallery ─────────────────────────────────────── */
.collection-masonry {
    padding: 2rem clamp(1rem, 5vw, 4rem);
    max-width: 1600px;
    margin: 0 auto;
}

.masonry-grid {
    columns: 3 280px;          /* auto-fill: 3 cols on desktop, fewer on smaller screens */
    column-gap: 12px;
}

.masonry-item {
    break-inside: avoid;       /* prevents images from being split across columns */
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: 4px;
}

.masonry-item-link {
    display: block;
    position: relative;
    overflow: hidden;
    line-height: 0;            /* removes gap below inline img */
}

.masonry-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 4px;
}

.masonry-item-link:hover .masonry-img,
.masonry-item-link:focus-visible .masonry-img {
    transform: scale(1.04);
}

.masonry-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.35s ease;
    color: #fff;
    border-radius: 4px;
}

.masonry-item-link:hover .masonry-overlay,
.masonry-item-link:focus-visible .masonry-overlay {
    opacity: 1;
}

.masonry-overlay svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}

/* ── Mobile: 2 cols below 600px, 1 col below 400px ────── */
@media (max-width: 600px) {
    .masonry-grid {
        columns: 2 160px;
        column-gap: 8px;
    }
    .masonry-item {
        margin-bottom: 8px;
    }
}

@media (max-width: 380px) {
    .masonry-grid {
        columns: 1;
    }
}

/* ── Lightbox ──────────────────────────────────────────── */
.masonry-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.masonry-lightbox[hidden] { display: none; }

.lightbox-inner {
    position: relative;
    max-width: min(90vw, 1200px);
    width: 100%;
    text-align: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.lightbox-caption {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    letter-spacing: 0.03em;
}

.lightbox-counter-lb {
    display: block;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    letter-spacing: 0.08em;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: fixed;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    line-height: 1;
}

.lightbox-prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ── Mobile lightbox adjustments ──────────────────────── */
@media (max-width: 600px) {
    .lightbox-prev  { left: 0.5rem; width: 38px; height: 38px; font-size: 1rem; }
    .lightbox-next  { right: 0.5rem; width: 38px; height: 38px; font-size: 1rem; }
    .lightbox-close { top: 0.5rem; right: 0.5rem; }
    .lightbox-img   { max-height: 75vh; }
}
