/* Conversion Pro — shared product card (modules 6 & 10), adapted from
   letsdotherooms.com: full-bleed image, no card border/padding, overlay
   Add to Cart bar, plain-text badge (module 11's default preset). Used on
   the category grid, homepage Shop by Collection/Best Sellers, and
   "Pairs well with" — one component, not rebuilt per section. */

/* Three markup shapes need covering here: the classic shop-loop template
   (.woocommerce ul.products li.product — content-product.php) rendered
   inside a `ul.products` list, WooCommerce's block-based Product
   Collection/Product Template block (ul.wc-block-product-template >
   li.wc-block-product) which is the default grid markup on current
   WooCommerce installs, and content-product.php rendered standalone
   (module 10's homepage sections call wc_get_template_part('content',
   'product') directly inside a plain .cvp-home-scroll-row div, with no
   ul.products/.woocommerce ancestor at all). Confirmed via live testing
   that all three cases occur on a fresh install, and a selector scoped to
   only one of them silently fails to match the others — hence the bare
   `li.product` fallback below, which doesn't depend on any ancestor
   wrapper and catches every case content-product.php can be used in. */
.woocommerce ul.products li.product,
.wc-block-product-template li.wc-block-product,
li.product,
.cvp-product-card {
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	border: none;
	box-shadow: none;
	background: none;
	padding: 0 !important;
	margin-bottom: 4px;
}

.woocommerce ul.products li.product img,
.wc-block-product-template li.wc-block-product img,
li.product img {
	aspect-ratio: 4 / 5;
	object-fit: cover;
	border-radius: 6px;
	display: block;
	width: 100%;
}

