/* NCS Gallery is intentionally scoped to its own roots so Hub, Elementor, and other page elements remain untouched. */
.ncs-gallery-detail-page {
    background: #f3fafe;
    padding-bottom: clamp(4rem, 7vw, 7rem);
    padding-top: 220px;
}

.ncs-gallery-detail-page__content {
    margin-inline: auto;
    max-width: none;
    padding-inline: 50px;
}

.ncs-gallery {
    --ncs-gallery-primary: #3c7dc1;
    --ncs-gallery-accent: #ffca05;
    --ncs-gallery-surface: #f3fafe;
    --ncs-gallery-card: #ffffff;
    --ncs-gallery-ink: #10283f;
    --ncs-gallery-muted: #587087;
    --ncs-gallery-focus: #155a9c;
    --ncs-gallery-radius: 20px;
    --ncs-gallery-gap: clamp(1rem, 2vw, 2rem);
    --ncs-gallery-shadow: 0 18px 36px rgba(16, 40, 63, 0.14), 0 4px 12px rgba(16, 40, 63, 0.08);
    box-sizing: border-box;
    color: var(--ncs-gallery-ink);
    font-family: inherit;
    width: 100%;
}

.ncs-gallery,
.ncs-gallery *,
.ncs-gallery *::before,
.ncs-gallery *::after {
    box-sizing: border-box;
}

.ncs-gallery__heading,
.ncs-gallery__title,
.ncs-gallery__intro,
.ncs-gallery__eyebrow,
.ncs-gallery__empty,
.ncs-gallery-card__title {
    margin: 0;
}

.ncs-gallery__heading {
    color: var(--ncs-gallery-primary);
    font-size: clamp(1.75rem, 3vw, 2.75rem);
    line-height: 1.1;
    margin-block-end: 0.65rem;
}

.ncs-gallery__intro {
    color: var(--ncs-gallery-muted);
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.55;
    margin-block-end: clamp(1.75rem, 4vw, 3.5rem);
    max-width: 68rem;
}

.ncs-gallery__cards {
    display: grid;
    gap: var(--ncs-gallery-gap);
    grid-template-columns: repeat(var(--ncs-gallery-columns, 3), minmax(0, 1fr));
}

.ncs-gallery-card {
    min-width: 0;
}

.ncs-gallery-card__link {
    background: var(--ncs-gallery-card);
    border-radius: var(--ncs-gallery-radius);
    box-shadow: var(--ncs-gallery-shadow);
    color: inherit;
    display: block;
    overflow: hidden;
    text-decoration: none;
    transform: translateZ(0);
    transition: box-shadow 220ms ease-out, transform 220ms ease-out;
}

.ncs-gallery-card__link:hover {
    box-shadow: 0 24px 44px rgba(16, 40, 63, 0.18), 0 6px 16px rgba(16, 40, 63, 0.1);
    transform: translateY(-3px);
}

.ncs-gallery-card__link:focus-visible,
.ncs-gallery-detail__link:focus-visible,
.ncs-gallery-lightbox__button:focus-visible,
.ncs-gallery-lightbox__nav:focus-visible {
    outline: 3px solid var(--ncs-gallery-focus);
    outline-offset: 4px;
}

.ncs-gallery-card__media {
    background: var(--ncs-gallery-surface);
    display: block;
    overflow: hidden;
    aspect-ratio: 1.55 / 1;
}

