/* Gallery page: grid + lightbox */
.gallery-page .page-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.gallery-page .page-header h1 {
    margin: 0 0 12px;
    font-size: clamp(2.2rem, 4vw, 4rem);
    line-height: 0.98;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: #0956c2;

}
.gallery-page .page-header p {
    font-size: 1.1rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

.gallery-page .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0;
    list-style: none;
    margin: 0;
}
.gallery-page .gallery-grid .gallery-item {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}
.gallery-page .gallery-grid .gallery-item:hover {
    /* transform: translateY(-4px); */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.gallery-page .gallery-grid .gallery-item a {
    display: block;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.gallery-page .gallery-grid .gallery-thumb {
    position: relative;
    padding-bottom: 75%;
    /* background: linear-gradient(110deg, #f1f5f9 8%, #e2e8f0 18%, #f8fafc 33%);
    background-size: 220% 100%; */
    overflow: hidden;
    animation: galleryThumbShimmer 1.6s linear infinite;
    contain: paint;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.gallery-page .gallery-grid .gallery-thumb img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: opacity;
}
.gallery-page .gallery-grid .gallery-thumb img.is-loaded {
    opacity: 1;
    will-change: auto;
}
.gallery-page .gallery-grid .gallery-thumb.is-ready {
    animation: none;
    background: #f3f4f6;
}
.gallery-page .gallery-grid .gallery-item:hover .gallery-thumb img {
    /* transform: scale(1.05); */
}
.gallery-page .gallery-grid .gallery-caption {
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    line-height: 1.3;
}
.gallery-page .gallery-grid .gallery-item.is-hidden {
    display: none;
}
.gallery-page .gallery-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}
.gallery-page .gallery-load-more-btn {
    /* min-width: 180px; */
    padding: 10px 24px;
}

@keyframes galleryThumbShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}
.gallery-lightbox .lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}
.gallery-lightbox .lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}
.gallery-lightbox .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #0956c2;
    cursor: pointer;
    z-index: 5;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 1.2rem;
}
.gallery-lightbox .lightbox-nav:hover {
    background: #EA92F2
}
.gallery-lightbox .lightbox-nav:disabled {
    opacity: 0.45;
    cursor: default;
}
.gallery-lightbox .lightbox-prev {
    left: calc(50% - min(1120px, 92vw) / 2 - 60px);
}
.gallery-lightbox .lightbox-next {
    right: calc(50% - min(1120px, 92vw) / 2 - 60px);
}
.gallery-lightbox .lightbox-content {
    width: min(1120px, 92vw);
    max-height: 90vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: auto;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
    position: relative;
    margin: auto;
}
.gallery-lightbox .lightbox-media {
    flex: 1 1 68%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #eef3f8;
}
.gallery-lightbox .lightbox-content img {
    max-width: 100%;
    max-height: calc(90vh - 3rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}
.gallery-lightbox .lightbox-details {
    flex: 0 0 320px;
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    overflow-y: auto;
}
.gallery-lightbox .lightbox-download {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    background: #6b7280;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.gallery-lightbox .lightbox-download:hover {
    background: #1e40af;
    transform: translateY(-1px);
}
.gallery-lightbox .lightbox-title {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.15;
    font-weight: 800;
}
#homeGalleryLightbox .lightbox-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.gallery-lightbox .lightbox-explore-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    gap: 5px;
    height: 2rem;
    border-radius: 999px;
    color: #1e3a8a;
    background: rgba(30, 58, 138, 0.08);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.gallery-lightbox .lightbox-explore-link:hover {
    color: #fff;
    background: #1e3a8a;
    transform: translateY(-1px);
}
.gallery-lightbox .lightbox-explore-link.is-disabled {
    pointer-events: none;
    opacity: 0.55;
}
.gallery-lightbox .lightbox-title-link {
    color: #172033;
    text-decoration: none;
    transition: color 0.2s ease;
}
.gallery-lightbox .lightbox-title-link:hover {
    color: #1e3a8a;
}
.gallery-lightbox .lightbox-title-link.is-disabled {
    pointer-events: none;
    cursor: default;
    color: #172033;
}
.gallery-lightbox .lightbox-description {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
    color: #52627a;
}
.gallery-lightbox .lightbox-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}
.gallery-lightbox .lightbox-actions .lightbox-download,
.gallery-lightbox .lightbox-actions .lightbox-download {
    width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    gap: 0;
    justify-content: center;
}
.gallery-lightbox .lightbox-actions .lightbox-download i,
.gallery-lightbox .lightbox-actions .lightbox-explore-link i {
    font-size: 1.12rem;
}
.gallery-lightbox .lightbox-actions .lightbox-download span {
    display: none;
}
.gallery-lightbox .lightbox-actions .lightbox-explore-link {
    width: auto;
    min-height: 2.6rem;
    height: 2.6rem;
    padding: 0 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-page .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    .gallery-page .gallery-grid .gallery-caption {
        font-size: 0.8rem;
        padding: 10px;
    }
    .gallery-lightbox {
        padding: 1rem;
    }
    .gallery-lightbox .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    .gallery-lightbox .lightbox-nav {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    .gallery-lightbox .lightbox-prev {
        left: 0.4rem;
    }
    .gallery-lightbox .lightbox-next {
        right: 0.4rem;
    }
    .gallery-lightbox .lightbox-content {
        width: min(96vw, 720px);
        max-height: 92vh;
        flex-direction: column;
    }
    .gallery-lightbox .lightbox-media {
        padding: 1rem;
    }
    .gallery-lightbox .lightbox-content img {
        max-height: 56vh;
    }
    .gallery-lightbox .lightbox-details {
        flex: 0 0 auto;
        border-left: none;
        border-top: 1px solid rgba(148, 163, 184, 0.2);
        padding: 1.25rem;
        gap: 0.75rem;
    }
    .gallery-lightbox .lightbox-download {
        padding: 0.65rem 0.95rem;
        font-size: 0.9rem;
    }
    .gallery-lightbox .lightbox-actions .lightbox-download,
    .gallery-lightbox .lightbox-actions .lightbox-download {
        width: 2.45rem;
        height: 2.45rem;
    }
    .gallery-lightbox .lightbox-actions .lightbox-explore-link {
        width: auto;
        min-height: 2.45rem;
        height: 2.45rem;
        padding: 0 0.9rem;
    }
    .gallery-lightbox .lightbox-title {
        font-size: 1.3rem;
    }
    .gallery-lightbox .lightbox-description {
        font-size: 0.95rem;
        line-height: 1.55;
    }
}
@media (max-width: 480px) {
    .gallery-page .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}
