.nxb-gallery {
    --nxb-gallery-gap: 1rem;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin-block: 2rem;
}

.nxb-gallery__viewport {
    display: grid;
    grid-template-columns: repeat(var(--nxb-gallery-columns, 3), minmax(0, 1fr));
    gap: var(--nxb-gallery-gap);
    min-width: 0;
}

.nxb-gallery__item,
.nxb-gallery__link {
    display: block;
    min-width: 0;
}

.nxb-gallery__link {
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
    color: inherit;
}

.nxb-gallery__link:focus-visible {
    z-index: 2;
    outline: 3px solid #172554;
    outline-offset: 3px;
}

.nxb-gallery__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .25s ease, opacity .25s ease;
}

.nxb-gallery__link:hover .nxb-gallery__image,
.nxb-gallery__link:focus-visible .nxb-gallery__image {
    opacity: .9;
    transform: scale(1.025);
}

.nxb-gallery--carousel {
    padding-bottom: 3.5rem;
}

.nxb-gallery--carousel .nxb-gallery__viewport.slick-initialized {
    display: block;
    margin-inline: calc(-.5 * var(--nxb-gallery-gap));
}

.nxb-gallery--carousel .slick-list {
    overflow: hidden;
}

.nxb-gallery--carousel .slick-track {
    display: flex;
    align-items: stretch;
}

.nxb-gallery--carousel .slick-slide {
    box-sizing: border-box;
    min-width: 0;
    height: auto;
    padding-inline: calc(.5 * var(--nxb-gallery-gap));
}

.nxb-gallery--carousel .slick-slide > div,
.nxb-gallery--carousel .slick-slide .nxb-gallery__item {
    height: 100%;
}

.nxb-gallery__controls {
    display: none;
}

.nxb-gallery__controls[hidden] {
    display: none !important;
}

.nxb-gallery.is-enhanced .nxb-gallery__controls {
    display: block;
}

.nxb-gallery__arrow,
.nxb-gallery__toggle,
.nxb-gallery__dot,
.nxb-gallery__lightbox-close,
.nxb-gallery__lightbox-arrow {
    border: 1px solid rgba(255, 255, 255, .75);
    background: rgba(17, 24, 39, .82);
    color: #fff;
    cursor: pointer;
}

.nxb-gallery__arrow:focus-visible,
.nxb-gallery__toggle:focus-visible,
.nxb-gallery__dot:focus-visible,
.nxb-gallery__lightbox-close:focus-visible,
.nxb-gallery__lightbox-arrow:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
}

.nxb-gallery__arrow {
    position: absolute;
    z-index: 4;
    top: calc(50% - 1.75rem);
    display: grid;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 50%;
    place-items: center;
    transform: translateY(-50%);
}

.nxb-gallery__arrow--previous { left: .75rem; }
.nxb-gallery__arrow--next { right: .75rem; }

.nxb-gallery__arrow > span,
.nxb-gallery__lightbox-arrow > span {
    display: block;
    box-sizing: border-box;
    width: .75rem;
    height: .75rem;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
}

.nxb-gallery__arrow--previous > span,
.nxb-gallery__lightbox-arrow--previous > span {
    transform: translateX(.12rem) rotate(-135deg);
}

.nxb-gallery__arrow--next > span,
.nxb-gallery__lightbox-arrow--next > span {
    transform: translateX(-.12rem) rotate(45deg);
}

.nxb-gallery__dots {
    position: absolute;
    right: 50%;
    bottom: .25rem;
    transform: translateX(50%);
}

.nxb-gallery__dots-list {
    display: flex;
    gap: .35rem;
    align-items: center;
    padding: .35rem .5rem;
    margin: 0;
    border-radius: 999px;
    background: rgba(17, 24, 39, .82);
    list-style: none;
}

.nxb-gallery__dots-list li {
    padding: 0;
    margin: 0;
}

.nxb-gallery__dot {
    display: grid;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    background: transparent;
}

.nxb-gallery__dot > span {
    display: block;
    width: .6rem;
    height: .6rem;
    border: 2px solid #fff;
    border-radius: 50%;
}

.nxb-gallery__dot[aria-current="true"] > span,
.nxb-gallery__dots-list .slick-active .nxb-gallery__dot > span {
    background: #fff;
}

.nxb-gallery__toggle {
    position: absolute;
    bottom: .25rem;
    left: .25rem;
    display: grid;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: .45rem;
    border-radius: 50%;
    place-items: center;
}

.nxb-gallery__lightbox {
    width: min(94vw, 90rem);
    max-width: none;
    height: min(92vh, 60rem);
    max-height: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
}

.nxb-gallery__lightbox:not([open]) {
    display: none;
}

.nxb-gallery__lightbox::backdrop {
    background: rgba(0, 0, 0, .88);
}

.nxb-gallery__lightbox-panel {
    position: relative;
    display: grid;
    width: 100%;
    height: 100%;
    grid-template-columns: 4rem minmax(0, 1fr) 4rem;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
}

.nxb-gallery__lightbox-figure {
    display: grid;
    min-width: 0;
    max-height: 100%;
    margin: 0;
    place-items: center;
}

.nxb-gallery__lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 5rem);
    object-fit: contain;
}

.nxb-gallery__lightbox-caption {
    max-width: 60rem;
    padding-top: .75rem;
    text-align: center;
}

.nxb-gallery__lightbox-caption:empty {
    display: none;
}

.nxb-gallery__lightbox-close {
    position: absolute;
    z-index: 2;
    top: .5rem;
    right: .5rem;
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 50%;
    place-items: center;
    font-size: 2rem;
    line-height: 1;
}

.nxb-gallery__lightbox-arrow {
    display: grid;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 50%;
    place-items: center;
}

.nxb-gallery__lightbox-arrow--previous { justify-self: start; }
.nxb-gallery__lightbox-arrow--next { justify-self: end; }

.nxb-gallery__lightbox-position {
    grid-column: 1 / -1;
    margin: .75rem 0 0;
    text-align: center;
}

.nxb-gallery__visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 1199px) {
    .nxb-gallery__viewport {
        grid-template-columns: repeat(var(--nxb-gallery-tablet-columns, 3), minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .nxb-gallery__viewport {
        grid-template-columns: minmax(0, 1fr);
    }

    .nxb-gallery__arrow {
        width: 2.5rem;
        height: 2.5rem;
    }

    .nxb-gallery__arrow--previous { left: .35rem; }
    .nxb-gallery__arrow--next { right: .35rem; }

    .nxb-gallery__lightbox-panel {
        grid-template-columns: 3rem minmax(0, 1fr) 3rem;
    }

    .nxb-gallery__lightbox-arrow {
        width: 2.5rem;
        height: 2.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nxb-gallery__image,
    .nxb-gallery .slick-track,
    .nxb-gallery .slick-slide {
        transition-duration: 0ms !important;
    }
}
