/* =======================================
   GALLERY PAGE CSS
   ======================================= */

/* -----------------------------------------------
   SECTION 1: PAGE HEADER
------------------------------------------------ */
.gallery-page-header {
    background: linear-gradient(180deg, #f4f9ff 0%, #ffffff 100%);
    padding-top: 260px;
    padding-bottom: 3.5rem;
    border-bottom: 1px solid rgba(15, 76, 129, 0.06);
    text-align: center;
}

.gallery-page-header .breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-surface-alt);
    border-radius: 999px;
}

.gallery-page-header .breadcrumb a {
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.gallery-page-header .breadcrumb a:hover {
    color: var(--color-primary-hover);
}

.gallery-page-header .breadcrumb .separator {
    color: var(--color-black);
    font-size: 0.7rem;
}

.gallery-page-header .breadcrumb .current {
    color: var(--color-black);
}

.gallery-page-header .page-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(135deg, #071e3d 0%, #0f4c81 50%, #1a83df 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.gallery-page-header .page-subtitle {
    font-size: 1.1rem;
    color: var(--color-black);
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.75;
}

@media (max-width: 768px) {
    .gallery-page-header .page-title {
        font-size: 1.875rem;
    }

    .gallery-page-header .page-subtitle {
        font-size: 1rem;
    }
}

/* -----------------------------------------------
   SECTION 2: FILTER PILLS
------------------------------------------------ */
.gallery-filter-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(15, 76, 129, 0.06);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 4px 24px rgba(15, 76, 129, 0.04);
}

.gallery-filter-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-filter-scroll::-webkit-scrollbar {
    display: none;
}

.gallery-filter-pills,
.gallery-subfilter-pills {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    white-space: nowrap;
    padding: 0.25rem 0;
}

.gallery-subfilter-pills {
    gap: 0.5rem;
}

.gallery-sub-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    color: var(--color-black);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

.gallery-sub-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.gallery-sub-pill.active {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.gallery-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.125rem;
    border-radius: 999px;
    border: 1.5px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

.gallery-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}

.gallery-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.25);
}

.gallery-pill .pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
    transition: background 0.25s ease;
}

.gallery-pill:not(.active) .pill-count {
    background: var(--color-surface-alt);
    color: var(--color-black);
}

/* -----------------------------------------------
   SECTION 3: MASONRY GALLERY
------------------------------------------------ */
.gallery-grid-section {
    padding: 4rem 0 6rem;
    background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
}

.gallery-count-bar {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-black);
    font-weight: 500;
}

/* Masonry using CSS columns */
.gallery-masonry {
    column-count: 4;
    column-gap: 1rem;
}

@media (min-width: 1400px) {
    .gallery-masonry {
        column-count: 5;
    }
}

@media (max-width: 1024px) {
    .gallery-masonry {
        column-count: 3;
    }
}

@media (max-width: 640px) {
    .gallery-masonry {
        column-count: 2;
        column-gap: 0.625rem;
    }
}

/* Gallery Item */
.gallery-item {
    break-inside: avoid;
    margin-bottom: 1.25rem;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    display: block;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(15, 76, 129, 0.04);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(15, 76, 129, 0.08);
}

@media (max-width: 640px) {
    .gallery-item {
        margin-bottom: 0.625rem;
        border-radius: 0.625rem;
    }
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.gallery-item:hover img {
    transform: scale(1.06);
}

/* Overlay */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(15, 76, 129, 0.9) 0%,
            rgba(15, 76, 129, 0.2) 50%,
            transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
}

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

.gallery-item-overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-item:hover .gallery-item-overlay-icon {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.gallery-item-event {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.25rem;
    transform: translateY(8px);
    transition: transform 0.35s ease;
}

/* ==========================================
   FANCYBOX UPSCALING
========================================== */
.f-image {
    min-width: 100vw;
    min-height: 100vh;
    object-fit: contain;
}

.gallery-item-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    transform: translateY(8px);
    transition: transform 0.35s ease 0.04s;
}

