/* Gallery Grid */
.gallery-grid {
    display: grid;
    gap: 20px;
    padding: 20px 0;
    /* Default for Mobile: 1 column */
    grid-template-columns: 1fr;
}

/* Tablet: 2 Columns */
@media (min-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: Max 3 Columns */
@media (min-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Updated for ADA: Resetting <figure> default margins */
.gallery-item {
    position: relative;
    overflow: hidden;
    /* This keeps all boxes the exact same size regardless of photo shape */
    aspect-ratio: 1 / 1; 
    background: #f8f8f8;
    margin: 0; /* CRITICAL: Prevents <figure> from breaking the grid */
    padding: 0;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform 0.5s ease, filter 0.5s ease;
}

.gallery-item:hover .gallery-thumb {
    transform: scale(1.05);
    filter: brightness(0.9);
}

/* Lightbox Modal */
.be-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: zoom-out;
}

.modal-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.be-modal img {
    max-width: 95%;
    max-height: 85vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 2px solid #333;
}

/* Updated for ADA: Styling the H3 caption to match the original design */
.modal-caption {
    color: #fff !important;
    margin-top: 20px;
    font-family: 'Bodoni Moda', serif;
    font-size: 2.2rem;
    font-weight: 400; /* Resetting <h3> bold to keep it elegant */
    letter-spacing: 1px;
    text-align: center;
}
