/* Nice Image Carousel */

.nic {
    --nic-per: var(--nic-per-d, 3);
    --nic-gap: 16px;
    --nic-peek: 0px;
    --nic-radius: 14px;
    --nic-ink: #0f172a;
    --nic-accent: #2563eb;
    --nic-arrow: 44px;
    position: relative;
    width: 100%;
}

@media (max-width: 1024px) {
    .nic { --nic-per: var(--nic-per-t, 2); }
}

@media (max-width: 767px) {
    .nic { --nic-per: var(--nic-per-m, 1); }
}

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

.nic-stage {
    position: relative;
}

/* The viewport is a native scroll-snap container: smooth touch swiping with no slider library. */
.nic-viewport {
    container-type: inline-size;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Room for hover lift and shadows, which the scroll container would otherwise clip. */
    margin: -10px 0 -18px;
    padding: 10px 0 18px;
    outline: none;
}

.nic-viewport::-webkit-scrollbar {
    display: none;
}

.nic-viewport:focus-visible {
    outline: 2px solid var(--nic-accent);
    outline-offset: 2px;
    border-radius: var(--nic-radius);
}

.nic.is-dragging .nic-viewport {
    scroll-snap-type: none;
    cursor: grabbing;
    user-select: none;
}

.nic-track {
    --nic-slide-w: calc((100cqw - var(--nic-peek) - (var(--nic-per) - 1) * var(--nic-gap)) / var(--nic-per));
    display: flex;
    align-items: flex-start;
    gap: var(--nic-gap);
    width: max-content;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Slide width comes from the viewport width (container units), the slides per view, gap and peek. */
.nic-slide {
    flex: 0 0 auto;
    width: var(--nic-slide-w);
    margin: 0;
    padding: 0;
    list-style: none;
    scroll-snap-align: start;
}

.nic-slide::before,
.nic-slide::marker {
    content: none;
}

.nic-figure {
    margin: 0;
}

.nic-media {
    position: relative;
    aspect-ratio: var(--nic-ratio, 4 / 3);
    overflow: hidden;
    border-radius: var(--nic-radius);
    /* Transparent so PNG/WebP images with transparency show the page behind them.
       Set a frame color in Style > Image > Background if you want one. */
    background: transparent;
    transition: transform 0.35s ease, box-shadow 0.35s ease, filter 0.35s ease;
}

.nic-ratio-auto .nic-media {
    aspect-ratio: auto;
}

.nic-media img,
.nic-media .nic-img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.4s ease, opacity 0.4s ease;
    -webkit-user-drag: none;
    user-select: none;
}

.nic-fit-contain .nic-media img {
    object-fit: contain;
}

.nic-ratio-auto .nic-media img {
    height: auto;
}

.nic-link {
    display: block;
    height: 100%;
    color: inherit;
}

.nic-link-lightbox {
    cursor: zoom-in;
}

.nic.is-dragging .nic-link {
    cursor: grabbing;
}

/* Hover effects */

.nic-hover-zoom .nic-slide:hover .nic-media img {
    transform: scale(1.06);
}

.nic-hover-lift .nic-slide:hover .nic-media {
    transform: translateY(-6px);
    /* drop-shadow follows the image's shape, so transparent images get a natural shadow. */
    filter: drop-shadow(0 16px 18px rgba(15, 23, 42, 0.28));
}

.nic-hover-grayscale .nic-media img {
    filter: grayscale(1);
}

.nic-hover-grayscale .nic-slide:hover .nic-media img {
    filter: none;
}

/* Captions */

.nic-caption {
    margin: 12px 0 0;
    color: #334155;
    font-size: 15px;
    line-height: 1.5;
}

.nic-caption-overlay .nic-caption,
.nic-caption-hover .nic-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 48px 18px 16px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.78) 100%);
    color: #fff;
    font-weight: 500;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.nic-caption-hover .nic-caption {
    opacity: 0;
    transform: translateY(10px);
}

.nic-caption-hover .nic-slide:hover .nic-caption,
.nic-caption-hover .nic-slide:focus-within .nic-caption {
    opacity: 1;
    transform: none;
}

@media (hover: none) {
    .nic-caption-hover .nic-caption {
        opacity: 1;
        transform: none;
    }
}

/* Arrows */

.nic .nic-arrow {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--nic-arrow);
    height: var(--nic-arrow);
    margin: 0;
    padding: 0;
    border: 0 solid transparent;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
    color: var(--nic-ink);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.nic .nic-arrow:hover {
    background: var(--nic-ink);
    color: #fff;
}

.nic .nic-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.nic .nic-arrow:disabled:hover {
    background: rgba(255, 255, 255, 0.92);
    color: var(--nic-ink);
}

.nic-arrow-icon {
    display: inline-flex;
    line-height: 1;
}

.nic-arrow-icon svg {
    display: block;
    width: 1em;
    height: 1em;
}

.nic-arrow-icon svg:not([fill="none"]) {
    fill: currentColor;
}

