﻿.gallery-page-header {
    background: linear-gradient(160deg, var(--teal-50) 0%, #e0f7ff 40%, var(--teal-50) 100%);
    padding: 200px 0 3.5rem;
    text-align: center;
}

.gallery-header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-page-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    color: var(--dark);
    margin: 0.75rem 0 1.25rem;
}

    .gallery-page-title .accent {
        color: var(--teal-600);
    }

.gallery-filter-section {
    padding: 2.5rem 0 0;
    background: white;
}

.gallery-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.55rem 1.25rem;
    border-radius: 50px;
    transition: var(--transition);
    cursor: pointer;
}

    .filter-chip:hover {
        border-color: var(--teal-400);
        color: var(--teal-700);
    }

    .filter-chip.active {
        background: linear-gradient(135deg, var(--teal-600), var(--cyan-600));
        border-color: transparent;
        color: white;
        box-shadow: var(--shadow-colored);
    }

.gallery-grid-section {
    padding: 3rem 0 5rem;
    background: white;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.gallery-masonry {
    columns: 3 280px;
    column-gap: 1.5rem;
}

    .gallery-masonry .gallery-item {
        break-inside: avoid;
        margin-bottom: 1.5rem;
        opacity: 1;
    }

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
}

.gallery-img {
    background-position: center !important;
    background-size: cover !important;
    height: 252px;
    position: relative;
    transition: transform 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.04);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-caption {
    padding: 0.6rem 0.75rem;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    background: white;
}

.gallery-empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

    .gallery-empty-state svg {
        color: var(--text-light);
        margin-bottom: 1rem;
    }

    .gallery-empty-state p {
        font-family: var(--font-heading);
        font-size: 0.95rem;
    }

.gallery-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

    .page-nav-btn:hover {
        background: var(--teal-600);
        color: white;
        border-color: transparent;
    }

.page-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

    .page-num:hover {
        border-color: var(--teal-400);
        color: var(--teal-700);
    }

    .page-num.active {
        background: linear-gradient(135deg, var(--teal-600), var(--cyan-600));
        color: white;
        border-color: transparent;
        box-shadow: var(--shadow-colored);
    }

/* Gallery Modal */
.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

    .gallery-modal.active {
        opacity: 1;
        pointer-events: all;
    }

.gallery-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.gallery-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.gallery-modal-media {
    position: relative;
    width: 100%;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
}

    .gallery-modal-media img,
    .gallery-modal-media video {
        max-width: 100%;
        max-height: 75vh;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 12px;
        display: none;
    }

        .gallery-modal-media img.visible,
        .gallery-modal-media video.visible {
            display: block;
        }

.gallery-modal-caption {
    color: #fff;
    font-size: 1.1rem;
    padding: 16px 24px;
    text-align: center;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    min-height: 24px;
    width: fit-content;
}

.gallery-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

    .gallery-modal-close:hover {
        background: rgba(255, 255, 255, 0.3);
    }

.gallery-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 10;
}

    .gallery-modal-nav:hover {
        background: rgba(255, 255, 255, 0.3);
    }

.gallery-modal-prev {
    left: 16px;
}

.gallery-modal-next {
    right: 16px;
}

.gallery-modal-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

.gallery-modal-loader.hidden {
    display: none;
}

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery-page-header {
        padding: 160px 0 2.5rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-masonry {
        columns: 2 160px;
    }
}

@media (max-width: 640px) {
    .gallery-modal-content {
        padding: 12px;
    }

    .gallery-modal-media {
        max-height: 60vh;
    }

        .gallery-modal-media img,
        .gallery-modal-media video {
            max-height: 60vh;
        }

    .gallery-modal-nav {
        width: 36px;
        height: 36px;
    }

    .gallery-modal-prev {
        left: 4px;
    }

    .gallery-modal-next {
        right: 4px;
    }

    .gallery-modal-close {
        width: 36px;
        height: 36px;
        top: 6px;
        right: 6px;
    }

    .gallery-modal-caption {
        font-size: 0.95rem;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .gallery-masonry {
        columns: 2 160px;
    }
}
