/* css/gallery.css */

/* Main Gallery Container */
.gallery-container {
    max-width: 1200px;
    margin: 50px auto;
    padding: 0 20px;
    text-align: center;
}

.gallery-container h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    color: #121212;
    margin-bottom: 15px;
    font-weight: 600;
}

.gallery-container p {
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* Elegant CSS Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.photo-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: box-shadow 0.4s ease;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.photo-item:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.photo-item:hover img {
    transform: scale(1.04);
}

.caption-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;
    padding: 30px 15px 15px 15px;
    opacity: 0;
    transition: opacity 0.4s ease;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.photo-item:hover .caption-overlay {
    opacity: 1;
}

/* Pagination Controls */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 60px;
}

.page-btn {
    padding: 10px 18px;
    border: 1px solid #D4AF37;
    color: #121212;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: 0.3s;
}

.page-btn:hover, .page-btn.active {
    background: #D4AF37;
    color: #fff;
}

/* Sophisticated Soft Lightbox */
#lightbox {
    position: fixed;
    z-index: 9999;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lb-content {
    max-width: 85%;
    text-align: center;
}

#lightbox img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#lightbox img.loaded {
    opacity: 1;
    transform: scale(1);
}

#lightbox-caption {
    color: #D4AF37;
    margin-top: 20px;
    font-size: 1.3rem;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    letter-spacing: 1px;
}

/* Lightbox Navigation */
.lb-controls {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
}

.lb-nav {
    color: rgba(255,255,255,0.5);
    font-size: 50px;
    cursor: pointer;
    transition: color 0.3s, transform 0.2s;
    padding: 20px;
    user-select: none;
}

.lb-nav:hover {
    color: #D4AF37;
    transform: scale(1.1);
}

/* Desktop: Pin chevrons to sides */
@media screen and (min-width: 769px) {
    .lb-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    /* THE FIX: Re-combining the vertical centering with the scale on hover */
    .lb-nav:hover {
        transform: translateY(-50%) scale(1.1);
    }

    #lb-prev { left: 40px; }
    #lb-next { right: 40px; }
    .lb-controls { margin-top: 0; }
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: rgba(255,255,255,0.5);
    font-size: 45px;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
    z-index: 10000;
}

.close-lightbox:hover { color: #D4AF37; }

/* --- MOBILE GALLERY FIX --- */
@media screen and (max-width: 768px) {
    .gallery-container {
        margin: 30px auto;
        padding: 0 15px; 
    }

    /* Thumbnail Grid: 2 columns */
    .photo-grid {
        grid-template-columns: 1fr 1fr !important; 
        gap: 10px;
        margin-bottom: 30px;
    }

    .lb-content {
        max-width: 95%;
    }

    /* Navigation Inline beneath image */
    .lb-controls {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 40px;
        margin-top: 10px;
    }

    .lb-nav {
        padding: 10px;
        font-size: 40px;
    }

    #lightbox-caption {
        font-size: 1.1rem;
        margin-top: 10px;
    }
}