/**
 * Editorial category showcase — home [product_categories]
 * Overlay titles, mosaic layout, cinematic hover.
 */

.dmary-cat-showcase {
	--dcs-ink: #1f1c1a;
	--dcs-muted: #6a645c;
	--dcs-line: rgba(31, 28, 26, 0.1);
	--dcs-sand: #f3efe8;
	--dcs-ease: cubic-bezier(0.22, 1, 0.36, 1);
	position: relative;
	isolation: isolate;
	margin-block: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 6vw, 4.5rem);
	padding-block: clamp(2.75rem, 6vw, 4.75rem);
	padding-inline: clamp(1.15rem, 4vw, 2.75rem);
	background:
		radial-gradient(120% 80% at 10% 0%, rgba(92, 107, 90, 0.08), transparent 55%),
		radial-gradient(90% 70% at 100% 100%, rgba(22, 58, 95, 0.06), transparent 50%),
		linear-gradient(180deg, #f7f4ef 0%, var(--dcs-sand) 48%, #efebe3 100%);
}

.dmary-cat-showcase::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--dcs-line), transparent);
	pointer-events: none;
}

.dmary-cat-showcase__inner {
	width: min(100%, 1240px);
	margin-inline: auto;
}

.dmary-cat-showcase__head {
	display: grid;
	gap: 0.65rem;
	margin-bottom: clamp(1.75rem, 3.5vw, 2.75rem);
	max-width: 36rem;
}

.dmary-cat-showcase__eyebrow {
	margin: 0;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--dcs-muted);
}

.dmary-cat-showcase__head .stk-block-heading__text,
.dmary-cat-showcase__title {
	margin: 0 !important;
	font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif !important;
	font-size: clamp(2rem, 4.2vw, 3rem) !important;
	font-weight: 600 !important;
	letter-spacing: -0.03em !important;
	line-height: 1.08 !important;
	color: var(--dcs-ink) !important;
	text-align: left !important;
}

.dmary-cat-showcase__lede {
	margin: 0.15rem 0 0;
	font-size: clamp(1rem, 1.4vw, 1.12rem);
	line-height: 1.55;
	color: var(--dcs-muted);
	max-width: 34ch;
}

/* Neutralize Stackable spacing when heading is relocated */
.dmary-cat-showcase #categorias,
.dmary-cat-showcase .stk-block-heading {
	margin: 0 !important;
	padding: 0 !important;
}

.dmary-cat-showcase .woocommerce.columns-4 {
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
}

.dmary-cat-showcase ul.products {
	display: grid !important;
	grid-template-columns: 1.15fr 1fr 1fr;
	grid-template-rows: minmax(240px, 32vh) minmax(240px, 32vh);
	gap: 0.85rem !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none;
	transform: none !important;
	width: 100% !important;
	float: none !important;
}

.dmary-cat-showcase ul.products > li.product-category {
	position: relative;
	width: auto !important;
	max-width: none !important;
	min-height: 240px;
	margin: 0 !important;
	float: none !important;
	list-style: none;
	overflow: hidden;
	background: #2a2724;
	isolation: isolate;
}

.dmary-cat-showcase ul.products > li.product-category:nth-child(1) {
	grid-row: 1 / 3;
}

.dmary-cat-showcase ul.products > li.product-category:nth-child(2) {
	grid-column: 2 / 4;
}

/* Hide Uncategorized leftovers */
.dmary-cat-showcase ul.products > li.product-category.product-cat-uncategorized,
.dmary-cat-showcase ul.products > li.product-category:has(a[href*="/uncategorized/"]),
.home ul.products > li.product-category.product-cat-uncategorized,
.home ul.products > li.product-category:has(a[href*="/uncategorized/"]),
.front-page ul.products > li.product-category.product-cat-uncategorized,
.front-page ul.products > li.product-category:has(a[href*="/uncategorized/"]) {
	display: none !important;
}

.dmary-cat-showcase ul.products > li.product-category figure {
	margin: 0;
	height: 100%;
}

.dmary-cat-showcase .dmary-cat-media,
.dmary-cat-showcase ul.products > li.product-category .ct-media-container {
	position: absolute !important;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border-radius: 0 !important;
	overflow: hidden;
	background: #2a2724;
	aspect-ratio: auto !important;
}

.dmary-cat-showcase ul.products > li.product-category .ct-media-container::after,
.dmary-cat-showcase .dmary-cat-media::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background:
		linear-gradient(
			180deg,
			rgba(15, 14, 12, 0.08) 0%,
			rgba(15, 14, 12, 0.18) 42%,
			rgba(15, 14, 12, 0.78) 100%
		);
	transition: background 0.55s var(--dcs-ease), opacity 0.55s var(--dcs-ease);
}

.dmary-cat-showcase ul.products > li.product-category:hover .ct-media-container::after,
.dmary-cat-showcase ul.products > li.product-category:focus-within .ct-media-container::after,
.dmary-cat-showcase ul.products > li.product-category:hover .dmary-cat-media::after,
.dmary-cat-showcase ul.products > li.product-category:focus-within .dmary-cat-media::after {
	background:
		linear-gradient(
			180deg,
			rgba(15, 14, 12, 0.12) 0%,
			rgba(15, 14, 12, 0.28) 40%,
			rgba(15, 14, 12, 0.86) 100%
		);
}

