/**
 * Top Products Slideshow Styles
 *
 * Professional full-width slideshow with background images, timer, and slide count.
 *
 * @package AccrueKit
 * @version 2.1.0
 */

/* Wrapper: keeps slideshow within the shortcode's container (no viewport breakout).
   Override theme full-bleed/hero negative margins so the slideshow does not extend above the header. */
.vm-accruekit-slideshow-wrap {
    display: block;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    margin-top: 0 !important; /* Prevent theme from pulling slideshow under nav */
    z-index: 0; /* Stay below fixed/sticky header stacking context */
}

/* Slideshow Container - No borders, shadows, or radius. Stays within wrapper. */
.vm-accruekit-slideshow {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    background: #000;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    contain: layout;
    z-index: auto;
}

.vm-accruekit-slideshow__container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 50%; /* 2:1 aspect ratio for professional look */
    overflow: hidden;
}

/* When shortcode height= is set, kill aspect-ratio padding in all breakpoints so inline height on container is the only height */
.vm-accruekit-slideshow--fixed-height .vm-accruekit-slideshow__container {
    padding-bottom: 0 !important;
}

.vm-accruekit-slideshow__track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slide - Background images fill the space */
.vm-accruekit-slideshow__slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.vm-accruekit-slideshow__slide.is-active {
    opacity: 1;
    visibility: visible;
}

/* Side-by-side background images */
.vm-accruekit-slideshow__background-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
}

.vm-accruekit-slideshow__bg-image {
    flex: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.vm-accruekit-slideshow__bg-image--primary {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.vm-accruekit-slideshow__bg-image--secondary {
    /* Secondary image on the right */
}

/* Overlay for text readability */
.vm-accruekit-slideshow__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.5) 100%);
    z-index: 1;
}

.vm-accruekit-slideshow__slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    padding: 4rem 6rem;
    z-index: 2;
}

/* Content */
.vm-accruekit-slideshow__content {
    max-width: 600px;
    color: #fff;
}

.vm-accruekit-slideshow__title {
    margin: 0 0 clamp(1rem, 4vw, 2rem) 0;
}

.vm-accruekit-slideshow__title-text {
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    color: #fff !important;
    text-shadow: 
        0 0 10px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: -0.02em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.vm-accruekit-slideshow__actions {
    margin-top: 1.5rem;
}

.vm-accruekit-slideshow__button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: #fff;
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: none;
    max-width: 100%;
    box-sizing: border-box;
}

.vm-accruekit-slideshow__button:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Navigation Controls */
.vm-accruekit-slideshow__controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    pointer-events: none;
    z-index: 10;
}

/* Hide arrows on touch devices - use swipe gestures instead */
@media (hover: none) and (pointer: coarse) {
    .vm-accruekit-slideshow__controls {
        display: none;
    }
}

.vm-accruekit-slideshow__prev,
.vm-accruekit-slideshow__next {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    color: #000;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.vm-accruekit-slideshow__prev:hover,
.vm-accruekit-slideshow__next:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vm-accruekit-slideshow__prev:active,
.vm-accruekit-slideshow__next:active {
    transform: scale(0.95);
}

/* Footer with Slide Count and Timer */
.vm-accruekit-slideshow__footer {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 10;
}

.vm-accruekit-slideshow__slide-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    padding: clamp(0.375rem, 1.5vw, 0.5rem) clamp(0.875rem, 3vw, 1.25rem);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: clamp(0.75rem, 2vw, 1rem);
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vm-accruekit-slideshow__current-slide {
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
}

.vm-accruekit-slideshow__slide-separator {
    opacity: 0.7;
}

.vm-accruekit-slideshow__total-slides {
    opacity: 0.7;
}

/* Timer */
.vm-accruekit-slideshow__timer {
    position: relative;
    width: clamp(40px, 8vw, 64px);
    height: clamp(40px, 8vw, 64px);
}

.vm-accruekit-slideshow__timer-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.vm-accruekit-slideshow__timer-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 4;
}

/* Translucent ring (always visible underneath) */
.vm-accruekit-slideshow__timer-ring-translucent {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 4;
}

/* Solid white ring that animates to reveal translucent ring */
.vm-accruekit-slideshow__timer-ring-progress {
    fill: none;
    stroke: #fff;
    stroke-width: 4;
    stroke-opacity: 1;
    stroke-dasharray: 81.68;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    transform-origin: center;
    transition: stroke-dashoffset 0.1s linear;
}

/* Responsive stroke-width adjustments */
@media (max-width: 768px) {
    .vm-accruekit-slideshow__timer-ring-bg,
    .vm-accruekit-slideshow__timer-ring-translucent,
    .vm-accruekit-slideshow__timer-ring-progress {
        stroke-width: 3;
    }
}

@media (max-width: 480px) {
    .vm-accruekit-slideshow__timer-ring-bg,
    .vm-accruekit-slideshow__timer-ring-translucent,
    .vm-accruekit-slideshow__timer-ring-progress {
        stroke-width: 2.5;
    }
}

