/* Carousel and Featured Sections Fixes */

/* Fix for featured carousel sections */
.featured-category-section {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 20px 0;
}

.featured-category-section .container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.featured-carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    gap: 16px;
    padding: 10px 0;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.featured-carousel-track::-webkit-scrollbar {
    display: none;
}

/* Ensure article cards in featured sections are properly sized and grouped */
.featured-carousel-track .article-card {
    flex: 0 0 calc(33.333% - 32px);
    width: calc(33.333% - 32px);
    max-width: 340px;
    margin: 0 16px;
    box-sizing: border-box;
}

/* Ensure the carousel track properly handles the card groups */
.featured-carousel-track {
    scroll-snap-type: x mandatory;
}

/* Create visual grouping for desktop view */
@media (min-width: 601px) {
    .featured-carousel-track {
        scroll-snap-type: x mandatory;
    }
    
    /* Make every third card a snap point for 3-card grouping */
    .featured-carousel-track .article-card:nth-child(3n+1) {
        scroll-snap-align: start;
    }
    
    /* Ensure exactly 3 cards are shown */
    .featured-carousel-track .article-card {
        flex: 0 0 calc(33.333% - 32px);
        width: calc(33.333% - 32px);
        margin: 0 16px;
        max-width: 340px;
    }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .featured-carousel-track .article-card {
        flex: 0 0 calc(33.333% - 24px);
        width: calc(33.333% - 24px);
        margin: 0 12px;
        max-width: 320px;
    }
    
    /* Increase arrow spacing */
    .featured-category-section > .container > div {
        padding: 0 60px; /* Increased padding for arrow spacing */
    }
}

@media (max-width: 992px) {
    .featured-carousel-track .article-card {
        flex: 0 0 calc(33.333% - 20px);
        width: calc(33.333% - 20px);
        margin: 0 10px;
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .featured-carousel-track .article-card {
        flex: 0 0 calc(33.333% - 16px);
        width: calc(33.333% - 16px);
        margin: 0 8px;
        max-width: 280px;
    }
}

@media (max-width: 600px) {
    .featured-carousel-track {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none; /* Hide scrollbar for Firefox */
        -ms-overflow-style: none; /* Hide scrollbar for IE and Edge */
        padding: 10px 0;
        margin: 0 auto;
        width: 100%;
        scroll-snap-align: center;
    }
    
    .featured-carousel-track::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome, Safari, and Opera */
    }
    
    .featured-carousel-track .article-card {
        flex: 0 0 calc(100% - 40px);
        width: calc(100% - 40px);
        margin: 0 20px;
        max-width: none;
        scroll-snap-align: center;
        box-sizing: border-box;
    }
    
    .featured-category-section .container > div {
        padding: 0 45px; /* Increased padding for arrow spacing */
    }
    
    /* Show arrows on mobile for infinite scrolling */
    .featured-arrow {
        width: 36px;
        height: 36px;
        display: flex; /* Ensure arrows are visible */
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 20;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        align-items: center;
        justify-content: center;
    }
    
    .featured-arrow.left {
        left: 8px;
    }
    
    .featured-arrow.right {
        right: 8px;
    }
    
    /* Ensure proper touch scrolling on mobile */
    .featured-category-section .container {
        overflow: visible;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .featured-carousel-track .article-card {
        flex: 0 0 calc(100% - 30px);
        width: calc(100% - 30px);
        margin: 0 15px;
        scroll-snap-align: center;
    }
    
    .featured-category-section .container > div {
        padding: 0 40px;
    }
    
    .article-info h3 {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    .article-info .date {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .article-info p {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* Ensure proper spacing in the card */
    .article-card .article-info {
        padding: 10px;
    }
}

/* Fix for slider arrows */
.featured-arrow {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.featured-arrow:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.featured-arrow img {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.featured-arrow:hover img {
    transform: scale(1.1);
}

/* Fix for site-main to prevent horizontal overflow */
.site-main {
    overflow-x: hidden;
    width: 100%;
}

/* Main slider fixes */
.slider {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Ensure slider content is properly centered on all devices */
@media (max-width: 600px) {
    .slide-content {
        width: 90%;
        padding: 0 15px;
        box-sizing: border-box;
    }
}