/* Overlay Add to Cart bar */
.woocommerce ul.products li.product .add_to_cart_button,
.woocommerce ul.products li.product a.button,
.wc-block-product-template li.wc-block-product .add_to_cart_button,
.wc-block-product-template li.wc-block-product a.button,
.wc-block-product-template li.wc-block-product .wp-block-button__link,
li.product .add_to_cart_button,
li.product a.button {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	/* Explicit content-based height. Without this, an element with `left`,
	   `right`, and `bottom` set but `top`/`height` left auto has its `top`
	   resolved from its original static position (CSS2.1 §10.6.4 case 6) —
	   on the block-based Product Template markup that static position sits
	   near the top of a tall flex card, so the box stretches almost the
	   full card height instead of staying a compact bottom bar. Confirmed
	   live: without this, the overlay covered nearly the entire card. */
	height: fit-content;
	background: rgba(196, 8, 14, 0.88); /* brand red #C4080E, translucent */
	color: #fff;
	text-align: center;
	padding: 10px;
	font-weight: 600;
	border-radius: 0;
	opacity: 0;
	transform: translateY(100%);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Desktop: reveal on hover only */
@media ( hover: hover ) {
	.woocommerce ul.products li.product .add_to_cart_button,
	.woocommerce ul.products li.product a.button,
	.wc-block-product-template li.wc-block-product .add_to_cart_button,
	.wc-block-product-template li.wc-block-product a.button,
	.wc-block-product-template li.wc-block-product .wp-block-button__link,
li.product .add_to_cart_button,
li.product a.button {
		opacity: 0;
		transform: translateY(100%);
	}
	.woocommerce ul.products li.product:hover .add_to_cart_button,
	.woocommerce ul.products li.product:hover a.button,
	.wc-block-product-template li.wc-block-product:hover .add_to_cart_button,
	.wc-block-product-template li.wc-block-product:hover a.button,
	.wc-block-product-template li.wc-block-product:hover .wp-block-button__link,
	li.product:hover .add_to_cart_button,
	li.product:hover a.button {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Touch devices: always visible — hover doesn't exist, so hiding it would
   remove the add-to-cart option entirely on mobile (confirmed decision). */
@media ( hover: none ) {
	.woocommerce ul.products li.product .add_to_cart_button,
	.woocommerce ul.products li.product a.button,
	.wc-block-product-template li.wc-block-product .add_to_cart_button,
	.wc-block-product-template li.wc-block-product a.button,
	.wc-block-product-template li.wc-block-product .wp-block-button__link,
li.product .add_to_cart_button,
li.product a.button {
		opacity: 1;
		transform: translateY(0);
		position: static;
		margin-top: 6px;
	}
}

.woocommerce ul.products li.product .price,
.wc-block-product-template li.wc-block-product .price,
li.product .price {
	margin-top: 8px;
	font-size: 14px;
}

/* Title — confirmed missing here originally, which only surfaced visually
   when content-product.php is rendered standalone (homepage Best Sellers,
   "Pairs well with" cross-sell) with no ul.products/theme-archive ancestor
   to inherit compact sizing from; on the real shop/category grid the
   theme's own archive styles happened to mask the gap. Explicit sizing
   here so the card looks identical in both contexts, matching WooCommerce's
   actual title class regardless of which of the three markup shapes wraps
   it. */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.wc-block-product-template li.wc-block-product .woocommerce-loop-product__title,
li.product .woocommerce-loop-product__title,
.cvp-product-card .woocommerce-loop-product__title,
.woocommerce-loop-product__title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	margin: 8px 0 0;
	color: #222;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Motta's own "layout-5" related-product card (used for the "Pairs well
   with" cross-sell row) is a different markup shape from the plain
   content-product.php card targeted above: it wraps Add to Cart, Quick
   View, and Wishlist in its own .product-featured-icons group. Confirmed
   live: our broad `.add_to_cart_button, a.button` overlay-bar rule above
   was unintentionally matching Motta's Add to Cart AND Quick View buttons
   too (both carry those exact classes), stretching each to the FULL card
   width/height (position:absolute; left:0; right:0; bottom:0) — since
   both are full-width and bottom-anchored, they rendered stacked directly
   on top of each other. Reset + rebuilt below as a small rounded pill row,
   colored to match the single-product page's own Add to Cart (red fill)
   / Buy Now (red outline) buttons per explicit request, so the two
   "add to cart" actions on the site are visually the same button.

   Everything in this section is scoped under .cvp-pairs-well-with —
   NOT globally — because this same Motta card component (and the exact
   class names .product-featured-icons / .motta-button--wishlist) turned
   out to be reused elsewhere on the page too (confirmed live: the
   previous unscoped version leaked out and moved a wishlist button that
   belonged to a completely different part of the page down to the
   bottom of the page). Scoping to the cross-sell row only is what fixes
   that regression without touching Motta's native behavior anywhere
   else this component appears. */
/* .product-thumbnail is the actual positioned ancestor .product-featured-
   icons is meant to anchor to (it wraps just the image), but Motta leaves
   it at its default position:static — confirmed live via
   getBoundingClientRect() that .product-featured-icons' offsetParent was
   therefore the WHOLE card (li.product, which this stylesheet's base rule
   already makes position:relative), so its bottom:8px was measured from
   the card's bottom edge, not the ~275px-tall image's bottom edge. On a
   448px-tall card that put the icon row ~30px into the title/price text
   below the image, overlapping it ("buttons hiding the price"). Giving
   .product-thumbnail its own position:relative makes it the offsetParent
   instead, so bottom:8px is relative to the image only, as intended. */
.cvp-pairs-well-with .product-thumbnail {
	position: relative;
}
.cvp-pairs-well-with .product-featured-icons {
	position: absolute;
	left: 8px;
	right: 8px;
	bottom: 8px;
	z-index: 3;
	display: flex;
	align-items: center;
	/* center, not stretch: now that Add to Cart is icon-only (below) it's
	   the same fixed 34px size as Quick View next to it, so the pair
	   should sit centered under the image like Best Sellers' matching
	   icon row, not stretched/left-anchored the way the old full-width
	   text pill needed. */
	justify-content: center;
	gap: 6px;
}
/* Confirmed live: each card actually renders the Add to Cart / Quick
   View pair TWICE — once as the compact icon row in
   .product-featured-icons (styled below), and again as a second,
   full-width hover-reveal overlay in .product-actions, which slides up
   over the title/price on hover ("hides the price"). Only one pair is
   wanted, so the second is removed entirely rather than restyled. */
.cvp-pairs-well-with .product-actions {
	display: none !important;
}
/* :not(.motta-button--wishlist) is required, not cosmetic: the wishlist
   link also carries WooCommerce's generic `button`/`a.button` class, so
   without this exclusion it was ALSO being caught by this reset (and,
   since ".product-featured-icons a.button" is more specific than the
   dedicated ".motta-button--wishlist" rule below, WINNING that fight) —
   forcing the wishlist into the flex row as a 3rd static item, which
   pushed it past the row's available width and off the right edge,
   where the card's own overflow:hidden clipped it invisibly. Confirmed
   live: wishlist had correct-looking CSS but never actually rendered
   anywhere on screen until this exclusion was added. Moot now that
   wishlist is relocated out of this row entirely (see below), but kept
   so a stray wishlist link left behind by a theme update doesn't
   silently get swept into this row again. */
.cvp-pairs-well-with .product-featured-icons .add_to_cart_button,
.cvp-pairs-well-with .product-featured-icons a.button:not(.motta-button--wishlist) {
	position: static !important;
	inset: auto !important;
	transform: none !important;
	opacity: 1 !important;
	height: 34px !important;
	min-height: 0 !important;
	line-height: 1 !important;
	padding: 0 12px !important;
	margin: 0 !important;
	border-radius: 20px !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 4px;
	white-space: nowrap;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
/* Icon-only (explicit request — "icon instead of button, similar to
   Best Sellers"), same treatment as .cvp-bestsellers' Add to Cart:
   fixed 34px circle matching Quick View beside it, text visually
   hidden via clip (kept for screen readers) rather than removed, since
   Motta renders it as a real `.add-to-cart-text` span, not CSS content.
   Was flex:1 1 auto (a full-width pill with "Add to cart"/"Choose
   options" text) before this. */
.cvp-pairs-well-with .product-featured-icons .motta-button--atc {
	flex: 0 0 auto !important;
	width: 34px !important;
	padding: 0 !important;
	background: #D91C22 !important;
	color: #fff !important;
	border: none !important;
}
.cvp-pairs-well-with .product-featured-icons .motta-button--atc .add-to-cart-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}
.cvp-pairs-well-with .product-featured-icons .motta-button--atc svg,
.cvp-pairs-well-with .product-featured-icons .motta-button--atc path {
	fill: #fff;
}
/* Transparent background per explicit request ("blocking the product
   image view") — just the red outline + eye glyph now, no solid fill,
   so the thumbnail shows through around it. */
.cvp-pairs-well-with .product-featured-icons .motta-button--quickview {
	flex: 0 0 auto;
	width: 34px;
	padding: 0 !important;
	background: transparent !important;
	color: #D91C22 !important;
	border: 2px solid #D91C22 !important;
}
.cvp-pairs-well-with .product-featured-icons .motta-button--quickview svg,
.cvp-pairs-well-with .product-featured-icons .motta-button--quickview path {
	fill: #D91C22;
}

/* Wishlist — moved out of the image entirely per explicit request and
   placed inline next to the SKU line (.meta-sku, in the card's own
   .meta-wrapper) via product.js, since there's no PHP hook available at
   that exact spot to print it there directly; this is styling for its
   new location, not the old image-corner placement. Icon-only (label
   hidden for sighted users, kept for screen readers via clip-rect
   rather than display:none), red on transparent background at rest,
   filling solid red (icon flips white for contrast) once added — a
   red heart outline on a red fill would be invisible otherwise. */
.cvp-pairs-well-with .meta-sku {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}
.cvp-pairs-well-with .motta-button--wishlist {
	position: static !important;
	inset: auto !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0 !important;
	margin: 0 !important;
	background: transparent !important;
	border-radius: 50%;
	color: #D91C22;
	flex: 0 0 auto;
	/* Confirmed live (found while fixing the same issue sitewide): despite
	   being relocated into .meta-sku, this was still rendering at
	   opacity: 0 — a Motta base rule for its original image-overlay
	   hover-reveal context that survives the JS relocation since the rule
	   targets the class, not an ancestor. Never actually visible until
	   this override, missed earlier because verification only checked
	   DOM placement (.meta-sku containment), not computed opacity. */
	opacity: 1 !important;
}
.cvp-pairs-well-with .motta-button--wishlist .motta-button__text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}
.cvp-pairs-well-with .motta-button--wishlist svg,
.cvp-pairs-well-with .motta-button--wishlist path {
	fill: currentColor;
}
.cvp-pairs-well-with .motta-button--wishlist.added {
	background: #D91C22 !important;
	color: #fff;
}

/* Redesign per explicit request ("not elegant... icon for add to cart,
   remove category, remove title, reviews bold + centered, price
   prominent + centered, everything aligned"). Title is dropped entirely
   (previously kept, now removed) — with category/SKU already stripped
   by product.js and Add to Cart now icon-only above, the remaining card
   content is just image → star rating → price, so centering both reads
   as a clean, deliberate layout rather than leftover left-alignment
   from the old title/meta rows. */
/* !important required here: this selector's specificity (2 classes, 0
   elements) actually loses to the earlier `li.product
   .woocommerce-loop-product__title` rule above (2 classes, 1 element —
   the extra "li" type selector outweighs what looks like the more
   specific, more targeted selector) — confirmed live the title was
   still rendering despite this rule matching. !important sidesteps the
   specificity math entirely rather than trying to out-specify it. */
.cvp-pairs-well-with .woocommerce-loop-product__title {
	display: none !important;
}

/* "in {Category}" text — confirmed live this lives in a SEPARATE
   element (.meta-cat) from the SKU line (.meta-sku, handled by
   product.js's relocateCrossSellWishlists() above), not the same one —
   still showing after that JS fix because it was only ever stripping
   .meta-sku's contents, never touching .meta-cat at all. Hidden
   outright via CSS here instead of another JS content-strip, since
   nothing needs to be preserved out of it (unlike .meta-sku, which
   keeps the relocated wishlist icon). */
.cvp-pairs-well-with .meta-cat {
	display: none !important;
}
.cvp-pairs-well-with .woocommerce-product-rating,
.cvp-pairs-well-with .product-rating {
	/* Covers WooCommerce core's rating wrapper, whichever class name
	   this theme actually renders — text-align:center centers
	   .star-rating even if it's inline-block rather than a block
	   element margin:auto could center directly. */
	text-align: center;
	margin-top: 8px;
}
.cvp-pairs-well-with .star-rating {
	margin: 8px auto 0;
}
.cvp-pairs-well-with .star-rating,
.cvp-pairs-well-with .review-count {
	font-weight: 700;
}
.cvp-pairs-well-with .review-count {
	display: block;
	text-align: center;
	color: #C4080E;
	font-size: 12px;
	margin-top: 2px;
}
.cvp-pairs-well-with .price {
	display: block;
	text-align: center;
	font-weight: 700;
	font-size: 16px;
	margin-top: 4px;
}

/* ========================================================================
   Generalized sitewide grid card fix (category grid, homepage catalog,
   homepage Best Sellers row) — confirmed live the exact same Motta
   layout-5 card component (.product-thumbnail / .product-featured-icons
   / .product-actions) used for "Pairs well with" above is ALSO what
   renders every other product grid on the site, not a separate system.
   Same three complaints, same root causes, same fix — applied broadly
   instead of re-diagnosing as new bugs:
   - Quick View's full-width hover overlay (.product-actions) blocking
     the price/title underneath it
   - Wishlist heart only reachable via hover (invisible on touch devices,
     which have no hover state at all — it was rendering stranded inside
     the image with no way to trigger it)
   - A large dead-space gap between the image and the "in Category" line

   These selectors are MORE specific than the plain "simple card" overlay
   rules earlier in this file (which target bare `.add_to_cart_button,
   a.button` and were originally written for the plain content-product.php
   card, not this Motta markup), so they win on specificity without
   needing to remove or guard those — harmless dead weight wherever this
   markup is present, still doing their original job wherever the plain
   card markup is used instead.
   ======================================================================== */
li.product .product-actions {
	display: none !important;
}
li.product .product-thumbnail {
	position: relative;
}
/* Confirmed follow-up: floating the Add to Cart/Quick View row on top of
   the image (even compact and icon-sized, not the old full-width bar)
   still reads as covering the product photo rather than sitting apart
   from it. Moved out of the absolute-overlay treatment entirely — static
   in normal flow, so it renders as its own row between the image and the
   "in Category" line below, on every device, not just the mobile
   @media (hover:none) case this was previously limited to.

   !important on position: confirmed live this non-important version
   worked everywhere EXCEPT the legacy "Featured Products" native
   WooCommerce Products Elementor widget below Best Sellers — that
   widget's own layout renders the icon row top-right over the image on
   desktop, because a more specific theme rule for that particular
   widget context still wins the position fight against a plain
   (non-!important) declaration. Confirmed live via getBoundingClientRect
   that the icons row's position stayed "absolute" there. !important
   forces static everywhere uniformly, without needing a separate
   widget-scoped override. */
li.product .product-featured-icons {
	position: static !important;
	display: flex;
	align-items: stretch;
	gap: 6px;
	margin-top: 8px;
}
li.product .product-featured-icons .add_to_cart_button,
li.product .product-featured-icons a.button:not(.motta-button--wishlist) {
	position: static !important;
	inset: auto !important;
	transform: none !important;
	opacity: 1 !important;
	height: 34px !important;
	min-height: 0 !important;
	/* Confirmed live: Motta's own `.button` base rule sets
	   min-width: 160px, which this flex item doesn't override by
	   default — on narrower cards (the 140px homepage rows) that
	   pushed the Add to Cart button past the card's right edge, cut
	   off/overlapped by the next card, with Quick View pushed
	   invisibly further out. min-width: 0 lets flex:1 1 auto actually
	   shrink the button to fit. */
	min-width: 0 !important;
	line-height: 1 !important;
	padding: 0 12px !important;
	margin: 0 !important;
	border-radius: 20px !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 4px;
	white-space: nowrap;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
li.product .product-featured-icons .motta-button--atc {
	flex: 1 1 auto;
	background: #D91C22 !important;
	color: #fff !important;
	border: none !important;
}
li.product .product-featured-icons .motta-button--atc svg,
li.product .product-featured-icons .motta-button--atc path {
	fill: #fff;
}
li.product .product-featured-icons .motta-button--quickview {
	flex: 0 0 auto;
	width: 34px;
	padding: 0 !important;
	background: transparent !important;
	color: #D91C22 !important;
	border: 2px solid #D91C22 !important;
}
li.product .product-featured-icons .motta-button--quickview svg,
li.product .product-featured-icons .motta-button--quickview path {
	fill: #D91C22;
}

/* Wishlist relocated (via category.js's relocateWishlists()) out of the
   image and into the "in Category" line — always visible regardless of
   hover state, which fixes the desktop positioning request ("below the
   right corner... vertically centered to the category") and the mobile
   "stuck inside the image" complaint in the same move: once it's not
   part of .product-featured-icons anymore, it no longer depends on
   hover (desktop) or end up stranded inside the image with no tap
   affordance (mobile). margin-left: auto (not justify-content, which
   would also space out the "in"/category-link pair unnecessarily) pushes
   just the wishlist button to the row's far right, leaving "in Category"
   left-aligned as before. */
li.product .meta-cat {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 2px;
}
li.product .motta-button--wishlist {
	position: static !important;
	inset: auto !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	padding: 0 !important;
	margin: 0 0 0 auto !important;
	background: transparent !important;
	border-radius: 50%;
	color: #D91C22;
	flex: 0 0 auto;
	/* Confirmed live: relocated into .meta-cat, the button still inherited
	   opacity: 0 from a Motta base rule (its original hover-reveal styling
	   for the image-overlay context it no longer lives in) — !important
	   override, same fix pattern used elsewhere in this file for
	   thumbnail-context leftovers surviving a JS relocation. */
	opacity: 1 !important;
}
li.product .motta-button--wishlist .motta-button__text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}
li.product .motta-button--wishlist svg,
li.product .motta-button--wishlist path {
	fill: currentColor;
}
li.product .motta-button--wishlist.added {
	background: #D91C22 !important;
	color: #fff;
}

/* The actual source of "too much empty gap between image and category"
   (confirmed via getBoundingClientRect(), not a guess): Motta reserves a
   fixed ~30px for `.product-variation-items` — a color/size swatch slot
   for variable products — even though it's empty on every card here
   (on-card swatches were explicitly declined, module 6). Collapsing it
   removes that dead space; safe sitewide since nothing ever renders
   inside it on this store regardless of product type. */
/* !important required: confirmed live on the actual category archive
   page (not just the homepage grids this was originally tested on) that
   Motta's own "ul.products li.product .product-variation-items"
   selector (woocommerce.css) is MORE specific than this one — it was
   winning and keeping the 30px min-height, which is exactly the "extra
   vertical space between cart and category" gap reported live. */
li.product .product-variation-items {
	min-height: 0 !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
}

/* Mobile: the icon row is already static/below-the-image sitewide now
   (see .product-featured-icons above), so nothing needed there for touch
   devices any more. Per confirmed decision, Quick View is still dropped
   entirely on touch devices — tapping the card already opens the product
   page, covering the same job a quick-view modal would on a small
   screen — Add to Cart alone remains. */
@media ( hover: none ) {
	li.product .product-featured-icons .motta-button--quickview {
		display: none;
	}
}
