/*
 * Supplier-campaign sale presentation.
 *
 * Loaded only while promotions are live or an admin preview is active
 * (supplenivo_promotions_enqueue_assets()), so a release with the feature in
 * observe mode adds no byte - not even a <link> tag - to any public page.
 *
 * Specificity note: WooCommerce's own stylesheet is loaded and is not
 * dequeued. Its card rules ("ul.products li.product .onsale", ".price del",
 * ".price ins") carry four classes, so every selector below spells out the
 * same ancestry and wins by loading later (this file depends on the other
 * theme stylesheets).
 */

/* ---- Card badge ---------------------------------------------------------- */

/*
 * The badge is printed inside the product link, so its positioned ancestor is
 * li.product. WooCommerce pins .onsale to top:0 / right:0 with a negative
 * margin, which li.product's overflow:hidden then clips; the theme's
 * flavour-count chip also lives at the right-hand corner on desktop. The
 * campaign badge therefore goes to the top-left corner of the image area and
 * every offset WooCommerce sets is reset explicitly.
 */
.woocommerce ul.products li.product .onsale.onsale--promo {
	align-items: center;
	background: var(--sn-coral);
	border-radius: var(--sn-radius-pill);
	color: var(--sn-ink);
	display: flex;
	font-size: 0.68rem;
	font-weight: 700;
	height: 46px;
	justify-content: center;
	left: 22px;
	letter-spacing: -0.01em;
	line-height: 1;
	margin: 0;
	min-height: 46px;
	min-width: 46px;
	padding: 0 6px;
	right: auto;
	top: 22px;
	white-space: nowrap;
	z-index: 5;
}

/* ---- Prices -------------------------------------------------------------- */

/*
 * The struck-through "was" price is secondary; the current price keeps the
 * normal price weight and is not underlined (browsers underline <ins>).
 * Every price surface is listed: Woo cards, the PDP price, and the home page's
 * own shelf and hero markup (which have no .price ancestor).
 */
.woocommerce ul.products li.product .price del,
.woocommerce div.product p.price del,
.woocommerce div.product span.price del,
.woocommerce .price del,
.storefront-product-card__price del {
	color: var(--sn-muted);
	display: inline-block;
	font-size: 0.78em;
	font-weight: 600;
	opacity: 1;
	text-decoration: line-through;
}

.woocommerce ul.products li.product .price ins,
.woocommerce div.product p.price ins,
.woocommerce div.product span.price ins,
.woocommerce .price ins,
.storefront-product-card__price ins,
.storefront-stage__caption ins {
	background: transparent;
	color: inherit;
	font-weight: inherit;
	text-decoration: none;
}

/* A price with both prices wraps as a unit instead of splitting mid-amount. */
.woocommerce ul.products li.product .price ins,
.woocommerce ul.products li.product .price del {
	white-space: nowrap;
}

/* ---- PDP reference line -------------------------------------------------- */

.price-reference {
	align-items: center;
	color: var(--sn-muted);
	display: flex;
	flex-wrap: wrap;
	font-size: 0.8rem;
	gap: 6px 10px;
	line-height: 1.4;
	margin: -10px 0 12px;
}

.price-reference__badge {
	background: var(--sn-coral);
	border-radius: var(--sn-radius-pill);
	color: var(--sn-ink);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
	padding: 5px 9px;
	white-space: nowrap;
}

.price-reference__amount {
	font-weight: 700;
}

/* ---- Deals page (product-archive frame) ----------------------------------- */

/*
 * page-deals.php renders the Deals page with the markup of a product category
 * archive (body gets `woocommerce woocommerce-page`, so the theme's grid, card,
 * result-count and pagination rules apply untouched). Only the two rules the
 * theme scopes to the archive body classes are repeated here: the reduced top
 * padding of the main column and the H1 reset.
 */
body.supplenivo-deals-page .commerce-main {
	padding-top: clamp(28px, 3vw, 46px);
}

body.supplenivo-deals-page .woocommerce-products-header__title {
	margin: 0;
}

/* A category has its landing blocks between the H1 and the count; here the count follows directly. */
body.supplenivo-deals-page .woocommerce-products-header {
	margin-bottom: 28px;
}

/* The count line above carries the 32px gap an archive has before its grid. */
.deals-grid {
	margin-block: 0 32px;
}

.deals-empty {
	align-items: center;
	background: var(--sn-white);
	border: 1px solid var(--sn-line);
	border-radius: var(--sn-radius);
	color: var(--sn-muted);
	display: flex;
	flex-direction: column;
	gap: 22px;
	margin-block: 32px;
	padding: clamp(28px, 6vw, 56px) clamp(18px, 4vw, 32px);
	text-align: center;
}

.deals-empty p {
	margin: 0 auto;
	max-width: 52ch;
}

/* ---- Phones -------------------------------------------------------------- */

@media (max-width: 620px) {
	body.supplenivo-deals-page .commerce-main {
		padding-top: 14px;
	}

	/*
	 * ~150px-wide cards: smaller circle, tucked closer to the corner. The
	 * flavour-count chip is in normal flow here, so nothing overlaps it.
	 */
	.woocommerce ul.products li.product .onsale.onsale--promo {
		font-size: 0.62rem;
		height: 36px;
		left: 14px;
		min-height: 36px;
		min-width: 36px;
		padding: 0 4px;
		top: 14px;
	}
}
