/**
 * Shop Categories Section Block Styles
 */

.shop-categories-section {
    padding: 0;
}

.shop-categories-section__title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
}

/* Desktop Grid Layout */
.shop-categories-section__grid {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping to ensure all items stay on one line */
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    column-gap: 0.8125rem;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
    overflow-y: hidden; /* Hide vertical scrollbar */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Hide scrollbars for Chrome, Safari and Opera */
.shop-categories-section__grid::-webkit-scrollbar {
    display: none;
}

/* Adjust width based on number of items */
.shop-categories-section__grid.items-1 .shop-categories-section__item {
    width: 100%;
    flex: 0 0 100%;
}

.shop-categories-section__grid.items-2 .shop-categories-section__item {
    width: 50%;
    flex: 0 0 calc(50% - 2.40625rem); /* Half of the gap on each side */
}

.shop-categories-section__grid.items-3 .shop-categories-section__item {
    width: 33.33%;
    flex: 0 0 calc(33.33% - 2.54167rem); /* Adjusted for gaps */
}

.shop-categories-section__grid.items-4 .shop-categories-section__item {
    width: 25%;
    flex: 0 0 calc(25% - 2.60938rem); /* Adjusted for gaps */
}

.shop-categories-section__grid.items-5 .shop-categories-section__item {
    width: 20%;
    flex: 0 0 calc(20% - 2.65rem); /* Adjusted for gaps */
}

.shop-categories-section__item {
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    border: 1rem solid var(--wp--preset--color--beige);
}

.shop-categories-section__link {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
    width: 100%;
}

.shop-categories-section__image-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    aspect-ratio: 546 / 704;
    height: 100%;
    width: 100%;
}

.shop-categories-section__front-image,
.shop-categories-section__hover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.shop-categories-section__hover-image {
    position: absolute;
    top: -100%;
    left: 0;
    opacity: 1;
    transition: top 0.5s ease;
}

.shop-categories-section__item:hover .shop-categories-section__hover-image {
    top: 0;
}

/* White overlay for title that covers the whole card */
.shop-categories-section__grid .shop-categories-section__item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.shop-categories-section__grid .shop-categories-section__item:hover::after {
    opacity: 1;
}

/* Desktop title styling - as overlay */
.shop-categories-section__grid .shop-categories-section__item-title {
    position: absolute;
    bottom: 0px; /* Position inside the card as overlay */
    left: 0;
    right: 0;
    text-align: center;
    margin: 0;
    padding: 10px;
    font-size: 1.2rem;
    color: #000;
    background-color: transparent;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.shop-categories-section__grid .shop-categories-section__item:hover .shop-categories-section__item-title {
    opacity: 1;
}

/* Reset margin for desktop items - no need for extra space */
.shop-categories-section__grid .shop-categories-section__item {
    margin-bottom: 0;
}

/* Mobile hover state added via JavaScript */
.shop-categories-section__item.mobile-hover::after {
    opacity: 1;
}

.shop-categories-section__item.mobile-hover .shop-categories-section__hover-image {
    top: 0;
}

.shop-categories-section__item.mobile-hover .shop-categories-section__item-title {
    opacity: 1;
}

.shop-categories-section__placeholder {
    width: 100%;
    text-align: center;
    padding: 40px;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

/* Mobile Horizontal Scroll Layout */
.shop-categories-section__swiper {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow-x: auto; /* Enable horizontal scrolling */
    overflow-y: hidden; /* Hide vertical scrollbar */
    scroll-behavior: smooth; /* Smooth scrolling - can be 'auto', 'smooth', or 'instant' */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: none; /* Hide scrollbar in Firefox */
    -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
    white-space: nowrap; /* Prevent wrapping */
    display: flex; /* Use flexbox for better control */
    flex-wrap: nowrap; /* Prevent wrapping */
    width: 100%; /* Ensure full width */
    min-width: 0; /* Allow shrinking */
}

/* Hide scrollbar in WebKit browsers */
.shop-categories-section__swiper::-webkit-scrollbar {
    display: none;
}

/* Mobile items layout */
.shop-categories-section__swiper .shop-categories-section__item {
    display: block; /* Changed from inline-block for flexbox */
    width: 100%;
    margin-right: 15px;
    flex: 0 0 auto; /* Don't grow or shrink */
    min-width: 0; /* Allow shrinking */
    touch-action: pan-x; /* Enable horizontal touch scrolling */
}

.shop-categories-section__swiper .shop-categories-section__image-container {
    aspect-ratio: 546 / 704;
    height: auto;
    width: 100%;
    overflow: hidden;
}

.shop-categories-section__swiper .shop-categories-section__front-image {
    transition: transform 0.3s ease;
}

/* Mobile title styling - below the card */
.shop-categories-section__swiper .shop-categories-section__item-title {
    position: static; /* Not absolute or relative */
    display: block;
    opacity: 1;
    background-color: transparent;
    padding: 15px 0 0;
    margin-top: 1rem; /* Space after the border */
    margin-bottom: 20px;
    z-index: 1;
}

/* Disable hover effects on mobile */
.shop-categories-section__swiper .shop-categories-section__item::after {
    display: none;
}

.shop-categories-section__swiper .shop-categories-section__hover-image {
    display: none;
}

/* Responsive Layout Control */
/* Desktop - hide swiper, show grid */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

/* Mobile - hide grid, show swiper */
@media (max-width: 767px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: flex;
		flex-direction: row;
		gap: 0.25rem;
    }

    .shop-categories-section {

        width: calc(100% + 4.375rem) !important;
        margin-left: -2.1875rem !important;

    }


    .shop-categories-section__title {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }

    .shop-categories-section__swiper {
        padding: 0;
        width: calc(100% + 4.375rem) !important;
        /* Ensure scrolling works on mobile */
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
    }

    .shop-categories-section__swiper .shop-categories-section__item {
        flex: 0 0 auto !important;
        touch-action: pan-x !important;
		margin-right: 0 !important;
		box-sizing: border-box;
    }

    /* Move title completely outside of card container for mobile */
    .shop-categories-section__swiper .shop-categories-section__content-wrapper {
        display: block;
        margin: 0 5px; /* Add margin to content wrapper */
		width: 60%;
		flex-shrink: 0;
    }

    .shop-categories-section__swiper .shop-categories-section__item-title {
        margin-top: 1rem;
        text-align: left;
        padding: 0 5px; /* Add padding to title */
    }
}

/* Adjust content wrapper to position elements properly */
.shop-categories-section__content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.shop-categories-section__swiper .shop-categories-section__image-container {
    flex: 1;
}
