/* Product grid, card, stock line and price markup shared by archives, blocks and the single product. Loaded on the frontend and in the editor. */

/* In `base` so the caller's `grid-cols-*` utilities set the columns. */
@layer base {
	.nomon-product-grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--grid-dense);
		margin: 0;
		padding: 0;
		list-style: none;
	}
}

/* A grid printed straight into a template is a `ul` child of the content column, which caps lists (main.css). */
:root :is(.site-content, .wp-block-group, .is-root-container) > ul.nomon-product-grid { max-width: none; }

.nomon-product-card {
	overflow-wrap: break-word;
	transition: border-color .2s;
}
.nomon-product-card:is(:hover, :focus-within) { border-color: var(--wp--preset--color--accent); }
.nomon-product-card:is(:hover, :focus-within) .nomon-product-card__title { text-decoration: underline; }

.nomon-product-card__media {
	margin: 5px 5px 0;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 500px 500px 0 0;
}
.nomon-product-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nomon-product-card__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	min-height: 2.4em;
	line-height: 1.2;
	overflow-wrap: anywhere;
}
.nomon-product-card__title a {
	color: inherit;
	font-weight: inherit;
	text-decoration: none;
}
.nomon-product-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
}
/* The ring is drawn on the card; the link's own box is two clamped lines. */
.nomon-product-card__title a:focus-visible { outline: none; }
.nomon-product-card:has(.nomon-product-card__title a:focus-visible) {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.nomon-product-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px;
	min-height: 2.25em;
	line-height: 1.3;
}
.nomon-product-card__price ins {
	padding: 6px 12px;
	border-radius: 5px;
	background: var(--wp--preset--color--sale);
	color: var(--wp--preset--color--background);
}
.nomon-product-card__price del {
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 400;
}

.nomon-badge { line-height: 1.1; }

.nomon-stock {
	display: flex;
	align-items: center;
	gap: 5px;
	color: var(--wp--preset--color--success-dark);
}
.nomon-stock__dot {
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--wp--preset--color--success);
}
.nomon-stock:is(.nomon-stock--backorder, .nomon-stock--out) { color: var(--wp--preset--color--danger-dark); }
:is(.nomon-stock--backorder, .nomon-stock--out) .nomon-stock__dot { background: var(--wp--preset--color--danger); }

.price ins { text-decoration: none; }
.price .woocommerce-price-suffix { display: none; }
.from-prefix {
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 400;
}
