/**
 * Exakt Banner Slider — auto-rotating image slideshow.
 *
 * Shares the .exakt-slider-* / .exakt-slide class names with the product slider so
 * the same JS engine drives it and the theme's exakt_slider_* Customizer colours
 * still land. Self-contained otherwise: this file is enqueued on its own, so it
 * must not rely on product-slider.css being present.
 *
 * @package exakt-slider
 * @since   0.2.0
 */

.exakt-banner-slider {
    --exakt-banner-height: 62vh;
    position: relative;
    width: 100%;
    outline: none;
}

.exakt-banner-slider .exakt-slider-section-title {
    text-align: center;
    margin: 0 0 18px;
}

/* Progress bar ------------------------------------------------------------ */

/* v0.2.2 - the timer is overlaid on the bottom edge of the artwork.
   It previously sat in normal flow above .exakt-slider-main, so on a page where
   the slider is the first section it rendered as a stray dark rule directly
   under the site header, visually unrelated to the slider it belonged to. */
.exakt-banner-slider .exakt-slider-progress-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    z-index: 3;
    /* Sits on photography, so the trough is a wash of the image rather than a
       solid colour that would band against it. */
    background: rgba(255, 255, 255, .28);
    overflow: hidden;
    pointer-events: none;
}

.exakt-banner-slider .exakt-slider-progress-fill {
    height: 100%;
    width: 100%;
    /* The BUTTON colour, not the arrow colour: the arrow background carries the
       arrow's opacity and is deliberately washed out, which made the timer
       almost invisible against a light photograph. */
    background: var(--exakt-slider-btn-bg, #303030);
    transform-origin: left center;
    /* v0.2.3 - parked empty until the engine says a slide is running. */
    transform: scaleX(0);
}

/* v0.2.3 - the fill is driven by the .running class the engine already toggles
   in restartProgressBar(), exactly as product-slider.css does.

   It used to animate unconditionally with animation-iteration-count:infinite,
   which meant the bar ran on its own private loop with no connection to the
   slide actually on screen: clicking an arrow, hovering to pause, or any drift
   between the CSS duration and the JS timer left the fill showing one thing
   while the slider showed another. iteration-count:1 + forwards holds it full
   at the end of a slide instead of snapping back to empty. */
.exakt-banner-slider .exakt-slider-progress-fill.running {
    animation-name: exakt-banner-progress;
    animation-timing-function: linear;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
}

@keyframes exakt-banner-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Track: every slide stacked in one grid cell, cross-faded ----------------- */

.exakt-banner-slider .exakt-slider-track-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.exakt-banner-slider .exakt-slider-track {
    display: grid;
    grid-template-rows: auto;
    grid-template-columns: 1fr;
}

.exakt-banner-slider .exakt-slide {
    grid-row: 1;
    grid-column: 1;
    position: relative;
    width: 100%;
    height: var(--exakt-banner-height);
    min-height: 320px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .6s ease;
    z-index: 1;
}

.exakt-banner-slider .exakt-slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.exakt-banner-slider .exakt-slide-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.exakt-banner-slider .exakt-slide-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}


/* A ratio sizes the slide to the artwork instead of a fixed height, so a wide
   banner with its wording baked in is never cropped. */
.exakt-banner-slider[data-ratio="true"] .exakt-slide {
    height: auto;
    min-height: 0;
    aspect-ratio: var(--exakt-banner-ratio, 20 / 9);
}

/* v0.2.1 - !important is REQUIRED here, not sloppiness.
   The banner slider deliberately reuses the .exakt-slide-* classes so the existing
   product-slider.js engine can drive it, which also means it inherits
   product-slider.css's `.exakt-slide-bg img { object-fit: contain !important }`.
   Greater specificity does NOT beat !important, so `fit="cover"` was silently
   ignored and every banner rendered letterboxed. */
.exakt-banner-slider .exakt-slide-bg img {
    object-fit: var(--exakt-banner-fit, cover) !important;
}

/* Whole-slide link (image-only banners). */
.exakt-banner-slider .exakt-slide-link {
    position: absolute;
    inset: 0;
    display: block;
    z-index: 3;
}

/* Copy over the image ----------------------------------------------------- */

.exakt-banner-slider .exakt-slide-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: clamp(20px, 5vw, 60px);
    max-width: 640px;
}

