/* =============================================================================
 * CarParts — Equal-height WooCommerce product cards
 *
 * Two things make cards in a row unequal:
 *   1) the product image — thumbnails are «uncropped», so products with different
 *      aspect ratios (600×600 vs 600×200 vs 483×134 …) render at different heights;
 *   2) the title — wrapping to one vs. two lines.
 *
 * Fix both, purely on the loop, so the image area, title, category label and the
 * price / «افزودن به سبد خرید» bar all line up across a row — in the homepage Slick
 * carousels AND the shop / category / related-products («محصولات مشابه») grids.
 *
 * Deliberately scoped to `ul.products li.product` with no flex/height/float
 * overrides on the card itself, so the single-product related slider isn't broken.
 * Bump $ver in the loader after editing.
 * ========================================================================== */

/* 1) Uniform image area. The image keeps its own aspect ratio (object-fit:contain
 *    → no distortion, just centred with whitespace around it) but every image now
 *    occupies the SAME square box, so the title always starts at the same height. */
.woocommerce ul.products li.product .xtra-product-thumbnail img,
.woocommerce ul.products li.product img.attachment-woocommerce_thumbnail {
	width: 100% !important;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	object-position: center;
}

/* 2) Reserve a consistent two-line height for the title and centre a one-line
 *    title inside it. Measured: one line = 46px, two lines = 74px at the theme's
 *    18px title font, so reserve 4.2em (≈ 76px) — every one-line title now fills
 *    the same height as a two-line one. It's a min-height, so a rare three-line
 *    title still grows without clipping. */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	display: flex !important;
	flex-direction: column !important;  /* text spans full width → text-align truly centres */
	justify-content: center !important; /* vertical centring inside the 2-line slot          */
	align-items: center !important;     /* horizontal centring of each wrapped line          */
	text-align: center !important;      /* centre EVERY wrapped line (beats theme RTL start) */
	min-height: 4.2em !important;
	line-height: 1.55 !important;
	box-sizing: border-box !important;
	margin-top: 15px !important;        /* match theme inline margin-top, uniform across cards */
	/* The theme's product link is shrink-wrapped, so without an explicit width the h3
	 * collapses to its text width and the RTL link parks it against the right edge
	 * (≈25px off-centre). Force full width so text-align:center is measured against the
	 * whole card, not the text box. */
	width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
