/*------------------------------------*\
    PRODUCT CATEGORIES (Homepage)
\*------------------------------------*/

/* Base grid layout - Default 8 columns */
.product-categories ul.products {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-column-gap: 20px;
    grid-row-gap: 20px;
    margin: 0 !important;
}

/* 4-column variant */
.product-categories-4 ul.products {
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* Search variant */
.product-categories-search ul.products {
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* Hide stray elements */
ul.products::before {
	display: none !important;
}

.product-categories ul.products::after {
    display: none;
}

.woocommerce ul.products li.product a {
	width: 100%;
}

/* Category tile structure */
.product-categories ul li {
	width: 100% !important;
	margin: 0 !important;
	padding-bottom: 100% !important;
	position: relative !important;
	list-style: none !important;
}

.product-categories ul li a {
	height: 100%;
	position: absolute;
	overflow: hidden;
	border-radius: 8px;
}

/* Gradient overlay on hover */
.product-category a::before {
    content: "";
    position: absolute;
    left: 0;
    height: 100%;
    width: 100%;
    inset: 0px;
    display: block;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 10.7%, rgba(0, 0, 0, 0) 95.44%);
    transition: top .2s ease;
    top: 50%;
	z-index: 1;
}

.product-category:hover a::before {
	top: 0;
}

/* Category image */
.product-categories ul li img {
	margin: 0px !important;
	height: 100% !important;
	object-fit: cover;
	object-position: left;
}

/* Category title */
.product-categories ul li h2 {
	position: absolute;
	bottom: 0;
	width: 100% !important;
	color: white !important;
	text-align: center !important;
	padding: 16px 5px !important;
	line-height: 1.25em !important; 
	transition: all 0.3s ease;
	z-index: 2;
}

.product-category:hover h2 {
	transform: translateY(-10px);
}

/* Hide count */
.product-categories ul li h2 mark.count {
	display: none !important; 
}


/*------------------------------------*\
    RESPONSIVE STYLES
\*------------------------------------*/

/* Mobile: Horizontal scroll (< 768px) */
@media only screen and (max-width: 767px) {
	.product-categories ul.products {	
		overflow-x: scroll;
	    white-space: nowrap;
	    display: block;
	    width: calc(100vw);
	    transform: translateX(-5vw);
	    padding: 0 5vw;
	    vertical-align: top;
	    -webkit-overflow-scrolling: touch;
	}
	
	.product-categories ul.products li {
		display: inline-block;
	    max-width: 150px;
	    padding-bottom: 150px !important;
	    margin-right: 10px !important;
	    vertical-align: top;
	    white-space: normal;
	    float: none !important;
	}
}

/* Tablet: 4 columns (768px - 1139px) */
@media only screen and (min-width: 768px) {
	.product-categories ul.products {
	    display: grid;
	    grid-template-columns: repeat(4, minmax(0, 1fr));
	    grid-column-gap: 20px;
	    grid-row-gap: 20px;

	    padding: 0;
	    width: 100%;
	    overflow: auto;
	    transform: none;
	}
	
	.product-categories-de ul.products {
	    grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	
	.product-categories-de-4 ul.products {
	    grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	

	.product-categories ul.products li {
		display: list-item;
	    max-width: none;
	    margin-right: 0px;
	    padding-bottom: 100% !important;
	}
	
	.product-categories-de ul.products li {
	    padding-bottom: 75% !important;
	}
	
	.product-categories-de-4 ul.products li {
	    padding-bottom: 75% !important;
	}
	
	.product-categories-4 ul.products li {
		padding-bottom: 60% !important;
	}
}

/* Desktop: 8 columns (≥ 1140px) */
@media only screen and (min-width: 1140px) {
	.product-categories ul.products {
	    display: grid;
	    grid-template-columns: repeat(8, minmax(0, 1fr));
	    grid-column-gap: 20px;
	    grid-row-gap: 20px;
	}
	
	.product-categories-de ul.products {
	    grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	
	.product-categories-de-4 ul.products {
	    grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	
	.product-categories-de ul.products li {
		padding-bottom: 52% !important;
	}
	
	.product-categories-de-4 ul.products li {
		padding-bottom: 75% !important;
	}
}
