
.articles-carousel-wrapper {
    position: relative;
    margin: 0 auto;
    margin-bottom: 60px; /* Add space for dots and prevent clipping */
    overflow: visible; /* Ensure dots are not clipped */
}

.articles-carousel {
    margin: 0 -15px;
}

.articles-carousel .carousel-cell {
    width: 50%; /* 2 columns on mobile/tablet portrait */
    padding: 0 8px;
}

/* Navigation buttons responsive visibility */
.articles-carousel-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: none;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

/* Show navigation based on article count and screen size */
@media (max-width: 767px) {
    .articles-carousel-wrapper[data-mobile-nav="true"] .articles-carousel-nav {
        display: flex;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .articles-carousel-wrapper[data-tablet-nav="true"] .articles-carousel-nav {
        display: flex;
    }
}

@media (min-width: 1200px) {
    .articles-carousel-wrapper[data-desktop-nav="true"] .articles-carousel-nav {
        display: flex;
    }
}

.ac-nav-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #007bff;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #007bff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    pointer-events: all;
}

.ac-nav-btn:hover {
    background: #007bff;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

.ac-prev {
    margin-left: -22px;
}

.ac-next {
    margin-right: -22px;
}

@media (max-width: 768px) {
    .ac-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .ac-prev {
        margin-left: -20px;
    }

    .ac-next {
        margin-right: -20px;
    }
}

/* Responsive carousel cell widths */
@media (min-width: 768px) and (max-width: 1199px) {
    .articles-carousel .carousel-cell {
        width: 33.333%; /* 3 columns on tablet landscape */
    }
}

@media (min-width: 1200px) {
    .articles-carousel .carousel-cell {
        width: 20%; /* 5 columns on large screens */
    }
}

/* Custom Navigation buttons - scoped to articles carousel */
.articles-carousel-wrapper .articles-carousel-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

.articles-carousel-wrapper .ac-nav-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    z-index: 11;
}

.articles-carousel-wrapper .ac-nav-btn:hover {
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.articles-carousel-wrapper .ac-nav-btn:active {
    transform: scale(0.95);
}

.articles-carousel-wrapper .ac-prev {
    left: -22px;
}

.articles-carousel-wrapper .ac-next {
    right: -22px;
}

/* Flickity dots styling for articles carousel */
.articles-carousel .flickity-page-dots {
    bottom: -50px; /* More space from carousel */
    text-align: center;
}

.articles-carousel .flickity-page-dots .dot {
    background: #cbd5e0;
    width: 12px;
    height: 12px;
    margin: 0 6px;
    transition: all 0.3s ease;
}

.articles-carousel .flickity-page-dots .dot.is-selected {
    background: #3182ce;
    transform: scale(1.2);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .articles-carousel-wrapper {
        margin-bottom: 50px; /* Less space needed on mobile */
    }

    .articles-carousel {
        margin: 0 -10px;
    }

    .articles-carousel .carousel-cell {
        padding: 0 10px;
    }

    .articles-carousel-wrapper .ac-nav-btn {
        display: none; /* Hide on mobile, use swipe instead */
    }

    .articles-carousel .flickity-page-dots {
        bottom: -40px; /* Less space needed on mobile */
    }

    /* Override homepage min-height rule for carousel cards */
    .articles-carousel .carousel-cell .card {
        min-height: auto !important;
        max-height: 380px; /* Reasonable max height for mobile */
    }

    /* Mobile styling - show description with shorter excerpt */
    .articles-carousel .carousel-cell .card .article-description-mobile {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
        margin-top: 0.25rem !important; /* Reduced margin from top */
        display: block !important;
    }

    /* Reduce spacing between meta info and description on mobile */
    .articles-carousel .carousel-cell .card .card-text {
        margin-top: 0 !important;
    }

    /* Mobile "see more" link styling - simple color change like desktop */
    .articles-carousel .carousel-cell .card .see-more-link span {
        color: #0d6efd !important;
        font-weight: 500 !important;
        font-style: italic !important;
        transition: color 0.3s ease !important;
    }

    .articles-carousel .carousel-cell .card .see-more-link:hover span {
        color: #0056b3 !important;
        text-decoration: underline !important;
    }

    /* Meta styling matching articles-grid */
    .articles-carousel .carousel-cell .author-name {
        font-size: 0.72rem !important;
    }

    .articles-carousel .carousel-cell time {
        font-size: 0.62rem !important;
    }
}

/* Ensure consistent card height with articles-grid */
.articles-carousel .carousel-cell .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 400px; /* Prevent cards from being too tall */
}

.articles-carousel .carousel-cell .card .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.articles-carousel .carousel-cell .card .card-text {
    margin-top: auto; /* Push text to bottom if needed */
}

/* Match articles-grid image height exactly */
.articles-carousel .carousel-cell .card .card-img-top {
    max-height: 220px !important;
    object-fit: cover;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
}

/* Mobile responsive image heights matching articles-grid */
@media (max-width: 576px) {
    .articles-carousel .carousel-cell .card .card-img-top {
        max-height: 170px !important;
    }
}

@media (max-width: 420px) {
    .articles-carousel .carousel-cell .card .card-img-top {
        max-height: 160px !important;
    }
}

/* Ensure no conflicts with other carousels */
.articles-carousel-wrapper .articles-carousel-nav {
    pointer-events: none;
}

.articles-carousel-wrapper .articles-carousel-nav .ac-nav-btn {
    pointer-events: all;
}

