/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --slider-primary: #0066cc;
    --slider-primary-dark: #0052a3;
    --slider-overlay: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 100%);
    --slider-text: #ffffff;
    --slider-text-dark: #333333;
    --slider-duration: 0.5s;
    --slider-timing: ease-in-out;
    --spacing-unit: 1rem;
    --border-radius: 8px;
    --box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

/* Aspect Ratio Utility Classes */
.aspect-ratio-16-9 { aspect-ratio: 16 / 9; }
.aspect-ratio-4-3 { aspect-ratio: 4 / 3; }
.aspect-ratio-1-1 { aspect-ratio: 1 / 1; }
.aspect-ratio-21-9 { aspect-ratio: 21 / 9; }
.aspect-ratio-3-2 { aspect-ratio: 3 / 2; }

/* ==========================================================================
   Slider Container - FULLY RESPONSIVE
   ========================================================================== */
.slider {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
    background-color: #f5f5f5;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    isolation: isolate;
    padding-bottom: 49px;
}

/* Responsive height based on viewport */
.slider {
    min-height: 300px;
    height: 70vh;
    max-height: 600px;
}

/* ==========================================================================
   Slides Container
   ========================================================================== */
.slider__slides {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    height: 100%;
    transition: transform var(--slider-duration) var(--slider-timing);
    will-change: transform;
    cursor: grab;
    user-select: none;
    touch-action: pan-y pinch-zoom;
}

.slider__slides:active {
    cursor: grabbing;
}

.slider__slides img {
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* ==========================================================================
   Individual Slide
   ========================================================================== */
.slider__slide {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.slider__slide[aria-hidden="true"] {
    visibility: hidden;
}

/* ==========================================================================
   Slide Images - FULLY RESPONSIVE
   ========================================================================== */
.slider__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    will-change: transform;
    z-index: 1;
}

/* Different image fit options */
.image--cover { object-fit: cover; }
.image--contain { object-fit: contain; background: #000; }
.image--fill { object-fit: fill; }

@media (prefers-reduced-motion: no-preference) {
    .slider__slide:hover .slider__image {
        transform: scale(1.05);
    }
}

/* ==========================================================================
   Caption Container - FULLY RESPONSIVE WITH WRAPPING
   ========================================================================== */
.slider__caption {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Darker gradient - increased opacity across the board */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 60%, rgba(0, 0, 0, 0.4) 100%);
    color: var(--slider-text);
    padding: clamp(0.5rem, 3vh, 1.5rem) clamp(0.75rem, 4vw, 1.5rem) clamp(0.3rem, 1.5vh, 0.8rem) clamp(0.75rem, 4vw, 1.5rem);
    border-radius: 0;
    border: none;
    z-index: 5;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    will-change: transform, opacity;
    
    /* Text wrapping properties */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    word-break: break-word;
    hyphens: auto;
}

.slider__slide.active .slider__caption {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.slider__caption--solid {
    background: rgba(0, 0, 0, 0.95);
    border-top: 2px solid var(--slider-primary);
}

.slider__caption--glass {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.slider__caption::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--slider-primary) 0%, var(--slider-primary) 30%, rgba(0,102,204,0.3) 100%);
}

/* ==========================================================================
   Slide Titles - RESPONSIVE
   ========================================================================== */
.slider__title {
    font-size: clamp(1rem, 4vw, 2rem);
    font-weight: 700;
    margin-bottom: 0.2rem;
    line-height: 1.3;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.01em;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    
    /* Add this line to make the title white */
    color: white;
    
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    word-break: break-word;
}

/* ==========================================================================
   Slide Descriptions - RESPONSIVE
   ========================================================================== */
.slider__description {
    font-size: clamp(0.7rem, 2vw, 1rem);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    opacity: 0.9;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    word-break: break-word;
}

/* ==========================================================================
   Buttons - RESPONSIVE
   ========================================================================== */
.button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 1rem;
    border-radius: 40px;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    letter-spacing: 0.3px;
    margin: 0 0.15rem;
    position: relative;
    white-space: nowrap;
}

