/**
 * Hero Carousel Styles - Responsive & Optimized
 * Safe implementation without causing timeouts
 */

/* Hero Carousel Container */
.hero-carousel {
    position: relative;
    width: 100%;
    height: 56.25vw; /* Fixed height based on 16:9 aspect ratio - prevents vertical scrolling */
    min-height: 500px;
    max-height: 800px;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background-color: #f3e9df;
    /* Maintain aspect ratio on all devices - height will be calculated based on width */
    aspect-ratio: 16 / 9;
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .hero-carousel {
        height: 56.25vw; /* 16:9 aspect ratio calculation */
        max-height: 800px;
        min-height: 500px;
    }
}

/* Swiper Container */
.hero-carousel .swiper {
    width: 100%;
    height: 100%;
}

.hero-carousel .swiper-wrapper {
    height: 100%;
}

/* Individual Slides */
.hero-carousel .swiper-slide {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Prevent any overflow that could cause scrolling */
}

/* On mobile, fit width to page limits and show full height */
@media (max-width: 768px) {
    .hero-carousel {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }
    
    .hero-carousel .swiper-slide {
        background-size: 100% auto !important;
        background-position: center top;
    }
}

/* No overlay - keep background images clear */

/* Slide Content - Consistent width ratio across devices */
.hero-carousel .slide-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    padding: clamp(1rem, 3vw, 2rem) clamp(1.25rem, 4vw, 2.5rem);
    width: clamp(280px, 60vw, 500px);
    max-width: 90vw;
    animation: fadeInUp 0.8s ease;
    background: rgba(0, 0, 0, 0.3);
    border-radius: clamp(10px, 2vw, 15px);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(244, 208, 63, 0.6);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
}

.hero-carousel .slide-title {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    font-weight: 600;
    color: white;
    margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
    line-height: 1.3;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-carousel .slide-description {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
    font-weight: 400;
    color: #f1e6db;
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    line-height: 1.5;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
}

/* Slide Buttons */
.hero-carousel .slide-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-carousel .slide-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    padding: clamp(0.5rem, 1.5vw, 0.7rem) clamp(1rem, 2.5vw, 1.25rem);
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    font-weight: 600;
    text-decoration: none;
    border-radius: clamp(4px, 1vw, 8px);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    min-width: clamp(120px, 18vw, 160px);
    text-align: center;
}

.hero-carousel .slide-button-primary {
    background: linear-gradient(135deg, #f4d03f 0%, #f39c12 100%);
    color: #3A4532;
    box-shadow: 0 4px 15px rgba(244, 208, 63, 0.3);
}

.hero-carousel .slide-button-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(244, 208, 63, 0.5);
    background: linear-gradient(135deg, #f39c12 0%, #f4d03f 100%);
}

.hero-carousel .slide-button-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.hero-carousel .slide-button-secondary:hover {
    background: white;
    color: #3A4532;
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.3);
}

/* Navigation Buttons */
.hero-carousel .swiper-button-next,
.hero-carousel .swiper-button-prev {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: #3A4532;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.hero-carousel .swiper-button-next::after,
.hero-carousel .swiper-button-prev::after {
    font-size: 20px;
    font-weight: 700;
}

.hero-carousel .swiper-button-next:hover,
.hero-carousel .swiper-button-prev:hover {
    background: #f4d03f;
    color: #3A4532;
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(244, 208, 63, 0.4);
}

/* Pagination Bullets */
.hero-carousel .swiper-pagination {
    bottom: 30px !important;
    z-index: 10;
}

.hero-carousel .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    margin: 0 6px !important;
    transition: all 0.3s ease;
}

