/*
 * GALLERY.CSS
 * All styles for the photos page grid and lightbox.
 */

/* --- PHOTOS PAGE GRID --- */
#filter-buttons-container {
    padding: 3rem 0 2rem 0;
}

#filter-buttons {
    text-align: center;
}

.filter-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    cursor: pointer;
    border-radius: 20px;
    color: var(--font-color);
    transition: all 0.2s;
}

.filter-btn.active, .filter-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.photo-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 250px;
}

/* Masonry item sizing */
.gallery-item.tall { grid-row: span 2 / auto; }
.gallery-item.wide { grid-column: span 2 / auto; }
.gallery-item.big { grid-column: span 2 / auto; grid-row: span 2 / auto; }

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); color: #fff;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}

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

.gallery-item .overlay h3 {
    position: absolute;
    bottom: 2rem;
    transition: all 0.3s ease;
}

.gallery-item:hover .overlay h3 {
    transform: translateY(-20px);
}

.gallery-item .overlay .view-icon {
    font-size: 3rem;
    font-weight: 100;
    line-height: 1;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s ease;
}

.gallery-item:hover .overlay .view-icon {
    transform: scale(1);
    opacity: 1;
}

/* --- ENHANCED LIGHTBOX --- */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000; /* Higher than header */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s;
    align-items: stretch;
    padding: 0 4rem;
}

.lightbox.active { display: flex; }

@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }

.lightbox-content-wrapper {
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 80vw;
    max-height: 90vh;
}

.lightbox-content {
    border-radius: 8px;
    max-height: 80vh;
    object-fit: contain;
    animation: zoom 0.3s ease;
}

@keyframes zoom { from {transform: scale(0.8);} to {transform: scale(1);} }

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.lightbox-caption {
    color: #fff;
    text-align: center;
    padding-top: 1rem;
    animation: fadeInUp 0.5s;
}

.lightbox-caption h3 { margin: 0; font-size: 1.2rem; }
.lightbox-caption p { margin-top: 0.5rem; font-size: 0.9rem; opacity: 0.8; }

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.lightbox-arrow:hover { color: #fff; }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* --- MOBILE GALLERY ENHANCEMENTS --- */
@media (max-width: 768px) {
    /*
      On mobile, we change the grid to show square items.
      This makes the layout predictable and reduces cropping.
    */
    .photo-grid {
        grid-auto-rows: 300px; /* Taller rows for better viewing */
    }

    /* Override the masonry spans for a consistent grid on mobile */
    .gallery-item.tall,
    .gallery-item.wide,
    .gallery-item.big {
        grid-column: span 1 / auto;
        grid-row: span 1 / auto;
    }

    /*
      Make lightbox arrows always visible, larger, and
      positioned at the bottom for easy thumb access on mobile.
    */
    .lightbox {
        padding: 0 1rem; /* Reduce side padding */
    }

    .lightbox-arrow {
        top: auto; /* Remove vertical centering */
        bottom: 1.5rem; /* Position at the bottom */
        transform: none; /* Remove vertical transform */
        font-size: 2.5rem;
        color: #fff; /* Make them always white */
        background-color: rgba(0, 0, 0, 0.3);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }

    .lightbox-caption {
        padding-bottom: 6rem; /* Add space so caption isn't behind arrows */
    }
}