/* Animate the solid white ring to reveal translucent ring underneath */
/* Animation is applied via JavaScript with dynamic duration */
.vm-accruekit-slideshow.is-playing .vm-accruekit-slideshow__timer-ring-progress {
    animation-fill-mode: forwards;
}

.vm-accruekit-slideshow.is-paused .vm-accruekit-slideshow__timer-ring-progress {
    animation-play-state: paused;
}

@keyframes timer-ring-reveal {
    0% {
        stroke-dashoffset: 0;
        stroke-opacity: 1;
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 81.68;
        stroke-opacity: 0.2;
        opacity: 0.2;
    }
}

.vm-accruekit-slideshow__timer-display {
    display: none;
}

.vm-accruekit-slideshow__timer-toggle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(20px, 4vw, 32px);
    height: clamp(20px, 4vw, 32px);
    background: #fff;
    border: 2px solid #000;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
    font-size: clamp(0.5rem, 1vw, 0.75rem);
    color: #000;
    z-index: 2;
}

.vm-accruekit-slideshow__timer-toggle:hover {
    background: #f5f5f5;
    transform: translate(-50%, -50%) scale(1.1);
}

.vm-accruekit-slideshow__timer-icon {
    display: none;
    line-height: 1;
    font-size: 0.625rem;
}

.vm-accruekit-slideshow.is-playing .vm-accruekit-slideshow__timer-icon--pause {
    display: block;
}

.vm-accruekit-slideshow.is-paused .vm-accruekit-slideshow__timer-icon--play {
    display: block;
}

.vm-accruekit-slideshow.is-playing .vm-accruekit-slideshow__timer-icon--play {
    display: none;
}

.vm-accruekit-slideshow.is-paused .vm-accruekit-slideshow__timer-icon--pause {
    display: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .vm-accruekit-slideshow__container {
        padding-bottom: 60%;
    }
    
    .vm-accruekit-slideshow__slide-inner {
        padding: 3rem 4rem;
    }
}

@media (max-width: 768px) {
    .vm-accruekit-slideshow__container {
        padding-bottom: 75%;
    }
    
    /* Single main product image on mobile; hide secondary */
    .vm-accruekit-slideshow__bg-image--secondary {
        display: none;
    }
    .vm-accruekit-slideshow__bg-image--primary {
        flex: 1 1 100%;
        width: 100%;
        border-right: none;
    }
    
    .vm-accruekit-slideshow__slide-inner {
        padding: 2rem;
    }
    
    .vm-accruekit-slideshow__title {
        margin-bottom: 1rem;
    }
    
    .vm-accruekit-slideshow .vm-accruekit-slideshow__title-text {
        font-size: clamp(0.75rem, 2.5vw, 1.75rem) !important;
        line-height: 1.3 !important;
    }
    
    .vm-accruekit-slideshow__button {
        padding: 0.75rem 1.5rem;
        font-size: clamp(0.75rem, 2.5vw, 0.875rem);
        width: auto;
        max-width: 100%;
    }
    
    .vm-accruekit-slideshow__controls {
        display: none; /* Hide arrows on mobile - use swipe instead */
    }
    
    .vm-accruekit-slideshow__footer {
        bottom: 1.5rem;
        right: 1.5rem;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .vm-accruekit-slideshow__container {
        padding-bottom: 100%;
    }
    
    .vm-accruekit-slideshow__slide-inner {
        padding: 1rem 1.25rem;
        align-items: flex-end;
    }
    
    .vm-accruekit-slideshow__content {
        max-width: 100%;
        width: 100%;
    }
    
    .vm-accruekit-slideshow__title {
        margin-bottom: 0.75rem;
    }
    
    .vm-accruekit-slideshow .vm-accruekit-slideshow__title-text {
        font-size: clamp(0.825rem, 2.75vw, 1.925rem) !important;
        line-height: 1.3 !important;
        max-height: 3.5em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
    }
    
    .vm-accruekit-slideshow__actions {
        margin-top: 0.75rem;
    }
    
    .vm-accruekit-slideshow__button {
        width: 100%;
        padding: clamp(0.625rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.5rem);
        font-size: clamp(0.7rem, 2.2vw, 0.8rem);
        text-align: center;
        box-sizing: border-box;
    }
    
    .vm-accruekit-slideshow__controls {
        display: none; /* Hide arrows on mobile - use swipe instead */
    }
    
    /* Hide timer and slide count on mobile */
    .vm-accruekit-slideshow__footer {
        display: none !important;
    }
}

/* Accessibility */
.vm-accruekit-slideshow__prev:focus,
.vm-accruekit-slideshow__next:focus,
.vm-accruekit-slideshow__timer-toggle:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Loading state */
.vm-accruekit-slideshow.is-loading .vm-accruekit-slideshow__slide {
    opacity: 0;
}
