/* *
 * Handpicked Query Horizontal Slider Block Styles
 * 
 * Styles required for the GSAP horizontal scrolling slider to work properly.
 * These styles ensure the items are laid out horizontally without wrapping,
 * and the container structure supports the scroll animation.
 */

/* Main wrapper - contains the entire slider section */
.handpicked-query-horizontal-slider-block .horizontal-slider-wrapper {
    width: 100%;
    overflow: hidden; /* Hide overflow on all sides - GSAP will handle the scrolling */
    position: relative;
}

/* Pin wrapper - this element gets pinned by GSAP ScrollTrigger */
.handpicked-query-horizontal-slider-block .horizontal-slider-pin {
    width: 100%;
    position: relative;
}

/* Content container - this moves horizontally */
.handpicked-query-horizontal-slider-block .horizontal-slider-content {
    width: 100%;
    position: relative;
}

/* List container - holds all the items in a horizontal row */
.handpicked-query-horizontal-slider-block .horizontal-slider-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    width: max-content; /* Allow content to determine width */
    min-width: 100%; /* At least full width of container */
}

/* Individual slider items */
.handpicked-query-horizontal-slider-block .horizontal-slider-item {
    flex: 0 0 auto; /* Don't shrink or grow, use natural width */
    display: flex;
    flex-direction: column;
    /* Remove any flex-basis that might constrain width */
    min-width: 0; /* Allow content to determine minimum width */
    /* Apply spacing between items via CSS variable (set in template) */
    margin-right: var(--horizontal-slider-item-spacing, 3rem);
}

/* Remove margin from last item */
.handpicked-query-horizontal-slider-block .horizontal-slider-item:last-child {
    margin-right: 0;
}

/* Make .list-item 50% width of container (not list) */
/* Container max-width: 1148px, so 50% = 574px */
/* The list has width: max-content which makes it wider than container */
/* We need to calculate based on container's actual width (1148px) */
.handpicked-query-horizontal-slider-block .horizontal-slider-list .list-item {
    /* 50% of container width (1148px) = 574px, accounting for spacing */
    flex: 0 0 calc(574px - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
    width: calc(574px - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
    min-width: 0;
    max-width: calc(574px - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
    box-sizing: border-box;
}

/* For smaller screens where container is less than 1148px, use percentage */
/* @media (max-width: 1148px) {
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .list-item {
        /* Use 50% of container width on smaller screens */
        flex: 0 0 calc(50% - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
        width: calc(50% - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
        max-width: calc(50% - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
    }
} */

/* Ensure items don't wrap on smaller screens initially */
/* The GSAP animation will handle the scrolling */
@media (max-width: 768px) {
    .handpicked-query-horizontal-slider-block .horizontal-slider-list {
        flex-wrap: nowrap;
    }
    
    .handpicked-query-horizontal-slider-block .horizontal-slider-item {
        flex: 0 0 auto;
        min-width: 280px; /* Minimum width for mobile items */
    }

    .handpicked-query-horizontal-slider-block .horizontal-slider-list .list-item {
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 0;
    }
}

/* Override any theme styles that might interfere */
.handpicked-query-horizontal-slider-block .horizontal-slider-list.collection-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
}

/* Ensure the list items maintain their natural width and don't shrink */
.handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item {
    /*     width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important; /* Override any flex-basis from theme */
    min-width: 0;
}

/* Override specific flex properties that might be set by theme */
.handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item.team,
.handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item[class*="team"] {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 280px; /* Set a reasonable minimum width */
    -ms-flex: 0 0 auto !important; /* IE11 support */
    /* Override margin-right with CSS variable spacing */
    margin-right: var(--horizontal-slider-item-spacing, 3rem) !important;
}

/* Override media query rules that might interfere - must be more specific */
@media only screen and (max-width: 1024px) {
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item.team,
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item[class*="team"],
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .list-item.team {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 280px !important;
        -ms-flex: 0 0 auto !important;
    }
}

@media only screen and (max-width: 768px) {
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item.cases,
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item[class*="cases"],
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .list-item.cases {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 280px !important;
        -ms-flex: 0 0 auto !important;
        max-width: calc(320px - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
    }
    
    /* Mobile fallback: When GSAP is disabled on mobile, allow normal vertical layout */
    .handpicked-query-horizontal-slider-block.gsap-mobile-fallback .horizontal-slider-wrapper,
    .handpicked-query-horizontal-slider-block .horizontal-slider-wrapper.gsap-mobile-disabled {
        overflow: visible;
    }
    
    .handpicked-query-horizontal-slider-block.gsap-mobile-fallback .horizontal-slider-list,
    .handpicked-query-horizontal-slider-block .horizontal-slider-wrapper.gsap-mobile-disabled .horizontal-slider-list {
        flex-wrap: wrap; /* Allow items to wrap on mobile when GSAP is disabled */
        width: 100%; /* Use full width instead of max-content */
    }
    
    .handpicked-query-horizontal-slider-block.gsap-mobile-fallback .horizontal-slider-item,
    .handpicked-query-horizontal-slider-block .horizontal-slider-wrapper.gsap-mobile-disabled .horizontal-slider-item {
        flex: 0 1 calc(50% - var(--horizontal-slider-item-spacing, 3rem) / 2); /* Two columns on mobile */
        margin-bottom: var(--horizontal-slider-item-spacing, 3rem);
    }
}

@media only screen and (max-width: 500px) {
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item.cases,
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .horizontal-slider-item[class*="cases"],
    .handpicked-query-horizontal-slider-block .horizontal-slider-list .list-item.cases {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 280px !important;
        -ms-flex: 0 0 auto !important;
        max-width: calc(320px - var(--horizontal-slider-item-spacing, 3rem) / 2) !important;
    }
}

/* Force the list to use natural content width, not percentage-based */
.handpicked-query-horizontal-slider-block .collection-wrapper.horizontal-slider-list {
    width: max-content !important;
    display: flex !important;
    flex-wrap: nowrap !important;
}