/* v0.2.4-nolz - `right` and `width` are NOT optional here. The base rule sets
   `inset: 0`, i.e. left:0 AND right:0; overriding only `left` to 50% leaves
   right:0 standing, so the copy box spanned from the middle of the slide to its
   right edge - HALF the slider - and was then translated back by half its own
   width. On a desktop that half came to ~632px, just under the 640px cap, so it
   looked deliberate. On a 355px phone it resolved to 178px and the tagline
   overflowed its own translucent panel onto the photograph. */
.exakt-banner-slider .exakt-slide-content--center {
    left: 50%;
    right: auto;
    width: 100%;
    transform: translateX(-50%);
    align-items: center;
    text-align: center;
}

.exakt-banner-slider .exakt-slide-content--right {
    left: auto;
    right: 0;
    align-items: flex-end;
    text-align: right;
}

/* The copy sits on a TRANSLUCENT panel, never a solid one - the photograph is
   the point of a banner and a solid block would hide it. Matches the hero rule
   used across exakt builds. */
.exakt-banner-slider .exakt-slide-title,
.exakt-banner-slider .exakt-slide-text {
    background: rgba(35, 31, 32, .72);
    color: #fff;
    margin: 0;
    padding: 10px 16px;
    max-width: 100%;
}

.exakt-banner-slider .exakt-slide-title {
    font-size: clamp(22px, 3.4vw, 40px);
    line-height: 1.15;
}

.exakt-banner-slider .exakt-slide-text {
    font-size: clamp(14px, 1.4vw, 17px);
    line-height: 1.55;
}

.exakt-banner-slider .exakt-slide-button {
    display: inline-block;
    background: var(--exakt-slider-btn-bg, #E61577);
    color: var(--exakt-slider-btn-color, #fff);
    padding: 13px 28px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.exakt-banner-slider .exakt-slide-button:hover,
.exakt-banner-slider .exakt-slide-button:focus {
    background: var(--exakt-slider-btn-hover-bg, #303030);
    color: var(--exakt-slider-btn-hover-color, #fff);
}

/* Arrows ------------------------------------------------------------------ */

.exakt-banner-slider .exakt-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    cursor: pointer;
    background: var(--exakt-slider-arrow-bg, rgba(48, 48, 48, .8));
    color: var(--exakt-slider-arrow-color, #fff);
    transition: background .2s ease, opacity .2s ease;
}

.exakt-banner-slider .exakt-slider-arrow:hover,
.exakt-banner-slider .exakt-slider-arrow:focus-visible {
    background: var(--exakt-slider-btn-bg, #E61577);
}

.exakt-banner-slider .exakt-slider-arrow svg { width: 22px; height: 22px; }
.exakt-banner-slider .exakt-slider-prev { left: 14px; }
.exakt-banner-slider .exakt-slider-next { right: 14px; }

/* Dots -------------------------------------------------------------------- */

.exakt-banner-slider .exakt-slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    /* v0.2.2 - was 14px, which left the dots crowded against the bottom of
       the artwork and against whatever section follows. */
    padding: 24px 0 4px;
}

.exakt-banner-slider .exakt-slider-thumb {
    width: 11px;
    height: 11px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(48, 48, 48, .28);
    transition: background .2s ease, transform .2s ease;
}

.exakt-banner-slider .exakt-slider-thumb.is-active {
    background: var(--exakt-slider-btn-bg, #E61577);
    transform: scale(1.25);
}

.exakt-banner-slider .exakt-slider-thumb:focus-visible {
    outline: 2px solid var(--exakt-slider-btn-bg, #E61577);
    outline-offset: 3px;
}

/* Motion + small screens -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .exakt-banner-slider .exakt-slide { transition: none; }
    .exakt-banner-slider .exakt-slider-progress-fill,
    .exakt-banner-slider .exakt-slider-progress-fill.running { animation: none; transform: scaleX(1); }
}

@media (max-width: 768px) {
    .exakt-banner-slider {
        --exakt-banner-height: 46vh;
    }
    .exakt-banner-slider .exakt-slide-content {
        max-width: 100%;
        padding: 18px;
    }
    .exakt-banner-slider .exakt-slider-arrow { width: 36px; height: 36px; }
    .exakt-banner-slider .exakt-slider-prev { left: 6px; }
    .exakt-banner-slider .exakt-slider-next { right: 6px; }
}
