/**
 * Product loop box template — every loop, not just the shop archive.
 *
 *   CATEGORY
 *   Product title
 *   attributes / excerpt
 *   [ price | cart icon ]   ← `.dongduongwine-price-cart`
 *
 * Scoped to `.product-small.box`, the inner card (the column wrapper is also
 * `.product-small`). Overlay and shade boxes are excluded from the text/cart
 * template; the 3:4 image frame still applies to them.
 */

/* ---------------------------------------------------------------------------
 * Catalog image — 3:4 without Flatsome Equalize Items / equal image heights.
 *
 * The frame is locked with aspect-ratio. Images fill it with object-fit so
 * mixed source sizes (square, portrait, landscape) still line up in the grid.
 * padding-top is reset so Flatsome’s equal-height trick cannot stretch the box.
 * ------------------------------------------------------------------------- */

.product-small .box-image {
	position: relative;
	aspect-ratio: 3 / 4;
	height: auto !important;
	padding-top: 0 !important;
	overflow: hidden;
	background-color: #f6f6f6;
}

.product-small .box-image > :first-child {
	position: absolute;
	inset: 0;
	height: 100% !important;
	padding-top: 0 !important;
}

.product-small .box-image a {
	display: block;
	height: 100%;
}

.product-small .box-image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

/* Keep loop title look when the markup uses h3 instead of p. */
.product-small .box-text > .product-title,
h3.name.product-title.woocommerce-loop-product__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	height: auto;
	max-height: none;
	margin: 0.1em 0 0.4em;
	font-weight: inherit;
	line-height: 1.35;
}

a.woocommerce-LoopProduct-link.woocommerce-loop-product__link {
	font-size: 13px;
	color: #000000;
}

.product-small .box-text .title-wrapper {
	overflow: visible;
}

.product-small .box-text .pwpa-loop-slot {
	flex: 0 0 auto;
	min-width: 0;
	width: 100%;
	text-align: left;
}

.product-small .box-text .pwpa-loop-slot:empty {
	display: none;
}

/* Slot owns the loop table; hide a leftover copy inside the title. */
.product-small .box-text:has(> .pwpa-loop-slot .pwpa) .title-wrapper > .pwpa--loop {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Price + cart row
 *
 * HTML wrap (`.dongduongwine-price-cart`) owns this layout so `.box-text`
 * stays a normal stack — title, attributes and excerpt are untouched.
 * ------------------------------------------------------------------------- */

.product-small.box:not(.box-overlay):not(.box-shade) .dongduongwine-price-cart {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	text-align: left;
}

.product-small.box:not(.box-overlay):not(.box-shade) .dongduongwine-price-cart .price-wrapper {
	flex: 1 1 auto;
	min-width: 0;
	text-align: left;
}

.product-small.box:not(.box-overlay):not(.box-shade) .dongduongwine-price-cart .add-to-cart-button {
	flex: 0 0 auto;
	align-self: center;
	margin: 0;
}

/* Two prices (regular + sale) stack on the left; one price stays one line. */
.product-small.box:not(.box-overlay):not(.box-shade) .dongduongwine-price-cart .price:has(del),
.product-small.box:not(.box-overlay):not(.box-shade) .dongduongwine-price-cart .smt-fs-prices:has(del) {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.1em;
}

/* ---------------------------------------------------------------------------
 * Add-to-cart icon button
 *
 * No extra scoping needed: the two spans only exist on buttons this theme has
 * filtered, so the rules reach exactly those.
 * ------------------------------------------------------------------------- */

/* Visually hidden, but still in the accessibility tree — the button must not
   end up nameless if WooCommerce ever drops its aria-label. */
.dongduongwine-cart-label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.dongduongwine-cart-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.dongduongwine-cart-icon i {
	margin: 0;
	font-size: 1.25em;
	line-height: 1;
}

/* Round icon button instead of a text-width one.
   `.add-to-cart-button` is only ever rendered by the same hook this theme
   filters, so every button it contains carries the icon. */
.add-to-cart-button > .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	border-radius: 5px;
	vertical-align: middle;
	border-width: 1px;
}

/*
 * After AJAX add-to-cart Woo/Flatsome hide `.add_to_cart_button.added` and
 * inject `a.added_to_cart` (“Xem giỏ hàng”). Our 36px `display: inline-flex`
 * is more specific, so the icon would stay and overlap the price — restore
 * the hide, then show only the view-cart text.
 */
.add-to-cart-button > .button.added {
	display: none;
}

/* Zero-price “Liên Hệ” (smt-wp-customize): same outline icon as add-to-cart,
   not the filled `.button.alt` block that stacked under the price. */
.product-small .add-to-cart-button > a.button.smtwpc-contact-button {
	width: 36px;
	height: 36px;
	padding: 6px;
	background-color: transparent;
	background-image: none;
	box-shadow: none;
	color: inherit;
}

.dongduongwine-price-cart a.added_to_cart {
	padding: 0;
	white-space: nowrap;
	line-height: 1.2;
}