.gallery-item:hover .gallery-item-event,
.gallery-item:hover .gallery-item-title {
    transform: translateY(0);
}

/* PDF Actions */
.gallery-item-pdf-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.gallery-item:hover .gallery-item-pdf-actions {
    opacity: 1;
}

.gallery-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.25s ease;
}

.gallery-pdf-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    color: #fff;
}

/* Animate in */
.gallery-item {
    opacity: 0;
    transform: translateY(16px);
    animation: galleryItemIn 0.4s ease forwards;
}

@keyframes galleryItemIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty State */
.gallery-empty {
    display: none;
    text-align: center;
    padding: 5rem 2rem;
    background: #fff;
    border-radius: 1rem;
    border: 1px solid var(--color-border);
}

.gallery-empty i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    display: block;
}

.gallery-empty h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.gallery-empty p {
    color: var(--color-black);
}

/* -----------------------------------------------
   SECTION 4: CTA
------------------------------------------------ */
.gallery-cta-section {
    padding: 7rem 0;
    background: #ffffff;
    border-top: 1px solid rgba(15, 76, 129, 0.06);
}

.gallery-cta-wrapper {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 5rem 4rem;
    background: linear-gradient(145deg, #ffffff 0%, color-mix(in srgb, var(--color-primary) 4%, #ffffff) 100%);
    border: 1px solid rgba(15, 76, 129, 0.1);
    border-radius: 48px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(15, 76, 129, 0.08), inset 0 2px 0 #fff;
}

.gallery-cta-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b, var(--color-primary));
}

.gallery-cta-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(color-mix(in srgb, var(--color-primary) 15%, transparent) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    opacity: 0.6;
}

.gallery-cta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.5rem;
}

.gallery-cta-heading {
    font-size: clamp(2.25rem, 4vw, 2.75rem);
    font-weight: 900;
    color: var(--color-text);
    line-height: 1.15;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.gallery-cta-sub {
    font-size: 1.05rem;
    color: var(--color-black);
    line-height: 1.8;
    margin-bottom: 2.25rem;
}

.gallery-cta-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.gallery-cta-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.875rem;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(15, 76, 129, 0.2);
}

.gallery-cta-btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 76, 129, 0.3);
}

.gallery-cta-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.875rem;
    border-radius: 999px;
    background: #fff;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid var(--color-primary);
    transition: all 0.3s ease;
    text-decoration: none;
}

.gallery-cta-btn-outline:hover {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .gallery-cta-heading {
        font-size: 1.75rem;
    }

    .gallery-cta-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-cta-btn-primary,
    .gallery-cta-btn-outline {
        justify-content: center;
    }
}

/* -----------------------------------------------
   LIGHTBOX
------------------------------------------------ */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 16, 30, 0.94);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

/* Nav buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.lightbox-prev {
    left: 1.25rem;
}

.lightbox-next {
    right: 1.25rem;
}

@media (max-width: 640px) {
    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }
}

/* Content */
.lightbox-content {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: min(92vw, 1100px);
    max-height: 92vh;
    width: 100%;
}

.lightbox-img-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 78vh;
    max-height: 80vh;
    overflow: hidden;
    border-radius: 0.75rem;
}

.lightbox-image {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    /* width: 100%;
    height: 100%; */
    object-fit: contain;
    border-radius: 0.75rem;
    display: block;
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0.94);
}

.lightbox-image.loaded {
    opacity: 1;
    transform: scale(1);
}

.lightbox-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 2rem;
}

.lightbox-spinner.hidden {
    display: none;
}

/* Caption */
.lightbox-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
    text-align: center;
}

.lightbox-caption-event {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.55);
}

.lightbox-caption-title {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* Counter */
.lightbox-counter {
    margin-top: 0.625rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* Simple responsive padding for headers */
@media (max-width: 1024px) {
    .gallery-page-header {
        padding-top: 115px;
        padding-bottom: 2rem;
    }
}