/* Made with the help of AI */

/* Gallery grid — CSS columns for natural masonry flow */
.gallery-grid {
    columns: 3 240px;
    column-gap: var(--space-md);
    padding: var(--space-lg) var(--space-md);
}

/* Each figure breaks naturally across columns */
.gallery-item {
    break-inside: avoid;
    margin-bottom: var(--space-md);
    overflow: hidden;
    border-radius: 4px;
    background: var(--color-border);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0;
    cursor: zoom-in;
}

/* Fade in once loaded */
.gallery-item img.loaded {
    opacity: 1;
}

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

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lightbox.is-open {
    opacity: 1;
    pointer-events: all;
}

.lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: lb-in 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

@keyframes lb-in {
    from { opacity: 0; transform: scale(0.82); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox.is-closing .lightbox__img {
    animation: lb-out 0.2s ease forwards;
}

@keyframes lb-out {
    to { opacity: 0; transform: scale(0.88); }
}

.lightbox__close {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 0.4rem 0.6rem;
}

.lightbox__close:hover { opacity: 1; }

.lightbox__prev,
.lightbox__next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 3.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
    padding: 1rem 1.25rem;
    user-select: none;
}

.lightbox__prev:hover,
.lightbox__next:hover { opacity: 1; }

.lightbox__prev { left: 0; }
.lightbox__next { right: 0; }

/* States */
.gallery-loading,
.gallery-empty {
    padding: var(--space-xl) var(--space-md);
    text-align: center;
    color: var(--color-muted);
    font-size: var(--size-sm);
    column-span: all;
}
