/*
 * EZ Minim Product Grid
 * Scoped to WooCommerce listing cards. Single-product galleries are untouched.
 */
:root {
	--ezmpg-cream: #f7f3e9;
	--ezmpg-green: #0d382d;
	--ezmpg-gold: #cfa719;
	--ezmpg-line: rgba(13, 56, 45, 0.14);
}

/* Give cards a consistent, quiet structure. */
:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product,
.wp-block-woocommerce-product-collection .wc-block-product,
.wc-block-grid__products .wc-block-grid__product {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	padding: 0 0 28px;
	background: transparent;
	border: 1px solid var(--ezmpg-line);
	border-radius: 4px;
	overflow: hidden;
	box-shadow: none;
}

/*
 * Woo themes commonly crop here with object-fit:cover. The square frame stays
 * consistent, while contain guarantees that tall lulavim/koishekal remain whole.
 */
.wp-block-woocommerce-product-collection .wc-block-components-product-image,
.wc-block-product .wc-block-components-product-image,
.wp-block-woocommerce-product-template .wc-block-components-product-image,
.wc-block-grid__products .wc-block-grid__product-image {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	margin: 0 0 20px;
	padding: 24px;
	background: var(--ezmpg-cream);
	overflow: hidden;
}

.wc-block-product .wc-block-components-product-image > a,
.wp-block-woocommerce-product-template .wc-block-components-product-image > a,
.wc-block-grid__products .wc-block-grid__product-image > a {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
}

:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product .woocommerce-loop-product__link > img,
:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product > img {
	box-sizing: border-box;
	display: block;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 1 / 1;
	margin: 0 0 20px !important;
	padding: 24px;
	background: var(--ezmpg-cream);
	object-fit: contain !important;
	object-position: center !important;
	transform: none !important;
	transition: none !important;
	overflow: hidden;
}

.wp-block-woocommerce-product-collection .wc-block-components-product-image img,
.wc-block-product .wc-block-components-product-image img,
.wp-block-woocommerce-product-template .wc-block-components-product-image img,
.wc-block-grid__products .wc-block-grid__product-image img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	max-height: 100% !important;
	margin: 0 !important;
	padding: 0;
	object-fit: contain !important;
	object-position: center !important;
	transform: none !important;
	transition: none !important;
	filter: none;
}

/* Prevent theme hover effects from moving or enlarging listing images. */
:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product:hover img,
.wp-block-woocommerce-product-collection .wc-block-product:hover img,
.wc-block-product:hover .wc-block-components-product-image img,
.wp-block-woocommerce-product-template .wc-block-components-product-image:hover img,
.wc-block-grid__products .wc-block-grid__product:hover img {
	transform: none !important;
	scale: 1 !important;
}

/* Typography and content rhythm. */
:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product > :not(.woocommerce-loop-product__link),
.wp-block-woocommerce-product-collection .wc-block-product > :not(.wc-block-components-product-image),
.wc-block-grid__products .wc-block-grid__product > :not(.wc-block-grid__product-image) {
	margin-left: 28px;
	margin-right: 28px;
}

:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product .woocommerce-loop-product__title,
:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product .woocommerce-loop-product__link > .price {
	margin-left: 28px;
	margin-right: 28px;
}

:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product .woocommerce-loop-product__title,
.wp-block-woocommerce-product-collection .wc-block-components-product-title,
.wc-block-grid__products .wc-block-grid__product-title {
	margin-top: 0;
	margin-bottom: 18px;
	color: var(--ezmpg-green);
	line-height: 1.08;
}

:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product .price,
.wp-block-woocommerce-product-collection .wc-block-components-product-price,
.wc-block-grid__products .wc-block-grid__product-price {
	margin-top: auto;
	margin-bottom: 16px;
	color: var(--ezmpg-green);
	font-weight: 700;
}

/* Keep grid controls restrained and aligned with the established visual system. */
:where(
	body.woocommerce-shop,
	body.post-type-archive-product,
	body.tax-product_cat,
	body.tax-product_tag,
	body.woocommerce-page
) ul.products li.product .button,
.wp-block-woocommerce-product-collection .wp-block-button__link,
.wc-block-grid__products .wp-block-button__link {
	align-self: flex-start;
	color: var(--ezmpg-green);
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--ezmpg-gold);
	border-radius: 0;
	padding: 3px 0 5px;
	font-weight: 700;
	text-decoration: none;
}

@media (max-width: 781px) {
	:where(
		body.woocommerce-shop,
		body.post-type-archive-product,
		body.tax-product_cat,
		body.tax-product_tag,
		body.woocommerce-page
	) ul.products li.product .woocommerce-loop-product__link > img,
	:where(
		body.woocommerce-shop,
		body.post-type-archive-product,
		body.tax-product_cat,
		body.tax-product_tag,
		body.woocommerce-page
	) ul.products li.product > img,
	.wp-block-woocommerce-product-collection .wc-block-components-product-image,
	.wc-block-product .wc-block-components-product-image,
	.wp-block-woocommerce-product-template .wc-block-components-product-image,
	.wc-block-grid__products .wc-block-grid__product-image {
		padding: 18px;
	}

	:where(
		body.woocommerce-shop,
		body.post-type-archive-product,
		body.tax-product_cat,
		body.tax-product_tag,
		body.woocommerce-page
	) ul.products li.product > :not(.woocommerce-loop-product__link),
	.wp-block-woocommerce-product-collection .wc-block-product > :not(.wc-block-components-product-image),
	.wc-block-grid__products .wc-block-grid__product > :not(.wc-block-grid__product-image) {
		margin-left: 20px;
		margin-right: 20px;
	}

	:where(
		body.woocommerce-shop,
		body.post-type-archive-product,
		body.tax-product_cat,
		body.tax-product_tag,
		body.woocommerce-page
	) ul.products li.product .woocommerce-loop-product__title,
	:where(
		body.woocommerce-shop,
		body.post-type-archive-product,
		body.tax-product_cat,
		body.tax-product_tag,
		body.woocommerce-page
	) ul.products li.product .woocommerce-loop-product__link > .price {
		margin-left: 20px;
		margin-right: 20px;
	}
}
