/* =========================================================
   Modern WooCommerce subcategory cards
   ========================================================= */

.tax-product_cat .products.elements-grid:has(.category-grid-item) {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	gap: 18px !important;
	margin: 0 0 40px !important;
	float: none !important;
	width: 100% !important;
}

.tax-product_cat .products.elements-grid:has(.category-grid-item)::before,
.tax-product_cat .products.elements-grid:has(.category-grid-item)::after {
	display: none !important;
	content: none !important;
}

/* Basel float clearfix divs create empty grid holes */
body.tax-product_cat .products.elements-grid > .clearfix,
body.tax-product_cat .products.elements-grid > .clearfix.visible-md-block,
body.tax-product_cat .products.elements-grid > .clearfix.visible-lg-block,
body.tax-product_cat .products.elements-grid > .clearfix.visible-sm-block,
body.tax-product_cat .products.elements-grid > .clearfix.visible-xs-block {
	display: none !important;
	visibility: hidden !important;
	position: absolute !important;
	width: 0 !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
	pointer-events: none !important;
}

.tax-product_cat .category-grid-item {
	width: auto !important;
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
	clear: none !important;
	min-height: 0 !important;
}

.tax-product_cat .category-grid-item.cat-design-default .category-content,
.tax-product_cat .category-grid-item .category-content {
	position: relative !important;
	display: flex !important;
	flex-direction: column !important;
	height: 100% !important;
	background: #fff !important;
	border: 1px solid #e5e7eb !important;
	border-radius: 12px !important;
	overflow: hidden !important;
	box-shadow: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.tax-product_cat .category-grid-item:hover .category-content {
	border-color: #d1d5db !important;
	box-shadow: 0 12px 28px rgba(17, 24, 39, 0.08) !important;
	transform: translateY(-2px);
}

.tax-product_cat .category-grid-item .category-link {
	display: block !important;
	position: relative !important;
	flex: 1 1 auto;
}

/* Image fills the whole card media area */
.tax-product_cat .category-grid-item .product-category-thumbnail {
	position: relative !important;
	height: auto !important;
	min-height: 0 !important;
	aspect-ratio: 4 / 3;
	background: #f3f4f6 !important;
	padding: 0 !important;
	display: block !important;
	overflow: hidden !important;
}

.tax-product_cat .category-grid-item .product-category-thumbnail img,
.tax-product_cat .category-grid-item .product-category-thumbnail .attachment-woocommerce_thumbnail {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	margin: 0 !important;
}

.tax-product_cat .category-grid-item .products-cat-number {
	display: none !important;
}

/* Title bar under the image */
.tax-product_cat .category-grid-item .hover-mask {
	position: static !important;
	top: auto !important;
	left: auto !important;
	right: auto !important;
	bottom: auto !important;
	width: 100% !important;
	height: auto !important;
	min-height: 52px !important;
	transform: none !important;
	opacity: 1 !important;
	visibility: visible !important;
	background: #fff !important;
	box-shadow: none !important;
	padding: 14px 16px !important;
	margin: 0 !important;
	border-top: 1px solid #f1f5f9 !important;
	display: flex !important;
	align-items: center !important;
	gap: 12px !important;
	text-align: left !important;
}

.tax-product_cat .category-grid-item .hover-mask::before {
	content: "" !important;
	display: block !important;
	flex-shrink: 0;
	width: 24px !important;
	height: 24px !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b1a24' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 15h11V8H8l-2 3H3v4z'/%3E%3Cpath d='M14 11h4l3 3v1h-7v-4z'/%3E%3Ccircle cx='7' cy='17' r='1.7'/%3E%3Ccircle cx='17.5' cy='17' r='1.7'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
	background-size: contain !important;
}

.tax-product_cat .category-grid-item .hover-mask::after {
	content: "" !important;
	display: block !important;
	flex-shrink: 0;
	width: 8px !important;
	height: 8px !important;
	margin-left: auto !important;
	border-right: 2px solid #8b1a24 !important;
	border-top: 2px solid #8b1a24 !important;
	transform: rotate(45deg);
}

.tax-product_cat .category-grid-item .hover-mask h3 {
	flex: 1 1 auto;
	margin: 0 !important;
	padding: 0 !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	line-height: 1.35 !important;
	letter-spacing: 0.01em;
	text-transform: uppercase !important;
	color: #111 !important;
	font-family: inherit !important;
	background: none !important;
	box-shadow: none !important;
}

.tax-product_cat .category-grid-item .hover-mask > a:not(.category-link-overlay) {
	display: none !important;
}

.tax-product_cat .category-grid-item .hover-mask .category-link-overlay {
	position: absolute !important;
	inset: 0 !important;
	z-index: 3 !important;
	background: transparent !important;
}

@media (max-width: 1199px) {
	.tax-product_cat .products.elements-grid:has(.category-grid-item) {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 767px) {
	.tax-product_cat .products.elements-grid:has(.category-grid-item) {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 12px !important;
	}

	.tax-product_cat .category-grid-item .hover-mask {
		padding: 12px !important;
		gap: 8px !important;
	}

	.tax-product_cat .category-grid-item .hover-mask h3 {
		font-size: 11px !important;
	}

	.tax-product_cat .category-grid-item .hover-mask::before {
		width: 18px;
		height: 18px;
	}
}

/* =========================================================
   Product grid on shop / category / tag (fix float gaps)
   ========================================================= */

body.tax-product_cat .products.elements-grid:has(.product-grid-item),
body.tax-product_tag .products.elements-grid:has(.product-grid-item),
body.post-type-archive-product .products.elements-grid:has(.product-grid-item) {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	gap: 24px 18px !important;
	margin: 0 0 40px !important;
	float: none !important;
	width: 100% !important;
}

body.tax-product_cat .products.elements-grid:has(.product-grid-item)::before,
body.tax-product_cat .products.elements-grid:has(.product-grid-item)::after,
body.tax-product_tag .products.elements-grid:has(.product-grid-item)::before,
body.tax-product_tag .products.elements-grid:has(.product-grid-item)::after,
body.post-type-archive-product .products.elements-grid:has(.product-grid-item)::before,
body.post-type-archive-product .products.elements-grid:has(.product-grid-item)::after {
	display: none !important;
	content: none !important;
}

body.tax-product_cat .products.elements-grid > .product-grid-item,
body.tax-product_tag .products.elements-grid > .product-grid-item,
body.post-type-archive-product .products.elements-grid > .product-grid-item {
	width: auto !important;
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
	clear: none !important;
	min-height: 0 !important;
}

/* Keep clearfix hidden on product grids too (already covered above for tax-product_cat) */
body.tax-product_tag .products.elements-grid > .clearfix,
body.post-type-archive-product .products.elements-grid > .clearfix,
body.tax-product_tag .products.elements-grid > .clearfix.visible-md-block,
body.tax-product_tag .products.elements-grid > .clearfix.visible-lg-block,
body.tax-product_tag .products.elements-grid > .clearfix.visible-sm-block,
body.tax-product_tag .products.elements-grid > .clearfix.visible-xs-block,
body.post-type-archive-product .products.elements-grid > .clearfix.visible-md-block,
body.post-type-archive-product .products.elements-grid > .clearfix.visible-lg-block,
body.post-type-archive-product .products.elements-grid > .clearfix.visible-sm-block,
body.post-type-archive-product .products.elements-grid > .clearfix.visible-xs-block {
	display: none !important;
	visibility: hidden !important;
	position: absolute !important;
	width: 0 !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	overflow: hidden !important;
	pointer-events: none !important;
}

@media (max-width: 1199px) {
	body.tax-product_cat .products.elements-grid:has(.product-grid-item),
	body.tax-product_tag .products.elements-grid:has(.product-grid-item),
	body.post-type-archive-product .products.elements-grid:has(.product-grid-item) {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 767px) {
	body.tax-product_cat .products.elements-grid:has(.product-grid-item),
	body.tax-product_tag .products.elements-grid:has(.product-grid-item),
	body.post-type-archive-product .products.elements-grid:has(.product-grid-item) {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 16px 12px !important;
	}
}
