/* ====================
   Gallery Styles
   ==================== */

/* Responsive grid with aspect-ratio preservation */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin: 2em 0;
}

.gallery-item {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    background: #f5f5f5;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 200px;
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    /* Use 'contain' instead of 'cover' if you want full image visible with padding:
       object-fit: contain; */
}

/* Lightbox overlay */
.gallery-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.gallery-overlay.active {
    display: flex;
}

.gallery-overlay .slideshow-container {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-overlay .slideshow-container img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.gallery-overlay .caption {
    color: #fff;
    text-align: center;
    padding: 12px 20px;
    font-size: 1em;
    max-width: 80vw;
}

.gallery-overlay .close-btn {
    position: fixed;
    top: 20px;
    right: 25px;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10001;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.gallery-overlay .close-btn:hover {
    background: rgba(255,255,255,0.15);
}

.gallery-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    z-index: 10000;
    padding: 10px 15px;
    transition: color 0.3s;
    user-select: none;
    opacity: 0.7;
}

.gallery-nav:hover {
    opacity: 1;
    color: #ccc;
}

.gallery-nav.prev {
    left: 15px;
}

.gallery-nav.next {
    right: 15px;
}

/* Responsive */
@media (max-width: 736px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
    }
    
    .gallery-item img {
        height: 150px;
        max-width: 150px;
        max-height: 150px;
    }
}