/**
 * YITH Added-to-Cart popup – "People also bought" block.
 *
 * The plugin ships a float-based loop (`width: 30.6%; float: left`), but
 * Astra 4 renders `ul.products` as a CSS grid. Inside a grid, that percentage
 * resolves against the grid cell, shrinking every card to ~62px.
 *
 * These rules re-assert a clean, self-contained card grid and neutralise the
 * legacy float sizing, without touching the plugin itself.
 */

/* ---------------------------------------------------------------
   Heading
   --------------------------------------------------------------- */

#yith-wacp-popup .yith-wacp-content .yith-wacp-related {
	margin-top: 22px;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related > h3 {
	margin: 0 0 18px;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-align: center;
	text-transform: uppercase;
	color: #415161;
}

/* ---------------------------------------------------------------
   Grid of cards

   The column count comes from WooCommerce's `columns-*` class on the list,
   so the grid keeps working if the popup column setting is changed.
   --------------------------------------------------------------- */

#yith-wacp-popup .yith-wacp-content .yith-wacp-related ul.products {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	gap: 20px 16px !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related ul.products.columns-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related ul.products.columns-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* Neutralise the plugin's float/percentage sizing (the 62px bug). */
#yith-wacp-popup .yith-wacp-content .yith-wacp-related ul.products li.product,
#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product.yith-wacp-related-product {
	float: none !important;
	clear: none !important;
	position: relative;
	display: flex !important;
	flex-direction: column;
	width: auto !important;
	max-width: none !important;
	min-width: 0 !important;
	height: 100%;
	margin: 0 !important;
	padding: 0 !important;
	text-align: center;
	background: transparent;
}

/* Push the add-to-cart button to the bottom so cards line up. */
#yith-wacp-popup .yith-wacp-content .yith-wacp-related ul.products li.product > a {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	text-decoration: none;
}

/* ---------------------------------------------------------------
   Card contents
   --------------------------------------------------------------- */

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product .product-image {
	margin: 0 0 10px;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product .product-image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #f7f7f7;
	border-radius: 4px;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product h3 {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin: 0 0 8px;
	padding: 0;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: #27393f;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product .product-price {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	color: #565656;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product .product-price .price {
	margin: 0;
	font-size: inherit;
	color: inherit;
}

/* The button sits in a WooCommerce `add_to_cart_inline` paragraph that
   follows the link; strip the default paragraph box. */
#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product p.product.add_to_cart_inline {
	margin: 0 auto;
	padding: 0;
	border: 0;
	width: 100%;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product a.button {
	display: inline-block;
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-radius: 3px;
	background-color: #a97b49;
	color: #ffffff;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.04em;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product a.button:hover,
#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product a.button:focus {
	background-color: #8f6739;
	color: #ffffff;
}

/* ---------------------------------------------------------------
   Narrow viewports

   The popup shrinks to almost the full screen width on phones, so two
   columns read better than three.
   --------------------------------------------------------------- */

@media (max-width: 600px) {
	#yith-wacp-popup .yith-wacp-content .yith-wacp-related ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 16px 12px !important;
	}

	#yith-wacp-popup .yith-wacp-content .yith-wacp-related > h3 {
		margin-bottom: 14px;
		font-size: 13px;
	}

	#yith-wacp-popup .yith-wacp-content .yith-wacp-related li.product h3 {
		font-size: 12px;
	}
}
