/* Simple Masonry Gallery — Public styles
 * Uses CSS multi-column layout for true masonry without JS reflow.
 */

.smg-gallery {
    --smg-gap: 12px;
    --smg-cols: 3;
    column-count: var(--smg-cols);
    column-gap: var(--smg-gap);
    margin: 24px 0;
}

.smg-gallery .smg-item {
    display: block;
    width: 100%;
    margin: 0 0 var(--smg-gap);
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: #f4f4f4;
}

.smg-gallery .smg-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.smg-gallery .smg-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.smg-gallery .smg-item:hover .smg-image {
    transform: scale(1.04);
}

.smg-gallery .smg-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 16px;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0) 100%);
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.smg-gallery .smg-item:hover .smg-caption,
.smg-gallery .smg-item:focus-visible .smg-caption {
    opacity: 1;
    transform: translateY(0);
}

.smg-gallery .smg-item:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Responsive — gracefully reduce columns on smaller screens */
@media (max-width: 1024px) {
    .smg-gallery {
        column-count: min(var(--smg-cols), 3);
    }
}
@media (max-width: 768px) {
    .smg-gallery {
        column-count: 2;
    }
}
@media (max-width: 480px) {
    .smg-gallery {
        column-count: 1;
    }
}

/* Lightbox */
body.smg-lb-open {
    overflow: hidden;
}

.smg-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 12, 0.94);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: smg-fade-in 0.25s ease;
}

@keyframes smg-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.smg-lightbox .smg-lb-content {
    max-width: 92vw;
    max-height: 92vh;
    text-align: center;
    position: relative;
}

.smg-lightbox .smg-lb-img {
    max-width: 92vw;
    max-height: 84vh;
    display: block;
    margin: 0 auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    background: #222;
}

.smg-lightbox .smg-lb-caption {
    color: #f5f5f5;
    padding: 14px 8px 0;
    font-size: 14px;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    line-height: 1.45;
}

.smg-lightbox button {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.smg-lightbox button:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.smg-lightbox .smg-lb-close {
    top: 22px;
    right: 22px;
    font-size: 32px;
}
.smg-lightbox .smg-lb-prev {
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
}
.smg-lightbox .smg-lb-prev:hover {
    transform: translateY(-50%) scale(1.05);
}
.smg-lightbox .smg-lb-next {
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
}
.smg-lightbox .smg-lb-next:hover {
    transform: translateY(-50%) scale(1.05);
}

@media (max-width: 600px) {
    .smg-lightbox .smg-lb-close { top: 12px; right: 12px; }
    .smg-lightbox .smg-lb-prev  { left: 8px; }
    .smg-lightbox .smg-lb-next  { right: 8px; }
    .smg-lightbox button { width: 42px; height: 42px; font-size: 22px; }
}

.smg-empty-public {
    color: #777;
    padding: 18px;
    text-align: center;
}
