/*
Theme Name: Hestia Child - Legaris Blog Carousel
Theme URI: https://themeisle.com/themes/hestia/
Description: Child theme for Hestia 3.3.5 with a custom horizontal carousel for the front-page Blog section.
Author: Legaris
Template: hestia
Version: 1.0.0
Text Domain: hestia-child-legaris
*/

/*
 * Legaris Blog Carousel
 *
 * The carousel is created on the front-page Blog section only.
 * Hestia's original article/card markup is preserved; this CSS only
 * changes its layout into a horizontally scrollable track.
 */

.home #blog.hestia-blogs .hestia-blog-content {
    position: relative;
}

.home #blog.hestia-blogs .legaris-blog-carousel-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.home #blog.hestia-blogs .legaris-blog-carousel-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
}

.home #blog.hestia-blogs .legaris-blog-carousel-track::-webkit-scrollbar {
    display: none;
}

.home #blog.hestia-blogs .legaris-blog-carousel-track > .hestia-blog-item {
    position: relative;
    display: block !important;
    float: none !important;
    flex: 0 0 33.333333% !important;
    width: 33.333333% !important;
    max-width: 33.333333% !important;
    margin: 0 !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    vertical-align: top;
    scroll-snap-align: start;
}

.home #blog.hestia-blogs .legaris-blog-carousel-track .card-blog {
    height: 100%;
}

.home #blog.hestia-blogs .legaris-blog-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    z-index: 5;
    inset: 0;
    pointer-events: none;
}

.home #blog.hestia-blogs .legaris-blog-carousel-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    color: #3c4858;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.home #blog.hestia-blogs .legaris-blog-carousel-viewport:hover .legaris-blog-carousel-button,
.home #blog.hestia-blogs .legaris-blog-carousel-button:focus-visible {
    opacity: 1;
}

.home #blog.hestia-blogs .legaris-blog-carousel-button:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.home #blog.hestia-blogs .legaris-blog-carousel-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.home #blog.hestia-blogs .legaris-blog-carousel-button[disabled] {
    display: none;
}

.home #blog.hestia-blogs .legaris-blog-carousel-button--prev {
    margin-left: 4px;
}

.home #blog.hestia-blogs .legaris-blog-carousel-button--next {
    margin-right: 4px;
}

.home #blog.hestia-blogs .legaris-blog-carousel-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Keep arrows visible on touch devices because there is no hover state. */
@media (hover: none) {
    .home #blog.hestia-blogs .legaris-blog-carousel-button {
        opacity: 1;
    }
}

/* Tablet: two cards in view. */
@media (max-width: 991px) {
    .home #blog.hestia-blogs .legaris-blog-carousel-track > .hestia-blog-item {
        flex-basis: 50% !important;
        width: 50% !important;
        max-width: 50% !important;
    }
}

/* Mobile: one card in view. */
@media (max-width: 767px) {
    .home #blog.hestia-blogs .legaris-blog-carousel-track > .hestia-blog-item {
        flex-basis: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .home #blog.hestia-blogs .legaris-blog-carousel-button {
        width: 38px;
        height: 38px;
    }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    .home #blog.hestia-blogs .legaris-blog-carousel-track {
        scroll-behavior: auto;
    }

    .home #blog.hestia-blogs .legaris-blog-carousel-button {
        transition: none;
    }
}
