/* Screenshots carousel at the top of jeux reviews (NEX-21336). Behaviour modelled on the TopEndSports
   screenshot slider, colours from the jeux design tokens (fallbacks = their current values). Layout knobs
   for the designers: --jx-carousel-per-view, --jx-carousel-gap, --jx-carousel-ratio. */

.jx-carousel {
    --jx-carousel-per-view: 2.38;
    --jx-carousel-gap: 20px;
    --jx-carousel-ratio: 500 / 264;
    --jx-carousel-radius: var(--border-radius-xl, 16px);
    --jx-carousel-accent: var(--action-primary, #15101F);
    --jx-carousel-accent-hover: var(--action-primary-hover, #342E47);
    --jx-carousel-muted: var(--neutral-200, #D8D5E3);
    --jx-carousel-text: var(--text-secondary, #342E47);
    --jx-carousel-focus: var(--blue-500, #0071FF);
}

.jx-carousel .jx-carousel__viewport {
    overflow: hidden;
    touch-action: pan-y;
}

.jx-carousel .jx-carousel__track {
    display: flex;
    gap: var(--jx-carousel-gap);
    margin: 0;
    padding: 0;
    list-style: none;
    transition: transform 400ms cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform;
}

.jx-carousel.is-dragging .jx-carousel__track,
.jx-carousel.is-resizing .jx-carousel__track {
    transition: none;
}

.jx-carousel .jx-carousel__slide {
    flex: 0 0 calc((100% - (var(--jx-carousel-per-view) - 1) * var(--jx-carousel-gap)) / var(--jx-carousel-per-view));
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.jx-carousel .jx-carousel__slide::before,
.jx-carousel .jx-carousel__slide::marker {
    content: none;
}

.jx-carousel__figure {
    margin: 0;
}

.jx-carousel__frame {
    position: relative;
    aspect-ratio: var(--jx-carousel-ratio);
    border-radius: var(--jx-carousel-radius);
    overflow: hidden;
    background: var(--jx-carousel-muted);
}

.jx-carousel__link {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-user-drag: none;
}

.jx-carousel__link picture {
    display: contents;
}

/* more specific than the site-wide "a.rbo-widget.rbo-widget-tl img { height: auto }": the image must fill
   the frame whatever its own proportions (a wide banner would otherwise sit at the top of a grey frame) */
.jx-carousel .jx-carousel__frame .jx-carousel__link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    -webkit-user-drag: none;
    user-select: none;
}

.jx-carousel__expand {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 0;
    z-index: 2;
}

.jx-carousel__expand svg {
    width: 100%;
    height: 100%;
    display: block;
}

.jx-carousel__frame:hover .jx-carousel__expand,
.jx-carousel__expand:focus-visible {
    --jx-expand-bg: #404040;
    --jx-expand-bg-opacity: 1;
}

.jx-carousel__caption {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    color: var(--jx-carousel-text);
}

.jx-carousel__controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.jx-carousel__controls[hidden] {
    display: none;
}

.jx-carousel__arrow {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--jx-carousel-accent);
    border-radius: 50%;
    background: var(--neutral-0, #FFFFFF);
    color: var(--jx-carousel-accent);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.jx-carousel__arrow:hover:not([disabled]) {
    background: var(--jx-carousel-accent);
    color: var(--neutral-0, #FFFFFF);
}

.jx-carousel__arrow[disabled] {
    border-color: var(--jx-carousel-muted);
    color: var(--text-tertiary, #615B82);
    opacity: 0.5;
    cursor: default;
}

.jx-carousel__dots {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* 20px tap target around an 8px dot */
.jx-carousel__dot {
    position: relative;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.jx-carousel__dot::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--jx-carousel-muted);
    transition: background-color 0.2s;
}

.jx-carousel__dot[aria-current="true"]::before {
    background: var(--jx-carousel-accent);
}

.jx-carousel__arrow:focus-visible,
.jx-carousel__dot:focus-visible,
.jx-carousel__expand:focus-visible,
.jx-carousel__link:focus-visible {
    outline: 2px solid var(--jx-carousel-focus);
    outline-offset: 2px;
}

@media (max-width: 1023px) {
    .jx-carousel {
        --jx-carousel-per-view: 2.47;
        --jx-carousel-gap: 15px;
        --jx-carousel-ratio: 270 / 142;
        --jx-carousel-radius: var(--border-radius-lg, 8px);
    }
}

@media (max-width: 767px) {
    .jx-carousel {
        --jx-carousel-per-view: 1.42;
    }

    .jx-carousel__controls {
        margin-top: 16px;
    }

    /* Phone images (optional, per slide): like TopEndSports, one slide per view, and a slide that has one takes
       that image's own proportions (usually a portrait screenshot) instead of the landscape frame. */
    .jx-carousel.jx-carousel--phone-images {
        --jx-carousel-per-view: 1;
    }

    .jx-carousel.jx-carousel--phone-images .jx-carousel__track {
        align-items: flex-start;
    }

    .jx-carousel .jx-carousel__slide--phone-image .jx-carousel__frame {
        aspect-ratio: var(--jx-slide-ratio-phone, var(--jx-carousel-ratio));
    }

    /* a portrait slide stays phone-sized: never wider than 340px (TopEndSports ~335px) nor taller than 60% of
       the screen, so on wider phones / small tablets it does not grow with the width; the next one peeks in */
    .jx-carousel .jx-carousel__slide--phone-image {
        flex-basis: min(100%, 340px, calc(60vh * var(--jx-slide-ratio-phone, 9 / 16)));
        flex-basis: min(100%, 340px, calc(60svh * var(--jx-slide-ratio-phone, 9 / 16)));
    }
}

/* Fullscreen slider */

body.jx-carousel-open {
    overflow: hidden;
}

.jx-carousel-overlay {
    --jx-overlay-pad: 80px;
    --jx-overlay-gap: 35px;
    --jx-overlay-peek-scale: 0.4508;
    --jx-overlay-ratio: 16 / 9;
    --jx-overlay-bg: var(--neutral-950, #15101F);
    --jx-overlay-img-bg: var(--neutral-900, #221C31);
    --jx-overlay-dot: var(--neutral-0, #FFFFFF);
    --jx-overlay-accent: var(--green-400, #00D18C);
    /* pinned to the four edges: always covers the whole screen. A fixed 100dvh height was shorter than the
       screen when the browser shows its toolbar (and in devtools mobile emulation), letting the page show below. */
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 0 calc(40px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow: hidden;
    background: var(--jx-overlay-bg);
    color: var(--neutral-0, #FFFFFF);
    opacity: 0;
    transition: opacity 0.3s;
}

.jx-carousel-overlay[hidden] {
    display: none;
}

.jx-carousel-overlay.is-visible {
    opacity: 1;
}

.jx-carousel-overlay__close {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--neutral-0, #FFFFFF);
    cursor: pointer;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.jx-carousel-overlay__close:hover {
    opacity: 0.7;
}

/* 40px tap target, 18px cross */
.jx-carousel-overlay__close svg {
    width: 18px;
    height: 18px;
}

.jx-carousel-overlay__inner {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 var(--jx-overlay-pad);
    box-sizing: border-box;
}

.jx-carousel-overlay__viewport {
    touch-action: pan-y;
}

.jx-carousel-overlay__track {
    display: flex;
    align-items: center;
    gap: var(--jx-overlay-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.jx-carousel-overlay__slide {
    /* as wide as the column allows, but never taller than the screen leaves room for */
    flex: 0 0 min(100%, calc((100dvh - 260px) * (var(--jx-overlay-ratio))));
    margin: 0;
    padding: 0;
    list-style: none;
    transform-origin: right center;
    cursor: pointer;
}

.jx-carousel-overlay__slide.is-current ~ .jx-carousel-overlay__slide {
    transform-origin: left center;
}

.jx-carousel-overlay__slide:not(.is-current) {
    transform: scale(var(--jx-overlay-peek-scale));
}

.jx-carousel-overlay__slide.is-current {
    cursor: default;
}

.jx-carousel-overlay.is-animated .jx-carousel-overlay__track,
.jx-carousel-overlay.is-animated .jx-carousel-overlay__slide {
    transition: transform 400ms cubic-bezier(0.165, 0.84, 0.44, 1);
}

.jx-carousel-overlay.is-dragging .jx-carousel-overlay__track {
    transition: none;
}

.jx-carousel-overlay__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--jx-overlay-ratio);
    object-fit: contain;
    border: 1px solid var(--neutral-0, #FFFFFF);
    border-radius: var(--border-radius-xl, 16px);
    background: var(--jx-overlay-img-bg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    box-sizing: border-box;
    -webkit-user-drag: none;
    user-select: none;
}

.jx-carousel-overlay__captions {
    display: grid;
    margin-top: 20px;
}

.jx-carousel-overlay .jx-carousel-overlay__caption {
    grid-area: 1 / 1;
    margin: 0;
    color: var(--neutral-0, #FFFFFF);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.jx-carousel-overlay .jx-carousel-overlay__caption.is-active {
    opacity: 1;
    visibility: visible;
}

.jx-carousel-overlay__controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
}

.jx-carousel-overlay__controls[hidden] {
    display: none;
}

.jx-carousel-overlay__arrow {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -8px;
    padding: 8px;
    border: 0;
    background: none;
    color: var(--neutral-0, #FFFFFF);
    cursor: pointer;
    transition: opacity 0.2s;
}

.jx-carousel-overlay__arrow:hover:not([disabled]) {
    opacity: 0.7;
}

.jx-carousel-overlay__arrow[disabled] {
    opacity: 0.3;
    cursor: default;
}

.jx-carousel-overlay__dots {
    display: flex;
    align-items: center;
    gap: 0;
}

.jx-carousel-overlay__dot {
    position: relative;
    width: 19px;
    height: 19px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.jx-carousel-overlay__dot::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: var(--jx-overlay-dot);
    transition: background-color 0.2s;
}

.jx-carousel-overlay__dot[aria-current="true"]::before {
    background: var(--jx-overlay-accent);
}

.jx-carousel-overlay button:focus-visible {
    outline: 2px solid var(--jx-overlay-accent);
    outline-offset: 2px;
}

@media (max-width: 1023px) {
    .jx-carousel-overlay {
        --jx-overlay-pad: 60px;
        --jx-overlay-gap: 20px;
        --jx-overlay-peek-scale: 0.7846;
    }

    .jx-carousel-overlay__img {
        border-radius: var(--border-radius-lg, 8px);
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    }

    .jx-carousel-overlay__slide:not(.is-current) .jx-carousel-overlay__img {
        box-shadow: none;
    }

    .jx-carousel-overlay .jx-carousel-overlay__caption {
        font-size: 16px;
    }

    /* swipe or tap the peeking screenshot on touch screens; the dots stay as a position indicator */
    .jx-carousel-overlay__arrow {
        display: none;
    }
}

@media (max-width: 767px) {
    .jx-carousel-overlay {
        --jx-overlay-pad: 40px;
        --jx-overlay-peek-scale: 0.8;
    }

    .jx-carousel-overlay__close svg {
        width: 16px;
        height: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jx-carousel .jx-carousel__track,
    .jx-carousel-overlay,
    .jx-carousel-overlay.is-animated .jx-carousel-overlay__track,
    .jx-carousel-overlay.is-animated .jx-carousel-overlay__slide {
        transition: none;
    }
}

/* Themes: one block per template using the carousel (data-theme on the block and on its fullscreen overlay).
   jeux uses the defaults above (its design tokens). */

/* jeux-gratuits.com — colours of templates/jg/css/jg-review.css. No side padding: the slides line up with the
   review card above and the article text below (the old brand images row was indented by 16px). */
.jx-carousel[data-theme="jg"] {
    --jx-carousel-radius: 10px;
    --jx-carousel-accent: #2c3e50;
    --jx-carousel-accent-hover: #16384a;
    --jx-carousel-muted: #e4e9f0;
    --jx-carousel-text: #34495e;
    --jx-carousel-focus: #1e83b4;
    margin: 16px 0 22px;
}

.jx-carousel-overlay[data-theme="jg"] {
    --jx-overlay-bg: #16384a;
    --jx-overlay-img-bg: #2c3e50;
    --jx-overlay-dot: rgba(255, 255, 255, .45);
    --jx-overlay-accent: #FFFFFF;
}
