/* ==========================================================================
   toyota-sports-static.css
   Supplemental styles for the vanilla-JS conversion of the Toyota Sports
   page. This file ONLY adds what clientlib-base.css / clientlib-
   brand-toyota-sports.css do not already provide: the custom video/image
   lightbox (replacing lightGallery), the hand-rolled carousel transform
   logic (replacing Swiper), focus-visible states and reduced-motion
   guards. Everything else (layout, typography, colors, offcanvas,
   masthead animation, parallax) is intentionally left to the two
   original stylesheets so the page keeps its original look.
   ========================================================================== */

/* ---------- Carousel (vanilla replacement for Swiper) ---------- */
.swiper-container .swiper-wrapper {
    display: flex;
    will-change: transform;
    transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}

.swiper-container .swiper-slide {
    flex: 0 0 100%;
    width: 100%;
}

.cpl-carousel-gallery-thumbs .swiper-slide {
    flex: 0 0 auto;
    width: 96px;
    margin-right: .5rem;
    cursor: pointer;
    opacity: .5;
    transition: opacity .25s ease;
}

.cpl-carousel-gallery-thumbs .swiper-slide.swiper-slide-active,
.cpl-carousel-gallery-thumbs .swiper-slide:hover,
.cpl-carousel-gallery-thumbs .swiper-slide:focus-visible {
    opacity: 1;
}

.cpl-carousel-gallery-thumbs .swiper-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.cpl-carousel-gallery .swiper-button-prev,
.cpl-carousel-gallery .swiper-button-next {
    cursor: pointer;
    background-color: transparent;
    border: 0;
    padding: 0;
}

.cpl-carousel-gallery .swiper-pagination-bullet {
    cursor: pointer;
}

/* Athlete profile detail rows (Date of birth / Nationality / Sport / etc.).
   Uses <div> rather than <p> because one row's content (Recent
   Achievements) legitimately contains its own <p>, and <p> cannot be
   nested inside <p> per the HTML spec. Mirrors the original p spacing. */
.cpl-profile-row:not(:last-of-type) {
    margin-bottom: .5rem;
}

.cpl-lazy {
    opacity: .5;
    transition: opacity .25s ease, transform .25s ease;
}

.cpl-lazy.loaded {
    opacity: 1;
}

/* ---------- Video / Image lightbox (vanilla replacement for lightGallery) ---------- */
.cpl-video-modal,
.cpl-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .35s ease;
}

.cpl-video-modal.cpl-active,
.cpl-image-lightbox.cpl-active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.cpl-video-modal--backdrop,
.cpl-image-lightbox--backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 10, 10, .92);
    cursor: pointer;
}

.cpl-video-modal--dialog {
    position: relative;
    width: min(1120px, 92vw);
    max-width: 1120px;
    z-index: 1;
    transform: scale(.94);
    opacity: 0;
    transition: transform .35s ease, opacity .35s ease;
}

.cpl-video-modal.cpl-active .cpl-video-modal--dialog {
    transform: scale(1);
    opacity: 1;
}

.cpl-video-modal--frame {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
}

.cpl-video-modal--frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.cpl-video-modal--close {
    position: absolute;
    top: -48px;
    right: 0;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
}

/* Right-edge vertical toolbar: close / zoom-in / zoom-out, stacked. */
.cpl-image-lightbox--toolbar {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cpl-image-lightbox--close,
.cpl-image-lightbox--zoom-in,
.cpl-image-lightbox--zoom-out {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background-color .2s ease;
}

.cpl-image-lightbox--close {
    margin-bottom: 6px;
}

.cpl-image-lightbox--close:hover,
.cpl-image-lightbox--zoom-in:hover,
.cpl-image-lightbox--zoom-out:hover {
    background-color: rgba(255, 255, 255, .15);
}

.cpl-image-lightbox--zoom-in:disabled,
.cpl-image-lightbox--zoom-out:disabled {
    opacity: .35;
    cursor: default;
    background-color: transparent;
}

.cpl-image-lightbox--zoom-reset {
    min-width: 40px;
    height: 24px;
    padding: 0 6px;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, .75);
    font-size: .7rem;
    letter-spacing: .02em;
    cursor: pointer;
    text-align: center;
}

.cpl-image-lightbox--zoom-reset:hover {
    color: #fff;
    text-decoration: underline;
}

.cpl-image-lightbox--viewport {
    position: relative;
    width: 92vw;
    height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
    touch-action: none;
    cursor: zoom-in;
}

.cpl-image-lightbox--viewport.cpl-zoomed {
    cursor: grab;
}

.cpl-image-lightbox--viewport.cpl-panning {
    cursor: grabbing;
}

.cpl-image-lightbox-img,
#cpl-image-lightbox-img {
    max-width: 92vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    opacity: 0;
    transform: scale(.96);
    transition: transform .35s ease, opacity .35s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.cpl-image-lightbox.cpl-active #cpl-image-lightbox-img {
    opacity: 1;
    transform: scale(1);
}

.cpl-image-lightbox--viewport.cpl-zoomed #cpl-image-lightbox-img,
.cpl-image-lightbox--viewport.cpl-panning #cpl-image-lightbox-img {
    transition: none;
}

/* ---------- Focus visibility (accessibility) ---------- */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #eb0a1e;
    outline-offset: 2px;
}

.cpl-offcanvas:not(.cpl-opened) a,
.cpl-offcanvas:not(.cpl-opened) button {
    visibility: hidden;
}

/* Masthead "scroll down" cue: fade out once scrolled past the top,
   reproducing the original site's headroom-based hide behavior (see
   initScrollCue() in toyota-sports.js). */
.cpl-cta--scroll-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }

    .cpl-parallax {
        transform: none !important;
    }
}
