/* Mobile Carousel - Homepage Sections
   Only activates on mobile devices, desktop layout unchanged */

/* Carousel Container - Hidden on desktop */
.mobile-carousel-wrapper {
    display: none;
}

/* Carousel Styles - Mobile Only */
@media (max-width: 768px) {

    /* Show carousel wrapper on mobile */
    .mobile-carousel-wrapper {
        display: flex;
        flex-direction: column;
        justify-content: center;
        position: relative;
        overflow: hidden;
    }

    /* Hide original grid on mobile when carousel exists - HIGHEST PRIORITY */
    .section .container>.grid.grid-3.featured-products-grid,
    .section .container .featured-products-grid,
    .featured-products-grid,
    .grid.grid-3.featured-products-grid,
    .section .container>.grid.grid-3.featured-events-grid,
    .section .container .featured-events-grid,
    .featured-events-grid,
    .grid.grid-3.featured-events-grid,
    .mobile-carousel-wrapper~.grid,
    .mobile-carousel-wrapper .grid {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Carousel Container */
    .mobile-carousel {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        gap: var(--belle-space-md);
        padding: var(--belle-space-sm) 0;
        margin: 0 calc(-1 * var(--belle-space-md));
        padding-left: var(--belle-space-md);
        padding-right: var(--belle-space-md);
        scroll-padding: var(--belle-space-md);
        /* Smooth momentum scrolling */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    /* Hide scrollbar but keep functionality */
    .mobile-carousel::-webkit-scrollbar {
        display: none;
    }

    .mobile-carousel {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* Carousel Items - ONE TILE AT A TIME */
    .mobile-carousel-item {
        flex: 0 0 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        /* Smooth transitions */
        transition: transform 0.2s ease-out;
        /* Prevent layout shifts */
        box-sizing: border-box;
    }

    /* Ensure cards take full width in carousel */
    .mobile-carousel-item .card,
    .mobile-carousel-item .event-card {
        border: 3px solid var(--belle-wine);
        width: 100%;
        margin: 0;
        box-sizing: border-box;
        /* Prevent content overflow */
        overflow: hidden;
    }

    /* Carousel Navigation */
    .carousel-nav {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: var(--belle-space-sm);
        margin-top: var(--belle-space-lg);
        padding: var(--belle-space-md) 0;
    }

    .carousel-dots {
        display: flex;
        gap: var(--belle-space-xs);
        align-items: center;
    }

    .carousel-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--belle-border);
        border: none;
        padding: 0;
        cursor: pointer;
        transition: var(--belle-transition);
        flex-shrink: 0;
    }

    .carousel-dot.active {
        background: var(--belle-wine);
        width: 24px;
        border-radius: 4px;
    }

    .carousel-arrow {
        background: var(--belle-wine);
        color: var(--belle-ivory);
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--belle-transition);
        flex-shrink: 0;
    }

    .carousel-arrow:hover {
        background: var(--belle-wine-light);
        transform: scale(1.1);
    }

    .carousel-arrow:active {
        transform: scale(0.95);
    }

    .carousel-arrow svg {
        width: 20px;
        height: 20px;
    }

    /* Carousel Indicators */
    .carousel-indicator {
        text-align: center;
        margin-top: var(--belle-space-sm);
        font-size: 0.875rem;
        color: var(--belle-text-medium);
        font-family: var(--belle-font-sans);
    }
}

/* Desktop - Keep original grid layout */
@media (min-width: 769px) {
    .mobile-carousel-wrapper {
        display: none !important;
    }

    /* Ensure original grids are visible on desktop */
    .grid,
    .featured-products-grid {
        display: grid !important;
    }
}

/* Additional mobile-specific rule to ensure grid is hidden - MUST BE LAST */
/* This rule MUST load after all other CSS files to override them */
@media (max-width: 768px) {

    /* Override ALL grid display rules for featured products - MAXIMUM SPECIFICITY */
    html body .section .container>.grid.grid-3.featured-products-grid,
    html body .section .container>.featured-products-grid.grid.grid-3,
    html body .section .container .featured-products-grid.grid,
    html body .section .container .featured-products-grid.grid-3,
    html body .section .container .featured-products-grid,
    html body .featured-products-grid.grid.grid-3,
    html body .featured-products-grid.grid,
    html body .featured-products-grid.grid-3,
    html body .featured-products-grid {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }

    /* Also hide events grid on mobile */
    html body .section .container>.grid.grid-3.featured-events-grid,
    html body .section .container>.featured-events-grid.grid.grid-3,
    html body .section .container .featured-events-grid.grid,
    html body .section .container .featured-events-grid.grid-3,
    html body .section .container .featured-events-grid,
    html body .featured-events-grid.grid.grid-3,
    html body .featured-events-grid.grid,
    html body .featured-events-grid.grid-3,
    html body .featured-events-grid {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }

    /* Also hide any grid items inside */
    html body .featured-products-grid>*,
    html body .featured-products-grid .card,
    html body .featured-events-grid>*,
    html body .featured-events-grid .card {
        display: none !important;
        visibility: hidden !important;
    }
}