.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;
    transform: scale(1);
    transform-origin: center;
    transition: transform .4s ease-in-out;
}

.nxb-gallery__link:hover .nxb-gallery__image {
    transform: scale(1.05);
}

.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;
}

html:has(.nxb-gallery__lightbox[open]),
body:has(.nxb-gallery__lightbox[open]) { overflow: hidden; }

.nxb-gallery__lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: auto;
    background: transparent;
    color: #fff;
    opacity: 0;
    transition: opacity .15s linear;
}

.nxb-gallery__lightbox:not([open]) { display: none; }
.nxb-gallery__lightbox.is-visible { opacity: 1; }
.nxb-gallery__lightbox::backdrop { background: rgba(0, 0, 0, .75); opacity: 0; transition: opacity .15s linear; }
.nxb-gallery__lightbox.is-backdrop-visible::backdrop { opacity: 1; }

.nxb-gallery__lightbox-panel {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1800px;
    min-height: 100%;
    margin: auto;
    padding: 50px 0;
    pointer-events: none;
    transform: translateY(-50px);
    transition: transform .3s ease-out;
}
.nxb-gallery__lightbox.is-visible .nxb-gallery__lightbox-panel { transform: none; }

.nxb-gallery__lightbox-figure {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
    pointer-events: auto;
    touch-action: pan-y;
}

.nxb-gallery__lightbox-image {
    position: absolute;
    inset: 0;
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    object-fit: contain;
    pointer-events: auto;
    touch-action: pan-y;
    user-select: none;
    z-index: 1;
}

.nxb-gallery__lightbox-image--leaving { z-index: 0; pointer-events: none; }
.nxb-gallery__lightbox-image--entering { animation: gallery-image-enter .6s ease-in-out; }
@keyframes gallery-image-enter { from { opacity: 0; } to { opacity: 1; } }
.nxb-gallery__lightbox-figure::before { content: ""; position: absolute; top: calc(50% - 16px); left: calc(50% - 16px); width: 32px; height: 32px; border: 3.75px solid #fff; border-right-color: transparent; border-radius: 50%; animation: gallery-image-loading .75s linear infinite; }
@keyframes gallery-image-loading { to { transform: rotate(360deg); } }

.nxb-gallery__lightbox-caption {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding: 15px;
    text-align: center;
}
.nxb-gallery__lightbox-caption:empty { display: none; }

.nxb-gallery__lightbox-close {
    position: fixed;
    z-index: 3;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #fc4b57;
    font-size: 0;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 0, 0, .15);
}
.nxb-gallery__lightbox-close::before {
    content: "";
    position: absolute;
    top: 7.5px;
    left: calc(50% - 10.185546875px);
    width: 20.37109375px;
    height: 35px;
    background: currentColor;
    mask: url('/images/icons/lightbox-close.svg') center / contain no-repeat;
}

.nxb-gallery__lightbox-arrow {
    position: fixed;
    z-index: 2;
    top: 12.5%;
    width: 100px;
    height: 75%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fc4b57;
    opacity: .5;
    pointer-events: auto;
    transition: opacity .15s ease;
    cursor: pointer;
}
.nxb-gallery__lightbox-arrow:is(:hover,:focus-visible) { opacity: .9; }
.nxb-gallery__lightbox-arrow--previous { left: 0; }
.nxb-gallery__lightbox-arrow--next { right: 0; }
.nxb-gallery__lightbox-arrow > span {
    position: absolute;
    top: calc(50% - 20px);
    width: 40px;
    height: 40px;
    border: 0;
    background: #fff;
    transform: none;
}
.nxb-gallery__lightbox-arrow--previous > span { left: 0; }
.nxb-gallery__lightbox-arrow--next > span { right: 0; }
.nxb-gallery__lightbox-arrow > span::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 16.25px;
    width: 7.5px;
    height: 20px;
    background: currentColor;
    mask: url('/images/icons/lightbox-previous.svg') center / contain no-repeat;
}
.nxb-gallery__lightbox-arrow--next > span::before { mask-image: url('/images/icons/lightbox-next.svg'); }
.nxb-gallery__lightbox-arrow > span:hover { color: #092844; }
.nxb-gallery__lightbox :is(button):focus-visible { outline: 3px solid #fc4b57; outline-offset: -6px; }
.nxb-gallery__lightbox-position { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (min-width: 1350px) {
    .nxb-gallery__lightbox-panel { padding-inline: 50px; }
    .nxb-gallery__lightbox-close { background: transparent; color: #fff; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
    .nxb-gallery__lightbox,
    .nxb-gallery__lightbox::backdrop,
    .nxb-gallery__lightbox-panel,
    .nxb-gallery__lightbox-arrow { transition: none; }
    .nxb-gallery__lightbox-image--entering { animation: none; }
}

.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: 991px) {
    .nxb-gallery__viewport {
        grid-template-columns: repeat(var(--nxb-gallery-tablet-columns, 2), minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .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; }

}

@media (prefers-reduced-motion: reduce) {
    .nxb-gallery .slick-track,
    .nxb-gallery .slick-slide {
        transition-duration: 0ms !important;
    }
}
