/*
 * Product card: one look for every list of products — Elementor Pro's Products and Archive Products
 * widgets (home page, landing pages, categories, search), related products, the account's Обране.
 * The markup is WooCommerce's (content-product.php) plus the theme's: the instalment badges
 * (inc/installment-badges.php) and .ses-card-actions with the heart (inc/wishlist.php).
 *
 * The card is styled here and only here: the widgets' own Style settings are left empty. Elementor
 * still prints its defaults for them (global font and colour, selectors of five classes and two
 * elements), hence `html` and `.type-product` in front: a step heavier than those. `.woocommerce` is
 * the widget's wrapper or, on WooCommerce pages (related products), the body itself.
 */

:root {
	--ses-card-ink: #212b36;
	--ses-card-muted: #7a838c;
	--ses-card-line: #e3e6e9;
	--ses-card-line-hover: #c4cad0;
	--ses-card-pad: 16px;
	--ses-card-gap: 20px;
	--ses-card-font: var(--e-global-typography-accent-font-family, "Montserrat"), sans-serif;
}

/* The same gaps in every grid; Elementor sets them per widget, 40px × 20px by default. */
body .elementor-wc-products ul.products.elementor-grid {
	gap: var(--ses-card-gap) !important;
}

html .woocommerce ul.products li.product.type-product {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	padding: var(--ses-card-pad);
	border: 1px solid var(--ses-card-line);
	border-radius: 0;
	background: #fff;
	box-shadow: none;
	text-align: center;
	transition: border-color 0.2s;
}

/* Photo, name and price: one link that takes the card's height, so the price and the buttons line up
   along the row however long the names are. */
html .woocommerce ul.products li.product.type-product a.woocommerce-loop-product__link {
	display: flex;
	flex: 1 0 auto;
	flex-direction: column;
	color: var(--ses-card-ink);
}

html .woocommerce ul.products li.product.type-product a.woocommerce-loop-product__link img {
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	margin: 0 0 14px;
	object-fit: contain;
}

html .woocommerce ul.products li.product.type-product .woocommerce-loop-product__title {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	padding: 0;
	color: var(--ses-card-ink);
	font-family: var(--ses-card-font);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

html .woocommerce ul.products li.product.type-product .star-rating {
	margin: 8px auto 0;
	font-size: 12px;
}

html .woocommerce ul.products li.product.type-product .price {
	margin: auto 0 0;
	padding-top: 10px;
	color: var(--ses-card-ink);
	font-family: var(--ses-card-font);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
}

html .woocommerce ul.products li.product.type-product .price del {
	margin-right: 6px;
	color: var(--ses-card-muted);
	font-size: 14px;
	font-weight: 400;
	opacity: 1;
}

html .woocommerce ul.products li.product.type-product .price ins {
	background: none;
	font-weight: inherit;
	text-decoration: none;
}

@media (hover: hover) {
	html .woocommerce ul.products li.product.type-product:hover {
		border-color: var(--ses-card-line-hover);
	}
}

/*
 * Bottom row: "Додати в кошик" takes the width but the heart, a square as tall as the button; square
 * corners and capitals as on the product page. On a narrow card the text wraps to two lines.
 */
html .woocommerce ul.products li.product.type-product .ses-card-actions {
	display: flex;
	align-items: stretch;
	gap: 8px;
	margin-top: 14px;
}

html .woocommerce ul.products li.product.type-product .ses-card-actions .button {
	display: inline-flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 6px 8px;
	border-radius: 0;
	font-family: var(--ses-card-font);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.04em;
	text-align: center;
	text-transform: uppercase;
	text-wrap: balance;
	white-space: normal;
}

html .woocommerce ul.products li.product.type-product .ses-wishlist-btn--card {
	flex: 0 0 44px;
	width: 44px;
	min-height: 44px;
	border-radius: 0;
}

@media (max-width: 767px) {
	:root {
		--ses-card-pad: 10px;
		--ses-card-gap: 10px;
	}

	html .woocommerce ul.products li.product.type-product .woocommerce-loop-product__title {
		font-size: 13px;
	}

	html .woocommerce ul.products li.product.type-product .price {
		font-size: 15px;
	}

	html .woocommerce ul.products li.product.type-product .price del {
		font-size: 13px;
	}

	html .woocommerce ul.products li.product.type-product .ses-card-actions {
		gap: 6px;
		margin-top: 10px;
	}

	html .woocommerce ul.products li.product.type-product .ses-card-actions .button {
		padding: 6px;
		font-size: 12px;
		letter-spacing: 0.02em;
	}

	html .woocommerce ul.products li.product.type-product .ses-wishlist-btn--card {
		flex-basis: 40px;
		width: 40px;
	}
}
