/**
 * Prime Gallery - Exclusive styles
 * Prefix: nebula-prime-gallery
 */

.nebula-prime-gallery {
    --prime-gap: clamp(10px, 2.5vw, 16px);
    --prime-radius: 18px;
    --prime-bg: linear-gradient(135deg, rgba(22, 30, 54, 0.06), rgba(24, 76, 182, 0.08));
    --prime-border: rgba(18, 58, 132, 0.18);
    --prime-shadow: 0 20px 48px rgba(10, 22, 46, 0.12);
    --prime-caption-bg: rgba(10, 16, 32, 0.72);
    --prime-caption-text: #f2f6ff;
    --prime-accent: #2f7bff;
    position: relative;
    margin: clamp(16px, 3vw, 22px) 0;
    padding: clamp(14px, 3vw, 18px);
    border-radius: 24px;
    background: var(--prime-bg);
    border: 1px solid var(--prime-border);
    box-shadow: var(--prime-shadow);
}

.nebula-prime-gallery__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: clamp(12px, 3vw, 18px);
}

.nebula-prime-gallery__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: #132449;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.nebula-prime-gallery__badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f7bff, #21c9a8);
    box-shadow: 0 0 0 4px rgba(47, 123, 255, .18);
}

.nebula-prime-gallery__title {
    margin: 0;
    font-weight: 900;
    color: #0b1530;
    letter-spacing: -0.015em;
    font-size: clamp(1.22rem, 2.8vw, 1.6rem);
}

.nebula-prime-gallery__grid {
    display: flex;
    gap: var(--prime-gap);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    flex-wrap: nowrap;
}

.nebula-prime-gallery__cell {
    position: relative;
    overflow: hidden;
    border-radius: var(--prime-radius);
    background: #0d152a;
    box-shadow: 0 10px 26px rgba(8, 16, 34, .18);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
    flex: 0 0 auto;
    width: clamp(220px, 42vw, 320px);
}
.nebula-prime-gallery__cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px rgba(8, 16, 34, .22);
}

.nebula-prime-gallery__media {
    display: block;
    width: 100%;
    height: clamp(200px, 45vw, 360px);
    object-fit: cover;
    object-position: center;
    background: #0d152a;
    /* Prevent CLS - maintain aspect ratio */
    aspect-ratio: 1 / 1;
    min-height: 200px;
}

/* Hide lazy gallery images until interaction */
.nebula-prime-gallery__media.nebula-interaction-lazy {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Show gallery images after interaction */
.nebula-prime-gallery__media.nebula-interaction-lazy.loaded {
    opacity: 1;
    visibility: visible;
}
@media (min-width: 1024px) {
    .nebula-prime-gallery__cell {
        width: 280px;
    }
    .nebula-prime-gallery__media {
        height: 320px;
    }
}
@media (max-width: 720px) {
    .nebula-prime-gallery__cell {
        width: 85%;
    }
}

.nebula-prime-gallery__caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 12px 14px;
    font-weight: 700;
    font-size: .95rem;
    color: var(--prime-caption-text);
    background: var(--prime-caption-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Lightbox */
body.nebula-prime-lightbox-open {
    overflow: hidden !important;
}
.nebula-prime-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(6, 13, 27, .92);
    backdrop-filter: blur(10px);
    z-index: 99999;
    padding: clamp(12px, 4vw, 28px);
    opacity: 0;
    transition: opacity .2s ease;
}
.nebula-prime-lightbox.is-active {
    display: flex;
    opacity: 1;
}
.nebula-prime-lightbox__box {
    position: relative;
    width: min(96vw, 980px);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
    background: #050b1a;
}
.nebula-prime-lightbox__img {
    width: 100%;
    height: min(72vh, 640px);
    object-fit: contain;
    display: block;
    background: #050b1a;
}
.nebula-prime-lightbox__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    color: #eaf2ff;
    background: rgba(0, 0, 0, .35);
    font-size: .92rem;
}
.nebula-prime-lightbox__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.12);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 1.2rem;
}
.nebula-prime-lightbox__nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    transform: translateY(-50%);
    pointer-events: none;
}
.nebula-prime-lightbox__btn {
    pointer-events: auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.12);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 1.4rem;
}


