/* Gallery Grid Layout */
.gallery-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    justify-content: center;
}

.gallery-section h3 {
    grid-column: 1 / -1;
    margin-bottom: var(--spacing-md);
}

/* Gallery Item Container */
.gallery-item {
    display: flex;
    position: relative;
    cursor: pointer;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1 / 1;
    width: 100%;
    min-width: 0;
    margin: 0;
}

/* Apply hover effects */
.gallery-item:hover img {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    filter: brightness(1.05);
    transform: translateY(-2px);
}

.gallery-item img {
    border-radius: var(--radius-sm);
}

/* Hidden Checkbox */
.gallery-checkbox {
    display: none;
}

/* Label acts as the clickable trigger and container */
.gallery-label {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
}

.gallery-label img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    /* Fixed square size */
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

/* 
   Lightbox State (Checked) 
   When checkbox is checked, the LABEL becomes the fixed overlay 
*/
.gallery-checkbox:checked+.gallery-label {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    /* High z-index to cover everything */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    padding: var(--spacing-md);
    box-sizing: border-box;
    animation: fadeIn 0.3s ease-out;
}

.gallery-checkbox:checked+.gallery-label img {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 0;

    /* Reset hover effects so the expanded image isn't transformed/filtered */
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
    /* using the lightbox shadow instead */
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}