.nic-arrows-inside .nic-stage > .nic-arrow,
.nic-arrows-outside .nic-stage > .nic-arrow {
    position: absolute;
    top: var(--nic-arrow-top, 50%);
    z-index: 3;
    transform: translateY(-50%);
}

.nic-arrows-inside .nic-stage > .nic-prev {
    left: var(--nic-arrow-offset, 14px);
}

.nic-arrows-inside .nic-stage > .nic-next {
    right: var(--nic-arrow-offset, 14px);
}

.nic-arrows-outside .nic-stage > .nic-prev {
    left: calc(-1 * var(--nic-arrow) - var(--nic-arrow-offset, 14px));
}

.nic-arrows-outside .nic-stage > .nic-next {
    right: calc(-1 * var(--nic-arrow) - var(--nic-arrow-offset, 14px));
}

/* Outside arrows have no room on small screens, so they move inside. */
@media (max-width: 1024px) {
    .nic-arrows-outside .nic-stage > .nic-prev {
        left: 10px;
    }

    .nic-arrows-outside .nic-stage > .nic-next {
        right: 10px;
    }
}

/* Footer: pagination, plus the arrows when they sit at the bottom */

.nic-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 22px;
}

.nic-arrows-bottom .nic-arrow {
    box-shadow: none;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.nic-dots {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.nic .nic-dot {
    appearance: none;
    width: var(--nic-dot, 8px);
    height: var(--nic-dot, 8px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: none;
    cursor: pointer;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.nic .nic-dot.is-active {
    width: var(--nic-dot-active, 26px);
    background: var(--nic-ink);
}

.nic-fraction {
    color: var(--nic-ink);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.nic-sep {
    margin: 0 6px;
    opacity: 0.4;
}

.nic-progress {
    flex: 1;
    max-width: 260px;
    height: 3px;
    overflow: hidden;
    border-radius: 3px;
    background: #e2e8f0;
}

.nic-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--nic-ink);
    transition: width 0.25s ease;
}

/* Everything fits: no navigation needed. */
.nic.is-static .nic-arrow,
.nic.is-static .nic-pagination {
    display: none;
}

.nic .nic-arrow:focus-visible,
.nic .nic-dot:focus-visible {
    outline: 2px solid var(--nic-accent);
    outline-offset: 3px;
}

/* Marquee: a continuous, seamless ticker. Slides are duplicated by the script. */

.nic-mode-marquee .nic-viewport {
    overflow: hidden;
    scroll-snap-type: none;
}

.nic-mode-marquee.is-running .nic-track {
    animation: nic-marquee var(--nic-marquee-duration, 30s) linear infinite;
}

.nic-mode-marquee.nic-reverse.is-running .nic-track {
    animation-direction: reverse;
}

.nic-mode-marquee.nic-pause-hover:hover .nic-track {
    animation-play-state: paused;
}

.nic-fade-edges .nic-viewport {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

@keyframes nic-marquee {
    to {
        transform: translateX(calc(-50% - var(--nic-gap) / 2));
    }
}

/* Paged effects (fade, zoom, rise, blur, flip): all slides of a page share one grid row and the
   script switches which page is active. Each effect only defines where slides come from
   (inactive) and where they go (is-leaving); --nic-dir is -1 when going backwards. */

.nic-paged .nic-viewport {
    overflow: hidden;
    scroll-snap-type: none;
    touch-action: pan-y;
}

.nic-paged .nic-track {
    display: grid;
    grid-template-columns: repeat(var(--nic-per), minmax(0, 1fr));
    width: auto;
}

.nic-paged .nic-slide {
    grid-row: 1;
    width: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--nic-fx-speed, 700ms) ease,
        transform var(--nic-fx-speed, 700ms) cubic-bezier(0.22, 0.61, 0.36, 1),
        filter var(--nic-fx-speed, 700ms) ease,
        visibility 0s linear var(--nic-fx-speed, 700ms);
}

.nic-paged .nic-slide.is-active {
    --nic-delay: calc(var(--nic-i, 0) * var(--nic-stagger, 80ms));
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        opacity var(--nic-fx-speed, 700ms) ease var(--nic-delay),
        transform var(--nic-fx-speed, 700ms) cubic-bezier(0.22, 0.61, 0.36, 1) var(--nic-delay),
        filter var(--nic-fx-speed, 700ms) ease var(--nic-delay),
        visibility 0s linear 0s;
}

.nic-paged .nic-slide.is-leaving {
    z-index: 0;
}

.nic-paged .nic-slide.is-active {
    z-index: 1;
}

.nic-paged.nic-no-anim .nic-slide {
    transition: none !important;
}

/* Zoom: new images settle in from slightly larger, old ones shrink away. */
.nic-fx-zoom .nic-slide {
    transform: scale(1.12);
}

.nic-fx-zoom .nic-slide.is-leaving {
    transform: scale(0.9);
}

.nic-fx-zoom .nic-slide.is-active {
    transform: scale(1);
}

/* Rise: images glide up into place. */
.nic-fx-rise .nic-slide {
    transform: translateY(48px);
}

.nic-fx-rise .nic-slide.is-leaving {
    transform: translateY(-48px);
}

.nic-fx-rise .nic-slide.is-active {
    transform: translateY(0);
}

/* Blur: images come into focus. */
.nic-fx-blur .nic-slide {
    filter: blur(16px);
    transform: scale(1.05);
}

.nic-fx-blur .nic-slide.is-leaving {
    filter: blur(16px);
    transform: scale(0.98);
}

.nic-fx-blur .nic-slide.is-active {
    filter: blur(0);
    transform: scale(1);
}

/* 3D Flip: the old image turns away, then the new one turns in. */
.nic-fx-flip .nic-slide {
    transform: perspective(1400px) rotateY(calc(var(--nic-dir, 1) * 90deg));
    backface-visibility: hidden;
    transition-duration: calc(var(--nic-fx-speed, 700ms) / 2);
}

.nic-fx-flip .nic-slide.is-leaving {
    transform: perspective(1400px) rotateY(calc(var(--nic-dir, 1) * -90deg));
}

.nic-fx-flip .nic-slide.is-active {
    --nic-delay: calc(var(--nic-fx-speed, 700ms) / 2 + var(--nic-i, 0) * var(--nic-stagger, 80ms));
    transform: perspective(1400px) rotateY(0deg);
    transition-duration: calc(var(--nic-fx-speed, 700ms) / 2), calc(var(--nic-fx-speed, 700ms) / 2), calc(var(--nic-fx-speed, 700ms) / 2), 0s;
}

/* Ken Burns: the visible image slowly zooms while it is on screen. */
.nic-kenburns .nic-slide.is-active .nic-media img {
    animation: nic-kenburns var(--nic-kb, 5000ms) ease-out both;
}

@keyframes nic-kenburns {
    from { transform: scale(1); }
    to { transform: scale(1.12); }
}

/* Coverflow: native scrolling, centred slide in focus, neighbours tilted in 3D by the script. */
/* Keeps the slides' 3D stacking order inside the viewport, below the arrows. */
.nic-fx-coverflow .nic-viewport {
    isolation: isolate;
}

.nic-fx-coverflow .nic-track {
    padding-inline: calc((100cqw - var(--nic-slide-w)) / 2);
}

.nic-fx-coverflow .nic-slide {
    position: relative;
    scroll-snap-align: center;
}

.nic-fx-coverflow .nic-figure {
    transform-origin: center;
    will-change: transform;
}

.nic-notice {
    padding: 12px 16px;
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

/* Lightbox (a native <dialog>) */

.nic-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(2, 6, 23, 0.94);
    color: #fff;
}

.nic-lightbox[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nic-lightbox::backdrop {
    background: transparent;
}

.nic-lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    margin: 0;
    padding: 0 72px;
}

.nic-lightbox-figure img {
    display: block;
    max-width: min(1400px, 100%);
    max-height: calc(100dvh - 150px);
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.45));
}

.nic-lightbox-caption {
    min-height: 1.5em;
    margin: 14px 0 0;
    color: #e2e8f0;
    font-size: 15px;
    text-align: center;
}

.nic-lightbox-counter {
    position: absolute;
    top: 22px;
    left: 24px;
    color: #cbd5e1;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.nic-lightbox button {
    appearance: none;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.nic-lightbox button:hover,
.nic-lightbox button:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    outline: none;
}

.nic-lightbox button svg {
    width: 1em;
    height: 1em;
}

.nic-lightbox .nic-lb-close {
    top: 14px;
    right: 16px;
}

.nic-lightbox .nic-lb-prev {
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
}

.nic-lightbox .nic-lb-next {
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
}

.nic-lightbox.is-single .nic-lb-prev,
.nic-lightbox.is-single .nic-lb-next,
.nic-lightbox.is-single .nic-lightbox-counter {
    display: none;
}

@media (max-width: 767px) {
    .nic-lightbox-figure {
        padding: 0 12px;
    }

    .nic-lightbox .nic-lb-prev,
    .nic-lightbox .nic-lb-next {
        top: auto;
        bottom: 18px;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nic-media,
    .nic-media img,
    .nic .nic-dot,
    .nic-progress span {
        transition: none;
    }

    .nic-hover-zoom .nic-slide:hover .nic-media img,
    .nic-hover-lift .nic-slide:hover .nic-media {
        transform: none;
    }

    /* Effects become a quick, motion-free crossfade. */
    .nic-paged .nic-slide,
    .nic-paged .nic-slide.is-active,
    .nic-paged .nic-slide.is-leaving {
        transform: none;
        filter: none;
        transition-duration: 0.2s, 0s, 0s, 0s;
        transition-delay: 0s;
    }

    .nic-kenburns .nic-slide.is-active .nic-media img {
        animation: none;
    }

    /* No auto-scrolling ticker: let visitors scroll it themselves. */
    .nic-mode-marquee .nic-viewport {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }
}
