/**
 * SL Slider Gallery - Frontend Responsive Styles
 *
 * Implements:
 * - 5, 3, 1 visible images responsive progression
 * - Uniform image crop (object-fit: cover)
 * - Captions (toggleable)
 * - Smooth CSS transitions & scroll snapping
 * - Lightbox modal
 */

.sl-slider-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
    --sl-gap: 16px;
    --sl-aspect-ratio: 4 / 3;
}

.sl-slider-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    border-radius: 12px;
}

.sl-slider-track {
    display: flex;
    gap: var(--sl-gap);
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 8px 2px 14px 2px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sl-slider-track::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   Responsive Visible Slides (5, 3, 1) per user specification
   ========================================================================== */
/* Desktop (> 1024px): 5 slides visible */
@media screen and (min-width: 1025px) {
    .sl-slider-wrapper .sl-slide {
        flex: 0 0 calc((100% - (4 * var(--sl-gap))) / 5);
        min-width: calc((100% - (4 * var(--sl-gap))) / 5);
    }
}

/* Tablet (641px - 1024px): 3 slides visible */
@media screen and (max-width: 1024px) and (min-width: 641px) {
    .sl-slider-wrapper .sl-slide {
        flex: 0 0 calc((100% - (2 * var(--sl-gap))) / 3);
        min-width: calc((100% - (2 * var(--sl-gap))) / 3);
    }
}

/* Mobile (<= 640px): 1 slide visible */
@media screen and (max-width: 640px) {
    .sl-slider-wrapper .sl-slide {
        flex: 0 0 100%;
        min-width: 100%;
    }
}

.sl-slide {
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sl-slide:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

/* Image container with strict uniform aspect ratio & crop */
.sl-slide-media {
    position: relative;
    width: 100%;
    aspect-ratio: var(--sl-aspect-ratio);
    overflow: hidden;
    background-color: #f1f5f9;
}

.sl-slide-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}

.sl-slide:hover .sl-slide-media img {
    transform: scale(1.05);
}

/* Zoom overlay indicator */
.sl-slide-overlay {
    position: absolute;
    inset: 0;
    background: rgba(22, 150, 60, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    cursor: pointer;
}

.sl-slide:hover .sl-slide-overlay {
    opacity: 1;
}

.sl-zoom-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    color: #16963c;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transform: scale(0.85);
    transition: transform 0.25s ease;
}

.sl-slide:hover .sl-zoom-icon {
    transform: scale(1);
}

/* Captions */
.sl-slide-caption-wrap {
    padding: 12px 14px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sl-slide-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sl-slide-desc {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navigation Arrows */
.sl-arrow {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
}

.sl-arrow:hover {
    background: #16963c;
    color: #ffffff;
    border-color: #16963c;
    transform: translateY(-50%) scale(1.08);
}

.sl-arrow-prev {
    left: -20px;
}

.sl-arrow-next {
    right: -20px;
}

@media screen and (max-width: 768px) {
    .sl-arrow-prev { left: 8px; }
    .sl-arrow-next { right: 8px; }
}

/* Lightbox Modal */
.sl-lightbox-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sl-lb-container {
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sl-lb-container img {
    max-height: 72vh;
    width: auto;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.sl-lb-caption {
    margin-top: 14px;
    text-align: center;
    color: #ffffff;
}

.sl-lb-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.sl-lb-desc {
    font-size: 14px;
    color: #cbd5e1;
    margin: 0;
}

.sl-lb-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 12px;
}

.sl-lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    font-size: 38px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.sl-lb-arrow:hover {
    background: #16963c;
}

.sl-lb-prev { left: 24px; }
.sl-lb-next { right: 24px; }
