/* Retire only the former discount labels; keep stock, product tags and other labels. */
.awl-label-wrap.awl-label-id-2006,
.product-tag-sale-badge .badge:is(.off, .sale),
body .shopengine.shopengine-widget .shopengine-single-product-item .product-thumb .product-tag-sale-badge li.badge:is(.off, .sale),
.shopengine-product-image > .onsale {
	display: none !important;
}

/* A shared font and box model make both labels the height of the tallest in the row. */
.as-store-badge {
	display: none;
	position: relative;
	box-sizing: border-box;
	flex: 0 1 auto;
	align-items: center;
	min-inline-size: 0;
	max-inline-size: 100%;
	min-block-size: 1.7em;
	margin: 0;
	padding: .25em .55em;
	border-radius: 0;
	background-color: rgba(var(--as-store-badge-rgb), var(--as-badge-opacity, .72));
	color: var(--as-store-badge-fg);
	font: 600 clamp(12px, 1.25vw, 14px)/1.2 Arial, Helvetica, sans-serif;
	text-transform: none;
	pointer-events: none;
}

.as-store-badge__text {
	min-inline-size: 0;
	white-space: normal;
	overflow-wrap: anywhere;
}

.as-discount-badge {
	--as-store-badge-rgb: var(--as-discount-rgb, 53,125,55);
	--as-store-badge-fg: var(--as-discount-fg, #fff);
	flex-shrink: 0;
	text-align: center;
}

.as-discount-badge__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

:is(.shopengine-single-product-item .product-thumb > a, ul.products li.product a, ul.products li.product):has(> .as-card-badges),
.shopengine-product-image:has(> .as-gallery-badges),
.woocommerce-product-gallery:has(> .as-gallery-badges) {
	position: relative;
}

ul.products li.product a:has(> .as-card-badges) {
	display: block;
}

.as-card-badges,
.as-gallery-badges {
	display: none;
}

:is(.shopengine-single-product-item .product-thumb > a, ul.products li.product a, ul.products li.product) > .as-card-badges,
:is(.shopengine-product-image, .woocommerce-product-gallery) > .as-gallery-badges {
	position: absolute;
	z-index: 3;
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	inset-block-start: var(--as-badge-edge, 0px);
	inset-inline-start: var(--as-badge-edge, 0px);
	pointer-events: none;
}

:is(.shopengine-single-product-item .product-thumb > a, ul.products li.product a, ul.products li.product) > .as-card-badges {
	inset-inline-end: var(--as-badge-edge, 0px);
	justify-content: space-between;
	column-gap: 2px;
}

ul.products li.product > .as-card-badges {
	--as-badge-edge: var(--as-card-padding, 0px);
}

/* Keep the two square edges flush with each other and with the image corner. */
:is(.shopengine-product-image, .woocommerce-product-gallery) > .as-gallery-badges {
	inline-size: max-content;
	max-inline-size: 100%;
}

.angel-store-discount-badges .as-card-badges > .as-discount-badge--card,
.angel-store-discount-badges .as-gallery-badges > .as-discount-badge--single:not([hidden]) {
	display: flex;
}

.angel-store-discount-badges .as-card-badges > .as-discount-badge--card {
	margin-inline-start: auto;
}

.angel-store-discount-badges .as-gallery-badges > .as-discount-badge--single {
	flex-shrink: 1;
}

/* Keep at least half of a narrow photo available for the stock text when both labels show. */
.angel-store-stock-notices.angel-store-discount-badges .as-card-badges:has(> .as-low-stock) > .as-discount-badge {
	max-inline-size: 48%;
}
