/**
 * Buy box: template-parts/product/buy-box.php (2162:702). 24px between the
 * blocks. Title Heading/H2, rating Body/M with orange stars, lead Body/L
 * muted; price 48px ExtraBold, crossed-out price Body/L muted, price per
 * gram Body/M green. Quantity pill and Add to cart 56px tall. Specs table:
 * white, line border, radius 20, rows 16px / 24px.
 */

.buy-box {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	min-width: 0;
}

.buy-box__head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

.buy-box__title {
	margin: 0;
	color: var(--color-black);
	font-family: var(--font-display);
	font-size: var(--text-h2);
	font-weight: var(--weight-extrabold);
	letter-spacing: var(--tracking-h2);
	line-height: var(--leading-h2);
	overflow-wrap: break-word;
}

.buy-box__rating {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--color-ink);
	font-size: var(--text-body-m);
	line-height: var(--leading-body-m);
	text-decoration: none;
	/* 44px tap target without changing the 12px gaps of the head. */
	margin-block: -10px;
	padding-block: 10px;
}

.buy-box__rating:hover {
	text-decoration: underline;
}

/* Five star glyphs filled to the rating; the rest in line colour. */
.rating-stars {
	position: relative;
	display: inline-block;
	color: var(--color-line);
	letter-spacing: 0;
	white-space: nowrap;
}

.rating-stars::before {
	content: "★★★★★";
}

.rating-stars::after {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	width: var(--rating, 100%);
	color: var(--color-orange);
	content: "★★★★★";
}

.buy-box__lead {
	color: var(--color-muted);
	font-size: var(--text-body-l);
	line-height: var(--leading-body-l);
}

.buy-box__lead > * {
	margin: 0;
}

.buy-box__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 14px;
	margin: 0;
}

.buy-box__now {
	color: var(--color-black);
	font-family: var(--font-display);
	font-size: var(--text-h2);
	font-weight: var(--weight-extrabold);
	letter-spacing: var(--tracking-h2);
	line-height: var(--leading-h2);
}

.buy-box__was {
	color: var(--color-muted);
	font-size: var(--text-body-l);
	line-height: var(--leading-body-l);
}

.buy-box__ppg {
	color: var(--color-green);
	font-size: var(--text-body-m);
	line-height: var(--leading-body-m);
}

.buy-box__form {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

.buy-box__notices:empty {
	display: none;
}

/* WooCommerce notices (not designed): cream box, line border, Body/S; an
 * error has an orange border. Replaces WooCommerce's grey box. */
.buy-box__notices {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
}

.buy-box__notices .woocommerce-message,
.buy-box__notices .woocommerce-info,
.buy-box__notices .woocommerce-error {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-xs) var(--space-sm);
	margin: 0;
	padding: 14px 20px;
	border: 1px solid var(--color-line);
	border-radius: var(--radius-md);
	background: var(--color-cream);
	color: var(--color-ink);
	font-size: var(--text-body-s);
	line-height: var(--leading-body-s);
	list-style: none;
}

.buy-box__notices .woocommerce-error {
	flex-direction: column;
	align-items: flex-start;
	border-color: var(--color-orange);
}

.buy-box__notices .woocommerce-message::before,
.buy-box__notices .woocommerce-info::before,
.buy-box__notices .woocommerce-error::before {
	content: none;
}

.buy-box__notices a.button.wc-forward {
	order: 1;
	padding: 0;
	border: 0;
	background: none;
	color: var(--color-ink);
	font-weight: var(--weight-semibold);
	text-decoration: underline;
}

/* Options (2162:720): groups side by side 40px apart, each a Label/M title
 * and pills 8px apart. Pill: Label/M, 12px / 20px, white with a line
 * border; the selected one black with white text. Native radios underneath,
 * so the arrow keys move the selection. */
.buy-box__options {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-md) var(--space-lg);
}

.option-group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.option-group__label {
	margin-bottom: 10px;
	padding: 0;
	color: var(--color-ink);
	font-size: var(--text-label-m);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-label-m);
}

.option-group__pills {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-xs);
}

.option-pill {
	position: relative;
	display: block;
	cursor: pointer;
}

.option-pill__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.option-pill__label {
	display: block;
	box-sizing: border-box;
	min-width: 44px;
	padding: 12px 19px; /* 12 / 20 in Figma, where the border sits inside */
	border: 1px solid var(--color-line);
	border-radius: var(--radius-pill);
	background: var(--color-white);
	color: var(--color-ink);
	font-size: var(--text-label-m);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-label-m);
	text-align: center;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.option-pill:hover .option-pill__label {
	border-color: var(--color-ink);
}

.option-pill__input:checked + .option-pill__label {
	border-color: var(--color-black);
	background: var(--color-black);
	color: var(--color-white);
}

.option-pill.is-unavailable {
	cursor: default;
}

.option-pill.is-unavailable .option-pill__label {
	border-color: var(--color-line);
	background: var(--color-white);
	color: var(--color-muted);
	text-decoration: line-through;
}

.buy-box__row {
	display: flex;
	gap: 12px;
	align-items: center;
}

.buy-box__add {
	flex: 1;
	min-width: 0;
	height: 56px;
}

/* Specs table (2162:760). */
.specs {
	overflow: hidden;
	width: 100%;
	border: 1px solid var(--color-line);
	border-radius: 20px;
	border-spacing: 0;
	background: var(--color-white);
	font-size: var(--text-body-m);
}

.specs__label,
.specs__value {
	padding: var(--space-sm) 20px;
	vertical-align: baseline;
}

.specs__row + .specs__row > * {
	border-top: 1px solid var(--color-line);
}

.specs__label {
	color: var(--color-muted);
	font-weight: var(--weight-regular);
	line-height: var(--leading-body-m);
	text-align: left;
}

.specs__value {
	color: var(--color-ink);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-label-m);
	text-align: right;
}

@media (min-width: 768px) {
	.specs__label,
	.specs__value {
		padding-right: var(--space-md);
		padding-left: var(--space-md);
	}
}
