/* Gallery page styles */

/* Gallery Header - extends page-banner-header */
.gallery-header {
    /* Base styles from components/banners.css */
}

/* heading styles are centralized in style.css */

.gallery-header .lead {
    font-size: 1.5rem;
    font-weight: 300;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Banner overlay moved to components/banners.css */

.gallery-header .container {
    position: relative;
    z-index: 2;
}

/* Banner divider moved to components/banners.css */

/* Enable native sticky just under the navbar */
.gallery-filters {
    position: sticky; 
    top: var(--nav-offset, 72px); 
    z-index: 1020; 
    /* Ensure background matches page fill (white) to avoid blue strip */
    background-color: #ffffff !important;
    margin-top: 0 !important;
}

/* Smooth sticky behavior for gallery filters */
.gallery-filters {
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.gallery-filters.is-fixed {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateZ(0);
    background: rgba(255,255,255,0.98);
    backdrop-filter: saturate(120%) blur(6px);
    margin-top: 0 !important; /* prevent gap under navbar when sticky */
}

/* Adjust vertical padding for filters */
.gallery-filters {
    padding-top: 0;  /* remove gap under navbar on mobile */
    padding-bottom: 0.5rem;
}

/* When sticky, use tighter padding only while fixed */
.gallery-filters.is-fixed {
    padding-top: 0.45rem;
    padding-bottom: 0.3rem;
}

/* When sticky, remove vertical padding (overrides py-4) */
.gallery-filters.is-fixed {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
}

/* JS fallback class when sticky is not supported or overridden */
.gallery-filters.is-fixed {
    position: fixed !important;
    left: 0;
    right: 0;
    width: 100%;
    top: var(--nav-offset, 72px) !important;
    z-index: 1030 !important; /* stay above gallery cards/images */
    margin-top: 0 !important;
}

.filter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    max-width: 800px;
    margin: 0 auto;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.filter-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.4);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--secondary-color);
}

/* Spacing handled via Bootstrap py-5; background moved to class in template */

.gallery-item {
    margin-bottom: 1.5rem;
    opacity: 1;
    transform: scale(1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

.gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    display: none;
}

/* Hidden items that will be shown on "Load More" click */
.gallery-item-hidden {
    display: none;
}

/* Loading indicator for images */
.gallery-card {
    position: relative;
    overflow: hidden;
    border-radius: 25px !important;
    cursor: pointer;
    height: 320px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
}

.gallery-card.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
    opacity: 0.7;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gallery-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

.gallery-card img,
.gallery-card .img-fluid {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: all 0.4s ease;
    opacity: 1;
    filter: brightness(1);
    border-radius: 25px !important;
}

.gallery-card img.loading {
    opacity: 0.7;
    filter: brightness(0.95);
}

.gallery-card img.error {
    opacity: 0.8;
    filter: grayscale(0.3);
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.95), rgba(139, 69, 19, 0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    padding: 0;
    height: 100%;
    border-radius: 25px !important;
}

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

.gallery-content {
    text-align: center;
    color: white;
    padding: 2rem;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover .gallery-content {
    transform: scale(1.05);
}

.gallery-content h5 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    text-align: center;
    width: 100%;
    margin-top: 0;
    line-height: 1.3;
}

.gallery-content p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    text-align: center;
    width: 100%;
    margin-top: 0;
    line-height: 1.4;
}

.gallery-content i {
    font-size: 2.2rem;
    opacity: 0.9;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: block;
}

.gallery-card:hover .gallery-content i {
    transform: scale(1.3);
}

#loadMoreBtn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.2rem !important;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
}

#loadMoreBtn:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 165, 116, 0.4);
}

#loadMoreBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Gallery Modal - Lightbox */
#galleryModal .modal-content {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
}

#galleryModal .modal-header {
    background: rgba(0, 0, 0, 0.8);
    border: none;
    padding: 1.5rem 2rem;
    backdrop-filter: blur(10px);
    border-radius: 15px 15px 0 0;
}

#galleryModal .modal-title {
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    transition: all 0.3s ease;
}

.btn-close-white:hover {
    transform: scale(1.1);
}

.gallery-modal-content {
    position: relative;
    background: black;
    border-radius: 0 0 15px 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.gallery-modal-content img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    transition: opacity 0.3s ease;
    border-radius: 0;
}

.modal-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 1.5rem;
    pointer-events: none;
    z-index: 10;
}

.nav-btn {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.nav-btn:active {
    transform: scale(0.95);
}

.modal-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: white;
    padding: 1.3rem;
    text-align: center;
    backdrop-filter: blur(8px);
}

.modal-info h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.modal-info p {
    margin: 0;
    opacity: 0.95;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Loading animation for modal images */
.modal-image-loading {
    opacity: 0.5;
    filter: blur(2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-header {
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .gallery-filters { padding-top: 0; padding-bottom: 0.5rem; margin-top: 0 !important; }
    
    .filter-buttons {
        gap: 0.75rem;
        padding: 0.5rem 0.75rem;
        justify-content: center;
        overflow-x: auto;
        max-width: 100%;
        flex-wrap: wrap;
        margin-top: 0.75rem;
    }
    
    .filter-btn {
        padding: 0.55rem 1.1rem;
        font-size: 1.2rem !important;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 50px;
        font-weight: 500;
        letter-spacing: 0.3px;
    }
    
    .gallery-card {
        height: 280px;
        border-radius: 20px !important;
    }
    
    .gallery-content h5 {
        font-size: 1.3rem;
    }
    
    .gallery-content p {
        font-size: 0.9rem;
    }
    
    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .modal-info {
        padding: 2rem;
    }
    
    .modal-info h4 {
        font-size: 1.4rem;
    }
}

@media (max-width: 576px) {
    .gallery-header {
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .gallery-filters { padding-top: 0; padding-bottom: 0.45rem; margin-top: 0 !important; }
    
    .filter-buttons {
        justify-content: center;
        overflow-x: auto;
        padding: 0.5rem 0.6rem;
        gap: 0.6rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
    }
    
    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.45rem 0.8rem;
        font-size: 1.2rem !important;
        border-radius: 50px;
        font-weight: 500;
        letter-spacing: 0.2px;
    }
    
    .gallery-card {
        height: 240px;
        border-radius: 18px !important;
    }
    
    .gallery-content h5 {
        font-size: 1.1rem;
    }
    
    .gallery-content i {
        font-size: 1.8rem;
    }
    
    .modal-navigation {
        padding: 0 0.5rem;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .modal-info {
        padding: 1.5rem;
    }
    
    .modal-info h4 {
        font-size: 1.2rem;
    }
    
    .modal-info p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gallery-filters { padding-top: 0; padding-bottom: 0.4rem; margin-top: 0 !important; }
    
    .filter-buttons {
        justify-content: center;
        overflow-x: auto;
        padding: 0.4rem 0.5rem;
        gap: 0.5rem;
        flex-wrap: wrap;
        margin-top: 0.4rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.7rem;
        font-size: 1.2rem !important;
        border-radius: 50px;
        font-weight: 500;
        letter-spacing: 0.15px;
    }
}