.ncs-gallery-card__image,
.ncs-gallery-detail__image {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.ncs-gallery-card__image {
    transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ncs-gallery-card__link:hover .ncs-gallery-card__image,
.ncs-gallery-card__link:focus-visible .ncs-gallery-card__image {
    transform: scale(1.055);
}

.ncs-gallery-card__placeholder {
    align-items: center;
    background: linear-gradient(135deg, #e4f3fc, #c8e1f3);
    color: var(--ncs-gallery-primary);
    display: flex;
    font-size: 0.8rem;
    height: 100%;
    justify-content: center;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ncs-gallery-card__title {
    display: block;
    font-size: clamp(1.15rem, 1.8vw, 1.7rem);
    font-weight: 700;
    line-height: 1.2;
    padding: clamp(1.2rem, 2.4vw, 2rem) 1.25rem;
    text-align: center;
}

.ncs-gallery__detail-heading {
    margin-block-end: clamp(1.5rem, 3.5vw, 3rem);
}

.ncs-gallery__eyebrow {
    color: var(--ncs-gallery-primary);
    font-size: clamp(1.4rem, 2.4vw, 2.2rem);
    font-weight: 700;
    line-height: 1.15;
    margin-block-end: 0.85rem;
}

.ncs-gallery__title {
    color: var(--ncs-gallery-ink);
    font-size: clamp(1.65rem, 3.6vw, 3.4rem);
    line-height: 1.12;
}

.ncs-gallery-detail-page .ncs-gallery__title {
    font-size: clamp(1.75rem, 2.8vw, 3rem);
}

.ncs-gallery__images {
    display: grid;
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    grid-template-columns: repeat(var(--ncs-gallery-columns, 4), minmax(0, 1fr));
}

.ncs-gallery-detail__link {
    background: var(--ncs-gallery-surface);
    display: block;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9;
}

.ncs-gallery-detail__item {
    min-width: 0;
}

.ncs-gallery-detail__image {
    transition: transform 260ms ease-out, filter 260ms ease-out;
}

.ncs-gallery-detail__link:hover .ncs-gallery-detail__image,
.ncs-gallery-detail__link:focus-visible .ncs-gallery-detail__image {
    filter: saturate(1.04);
    transform: scale(1.025);
}

.ncs-gallery__empty {
    background: var(--ncs-gallery-surface);
    border: 1px solid rgba(60, 125, 193, 0.18);
    border-radius: 14px;
    color: var(--ncs-gallery-muted);
    padding: 1.25rem 1.5rem;
}

.ncs-gallery-lightbox[hidden] {
    display: none !important;
}

.ncs-gallery-lightbox {
    align-items: center;
    display: grid;
    inset: 0;
    isolation: isolate;
    justify-items: center;
    padding: clamp(0.75rem, 3vw, 2rem);
    position: fixed;
    z-index: 2147483647;
}

.ncs-gallery-lightbox__backdrop {
    background: rgba(4, 13, 22, 0.9);
    inset: 0;
    position: absolute;
    z-index: -1;
}

.ncs-gallery-lightbox__panel {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(3rem, 5vw) minmax(0, 1fr) minmax(3rem, 5vw);
    grid-template-rows: auto minmax(0, 1fr);
    max-height: 100%;
    max-width: 100rem;
    min-height: 0;
    position: relative;
    width: min(100%, 100rem);
}

.ncs-gallery-lightbox__toolbar {
    align-items: center;
    display: flex;
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-block-end: 0.75rem;
}

.ncs-gallery-lightbox__counter {
    color: #ffffff;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.ncs-gallery-lightbox__button,
.ncs-gallery-lightbox__nav {
    align-items: center;
    appearance: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    justify-content: center;
    height: 44px;
    min-height: 44px;
    min-width: 44px;
    padding: 0;
    transition: background 180ms ease-out, border-color 180ms ease-out;
}

.ncs-gallery-lightbox__icon {
    display: block;
    font-family: Arial, sans-serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
}

.ncs-gallery-lightbox__icon--close {
    height: 1.1rem;
    font-size: 1.5rem;
    position: relative;
    width: 1.1rem;
}

.ncs-gallery-lightbox__icon--close::before,
.ncs-gallery-lightbox__icon--close::after {
    background: currentColor;
    border-radius: 1px;
    content: '';
    height: 1.5px;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 1.1rem;
}

.ncs-gallery-lightbox__icon--close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.ncs-gallery-lightbox__button:hover,
.ncs-gallery-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.58);
}

.ncs-gallery-lightbox__figure {
    align-items: center;
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 2;
    justify-content: center;
    margin: 0;
    max-height: calc(100dvh - 7rem);
    min-width: 0;
}

.ncs-gallery-lightbox__image {
    display: block;
    max-height: calc(100dvh - 10rem);
    max-width: 100%;
    object-fit: contain;
    width: auto;
}

.ncs-gallery-lightbox__caption {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.95rem;
    line-height: 1.45;
    margin-block-start: 0.75rem;
    max-width: 52rem;
    text-align: center;
}

.ncs-gallery-lightbox__nav {
    align-self: center;
    grid-row: 2;
}

.ncs-gallery-lightbox__nav--previous {
    grid-column: 1;
}

.ncs-gallery-lightbox__nav--next {
    grid-column: 3;
}

.ncs-gallery-lightbox__nav[disabled] {
    cursor: default;
    opacity: 0.35;
}

@media (max-width: 1024px) {
    .ncs-gallery__cards {
        grid-template-columns: repeat(min(var(--ncs-gallery-columns, 3), 2), minmax(0, 1fr));
    }

    .ncs-gallery__images {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .ncs-gallery-detail-page__content {
        padding-inline: 20px;
    }

    .ncs-gallery__cards,
    .ncs-gallery__images {
        grid-template-columns: minmax(0, 1fr);
    }

    .ncs-gallery-card__title {
        font-size: 1.2rem;
        padding-block: 1.1rem;
    }

    .ncs-gallery-lightbox {
        padding: 0.75rem;
    }

    .ncs-gallery-lightbox__panel {
        grid-template-columns: 3rem minmax(0, 1fr) 3rem;
    }

    .ncs-gallery-lightbox__figure {
        max-height: calc(100dvh - 6rem);
    }

    .ncs-gallery-lightbox__image {
        max-height: calc(100dvh - 9rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ncs-gallery-card__link,
    .ncs-gallery-card__image,
    .ncs-gallery-detail__image,
    .ncs-gallery-lightbox__button,
    .ncs-gallery-lightbox__nav {
        transition-duration: 0.01ms;
    }

    .ncs-gallery-card__link:hover .ncs-gallery-card__image,
    .ncs-gallery-card__link:focus-visible .ncs-gallery-card__image,
    .ncs-gallery-detail__link:hover .ncs-gallery-detail__image,
    .ncs-gallery-detail__link:focus-visible .ncs-gallery-detail__image {
        filter: none;
        transform: none;
    }
}
