/* Product card (block forge/product-card). Theme tokens only. */

/* Editor: the server-rendered preview fills the slot like on the front. */
.forge-pcard-preview > div {
	display: flex;
	flex: 1;
	min-width: 0;
}

/* The card draws its own frame: the Product Template's <li> becomes a plain slot. */
.wc-block-product:has(> .wp-block-forge-product-card),
.forge-grid .wc-block-product:has(> .wp-block-forge-product-card),
.forge-grid .wc-block-product:has(> .wp-block-forge-product-card):hover {
	display: flex;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
}

.forge-grid .wc-block-product > .wp-block-forge-product-card {
	margin: 0;
}

.forge-pcard {
	/* Card tokens: one control height and one control fill for the eye and the cart button. */
	--forge-pcard-ctl: 44px;
	--forge-pcard-ctl-bg: var(--wp--preset--color--wash);
	container: forge-pcard / inline-size; /* layout follows the card's own width (grids, sliders, phones) */
	position: relative;
	display: flex;
	flex-direction: column;
	flex: 1;
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	padding: 0.625rem 0.625rem 1rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--bg);
	transition: border-color 150ms var(--forge-ease), box-shadow 200ms var(--forge-ease);
}

.forge-pcard:hover {
	border-color: var(--wp--preset--color--control);
	box-shadow: var(--wp--preset--shadow--card-hover);
}

.forge-pcard:focus-within {
	border-color: var(--wp--preset--color--primary);
}

.forge-pcard--filled {
	--forge-pcard-ctl-bg: var(--wp--preset--color--bg); /* controls must stand out from a grey card */
	border-color: transparent;
	background: var(--wp--preset--color--wash);
}

.forge-pcard--filled .forge-pcard__media {
	background: var(--wp--preset--color--bg);
}

.forge-pcard--plain {
	padding: 0;
	border-color: transparent;
	background: transparent;
}

.forge-pcard--plain:hover {
	border-color: transparent;
	box-shadow: none;
}

.forge-pcard--plain .forge-pcard__body {
	padding-inline: 0;
}

/* ---------- Image ---------- */
.forge-pcard__media {
	position: relative;
	aspect-ratio: var(--forge-pcard-ratio, 1);
	margin-bottom: 0.625rem;
	overflow: hidden;
	border-radius: calc(var(--wp--custom--radius--card) - 4px);
	background: var(--forge-pcard-media-bg, var(--wp--preset--color--wash)); /* card settings → Image background */
}

.forge-pcard__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	padding: var(--forge-pcard-img-pad, 0); /* card settings → Image padding */
	object-fit: contain;
	mix-blend-mode: multiply; /* white product shots sit on the wash */
	transition: transform 300ms var(--forge-ease), opacity 200ms var(--forge-ease);
}

.forge-pcard--fit-cover .forge-pcard__img {
	object-fit: cover;
	mix-blend-mode: normal;
}

.forge-pcard:hover .forge-pcard__img {
	transform: scale(1.03);
}

.forge-pcard__img--alt {
	opacity: 0;
}

.forge-pcard:hover .forge-pcard__img--alt {
	opacity: 1;
}

.forge-pcard:has(.forge-pcard__img--alt):hover .forge-pcard__img:not(.forge-pcard__img--alt) {
	opacity: 0;
}

.forge-pcard.is-out-of-stock .forge-pcard__img {
	opacity: 0.6;
}

/* ---------- Badges ---------- */
.forge-pcard__badges {
	position: absolute;
	top: 0.625rem;
	left: 0.625rem;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.25rem;
}

.forge-pcard__badges--inline {
	position: static;
	flex-direction: row;
	margin: 0 0.375rem 0.5rem;
}

.forge-pcard__badge {
	padding: 0.25rem 0.625rem;
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.forge-pcard__badge--sale {
	background: var(--wp--preset--color--sale);
	color: var(--wp--preset--color--bg);
}

.forge-pcard__badge--new {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
}

.forge-pcard__badge--out {
	background: var(--wp--preset--color--bg);
	color: var(--wp--preset--color--ink);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--line);
}

/* ---------- Body ---------- */
.forge-pcard__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
	padding-inline: 0.375rem;
}

.forge-pcard__body > p {
	margin: 0;
}

