/* --- Gallery Header Text --- */
.text-center {
    text-align: center;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
    max-width: 800px;
}

.gallery-header {
    margin-bottom: 3rem;
    border-left: 3px solid var(--accent);
    padding-left: 1.5rem;
}

.gallery-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.gallery-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    line-height: 1.6;
}

/* --- High-Capacity Photo Grid --- */
.photo-grid {
    display: grid;
    /* This automatically creates as many columns as will fit, minimum 300px wide */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 300px; /* Forces a uniform height for a clean look */
    gap: 1.5rem;
}

.photo-item {
    margin: 0;
    overflow: hidden;
    border-radius: 8px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
}

/* Images fill the uniform boxes perfectly without distorting */
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Crops the image perfectly to fill the square */
    object-position: center;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.photo-item:hover img {
    transform: scale(1.05); /* Subtle zoom on hover */
    opacity: 0.8;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        grid-auto-rows: 250px;
    }
}





/* --- Lightbox / Fullscreen Viewer --- */
.lightbox {
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(9, 9, 11, 0.95); /* Deep dark overlay */
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out; /* Tells the user clicking will close it */
    opacity: 0;
    pointer-events: none; /* Prevents clicks when hidden */
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain; /* Ensures the whole image is visible */
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: var(--text-secondary);
    font-size: 3rem;
    font-weight: 300;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: var(--text-primary);
}

/* Optional: change cursor on the grid images to hint they are clickable */
.photo-item {
    cursor: zoom-in;
}