.button--primary {
    background-color: var(--slider-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
}

.button--primary:hover,
.button--primary:focus {
    background-color: var(--slider-primary-dark);
    transform: translateY(-2px);
}

.button--outline {
    background-color: transparent;
    color: white;
    border: 2px solid white;
}

.button--outline:hover {
    background-color: white;
    color: var(--slider-primary-dark);
}

.button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Navigation Controls
   ========================================================================== */
.slider__controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 clamp(0.5rem, 3vw, 2rem);
    z-index: 20;
    pointer-events: none;
}

.slider__button {
    width: clamp(32px, 5vw, 48px);
    height: clamp(32px, 5vw, 48px);
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--slider-text-dark);
    font-size: clamp(1rem, 2vw, 1.2rem);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
}

.slider__button:hover {
    transform: scale(1.1);
    background-color: white;
}

/* ==========================================================================
   PAGINATION DOTS - MOVED UP
   ========================================================================== */
.slider__pagination {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 50px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.slider__dot {
    width: clamp(8px, 2vw, 12px);
    height: clamp(8px, 2vw, 12px);
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.slider__dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.slider__dot--active {
    background-color: var(--slider-primary);
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(0, 102, 204, 0.6);
}

/* ==========================================================================
   Autoplay Progress Bar
   ========================================================================== */
.slider__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 20;
}

.slider__progress-bar {
    width: 0%;
    height: 100%;
    background: var(--slider-primary);
    transition: width linear;
    transform-origin: left;
}

.slider__progress-bar--active { width: 100%; }

/* ==========================================================================
   FULLY RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .slider {
        max-width: 1400px;
        margin: 0 auto;
        height: 550px;
        max-height: 650px;
    }
    .slider__title { max-width: 70%; font-size: 2rem; }
    .slider__description { max-width: 60%; font-size: 1rem; }
}

/* Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .slider {
        height: 500px;
        max-height: 600px;
    }
    .slider__title { font-size: 1.8rem; }
    .slider__description { font-size: 0.95rem; }
}

/* Tablet Landscape (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .slider {
        height: 450px;
        max-height: 500px;
    }
    .slider__title { 
        font-size: 1.5rem;
        max-width: 85%;
    }
    .slider__description { 
        font-size: 0.85rem;
        max-width: 75%;
    }
    .slider__button {
        width: 38px;
        height: 38px;
    }
    .slider__pagination {
        bottom: 70px;
        padding: 6px 14px;
    }
}

/* Mobile Landscape (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .slider {
        height: 400px;
        max-height: 450px;
    }
    .slider__caption {
        bottom: 70px;
        padding: 0.8rem 1rem 0.5rem 1rem;
    }
    .slider__title { 
        font-size: 1.3rem;
        max-width: 90%;
        margin-bottom: 0.2rem;
    }
    .slider__description { 
        font-size: 0.8rem;
        max-width: 85%;
        margin-bottom: 0.4rem;
    }
    .button {
        padding: 0.25rem 0.8rem;
        font-size: 0.75rem;
    }
    .slider__button {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    .slider__pagination {
        bottom: 60px;
        padding: 6px 12px;
        gap: 8px;
    }
    .slider__dot {
        width: 8px;
        height: 8px;
    }
}

/* Mobile Portrait (481px - 575px) */
@media (min-width: 481px) and (max-width: 575px) {
    .slider {
        height: 380px;
        max-height: 420px;
    }
    .slider__caption {
        bottom: 35px;
        padding: 0.6rem 0.8rem 0.4rem 0.8rem;
    }
    .slider__title { 
        font-size: 1.1rem;
        max-width: 95%;
    }
    .slider__description { 
        font-size: 0.75rem;
        max-width: 90%;
        margin-bottom: 0.3rem;
    }
    .button {
        padding: 0.2rem 0.7rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }
    .button-group {
        gap: 0.3rem;
    }
    .slider__button {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    .slider__pagination {
        bottom: 55px;
        padding: 5px 10px;
        gap: 8px;
    }
    .slider__dot {
        width: 7px;
        height: 7px;
    }
}

/* Small Mobile (320px - 480px) */
@media (max-width: 480px) {
    .slider {
        height: 350px;
        max-height: 400px;
        min-height: 300px;
    }
    .slider__caption {
        bottom: 55px;
        padding: 0.5rem 0.6rem 0.3rem 0.6rem;
    }
    .slider__title { 
        font-size: 1rem;
        max-width: 98%;
        margin-bottom: 0.1rem;
    }
    .slider__description { 
        display: none;
    }
    .button {
        padding: 0.15rem 0.6rem;
        font-size: 0.65rem;
        min-height: 28px;
        white-space: nowrap;
    }
    .button-group {
        gap: 0.25rem;
    }
    .slider__button {
        display: none;
    }
    .slider__pagination {
        bottom: 45px;
        padding: 4px 10px;
        gap: 6px;
    }
    .slider__dot {
        width: 6px;
        height: 6px;
    }
    .slider__dot--active {
        transform: scale(1.3);
    }
}

/* Extra Small Mobile (under 320px) */
@media (max-width: 320px) {
    .slider {
        height: 320px;
    }
    .slider__caption {
        bottom: 50px;
    }
    .slider__title { 
        font-size: 0.9rem;
        line-height: 1.2;
    }
    .button {
        padding: 0.12rem 0.5rem;
        font-size: 0.6rem;
        white-space: normal;
        word-break: break-word;
        min-height: 26px;
    }
    .slider__pagination {
        bottom: 40px;
        padding: 3px 8px;
        gap: 5px;
    }
    .slider__dot {
        width: 5px;
        height: 5px;
    }
}

/* ==========================================================================
   LANDSCAPE MODE FIXES
   ========================================================================== */
@media (orientation: landscape) and (max-height: 500px) {
    .slider {
        height: 85vh;
        min-height: 250px;
    }
    .slider__title {
        font-size: 1rem;
        margin-bottom: 0.1rem;
    }
    .slider__description {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .slider__caption {
        bottom: 50px;
        padding: 0.4rem 0.8rem 0.3rem 0.8rem;
    }
    .button {
        padding: 0.15rem 0.6rem;
        font-size: 0.65rem;
    }
    .button-group {
        gap: 0.2rem;
    }
    .slider__pagination {
        bottom: 40px;
        padding: 4px 10px;
    }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    .slider__button {
        width: 44px;
        height: 44px;
    }
    .slider__dot {
        width: 12px;
        height: 12px;
    }
    .slider__dot--active {
        transform: scale(1.2);
    }
    .button {
        padding: 0.35rem 1rem;
    }
    .slider__pagination {
        padding: 8px 16px;
        gap: 12px;
    }
}

/* ==========================================================================
   ACCESSIBILITY & COLOR PROFILES
   ========================================================================== */
@media (prefers-contrast: high) {
    .slider__caption { 
        background: rgba(0, 0, 0, 0.95); 
        border-top: 2px solid white; 
    }
    .button--primary { 
        border: 2px solid white; 
    }
    .slider__dot--active {
        background-color: yellow;
        box-shadow: 0 0 0 2px black;
    }
    .slider__pagination {
        background: black;
        border: 1px solid white;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .slider__slide.active .slider__caption {
        opacity: 1; 
        transform: translateY(0); 
        transition: none;
    }
    .slider__slide:hover .slider__image {
        transform: none;
    }
}

@media (prefers-color-scheme: dark) {
    .slider { 
        background-color: #1a1a1a; 
    }
    .slider__button {
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
    }
    .slider__pagination {
        background: rgba(0, 0, 0, 0.8);
        border-color: rgba(255, 255, 255, 0.3);
    }
}

/* RTL Support */
[dir="rtl"] .slider__progress-bar { 
    transform-origin: right; 
}

[dir="rtl"] .slider__controls {
    flex-direction: row-reverse;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    .slider__controls,
    .slider__pagination,
    .slider__progress {
        display: none;
    }
    .slider__caption {
        position: static;
        background: #000;
        color: white;
        padding: 1rem;
    }
    .slider__image {
        position: relative;
        height: auto;
        max-height: 300px;
    }
}