/* ===== Gallery Page Styles ===== */

/* Ensure navbar always has a solid background on gallery page for readability */
.navbar-gallery {
    background: rgba(253, 248, 243, 0.97) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05) !important;
}

/* Gallery Header */
.gallery-header-section {
    padding: 160px 0 60px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.gallery-header-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.gallery-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--primary-dark);
    margin-bottom: 16px;
    line-height: 1.2;
}

.gallery-subtitle {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Gallery Content - Masonry Grid */
.gallery-container {
    padding: 20px 0 120px;
}

.gallery-masonry {
    column-count: 3;
    column-gap: 30px;
}

.gallery-card {
    break-inside: avoid;
    margin-bottom: 30px;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--bg-card);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border);
}

.gallery-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.gallery-card:hover img {
    transform: scale(1.03);
    filter: brightness(1.03);
}

/* Lightbox Modal */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(17, 29, 21, 0.96);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

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

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
    object-fit: contain;
}

.lightbox.active .lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 5px;
}

.lightbox-close:hover {
    color: var(--gold);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

.lightbox-nav:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev {
    left: -80px;
}

.lightbox-next {
    right: -80px;
}

.lightbox-caption {
    margin-top: 20px;
    color: white;
    text-align: center;
}

.lightbox-counter {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

/* Responsive Breakpoints for Masonry */
@media (max-width: 1024px) {
    .gallery-masonry {
        column-count: 2;
        column-gap: 24px;
    }
    .gallery-card {
        margin-bottom: 24px;
    }
    .lightbox-prev {
        left: 20px;
    }
    .lightbox-next {
        right: 20px;
    }
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 1rem;
        background: rgba(0, 0, 0, 0.5);
    }
    .lightbox-close {
        right: 10px;
        top: 20px;
        position: fixed;
        background: rgba(0, 0, 0, 0.5);
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .gallery-header-section {
        padding: 120px 0 40px;
    }
    .gallery-container {
        padding: 20px 0 80px;
    }
}

@media (max-width: 580px) {
    .gallery-masonry {
        column-count: 1;
    }
    .lightbox-nav {
        display: none; /* Hide navigation buttons on mobile touch, swipe is supported */
    }
}