.forge-pcard__terms {
	/* One line: "Brand · Category", cut with an ellipsis when the card is narrow. */
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.4;
}

.forge-pcard__term {
	position: relative;
	z-index: 1; /* above the card link */
	color: inherit;
	text-decoration: none;
}

.forge-pcard__term:hover {
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
}

.forge-pcard__term--brand {
	color: var(--wp--preset--color--ink);
	font-weight: 600;
}

.forge-pcard__term + .forge-pcard__term::before {
	content: "·";
	margin: 0 0.375rem;
	color: var(--wp--preset--color--ink-muted);
}

.forge-pcard__terms + .forge-pcard__title {
	margin-top: -0.25rem !important; /* brand/category belongs to the name */
}

.forge-pcard__title {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0;
}

.forge-pcard__subtitle {
	margin: 0;
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}

.forge-pcard__title a {
	display: -webkit-box;
	-webkit-line-clamp: var(--forge-pcard-lines, 2);
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(var(--forge-pcard-lines, 2) * 1.4em); /* reserved lines: cards align */
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

/* Whole card is the link target. */
.forge-pcard__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--wp--custom--radius--card);
}

.forge-pcard__title a:focus-visible {
	outline: none;
}

.forge-pcard__title a:focus-visible::after {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* ---------- Rating ---------- */
.forge-pcard__rating {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	min-width: 0;
	overflow: hidden;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--ink-muted);
}

.forge-pcard__stars {
	/* Five drawn stars (assets/icons/star.svg, 26×24 tile = star + gap), filled up to the rating. */
	--forge-fill: calc(var(--forge-rating, 0) / 5 * 100%);
	flex: none;
	width: calc(5em * 26 / 24);
	height: 1em;
	font-size: 0.9375rem;
	background: linear-gradient(90deg, var(--wp--preset--color--ink) var(--forge-fill), var(--wp--preset--color--line) var(--forge-fill));
	mask: url("../../assets/icons/star.svg") 0 0 / calc(1em * 26 / 24) 1em repeat-x;
}

.forge-pcard__count {
	min-width: 0;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* ---------- Summary, swatches, meta ---------- */
.forge-pcard__summary {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.45;
}

.forge-pcard__swatches {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3125rem;
}

.forge-pcard__dot {
	width: 1rem;
	height: 1rem;
	border-radius: 50%;
	background: var(--forge-dot, var(--wp--preset--color--wash)) center / cover no-repeat;
	box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.14);
}

.forge-pcard__chip {
	padding: 0.0625rem 0.4375rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.5;
}

.forge-pcard__more {
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--x-small);
}

.forge-pcard__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.125rem 0.75rem;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--ink-muted);
}

.forge-pcard__stock {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-weight: 600;
}

.forge-pcard__stock::before {
	content: "";
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: currentColor;
}

.forge-pcard__stock--in {
	color: var(--wp--preset--color--accent);
}

.forge-pcard__stock--low,
.forge-pcard__stock--out {
	color: var(--wp--preset--color--sale);
}

.forge-pcard__stock--backorder {
	color: var(--wp--preset--color--ink);
}

.forge-pcard__sku {
	font-variant-numeric: tabular-nums;
}