.hero-carousel .swiper-pagination-bullet-active {
    width: 35px;
    border-radius: 6px;
    background: #f4d03f;
    box-shadow: 0 2px 10px rgba(244, 208, 63, 0.5);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */

/* Tablet (768px and below) - Responsive scaling maintained by clamp() */
@media (max-width: 768px) {
    .hero-carousel {
        height: auto !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
        /* Allow container to expand to full image height */
    }
    
    .hero-carousel .swiper {
        height: auto !important;
        width: 100%;
    }
    
    .hero-carousel .swiper-wrapper {
        height: auto !important;
        display: flex;
        width: 100%;
    }
    
    .hero-carousel .swiper-slide {
        width: 100%;
        height: 0;
        /* padding-bottom will be set dynamically by JavaScript based on image aspect ratio */
        background-size: 100% auto !important;
        background-color: #f3e9df;
        background-position: center top;
        background-repeat: no-repeat;
        position: relative;
        flex-shrink: 0;
        display: block;
        overflow: hidden;
    }
    
    .hero-carousel .slide-content {
        width: clamp(250px, 70vw, 400px);
        padding: clamp(0.8rem, 2.5vw, 1.5rem) clamp(1rem, 3vw, 1.5rem);
    }
    
    .hero-carousel .slide-buttons {
        justify-content: center;
        align-items: center;
    }
    
    .hero-carousel .slide-button {
        padding: clamp(0.5rem, 1.2vw, 0.6rem) clamp(0.8rem, 2vw, 1rem);
        font-size: clamp(0.75rem, 1.3vw, 0.8rem);
    }
    
    .hero-carousel .swiper-button-next,
    .hero-carousel .swiper-button-prev {
        width: 40px;
        height: 40px;
    }
    
    .hero-carousel .swiper-button-next::after,
    .hero-carousel .swiper-button-prev::after {
        font-size: 16px;
    }
}

/* Mobile (480px and below) - Responsive scaling maintained by clamp() */
@media (max-width: 480px) {
    .hero-carousel {
        height: auto !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
        /* Allow container to expand to full image height */
    }
    
    .hero-carousel .swiper {
        height: auto !important;
        width: 100%;
    }
    
    .hero-carousel .swiper-wrapper {
        height: auto !important;
        display: flex;
        width: 100%;
    }
    
    .hero-carousel .swiper-slide {
        width: 100%;
        height: 0;
        /* padding-bottom will be set dynamically by JavaScript based on image aspect ratio */
        background-size: 100% auto !important;
        background-color: #f3e9df;
        background-position: center top;
        background-repeat: no-repeat;
        position: relative;
        flex-shrink: 0;
        display: block;
        overflow: hidden;
    }
    
    .hero-carousel .slide-content {
        width: clamp(220px, 80vw, 350px);
        padding: clamp(0.6rem, 2vw, 1.2rem) clamp(0.8rem, 2.5vw, 1.2rem);
    }
    
    .hero-carousel .slide-buttons {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
        justify-content: center;
    }
    
    .hero-carousel .slide-button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        max-width: 200px;
        justify-content: center;
        align-items: center;
        text-align: center;
        display: flex;
    }
    
    /* Hide navigation arrows on mobile */
    .hero-carousel .swiper-button-next,
    .hero-carousel .swiper-button-prev {
        display: none;
    }
    
    .hero-carousel .swiper-pagination {
        bottom: 20px !important;
    }
    
    .hero-carousel .swiper-pagination-bullet {
        width: 10px;
        height: 10px;
        margin: 0 4px !important;
    }
    
    .hero-carousel .swiper-pagination-bullet-active {
        width: 30px;
    }
}

/* Large Desktop (1400px and above) */
@media (min-width: 1400px) {
    .hero-carousel {
        height: 70vh; /* Use viewport height for larger screens */
        max-height: 900px;
        min-height: 600px;
        aspect-ratio: 16 / 9;
    }
    
    .hero-carousel .slide-title {
        font-size: 4rem;
    }
    
    .hero-carousel .slide-description {
        font-size: 1.4rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .hero-carousel .slide-button {
        min-height: 48px; /* Better touch target */
    }
    
    .hero-carousel .swiper-button-next,
    .hero-carousel .swiper-button-prev {
        width: 48px;
        height: 48px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .hero-carousel .slide-content {
        animation: none;
    }
    
    .hero-carousel .swiper-slide {
        transition: none !important;
    }
    
    .hero-carousel .swiper-button-next,
    .hero-carousel .swiper-button-prev,
    .hero-carousel .slide-button {
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .hero-carousel .swiper-button-next,
    .hero-carousel .swiper-button-prev,
    .hero-carousel .swiper-pagination {
        display: none !important;
    }
}

