:root {
    --bg-color: #fafafa;
    --text-color: #ffffff;
    --muted-text: #71717a;
    --overlay-bg: rgba(0, 0, 0, 0.4);
    --lightbox-bg: rgba(0, 0, 0, 0.95);
    --item-radius: 12px;
    --gap: 1.5rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.masonry-container {
    columns: 1;
    column-gap: var(--gap);
}

@media (min-width: 640px) { .masonry-container { columns: 2; } }
@media (min-width: 1024px) { .masonry-container { columns: 2; } }
@media (min-width: 1280px) { .masonry-container { columns: 3; } }

.masonry-item {
    break-inside: avoid;
    margin-bottom: var(--gap);
    position: relative;
    cursor: pointer;
    border-radius: var(--item-radius);
    overflow: hidden;
    background-color: #e4e4e7;
    transition: var(--transition);
}

.masonry-item:hover {
    transform: translateY(-4px);
    filter: brightness(1.05);
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.masonry-item img.loaded {
    opacity: 1;
}

/* Overlay */
.item-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--overlay-bg);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.masonry-item:hover .item-overlay {
    opacity: 1;
}

.item-overlay span {
    color: white;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* Lightbox */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: var(--lightbox-bg);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-top-bar {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 1020;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.lightbox-img {
    max-height: 85vh;
    max-width: 90vw;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#lightbox.active .lightbox-img {
    transform: scale(1);
}

#lightbox-caption {
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 300;
}

/* Buttons */
.btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn:hover {
    color: white;
    transform: scale(1.1);
}

#prev-btn { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); z-index: 1010; }
#next-btn { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 1010; }

@media (max-width: 768px) {
    #prev-btn, #next-btn { display: none; }
}

body.modal-open {
    overflow: hidden;
}