/* Public gallery page */

.gallery-banner {
    background-image: linear-gradient(135deg, rgba(12, 35, 64, 0.94), rgba(26, 58, 92, 0.9)),
        url('https://images.unsplash.com/photo-1586528116311-ad8dd3c8310d?w=1920&q=80');
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.gallery-banner-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 50% 60% at 15% 85%, rgba(245, 158, 11, 0.2), transparent 55%),
        radial-gradient(ellipse 40% 50% at 90% 15%, rgba(255, 255, 255, 0.08), transparent 50%);
    animation: gallery-banner-drift 16s ease-in-out infinite alternate;
}

@keyframes gallery-banner-drift {
    from { transform: scale(1) translate(0, 0); }
    to { transform: scale(1.05) translate(-1.5%, 2%); }
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.gallery-filter {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.2s ease;
}

.gallery-filter:hover {
    border-color: rgba(245, 158, 11, 0.45);
    transform: translateY(-1px);
}

.gallery-filter.is-active {
    background: var(--navy, #0c2340);
    border-color: var(--navy, #0c2340);
    color: #fff;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.15rem;
    }
}

@media (min-width: 1100px) {
    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

.gallery-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: start;
    color: inherit;
    cursor: pointer;
    width: 100%;
}

.gallery-card-media {
    position: relative;
    display: block;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--color-surface, #f3f5f8);
    border: 1px solid var(--color-border);
}

.gallery-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-card-media img.gallery-card-svg {
    object-fit: contain;
    padding: 1rem;
    background: #fff;
}

.gallery-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
    color: var(--accent, #f59e0b);
    background: linear-gradient(160deg, rgba(12, 35, 64, 0.08), rgba(245, 158, 11, 0.12));
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 35, 64, 0.45);
    color: #fff;
    font-size: 1.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-card:hover .gallery-card-overlay,
.gallery-card:focus-visible .gallery-card-overlay {
    opacity: 1;
}

.gallery-card:hover .gallery-card-media img,
.gallery-card:focus-visible .gallery-card-media img {
    transform: scale(1.06);
}

.gallery-card-badge {
    position: absolute;
    top: 0.65rem;
    inset-inline-start: 0.65rem;
    background: rgba(12, 35, 64, 0.82);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.gallery-card-caption {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
}

.gallery-empty {
    padding: 3rem 1rem;
}

.gallery-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    color: var(--accent, #f59e0b);
    background: rgba(245, 158, 11, 0.12);
}

.gallery-empty-filter {
    margin-top: 1.5rem;
}

.gallery-animate {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--gallery-delay, 0) * 1s);
}

.gallery-animate--scale {
    transform: translateY(10px) scale(0.98);
}

.gallery-animate.is-visible {
    opacity: 1;
    transform: none;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.gallery-lightbox[hidden] {
    display: none !important;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 16, 28, 0.88);
    backdrop-filter: blur(4px);
}

.gallery-lightbox-stage {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.gallery-lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    max-height: calc(100vh - 9rem);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.gallery-lightbox-media img,
.gallery-lightbox-media video {
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.gallery-lightbox-media img.is-svg {
    background: #fff;
    padding: 1.25rem;
    max-width: min(100%, 640px);
}

.gallery-lightbox-meta {
    color: #fff;
    text-align: center;
}

.gallery-lightbox-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.gallery-lightbox-desc {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.78);
}

.gallery-lightbox-counter {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
    position: absolute;
    z-index: 2;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.gallery-lightbox-close {
    top: 1rem;
    inset-inline-end: 1rem;
}

.gallery-lightbox-prev {
    top: 50%;
    inset-inline-start: 0.75rem;
    transform: translateY(-50%);
}

.gallery-lightbox-next {
    top: 50%;
    inset-inline-end: 0.75rem;
    transform: translateY(-50%);
}

.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
    transform: translateY(-50%) scale(1.05);
}

@media (max-width: 575.98px) {
    .gallery-lightbox {
        padding: 0.5rem;
        align-items: flex-end;
    }

    .gallery-lightbox-stage {
        max-height: calc(100vh - 1rem);
    }

    .gallery-lightbox-media {
        min-height: 32vh;
        max-height: calc(100vh - 11rem);
    }

    .gallery-lightbox-nav {
        width: 40px;
        height: 40px;
        top: auto;
        bottom: 7.5rem;
        transform: none;
    }

    .gallery-lightbox-prev:hover,
    .gallery-lightbox-next:hover {
        transform: scale(1.05);
    }

    .gallery-lightbox-close {
        top: 0.65rem;
        inset-inline-end: 0.65rem;
    }
}

body.gallery-lightbox-open {
    overflow: hidden;
}
