/**
 * monoLabels — storefront labels.
 *
 * Hand-written, no build step. Every colour and size comes from a custom property that the settings page sets
 * inline (see Style::css), so this file never has to be regenerated after a settings change.
 */

.ml-labels {
	position: absolute;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: var(--ml-gap, 6px);
	line-height: 1.2;
	/* Labels are a sign, not a control: clicks belong to the product link underneath. */
	pointer-events: none;
}

.ml-labels--top_left { top: 8px; left: 8px; align-items: flex-start; }
.ml-labels--top_right { top: 8px; right: 8px; align-items: flex-end; }
.ml-labels--bottom_left { bottom: 8px; left: 8px; align-items: flex-start; }
.ml-labels--bottom_right { bottom: 8px; right: 8px; align-items: flex-end; }

/* Inline mode: a row under the image, for themes whose image markup cannot hold an overlay. */
.ml-labels--inline {
	position: static;
	flex-direction: row;
	flex-wrap: wrap;
	margin: 8px 0;
}

/* An overlay needs a positioned ancestor. These are the two wrappers WooCommerce's own templates use;
	a theme that replaces them can call monoano_labels_html() or filter the hooks (docs/EXTENDING.md). */
.woocommerce ul.products li.product,
.woocommerce div.product div.images {
	position: relative;
}

.ml-label {
	display: inline-block;
	max-width: 100%;
	padding: var(--ml-pad-y, 4px) var(--ml-pad-x, 10px);
	border-radius: var(--ml-radius, 999px);
	background: var(--ml-bg, #111827);
	color: var(--ml-ink, #fff);
	font-size: var(--ml-font, 12px);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ml-label--tag {
	border-radius: 4px;
}

/* An icon inside the badge: the SVG inherits the text colour through currentColor and scales with the font size,
   so one rule covers small, medium and large. Flex keeps the glyph and the words on one baseline; a custom image
   keeps its own colours and gets `flex: none` so the badge's ellipsis never squeezes it. */
.ml-label--icon {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
}

.ml-label__icon {
	width: 1em;
	height: 1em;
	flex: none;
}

img.ml-label__icon {
	object-fit: contain;
}

/* The ribbon is a band with one cut end; the cut faces into the image, so it hangs from the top corners. */
.ml-label--ribbon {
	padding-right: calc(var(--ml-pad-x, 10px) + 8px);
	border-radius: 0;
	clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.ml-labels--top_right .ml-label--ribbon {
	padding-right: var(--ml-pad-x, 10px);
	padding-left: calc(var(--ml-pad-x, 10px) + 8px);
	clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%);
}

/* A phone screen shows fewer products side by side, so the same label would cover more of the photo. */
@media (max-width: 480px) {
	.ml-labels--overlay {
		gap: 4px;
	}

	.ml-label {
		font-size: calc(var(--ml-font, 12px) - 1px);
	}
}
