.nesa-gallery {
    --nesa-gallery-cols-desktop: 3;
    --nesa-gallery-cols-tablet: 2;
    --nesa-gallery-cols-mobile: 1;
    --nesa-gallery-gap: 16px;
    --nesa-gallery-radius: 16px;
    --nesa-gallery-shadow: 0 10px 28px rgba(16, 31, 54, .10);
    --nesa-gallery-ratio: 4 / 3;
    background: var(--surface, #fff);
}

.nesa-gallery__head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
}

.nesa-gallery__head > div:first-child {
    max-width: 780px;
}

.nesa-gallery__count {
    display: grid;
    flex: 0 0 auto;
    justify-items: end;
    color: var(--theme-primary, #102f5a);
}

.nesa-gallery__count strong {
    font-size: clamp(34px, 4vw, 54px);
    font-weight: 850;
    line-height: .9;
    letter-spacing: -.05em;
}

.nesa-gallery__count small {
    margin-top: 7px;
    color: var(--muted, #687587);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nesa-gallery__grid {
    display: grid;
    grid-template-columns: repeat(var(--nesa-gallery-cols-desktop), minmax(0, 1fr));
    gap: var(--nesa-gallery-gap);
}

.nesa-gallery__card {
    position: relative;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    border-radius: var(--nesa-gallery-radius);
    transform: translateZ(0);
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}

.nesa-gallery__media {
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--nesa-gallery-ratio);
    border-radius: inherit;
    background: #edf1f5;
}

.nesa-gallery-ratio--natural .nesa-gallery__media {
    aspect-ratio: auto;
}

.nesa-gallery__open,
.nesa-gallery__static {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
}

.nesa-gallery__open {
    cursor: zoom-in;
}

.nesa-gallery img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .52s cubic-bezier(.2, .75, .2, 1), filter .35s ease;
}

.nesa-gallery-ratio--natural img {
    height: auto;
}

