/* Shared media carousel: news detail and product detail. BEM/rem. */

.media-carousel {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 0.25rem; /* 4px */
    background: #eef2f6;
}

.media-carousel__frame {
    width: 100%;
    overflow: hidden;
    background: #eef2f6;
}

.media-carousel--news .media-carousel__frame {
    aspect-ratio: 4 / 3;
}

.media-carousel--product .media-carousel__frame {
    aspect-ratio: 4 / 3;
    background: #ffffff;
}

.media-carousel__track {
    display: flex;
    height: 100%;
    transition: transform 0.45s ease;
    will-change: transform;
}

.media-carousel__slide {
    position: relative;
    flex: 0 0 100%;
    min-width: 0;
    height: 100%;
}

.media-carousel__link,
.media-carousel__slide img,
.media-carousel__slide video {
    display: block;
    width: 100%;
    height: 100%;
}

.media-carousel__slide img {
    object-fit: cover;
}

.media-carousel--product .media-carousel__slide img {
    object-fit: contain;
}

.media-carousel__slide video {
    background: #000000;
    object-fit: contain;
}

/* Clickable video area: opens the full-size video lightbox; leaves the native control bar usable. */
.media-carousel__video-open {
    position: absolute;
    inset: 0 0 3rem 0; /* 48px for native video controls */
    z-index: 1;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.media-carousel__video-open-icon {
    position: absolute;
    top: 0.75rem; /* 12px */
    left: 0.75rem; /* 12px */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem; /* 32px */
    height: 2rem; /* 32px */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #004f9f;
    box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.18);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.media-carousel__video-open:hover .media-carousel__video-open-icon,
.media-carousel__video-open:focus-visible .media-carousel__video-open-icon {
    opacity: 1;
}

.media-carousel__video-open:focus-visible {
    outline: 2px solid #004f9f;
    outline-offset: -4px;
}

.media-carousel__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem; /* 38px */
    height: 2.375rem; /* 38px */
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    color: #004f9f;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.18);
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.5;
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
}

.media-carousel__arrow--prev {
    left: 0.75rem; /* 12px */
}

.media-carousel__arrow--next {
    right: 0.75rem; /* 12px */
}

.media-carousel__arrow span {
    display: block;
}

.media-carousel__arrow--prev span {
    transform: translate(var(--arrow-carousel-prev-x), var(--arrow-carousel-prev-y));
}

.media-carousel__arrow--next span {
    transform: translate(var(--arrow-carousel-next-x), var(--arrow-carousel-next-y));
}

.media-carousel__arrow:hover,
.media-carousel__arrow:focus-visible {
    opacity: 1;
}

.media-carousel__arrow:focus-visible {
    outline: 2px solid #004f9f;
    outline-offset: 2px;
}

.media-carousel__counter {
    position: absolute;
    right: 0.75rem; /* 12px */
    bottom: 0.75rem; /* 12px */
    z-index: 2;
    padding: 0.3125rem 0.625rem; /* 5px 10px */
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font-size: 0.75rem; /* 12px */
    line-height: 1.2;
    pointer-events: none;
}

/* Keep the counter clear of the native video controls at the bottom. */
.media-carousel[data-active-type="video"] .media-carousel__counter {
    top: 0.75rem; /* 12px */
    bottom: auto;
}

.media-carousel:focus-visible {
    outline: 2px solid #004f9f;
    outline-offset: 2px;
}

@media (max-width: 42.5rem) { /* 680px */
    .media-carousel__arrow {
        display: none;
    }

    .media-carousel {
        border-radius: 0;
    }
}

@media (pointer: coarse) {
    .media-carousel__arrow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .media-carousel__track {
        transition: none;
    }
}
