/**
 * Storefront recommendations — the default look of the cards the
 * `smaily/recommendations` block and the [smaily_recommendations] shortcode
 * show (CON-449): a grid, four across on a wide screen and two on a phone,
 * each image filling its card, an add-to-cart button under each card.
 *
 * Every selector sits inside :where(), so every rule here has zero
 * specificity: a theme rule for WooCommerce product grids (ul.products,
 * li.product, .button) always wins, property by property. The layout uses
 * floats, as WooCommerce's own product grid does, so a theme that floats the
 * cards simply replaces the widths and margins below.
 */

:where(.smaily-connect-recommendations ul.products) {
	display: flow-root;
	margin: 0;
	padding: 0;
	list-style: none;
}

:where(.smaily-connect-recommendations ul.products li.product) {
	float: left;
	width: calc((100% - 3 * 1.5em) / 4);
	margin: 0 1.5em 1.5em 0;
	padding: 0;
	list-style: none;
	text-align: left;
}

:where(.smaily-connect-recommendations ul.products li.product:nth-child(4n)) {
	margin-right: 0;
}

:where(.smaily-connect-recommendations ul.products li.product:nth-child(4n+1)) {
	clear: left;
}

:where(.smaily-connect-recommendations li.product a.woocommerce-loop-product__link) {
	display: block;
	text-decoration: none;
}

:where(.smaily-connect-recommendations li.product img) {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	margin: 0 0 0.75em;
}

:where(.smaily-connect-recommendations li.product .woocommerce-loop-product__title) {
	margin: 0 0 0.25em;
	padding: 0;
	font-size: 1em;
	line-height: 1.3;
}

:where(.smaily-connect-recommendations li.product .price) {
	display: block;
	margin: 0 0 0.75em;
}

:where(.smaily-connect-recommendations li.product a.smaily-connect-recommendations__button) {
	display: inline-block;
	padding: 0.5em 1em;
	border: 1px solid currentColor;
	border-radius: 3px;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
}

@media (max-width: 768px) {

	:where(.smaily-connect-recommendations ul.products li.product) {
		width: calc((100% - 1.5em) / 2);
		margin-right: 1.5em;
	}

	:where(.smaily-connect-recommendations ul.products li.product:nth-child(2n)) {
		margin-right: 0;
	}

	:where(.smaily-connect-recommendations ul.products li.product:nth-child(2n+1)) {
		clear: left;
	}
}