/* ---------- Price + button ---------- */
.forge-pcard__price {
	margin-top: auto !important;
	padding-top: 0.375rem;
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.forge-pcard__price del {
	margin-right: 0.375rem;
	color: var(--wp--preset--color--ink-muted);
	font-size: 0.8em;
	font-weight: 500;
}

.forge-pcard__price ins {
	color: var(--wp--preset--color--sale);
	text-decoration: none;
}

/* Button row: [eye] [Add to cart]. Same height, same fill, same hover. The selectors carry the
   block class so they win over the older .forge-grid product-button rules in app.css. */
.wp-block-forge-product-card.forge-pcard .forge-pcard__actions {
	position: relative;
	z-index: 1; /* above the card link */
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.wp-block-forge-product-card.forge-pcard:not(:has(.forge-pcard__price)) .forge-pcard__actions {
	margin-top: auto;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button {
	flex: 1;
	min-width: 0;
	margin: 0;
	gap: 0;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button,
.wp-block-forge-product-card.forge-pcard .forge-pcard__view {
	box-sizing: border-box;
	height: var(--forge-pcard-ctl);
	min-height: var(--forge-pcard-ctl);
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--forge-pcard-ctl-bg);
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition: background-color 150ms var(--forge-ease), color 150ms var(--forge-ease), transform 150ms var(--forge-ease);
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button {
	width: 100%;
	padding: 0 1rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__view {
	flex: none;
	display: grid;
	place-items: center;
	width: var(--forge-pcard-ctl);
	padding: 0;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__view::before {
	content: "";
	width: 1.25rem;
	height: 1.25rem;
	background-color: currentColor;
	mask: url("../../assets/icons/eye.svg") center / contain no-repeat;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button:hover,
.wp-block-forge-product-card.forge-pcard .forge-pcard__view:hover {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button:active,
.wp-block-forge-product-card.forge-pcard .forge-pcard__view:active {
	transform: scale(0.97);
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button:focus-visible,
.wp-block-forge-product-card.forge-pcard .forge-pcard__view:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* A label that doesn't fit ends in "…" instead of being clipped on both sides. */
.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button > span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Narrow cards (2 per row on phones, tight sliders): the eye moves onto the image corner,
   so Add to cart gets the full width. Badges stay top left. */
@container forge-pcard (max-width: 200px) {
	.wp-block-forge-product-card.forge-pcard .forge-pcard__actions {
		position: static;
	}

	.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button {
		position: relative;
		z-index: 1;
	}

	.wp-block-forge-product-card.forge-pcard .forge-pcard__actions .wc-block-components-product-button__button {
		padding: 0 0.625rem;
	}

	.wp-block-forge-product-card.forge-pcard .forge-pcard__view {
		--forge-pcard-ctl: 40px;
		position: absolute;
		top: 1rem;
		right: 1rem;
		z-index: 2;
		background: var(--wp--preset--color--bg);
		box-shadow: var(--wp--preset--shadow--card-hover);
	}

	.wp-block-forge-product-card.forge-pcard .forge-pcard__view::before {
		width: 1.125rem;
		height: 1.125rem;
	}

	.wp-block-forge-product-card.forge-pcard:not(:has(.forge-pcard__media)) .forge-pcard__view {
		position: static;
	}

	.forge-pcard__count--empty {
		display: none;
	}

	.forge-pcard__badges > :nth-child(n + 3) {
		display: none;
	}

	/* The eye owns the top-right corner here, so badges sit bottom left and stack
	   upwards: "Out of stock" no longer runs under the eye. */
	.forge-pcard__media .forge-pcard__badges {
		top: auto;
		bottom: 0.5rem;
		left: 0.5rem;
		flex-direction: column-reverse;
	}

	/* At ~160px a two-line excerpt and "Brand · Categ…" are noise that pushes the price
	   below the fold. The product page carries both; the brand stays. */
	.forge-pcard__summary,
	.forge-pcard__sku,
	.forge-pcard__terms:has(.forge-pcard__term--brand) .forge-pcard__term:not(.forge-pcard__term--brand) {
		display: none;
	}

	.forge-pcard__rating {
		gap: 0.25rem;
	}

	.forge-pcard__stars {
		font-size: 0.8125rem;
	}

	.forge-pcard__price {
		font-size: 1.125rem;
	}

	.forge-pcard__title {
		font-size: 0.875rem;
	}
}

/* ---------- Centred text ---------- */
.forge-pcard--center .forge-pcard__body {
	text-align: center;
}

.forge-pcard--center :is(.forge-pcard__rating, .forge-pcard__swatches, .forge-pcard__meta) {
	justify-content: center;
}

/* ---------- Quick view popup (assets/js/quick-view.js, woocommerce/forge/quick-view.php) ---------- */
/* Scroll lock is set on <body> by quick-view.js (overflow + scrollbar-width padding), like the Mini-Cart. */

.forge-qv-dialog {
	width: min(980px, calc(100vw - 2rem));
	max-width: none;
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: 0;
	background: transparent;
	overflow: visible;
	color: var(--wp--preset--color--ink);
}

.forge-qv-dialog::backdrop {
	background: rgb(27 27 28 / 0.55);
	animation: forge-qv-fade 200ms var(--forge-ease);
}

.forge-qv-dialog__panel {
	position: relative;
	max-height: calc(100dvh - 2rem);
	overflow: auto;
	overscroll-behavior: contain;
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--bg);
	box-shadow: var(--wp--preset--shadow--overlay);
	animation: forge-qv-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.forge-qv-dialog__panel:focus {
	outline: none;
}

.forge-qv-dialog.is-closing .forge-qv-dialog__panel {
	animation: forge-qv-out 150ms var(--forge-ease) forwards;
}

.forge-qv-dialog.is-closing::backdrop {
	animation: forge-qv-fade 150ms var(--forge-ease) reverse forwards;
}

/* Hand-over to the Mini-Cart drawer (quick-view.js handOverToDrawer): panel out, backdrop stays,
   then the backdrop fades over 300 ms while the drawer's own overlay fades in. */
.forge-qv-dialog.is-handoff .forge-qv-dialog__panel {
	animation: forge-qv-out 150ms var(--forge-ease) forwards;
}

.forge-qv-dialog.is-handoff::backdrop {
	animation: none;
}

.forge-qv-dialog.is-handoff.is-closing::backdrop {
	animation: forge-qv-fade 300ms linear reverse forwards;
}

@keyframes forge-qv-in {
	from { opacity: 0; transform: translateY(12px) scale(0.985); }
}

@keyframes forge-qv-out {
	to { opacity: 0; transform: translateY(8px) scale(0.985); }
}

@keyframes forge-qv-fade {
	from { opacity: 0; }
}

.forge-qv-dialog__close {
	/* Sticky in the scrolling panel: stays reachable after scrolling the details. */
	position: sticky;
	top: 1rem;
	z-index: 3;
	margin: 1rem 1rem calc(-44px - 1rem) auto;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--control);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--bg);
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition: background-color 150ms var(--forge-ease), border-color 150ms var(--forge-ease);
}

.forge-qv-dialog__close::before {
	content: "";
	width: 1.125rem;
	height: 1.125rem;
	background-color: currentColor;
	mask: url("../../assets/icons/x.svg") center / contain no-repeat;
}

.forge-qv-dialog__close:hover {
	border-color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--wash);
}

.forge-qv-dialog :focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* The panel only receives focus on open (so Tab starts inside); it is not a control. */
.forge-qv-dialog .forge-qv-dialog__panel:focus-visible {
	outline: none;
}

.forge-qv-dialog__error {
	display: grid;
	justify-items: center;
	gap: 1.25rem;
	padding: 5rem 2rem;
	text-align: center;
}

.forge-qv-dialog__error p {
	margin: 0;
	color: var(--wp--preset--color--ink-muted);
}

.forge-qv-dialog__error .forge-qv__add {
	flex: none;
}

/* Layout: gallery | details. The gallery stays in view while long details scroll. */
.forge-qv {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	gap: 2.5rem;
	padding: 1.5rem;
}

.forge-qv__gallery {
	position: sticky;
	top: 1.5rem;
	align-self: start;
	overflow: hidden;
	border-radius: calc(var(--wp--custom--radius--card) - 4px);
	background: var(--wp--preset--color--wash);
}

.forge-qv__gallery .forge-slider__slide {
	display: grid;
	place-items: center;
}

.forge-qv__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.forge-qv__gallery .forge-slider__pagination,
.forge-qv__gallery [class*="forge-slider__dots"] {
	padding-bottom: 0.875rem;
}

.forge-qv__gallery .forge-pcard__badges {
	top: 1rem;
	left: 1rem;
}

.forge-qv__info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 0.75rem 3.25rem 0.5rem 0; /* right: clear the close button */
}

.forge-qv__info p {
	margin: 0;
}

/* Name block: tight group */
.forge-qv__head {
	display: grid;
	gap: 0.5rem;
}

.forge-qv__title {
	margin: 0;
	font-size: clamp(1.375rem, 1.1rem + 0.8vw, 1.75rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

.forge-qv__title a {
	color: inherit;
	text-decoration: none;
}

.forge-qv__title a:hover {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.forge-qv__reviews {
	color: var(--wp--preset--color--ink-muted);
	text-underline-offset: 0.15em;
}

.forge-qv__reviews:hover {
	color: var(--wp--preset--color--ink);
}

/* Price: product-page voice, a step down */
.forge-qv__price {
	margin-top: 1.25rem !important;
	padding-top: 0;
	font-size: 1.75rem;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.03em;
}

.forge-qv__price del {
	font-size: 0.6em;
	vertical-align: 0.15em;
}

.forge-qv__summary {
	margin-top: 1rem;
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
	max-width: 52ch;
}

.forge-qv__summary > :first-child {
	margin-top: 0;
}

.forge-qv__summary > :last-child {
	margin-bottom: 0;
}

/* Buy area: separated from the description by a hairline */
.forge-qv__form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	margin: 1.5rem 0 0;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--line);
}

.forge-qv__attr {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.forge-qv__legend {
	margin-bottom: 0.625rem;
	padding: 0;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.forge-qv__chosen:not(:empty)::before {
	content: ": ";
}

.forge-qv__chosen {
	color: var(--wp--preset--color--ink-muted);
	font-weight: 400;
}

.forge-qv__attr.is-missing .forge-qv__legend {
	color: var(--wp--preset--color--sale);
}

.forge-qv__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.forge-qv__option {
	position: relative;
	cursor: pointer;
}

.forge-qv__option input {
	position: absolute;
	inset: 0;
	opacity: 0;
	margin: 0;
	cursor: inherit;
}

.forge-qv__chip {
	display: grid;
	place-items: center;
	min-width: 48px;
	min-height: 44px;
	padding: 0 1rem;
	box-sizing: border-box;
	border: 1px solid var(--wp--preset--color--control);
	border-radius: var(--wp--custom--radius--control);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	transition: border-color 150ms var(--forge-ease), box-shadow 150ms var(--forge-ease);
}

.forge-qv__dot {
	display: block;
	width: 40px;
	height: 40px;
	margin: 2px;
	border-radius: 50%;
	background: var(--forge-dot, var(--wp--preset--color--wash)) center / cover no-repeat;
	box-shadow: inset 0 0 0 1px rgb(27 27 28 / 0.16);
	transition: box-shadow 150ms var(--forge-ease);
}

.forge-qv__option:hover .forge-qv__chip {
	border-color: var(--wp--preset--color--ink);
}

.forge-qv__option:hover .forge-qv__dot {
	box-shadow: inset 0 0 0 1px rgb(27 27 28 / 0.16), 0 0 0 2px var(--wp--preset--color--bg), 0 0 0 3px var(--wp--preset--color--control);
}

.forge-qv__option input:checked + .forge-qv__chip {
	border-color: var(--wp--preset--color--primary);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--primary);
}

.forge-qv__option input:checked + .forge-qv__dot {
	box-shadow: inset 0 0 0 1px rgb(27 27 28 / 0.16), 0 0 0 2px var(--wp--preset--color--bg), 0 0 0 4px var(--wp--preset--color--primary);
}

.forge-qv__option input:focus-visible + span {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 4px;
}

/* Sold out with the other choice: faded and struck through, still visible */
.forge-qv__option.is-unavailable {
	cursor: not-allowed;
}

.forge-qv__option.is-unavailable .forge-qv__chip {
	border-style: dashed;
	color: var(--wp--preset--color--ink-muted);
	text-decoration: line-through;
}

.forge-qv__option.is-unavailable .forge-qv__dot {
	opacity: 0.35;
	background-image: linear-gradient(135deg, transparent calc(50% - 1px), var(--wp--preset--color--ink) calc(50% - 1px), var(--wp--preset--color--ink) calc(50% + 1px), transparent calc(50% + 1px));
}

.forge-qv__select {
	width: 100%;
	max-width: 22rem;
	min-height: 44px;
	padding: 0 0.875rem;
	border: 1px solid var(--wp--preset--color--control);
	border-radius: var(--wp--custom--radius--control);
	background: var(--wp--preset--color--bg);
	color: inherit;
	font: inherit;
}

.forge-qv__stock:not(:has(:not([hidden]))) {
	display: none;
}

.forge-qv__buy {
	display: flex;
	gap: 0.625rem;
}

.forge-qv__qty {
	display: flex;
	align-items: center;
	flex: none;
	border: 1px solid var(--wp--preset--color--control);
	border-radius: var(--wp--custom--radius--pill);
}

.forge-qv__step {
	display: grid;
	place-items: center;
	width: 44px;
	height: 50px;
	padding: 0;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: none;
	color: inherit;
	cursor: pointer;
	transition: background-color 150ms var(--forge-ease);
}

.forge-qv__step:hover {
	background: var(--wp--preset--color--wash);
}

.forge-qv__icon {
	width: 1rem;
	height: 1rem;
	background-color: currentColor;
	mask: center / contain no-repeat;
}

.forge-qv__icon--minus { mask-image: url("../../assets/icons/minus.svg"); }
.forge-qv__icon--plus { mask-image: url("../../assets/icons/plus.svg"); }

.forge-qv__qty input {
	width: 2.5rem;
	height: 50px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: center;
	font-variant-numeric: tabular-nums;
	-moz-appearance: textfield;
}

.forge-qv__qty input::-webkit-inner-spin-button,
.forge-qv__qty input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.forge-qv__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	flex: 1;
	min-height: 52px;
	padding: 0 1.5rem;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 150ms var(--forge-ease), transform 150ms var(--forge-ease);
}

.forge-qv__add:hover {
	background: var(--wp--preset--color--ink);
}

.forge-qv__add:active {
	transform: scale(0.985);
}

.forge-qv__add:disabled {
	background: var(--wp--preset--color--wash);
	color: var(--wp--preset--color--ink-muted);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--line);
	cursor: not-allowed;
	transform: none;
}

.forge-qv__add[aria-busy="true"] {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary-muted);
	box-shadow: none;
	cursor: progress;
}

/* Added: still the primary button, with a drawn check (green stays reassurance-only) */
.forge-qv__add.is-added::before {
	content: "";
	width: 1.125rem;
	height: 1.125rem;
	background-color: currentColor;
	mask: url("../../assets/icons/check.svg") center / contain no-repeat;
	animation: forge-qv-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes forge-qv-pop {
	from { opacity: 0; transform: scale(0.6); }
}

.forge-qv__message:empty {
	display: none;
}

.forge-qv__message {
	margin-top: -0.5rem !important;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.forge-qv__message.is-error {
	color: var(--wp--preset--color--sale);
}

/* Reassurance line after adding: green check + View cart */
.forge-qv__done {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin-top: -0.5rem !important;
	font-size: var(--wp--preset--font-size--small);
}

.forge-qv__done[hidden] {
	display: none;
}

.forge-qv__done-text {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	color: var(--wp--preset--color--accent);
	font-weight: 600;
}

.forge-qv__done-text::before {
	content: "";
	width: 1rem;
	height: 1rem;
	background-color: currentColor;
	mask: url("../../assets/icons/check.svg") center / contain no-repeat;
}

.forge-qv__done a {
	color: var(--wp--preset--color--ink);
	font-weight: 600;
	text-underline-offset: 0.15em;
}

.forge-qv__more {
	align-self: flex-start;
	margin-top: 1.5rem;
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-decoration: none;
}

.forge-qv__more:hover {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* Loading: the popup's own shape, still (no shimmer loop) */
.forge-qv--skeleton .forge-qv__gallery {
	position: static;
	aspect-ratio: 1;
}

.forge-qv--skeleton .forge-qv__info {
	gap: 0.875rem;
}

.forge-qv--skeleton .forge-qv__info span {
	display: block;
	height: 1rem;
	border-radius: 6px;
	background: var(--wp--preset--color--wash);
}

.forge-qv--skeleton .forge-qv__info span:nth-child(1) { width: 30%; }
.forge-qv--skeleton .forge-qv__info span:nth-child(2) { width: 85%; height: 1.75rem; }
.forge-qv--skeleton .forge-qv__info span:nth-child(3) { width: 35%; height: 2rem; margin-top: 1rem; }
.forge-qv--skeleton .forge-qv__info span:nth-child(4) { width: 100%; height: 3.25rem; margin-top: 2rem; border-radius: var(--wp--custom--radius--pill); }

/* Phones: a sheet from the bottom edge */
@media (max-width: 781px) {
	.forge-qv-dialog {
		width: 100%;
		max-height: calc(100dvh - 1rem);
		margin: auto 0 0;
	}

	.forge-qv-dialog__panel {
		max-height: calc(100dvh - 1rem);
		border-radius: var(--wp--custom--radius--card) var(--wp--custom--radius--card) 0 0;
		animation-name: forge-qv-sheet-in;
	}

	.forge-qv-dialog.is-closing .forge-qv-dialog__panel {
		animation-name: forge-qv-sheet-out;
	}

	@keyframes forge-qv-sheet-in {
		from { transform: translateY(100%); }
	}

	@keyframes forge-qv-sheet-out {
		to { transform: translateY(100%); }
	}

	.forge-qv-dialog__close {
		top: 0.75rem;
		margin: 0.75rem 0.75rem calc(-44px - 0.75rem) auto;
	}

	.forge-qv {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.25rem;
		padding: 0.75rem 0.75rem calc(1.25rem + env(safe-area-inset-bottom));
	}

	.forge-qv__gallery {
		position: static;
	}

	.forge-qv__info {
		padding: 0 0.375rem;
	}

	.forge-qv__price {
		margin-top: 1rem !important;
		font-size: 1.5rem;
	}

	.forge-qv__form {
		margin-top: 1.25rem;
		padding-top: 1.25rem;
	}

	.forge-qv--skeleton .forge-qv__info {
		padding-bottom: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.forge-pcard,
	.forge-pcard__img,
	.forge-pcard__view,
	.forge-qv-dialog__panel,
	.forge-qv-dialog::backdrop,
	.forge-qv__add,
	.forge-qv__add.is-added::before {
		transition: none;
		animation: none !important;
	}

	.forge-pcard:hover .forge-pcard__img {
		transform: none;
	}
}

/* ---------- Options on the card (setting "Choose options on the card") ----------
   One row per attribute (colours, then sizes …), Add to cart below. Choices reuse the quick view
   swatches (.forge-qv__option) at card size; the form sits above the card link. */
.wp-block-forge-product-card.forge-pcard .forge-pcard__pick {
	position: relative;
	z-index: 1; /* above the card link */
	display: grid;
	gap: 0.625rem;
	margin-top: 0.75rem;
}

.forge-pcard__attr {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.forge-pcard__legend {
	margin-bottom: 0.375rem;
	padding: 0;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

.forge-pcard__chosen {
	color: var(--wp--preset--color--ink-muted);
	font-weight: 400;
}

.forge-pcard__chosen:not(:empty)::before {
	content: ": ";
}

.forge-pcard__attr.is-missing .forge-pcard__legend {
	color: var(--wp--preset--color--sale);
}

.forge-pcard__pick .forge-qv__options {
	gap: 0.25rem;
}

.forge-pcard__pick .forge-qv__dot {
	width: 28px;
	height: 28px;
	margin: 4px;
}

.forge-pcard__pick .forge-qv__chip {
	min-width: 40px;
	min-height: 36px;
	padding: 0 0.5rem;
	font-size: var(--wp--preset--font-size--x-small);
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__pick .forge-pcard__actions {
	margin-top: 0.125rem;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__add {
	flex: 1;
	min-width: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	box-sizing: border-box;
	height: var(--forge-pcard-ctl);
	padding: 0 1rem;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: opacity 150ms var(--forge-ease), transform 150ms var(--forge-ease);
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__add:hover {
	opacity: 0.88;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__add:active {
	transform: scale(0.97);
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__add:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.wp-block-forge-product-card.forge-pcard .forge-pcard__add[aria-busy] {
	cursor: progress;
	opacity: 0.7;
}

.forge-pcard__add-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.forge-pcard__add.is-added::before {
	content: "";
	flex: none;
	width: 1rem;
	height: 1rem;
	background-color: currentColor;
	mask: url("../../assets/icons/check.svg") center / contain no-repeat;
}

.forge-pcard__message {
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
}

.forge-pcard__message:empty {
	display: none;
}

.forge-pcard__message.is-error {
	color: var(--wp--preset--color--sale);
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-forge-product-card.forge-pcard .forge-pcard__add {
		transition: none;
	}
}

/* Narrow cards: the eye moves onto the image corner (see above), so the form must not be its
   positioned parent; the choices and the button stay above the card link on their own. */
@container forge-pcard (max-width: 200px) {
	.wp-block-forge-product-card.forge-pcard .forge-pcard__pick {
		position: static;
	}

	.wp-block-forge-product-card.forge-pcard .forge-pcard__pick :is(.forge-pcard__attr, .forge-pcard__add) {
		position: relative;
		z-index: 1;
	}
}
