/* Modern Photo Gallery Styles */

/* Grid Container */
.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Desktop: 4 columns */
    gap: 20px;
    margin-bottom: 40px;
}

/* Photo Card */
.photo-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    margin: 0;
    /* Reset figure margin */
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Image Styling */
.photo-card a {
    display: block;
    aspect-ratio: 4 / 3;
    /* Enforce consistent aspect ratio */
    overflow: hidden;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.photo-card:hover img {
    transform: scale(1.05);
}

/* Caption Styling */
.photo-caption {
    padding: 12px 15px;
    background: #f9f9f9;
    font-size: 0.9em;
    color: #333;
    font-weight: 500;
    text-align: center;
    border-top: 1px solid #eee;
    flex-grow: 1;
    /* Ensure equal height text alignment */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Section Heading */
.gallery-section-title {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
    margin-top: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
    /* Official Blue Accent */
    display: inline-block;
}

/* Responsive Breakpoints */

/* Tablet: 2 Columns */
@media (max-width: 992px) {
    .photo-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Mobile: 1 Column */
@media (max-width: 576px) {
    .photo-gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-section-title {
        font-size: 1.25rem;
    }
}

/* Lightbox Styles */
#lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox-main {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

figure {
    margin: 0;
    text-align: center;
    position: relative;
    max-width: 100%;
}

/* Container for Image + Arrows - Fixed Dimensions on Desktop */
.lightbox-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 75vw;
    /* Fixed width as requested */
    height: 80vh;
    /* Fixed height to match aspect ratio handling */
    background: #000;
    /* Background for letterboxing */
    margin: 0 auto;
}

#lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Prevent distortion inside fixed box */
    border: none;
    /* Removed white border */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: block;
}

#lightbox-caption {
    color: #fff;
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 4px;
    width: 100%;
}

/* Close Button - Just Above Image Container */
.lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2002;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    border-radius: 50%;
}

.lightbox-close:hover {
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.1);
}

/* Navigation - Centered on Image Container */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    opacity: 1;
    /* Always visible */
}

/* Removed hover dependency for opacity */

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* Mobile Lightbox Adjustments */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 100%;
        height: 100%;
        justify-content: center;
        background: transparent;
    }

    .lightbox-image-container {
        width: 100%;
        display: flex;
        justify-content: center;
        background: #000;
        /* Black BG helps if image doesn't fill */
    }

    #lightbox-img {
        max-height: 60vh;
        width: auto;
        max-width: 100%;
        border: none;
        box-shadow: none;
    }

    /* Keep Nav Visible on Mobile */
    .lightbox-nav {
        opacity: 1;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .lightbox-nav.prev {
        left: 10px;
    }

    .lightbox-nav.next {
        right: 10px;
    }

    .lightbox-close {
        position: absolute;
        top: 20px;
        right: 20px;
        position: fixed;
    }

    #lightbox-caption {
        font-size: 0.9rem;
        margin-top: 15px;
        padding: 0 20px;
        text-align: center;
        width: 100%;
        background: transparent;
    }
}