.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding-bottom: 40px;
    animation: fadeIn 0.5s ease-out;
    align-items: start;
}

.gallery-loading,
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-style: italic;
    color: var(--navy-blue);
    opacity: 0.6;
}

.gallery-item {
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 12px var(--shadow-blue);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease;
    animation: cardAppear 0.5s ease-out backwards;
    background: var(--warm-beige);
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 28px var(--shadow-blue);
}

.gallery-skeleton {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(90deg,
        var(--warm-beige) 25%,
        var(--sand) 50%,
        var(--warm-beige) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

.gallery-item img.loaded { opacity: 1; }
.gallery-item.img-error  { background: var(--sand); }

.gallery-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(90, 69, 21, 0.88));
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.4;
    padding: 28px 12px 12px;
    border-radius: 0 0 16px 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-caption { opacity: 1; }

@media (hover: none) {
    .gallery-caption { opacity: 1; }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 14, 4, 0.96);
    backdrop-filter: blur(12px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 1;
}

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

.lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 20px;
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
    padding-bottom: 4px; 
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(3px); }

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.lightbox-caption {
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-style: italic;
    text-align: center;
    max-width: 600px;
}

@media (max-width: 600px) {
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
}
