/*
 * WooCommerce visual overrides.
 *
 * Ported from 2019 theme: scss/_woocommerce-overrides.scss
 * Foundation grid mixins are replaced with standard CSS.
 *
 * @package emhowart-2025
 * @since 1.0.0
 */

/*
 * On-sale badge: circular, uses theme primary/contrast colours.
 * WooCommerce forces two separate selectors for archive vs single.
 */
.woocommerce span.onsale,
.wc-block-grid .wc-block-grid__product-onsale,
.wc-block-grid__product-image .wc-block-grid__product-onsale {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border-radius: 100%;
	border: none;
	height: 3.7rem;
	width: 3.7rem;
	font-size: 1rem;
	text-transform: capitalize;
	text-align: center;
	line-height: 3.236;
}

/* Stock availability text */
.woocommerce div.product .stock {
	color: var(--wp--preset--color--primary);
}

/* Red dot on sold/out-of-stock products — listing and single pages.
   Targets classic WooCommerce templates, block-based query loops, and the
   newer Product Collection block.

   The Product Collection selector is not a duplicate of the query-loop ones:
   that block renders into .wc-block-product-template rather than
   .wp-block-post-template, so none of the others reach it. Without it the dot
   silently disappeared wherever a collection was embedded in a page — 21 of
   the 29 works on the Soul exhibition page are sold and none was marked. */
.woocommerce .outofstock .woocommerce-loop-product__title::after,
.woocommerce .outofstock .product_title::after,
.wp-block-post-template .outofstock .wp-block-post-title::after,
.wp-block-query .outofstock .wp-block-post-title::after,
.wc-block-product-template .outofstock .wp-block-post-title::after,
body.outofstock .wp-block-post-title::after {
	content: '';
	display: inline-block;
	width: 0.55em;
	height: 0.55em;
	background-color: #c0392b;
	border-radius: 50%;
	margin-left: 0.5em;
	vertical-align: middle;
	position: relative;
	top: -0.05em;
}

/*
 * "View" link under each artwork in a product grid.
 *
 * The image and title already link through, but on a page where the price has
 * been removed there is nothing that visibly reads as a way in — an artwork
 * card with no price and no button looks like a picture rather than something
 * you can click. This makes the route to the artwork page explicit.
 *
 * Styled as an outline button to match the hero CTA, rather than reusing
 * core/button: read-more is one of the few core blocks that resolves the
 * permalink per item inside a loop, which a static button cannot do.
 *
 * Two selectors because the site has two product grids, and neither reaches
 * the other. `.wc-block-product-template` is the Product Collection block, used
 * where a collection is embedded in a page or an exhibition.
 * `.products-block-post-template` is the query loop in archive-product,
 * taxonomy-collection and product-search-results.
 */
.wc-block-product-template .wp-block-read-more,
.products-block-post-template .wp-block-read-more {
	margin-top: 0.75rem;
}

/* The query-loop cards centre their contents. read-more renders a bare inline
   anchor with no alignment attribute of its own, so it needs an explicit auto
   margin to sit under the centred title and price rather than hard left. */
.products-block-post-template .wp-block-read-more {
	display: block;
	width: fit-content;
	margin-inline: auto;
}


/* Remove yellow highlight from category item counts */
.woocommerce mark {
	background-color: transparent;
}

/* Product loop title colour */
.woocommerce .woocommerce-loop-product__title {
	color: var(--wp--preset--color--contrast);
}

/* Single product: images and summary side by side on desktop */
@media (min-width: 782px) {
	.woocommerce div.product div.images,
	.woocommerce-page div.product div.images {
		width: 50%;
		float: left;
	}

	.woocommerce div.product div.summary,
	.woocommerce-page div.product div.summary {
		width: 45%;
		float: right;
	}
}

/* Single product summary — spacing between elements */
.single-product .wp-block-post-title {
	margin-bottom: var(--wp--preset--spacing--40);
}

.single-product .wp-block-woocommerce-product-price {
	margin-bottom: var(--wp--preset--spacing--50);
}

.single-product .product-short-description {
	margin-bottom: var(--wp--preset--spacing--50);
}

.single-product .wp-block-woocommerce-add-to-cart-form {
	margin-bottom: var(--wp--preset--spacing--50);
}

/* Breadcrumb padding to align with content */
.woocommerce .woocommerce-breadcrumb {
	padding: 0 2em 0 1.5em;
}

/*
 * Enquire — archived but unsold.
 *
 * Replaces the Add to Cart form on archived work. Styled as an outline button to
 * match the exhibition hero's CTA rather than the solid accent fill of Add to
 * Cart: it is an invitation to write, not a purchase, and should not compete
 * with buying elsewhere on the site.
 */
.archived-enquire {
	margin-bottom: var(--wp--preset--spacing--50);
}

/* .archived-enquire__button is styled as a button in buttons.css. */