.dmary-cat-showcase ul.products > li.product-category img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transform: scale(1.04);
	transition: transform 1.1s var(--dcs-ease), filter 1.1s var(--dcs-ease);
	aspect-ratio: unset !important;
	filter: saturate(0.92) contrast(1.02);
}

.dmary-cat-showcase ul.products > li.product-category:hover img,
.dmary-cat-showcase ul.products > li.product-category:focus-within img {
	transform: scale(1.12);
	filter: saturate(1.05) contrast(1.04);
}

.dmary-cat-caption {
	position: absolute;
	inset: auto 0 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	gap: 0.35rem;
	padding: clamp(1.15rem, 2.2vw, 1.75rem);
	pointer-events: none;
	color: #fff;
	transform: translateY(0);
	transition: transform 0.45s var(--dcs-ease);
}

.dmary-cat-showcase ul.products > li.product-category:hover .dmary-cat-caption,
.dmary-cat-showcase ul.products > li.product-category:focus-within .dmary-cat-caption {
	transform: translateY(-4px);
}

.dmary-cat-showcase .woocommerce-loop-category__title,
.dmary-cat-showcase ul.products > li.product-category .woocommerce-loop-category__title {
	margin: 0 !important;
	padding: 0 !important;
	font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
	font-size: clamp(1.55rem, 2.4vw, 2.15rem);
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.08;
	color: #fff !important;
	text-shadow: 0 1px 18px rgba(0, 0, 0, 0.25);
}

.dmary-cat-showcase ul.products > li.product-category:nth-child(1) .woocommerce-loop-category__title {
	font-size: clamp(1.9rem, 3vw, 2.65rem);
}

.dmary-cat-showcase .woocommerce-loop-category__title a {
	color: inherit !important;
	text-decoration: none !important;
	background: none !important;
}

.dmary-cat-showcase .woocommerce-loop-category__title .count {
	display: block;
	margin-top: 0.45rem;
	padding: 0;
	border: 0;
	background: none;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 0.7rem;
	font-weight: 500;
	font-style: normal;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.72);
	text-shadow: none;
}

.dmary-cat-explore {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin-top: 0.55rem;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.92);
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.4s var(--dcs-ease), transform 0.4s var(--dcs-ease);
}

.dmary-cat-explore::after {
	content: "";
	width: 1.35rem;
	height: 1px;
	background: currentColor;
	transform: scaleX(0.55);
	transform-origin: left center;
	transition: transform 0.4s var(--dcs-ease), width 0.4s var(--dcs-ease);
}

.dmary-cat-showcase ul.products > li.product-category:hover .dmary-cat-explore,
.dmary-cat-showcase ul.products > li.product-category:focus-within .dmary-cat-explore {
	opacity: 1;
	transform: translateY(0);
}

.dmary-cat-showcase ul.products > li.product-category:hover .dmary-cat-explore::after,
.dmary-cat-showcase ul.products > li.product-category:focus-within .dmary-cat-explore::after {
	transform: scaleX(1);
	width: 1.85rem;
}

/* Soft edge highlight on tile */
.dmary-cat-showcase ul.products > li.product-category::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
	opacity: 0.7;
	transition: box-shadow 0.4s var(--dcs-ease), opacity 0.4s var(--dcs-ease);
}

.dmary-cat-showcase ul.products > li.product-category:hover::after,
.dmary-cat-showcase ul.products > li.product-category:focus-within::after {
	opacity: 1;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* Carousel leftovers */
.home .dmary-carousel:has(.product-category),
.front-page .dmary-carousel:has(.product-category),
.dmary-cat-showcase .dmary-carousel {
	display: contents;
}

.home .dmary-carousel:has(.product-category) .dmary-carousel__btn,
.front-page .dmary-carousel:has(.product-category) .dmary-carousel__btn,
.dmary-cat-showcase .dmary-carousel__btn {
	display: none !important;
}

@media (max-width: 900px) {
	.dmary-cat-showcase ul.products {
		grid-template-columns: 1fr 1fr;
		grid-template-rows: minmax(260px, 42vw) minmax(220px, 36vw) minmax(220px, 36vw);
		gap: 0.7rem !important;
	}

	.dmary-cat-showcase ul.products > li.product-category:nth-child(1) {
		grid-column: 1 / 3;
		grid-row: 1;
		min-height: 280px !important;
	}

	.dmary-cat-showcase ul.products > li.product-category:nth-child(2) {
		grid-column: auto;
	}

	.dmary-cat-showcase ul.products > li.product-category:nth-child(1) .woocommerce-loop-category__title {
		font-size: clamp(1.7rem, 5vw, 2.2rem);
	}
}

@media (max-width: 560px) {
	.dmary-cat-showcase {
		padding-inline: 1rem;
	}

	.dmary-cat-showcase ul.products {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		gap: 0.65rem !important;
	}

	.dmary-cat-showcase ul.products > li.product-category,
	.dmary-cat-showcase ul.products > li.product-category:nth-child(1),
	.dmary-cat-showcase ul.products > li.product-category:nth-child(2) {
		grid-column: auto;
		grid-row: auto;
		min-height: 260px !important;
	}

	.dmary-cat-explore {
		opacity: 0.9;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dmary-cat-showcase ul.products > li.product-category img,
	.dmary-cat-caption,
	.dmary-cat-explore,
	.dmary-cat-explore::after {
		transition: none;
	}

	.dmary-cat-showcase ul.products > li.product-category:hover img {
		transform: scale(1.04);
	}
}