.nesa-gallery__zoom {
    position: absolute;
    z-index: 4;
    right: 14px;
    top: 14px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #fff;
    background: var(--theme-accent, var(--theme-primary, #102f5a));
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 50%;
    box-shadow: 0 9px 24px rgba(0,0,0,.18);
    opacity: .94;
    transform: scale(.92);
    transition: transform .25s ease, opacity .25s ease;
}

.nesa-gallery__zoom svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.nesa-gallery__caption {
    font-size: 13px;
    line-height: 1.5;
}

.nesa-gallery__caption--overlay {
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 44px 18px 16px;
    color: #fff;
    background: linear-gradient(transparent, rgba(6, 13, 24, .84));
    pointer-events: none;
}

.nesa-gallery__caption--below {
    padding: 14px 16px 16px;
    color: var(--text, #172234);
}

.nesa-gallery__empty {
    padding: 28px;
    color: var(--muted, #687587);
    background: #f7f9fb;
    border: 1px dashed #d8dee7;
    border-radius: 16px;
    text-align: center;
}

/* Theme 1: Minimal */
.nesa-gallery-theme--minimal .nesa-gallery__card {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.nesa-gallery-theme--minimal .nesa-gallery__media {
    border: 1px solid rgba(16, 47, 90, .09);
}

.nesa-gallery-theme--minimal .nesa-gallery__caption--below {
    padding-left: 2px;
    padding-right: 2px;
}

/* Theme 2: Soft Cards */
.nesa-gallery-theme--soft-card .nesa-gallery__card {
    background: #fff;
    border: 1px solid rgba(16, 47, 90, .10);
    box-shadow: var(--nesa-gallery-shadow);
}

/* Theme 3: Premium Overlay */
.nesa-gallery-theme--premium-overlay .nesa-gallery__card {
    background: #0b1d34;
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: var(--nesa-gallery-shadow);
}

.nesa-gallery-theme--premium-overlay .nesa-gallery__media::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    content: "";
    background: linear-gradient(135deg, rgba(9, 28, 52, .08), rgba(9, 28, 52, .18));
    pointer-events: none;
}

.nesa-gallery-theme--premium-overlay .nesa-gallery__caption--below {
    color: #fff;
    background: #0b1d34;
}

/* Hover */
.nesa-gallery-hover--zoom .nesa-gallery__card:hover img,
.nesa-gallery-hover--zoom-lift .nesa-gallery__card:hover img {
    transform: scale(1.055);
}

.nesa-gallery-hover--lift .nesa-gallery__card:hover,
.nesa-gallery-hover--zoom-lift .nesa-gallery__card:hover {
    transform: translateY(-5px);
    box-shadow: 0 22px 46px rgba(16, 31, 54, .18);
}

.nesa-gallery__card:hover .nesa-gallery__zoom {
    opacity: 1;
    transform: scale(1);
}

/* Layout: masonry */
.nesa-gallery--masonry .nesa-gallery__grid {
    display: block;
    columns: var(--nesa-gallery-cols-desktop);
    column-gap: var(--nesa-gallery-gap);
}

.nesa-gallery--masonry .nesa-gallery__card {
    width: 100%;
    margin-bottom: var(--nesa-gallery-gap);
    break-inside: avoid;
}

.nesa-gallery--masonry .nesa-gallery__media {
    aspect-ratio: auto;
}

.nesa-gallery--masonry img {
    height: auto;
}

/* Layout: featured */
.nesa-gallery--featured .nesa-gallery__grid {
    grid-template-columns: repeat(var(--nesa-gallery-cols-desktop), minmax(0, 1fr));
}

.nesa-gallery--featured .nesa-gallery__card:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.nesa-gallery--featured .nesa-gallery__card:first-child .nesa-gallery__media {
    height: 100%;
    min-height: 100%;
}

/* Lightbox */
.nesa-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    color: #fff;
    background: rgba(5, 10, 18, .95);
    backdrop-filter: blur(8px);
}

.nesa-gallery-lightbox.is-open { display: flex; }

.nesa-gallery-lightbox__stage {
    position: relative;
    display: flex;
    width: min(1280px, 100%);
    height: min(88vh, 920px);
    align-items: center;
    justify-content: center;
}

.nesa-gallery-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 26px 70px rgba(0,0,0,.42);
}

.nesa-gallery-lightbox__close,
.nesa-gallery-lightbox__prev,
.nesa-gallery-lightbox__next {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(10, 18, 30, .76);
    border: 1px solid rgba(255,255,255,.24);
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.nesa-gallery-lightbox__close {
    top: 0;
    right: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 28px;
}

.nesa-gallery-lightbox__prev,
.nesa-gallery-lightbox__next {
    top: 50%;
    width: 48px;
    height: 64px;
    border-radius: 12px;
    font-size: 30px;
    transform: translateY(-50%);
}

.nesa-gallery-lightbox__prev { left: 10px; }
.nesa-gallery-lightbox__next { right: 10px; }

.nesa-gallery-lightbox__meta {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: min(760px, calc(100% - 120px));
    padding: 11px 16px;
    color: #fff;
    background: rgba(8, 15, 25, .72);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    text-align: center;
    transform: translateX(-50%);
    backdrop-filter: blur(9px);
}

.nesa-gallery-lightbox__meta:empty { display: none; }
.nesa-gallery-lightbox__caption { font-size: 14px; }
.nesa-gallery-lightbox__counter { display: block; margin-top: 4px; font-size: 11px; opacity: .72; }
.nesa-gallery-lightbox-open { overflow: hidden; }

@media (max-width: 900px) {
    .nesa-gallery__grid,
    .nesa-gallery--featured .nesa-gallery__grid {
        grid-template-columns: repeat(var(--nesa-gallery-cols-tablet), minmax(0, 1fr));
    }

    .nesa-gallery--masonry .nesa-gallery__grid {
        columns: var(--nesa-gallery-cols-tablet);
    }

    .nesa-gallery--featured .nesa-gallery__card:first-child {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}

@media (max-width: 620px) {
    .nesa-gallery__head {
        align-items: flex-start;
    }

    .nesa-gallery__count { display: none; }

    .nesa-gallery__grid,
    .nesa-gallery--featured .nesa-gallery__grid {
        grid-template-columns: repeat(var(--nesa-gallery-cols-mobile), minmax(0, 1fr));
    }

    .nesa-gallery--masonry .nesa-gallery__grid {
        columns: var(--nesa-gallery-cols-mobile);
    }

    .nesa-gallery--featured .nesa-gallery__card:first-child {
        grid-column: 1 / -1;
    }

    .nesa-gallery-lightbox { padding: 12px; }
    .nesa-gallery-lightbox__stage { height: 90vh; }
    .nesa-gallery-lightbox__prev,
    .nesa-gallery-lightbox__next { width: 42px; height: 54px; }
    .nesa-gallery-lightbox__meta { width: calc(100% - 96px); }
}


/* NESA CMS 2.1.12 · progressive gallery reveal */
.nesa-gallery__card[hidden] {
    display: none !important;
}

.nesa-gallery__card--deferred.is-revealed {
    animation: nesaGalleryReveal .38s ease both;
}

.nesa-gallery__more-wrap {
    display: flex;
    justify-content: center;
    padding-top: clamp(20px, 3vw, 34px);
}

.nesa-gallery__more {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--theme-primary, #102f5a);
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--theme-primary, #102f5a) 20%, transparent);
    border-radius: 999px;
    box-shadow: 0 10px 26px rgba(16, 31, 54, .08);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.nesa-gallery__more:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--theme-accent, var(--theme-primary, #102f5a)) 45%, transparent);
    box-shadow: 0 15px 32px rgba(16, 31, 54, .13);
}

.nesa-gallery__more small {
    display: inline-grid;
    min-width: 28px;
    height: 28px;
    place-items: center;
    padding: 0 7px;
    color: #fff;
    background: var(--theme-accent, var(--theme-primary, #102f5a));
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
}

@keyframes nesaGalleryReveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
