/**
 * DKM Add to Cart
 *
 * The button holds one size through every state it can be in: all four labels
 * are in the markup, stacked on top of each other and clipped, and the button
 * is as tall as the tallest. Swapping them is then a transform, which cannot
 * reflow the page under the cursor - a button that grows when it says "Added"
 * moves whatever the shopper was about to click next.
 *
 * Colours come from the plugin's settings screen as custom properties.
 */

.wcg-atc {
	/* Diilikaubamaja Design System v3: every colour is a role token from
	   assets/css/tokens.css, which the shop's Elementor Variables of the same
	   name override. */
	/* Not var(--wcg-accent): that is the gallery's accent, and the
	   settings screen writes every chosen colour onto every one of this
	   plugin's roots - so chaining through it made the gallery's colour
	   the add to cart button's colour too. */
	/* v3.4 component tokens: DKM > Design tokens > Buttons > Primary. */
	--wcg-atc-bg: var(--button-primary-bg);
	--wcg-atc-text: var(--button-primary-text);
	/* Once added: the same greys it rests in, not the site's accent - a
	   colour that flashed for two seconds and went read as random. */
	--wcg-atc-done-bg: var(--bg-press);
	--wcg-atc-done-text: var(--wcg-atc-muted, var(--text-tertiary));
	--wcg-atc-fail-bg: var(--text-danger);
	/* Ink 500: the selector's edge has to clear WCAG 1.4.11's 3:1. */
	--wcg-atc-qty-border: var(--input-border);
	/* Focus is the interactive blue. A lime ring on white is 1.3:1. */
	--wcg-atc-focus: var(--border-focus);
	--wcg-atc-qty-bg: var(--input-bg);
	/* The quantity is a field: its minus and plus are part of it, no fill at
	   rest, the tertiary hover grey under the pointer (DS v3.4). */
	--wcg-atc-step-bg: transparent;
	--wcg-atc-step-hover-bg: var(--button-tertiary-hover-bg);
	--wcg-atc-step-icon: var(--text-primary);
	--wcg-atc-muted: var(--text-tertiary);
	--wcg-atc-radius: var(--button-radius);
	--wcg-atc-height: var(--control-md);
	/* Design system v3: hover and press are the next two ramp steps of the
	   action colour, not a mix toward black. A shop colour chosen on the
	   settings screen replaces both with a worked-out mix (Contrast::hover). */
	--wcg-atc-hover-bg: var(--button-primary-hover-bg);
	--wcg-atc-press-bg: var(--button-primary-press-bg);
	--wcg-atc-gap: 12px;

	/* Overridden by the size classes at the foot of this file. */
	--wcg-atc-font: inherit;
	--wcg-atc-pad: 24px;
	--wcg-atc-min: 180px;

	/* Elementor renders this element as the flex child itself, so it has to
	   claim its width. */
	display: block;
	width: 100%;
	min-width: 0;

	/* No spacing of our own: margin and padding are the Style tab's job. */
	margin: 0;
	padding: 0;
}

/* A full-width control must not change its grid column when its hidden label changes. */
.wcg-atc.is-full {
	contain: inline-size;
}

.wcg-atc__row {
	display: flex;
	align-items: stretch;
	gap: var(--wcg-atc-gap);
	flex-wrap: wrap;
}

/* Which way round the row goes is a property of the placement, so it comes
   off the element rather than out of the settings. */
.wcg-atc--button-first .wcg-atc__row {
	flex-direction: row-reverse;
}

.wcg-atc--stacked .wcg-atc__row {
	flex-direction: column;
	align-items: stretch;
}

.wcg-atc--stacked .wcg-atc__qty {
	justify-content: space-between;
}

/* ------------------------------------------------------------- quantity */

.wcg-atc__qty {
	display: flex;
	align-items: center;
	flex: none;
	box-sizing: border-box;
	background: var(--wcg-atc-qty-bg);
	border: 1px solid var(--wcg-atc-qty-border);
	border-radius: var(--wcg-atc-radius);
	padding: 4px;
	gap: 2px;
	min-height: var(--wcg-atc-height);
}

.wcg-atc__qty--square {
	border-radius: var(--radius-sm);
}

/* Compact: the same control with the air taken out, for a row that has to
   share its width with a button - a product listing, or a phone.

   The padding goes entirely and the buttons run to the border. Their own
   40x40 hit area is what makes them pressable, not the space around them, so
   the ring of padding was width spent on nothing. The figure is sized to the
   digits it holds rather than to a fixed 3.5ch, because most carts are one
   digit and the third character was always empty.

   34px against the standard 44 - and the tap target stays 34x34, which is
   under the 44px WCAG 2.5.5 asks for but at AAA; 2.5.8 at AA asks 24, and
   this clears that with room. A control that has to share a row with a button
   cannot have both. */
.wcg-atc__qty--compact {
	--wcg-atc-height: 34px;
	border-radius: var(--wcg-atc-radius);
	padding: 0;
	gap: 0;
}

.wcg-atc .wcg-atc__qty--compact .wcg-atc__step.wcg-atc__step {
	width: 32px;
	height: 32px;
}

.wcg-atc__qty--compact .wcg-atc__icon {
	width: 14px;
	height: 14px;
}

/* One digit wide, growing with the number rather than reserving room for a
   quantity nobody orders. field-sizing does it properly where it is
   understood; the ch floor is what everything else gets. */
.wcg-atc .wcg-atc__qty--compact .wcg-atc__input {
	width: 2ch;
	min-width: 2ch;
	padding: 0 2px;
	field-sizing: content;
}

.wcg-atc .wcg-atc__qty--compact .wcg-atc__cart-count,
.wcg-atc__cart-qty.wcg-atc__qty--compact .wcg-atc__cart-count {
	min-width: 2ch;
	padding: 0 2px;
}

/* Below this the row is fighting for width, so every selector becomes the
   compact one whatever it was told to be. */
@media (max-width: 480px) {
	.wcg-atc__qty {
		padding: 3px;
		gap: 0;
	}

	.wcg-atc .wcg-atc__step.wcg-atc__step {
		width: 30px;
		height: 30px;
	}

	.wcg-atc__icon {
		width: 15px;
		height: 15px;
	}

	.wcg-atc .wcg-atc__button.wcg-atc__button {
		min-width: 0;
		padding: 0 16px;
	}
}

.wcg-atc .wcg-atc__step.wcg-atc__step {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	flex: none;
	padding: 0;
	background: transparent;
	border: 0;
	/* Nested inside the field's radius-sm: one step smaller. */
	border-radius: var(--radius-xs);
	/* Ink 900 rather than inherit. The selector is one compound control, not
	   two of the theme's buttons, so it keeps its own contrast whether or not
	   the button beside it is following the theme - inheriting left the plus
	   and minus almost invisible against the white. */
	color: var(--wcg-atc-step-icon, var(--text-primary));
	cursor: pointer;
	transition: var(--motion-control);
}

/* The plus is the one being offered - it is what the shopper reaches for -
   so it is the one picked out. Neutral greys either way; the accent only
   comes into it when the shop has asked for its own colours. */
.wcg-atc__qty--pill .wcg-atc__step--up {
	background: var(--wcg-atc-step-bg);
}

/* The icons carry the whole control, so they are drawn a little heavier than
   the rest of the plugin's line work. */
.wcg-atc .wcg-atc__step .wcg-atc__icon {
	stroke-width: 2.25;
}

.wcg-atc__qty--square .wcg-atc__step {
	border-radius: var(--radius-sm);
	background: var(--wcg-atc-step-bg);
}

.wcg-atc .wcg-atc__step.wcg-atc__step:hover:not(:disabled) {
	background: var(--wcg-atc-step-hover-bg, var(--bg-subtle));
}

/* Still legible when it cannot be pressed: a control faded to a ghost reads
   as broken rather than as unavailable. */
.wcg-atc .wcg-atc__step.wcg-atc__step:disabled {
	opacity: 0.45;
	cursor: default;
}

.wcg-atc .wcg-atc__step.wcg-atc__step:focus {
	outline: none;
}

.wcg-atc .wcg-atc__step.wcg-atc__step:focus-visible {
	outline: 2px solid var(--wcg-atc-focus);
	outline-offset: 1px;
}

.wcg-atc__icon {
	width: 18px;
	height: 18px;
}

/* Scoped through the root rather than left as a bare class: both WordPress'
   admin styles - where this is previewed - and most themes reach the field as
   input[type="number"], which outranks a single class and would put a box back
   around the figure. */
.wcg-atc .wcg-atc__input {
	width: 3.5ch;
	min-width: 3.5ch;
	min-height: 0;
	height: auto;
	margin: 0;
	padding: 0 4px;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: var(--wcg-atc-font, inherit);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.wcg-atc .wcg-atc__input::-webkit-outer-spin-button,
.wcg-atc .wcg-atc__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.wcg-atc .wcg-atc__input:focus {
	outline: none;
	border: 0;
	box-shadow: none;
}

.wcg-atc__qty:focus-within {
	background-color: var(--input-focus-bg);
	border-color: var(--wcg-atc-focus);
}

/* --------------------------------------------------------------- button */

/* Doubled class on purpose. A WooCommerce theme reaches its buttons as
   `.woocommerce button.button:hover` and Elementor as `.elementor button` -
   both of which outrank a single class, so the theme ends up owning the
   background in the states we do not declare. That is what turned the button
   the theme's pink on hover, and what kept it looking pressed until the click
   went somewhere else: the colour was never ours to begin with once the
   pointer or the focus was on it. Every state is declared here, and declared
   high enough to hold. */
.wcg-atc .wcg-atc__button.wcg-atc__button {
	position: relative;
	display: block;
	box-sizing: border-box;
	flex: 1 1 auto;
	min-width: var(--wcg-atc-min, 180px);
	min-height: var(--wcg-atc-height);
	padding: 0 var(--wcg-atc-pad, 24px);
	border: 0;
	border-radius: var(--wcg-atc-radius);
	font: inherit;
	/* After the shorthand, which resets it. */
	font-size: var(--wcg-atc-font, inherit);
	line-height: var(--wcg-atc-height);
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	overflow: hidden;
	transition: var(--motion-control);
}

.wcg-atc:not(.is-full) .wcg-atc__button {
	flex: 0 1 auto;
}

/* Every state declared, and declared high enough to hold against
   `.woocommerce button.button:hover` and friends. Leaving any of them to the
   theme is what turned the button the theme's pink on hover, and what kept it
   looking pressed until the click went somewhere else: the colour was never
   ours once the pointer or the focus was on it. */
.wcg-atc .wcg-atc__button.wcg-atc__button {
	background: var(--wcg-atc-bg);
	color: var(--wcg-atc-text);
	/* The design system's accent/button weight. */
	font-weight: 700;
}

/* The brand guidelines: interaction always darkens - hover one step down the
   ramp, press two (lime 400 to 500 to 600) - because a lighter hover reads as
   disabled on an acid palette. Only a colour that darkening would take under
   WCAG 2.1 AA moves away from its text instead. Which way and how far is
   worked out on the server (Contrast::hover) and written onto the element;
   the mixing is the browser's, so a background the theme owns still gets a
   hover. */
.wcg-atc .wcg-atc__button.wcg-atc__button:hover {
	background: var(--wcg-atc-hover-bg);
	color: var(--wcg-atc-text);
}

.wcg-atc .wcg-atc__button.wcg-atc__button:active {
	background: var(--wcg-atc-press-bg);
	color: var(--wcg-atc-text);
}

/* :focus is not in either of those. A mouse click leaves the button focused,
   and a button that changes on focus stays changed until something else is
   clicked. The keyboard gets a ring further down. */
.wcg-atc .wcg-atc__button.wcg-atc__button:focus {
	background: var(--wcg-atc-bg);
	color: var(--wcg-atc-text);
}

/* A browser without color-mix keeps the flat colour rather than no colour. */
@supports not (background: color-mix(in oklab, #0a0a0a, #ffffff 10%)) {
	.wcg-atc .wcg-atc__button.wcg-atc__button:hover,
	.wcg-atc .wcg-atc__button.wcg-atc__button:active {
		background: var(--wcg-atc-bg);
		filter: brightness(0.94);
	}
}

.wcg-atc .wcg-atc__button.wcg-atc__button.is-done:hover,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-done:focus,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-done:active {
	background: var(--wcg-atc-done-bg);
}

.wcg-atc .wcg-atc__button.wcg-atc__button.is-fail:hover,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-fail:focus,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-fail:active {
	background: var(--wcg-atc-fail-bg);
}

.wcg-atc .wcg-atc__button.wcg-atc__button:active:not(:disabled) {
	transform: scale(var(--motion-press-scale));
}

/* A pressed button keeps no ring of its own - only keyboard focus draws one,
   which is what stopped the button looking stuck after a click. */
.wcg-atc .wcg-atc__button.wcg-atc__button:focus {
	outline: none;
}

.wcg-atc .wcg-atc__button.wcg-atc__button:focus-visible {
	outline: 2px solid var(--wcg-atc-focus);
	outline-offset: 2px;
}

.wcg-atc .wcg-atc__button.wcg-atc__button:disabled {
	background: var(--bg-press);
	color: var(--wcg-atc-muted, var(--text-tertiary));
	cursor: not-allowed;
	filter: none;
}

/* Every label occupies the same box; only one is in it at a time. The idle
   one is in flow, so it is the label that decides how wide the button is. */
.wcg-atc__layer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	white-space: nowrap;
	line-height: 1.2;
}

.wcg-atc__layer--busy,
.wcg-atc__layer--done,
.wcg-atc__layer--fail,
.wcg-atc__layer--max {
	position: absolute;
	inset: 0;
}

.wcg-atc__layer--idle {
	min-height: var(--wcg-atc-height);
}

.wcg-atc__layer .wcg-atc__icon {
	width: 20px;
	height: 20px;
}

/* -- slide: the label rises out of the top, the next comes up from below -- */

.wcg-atc--slide .wcg-atc__layer {
	transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.2s ease;
}

.wcg-atc--slide .wcg-atc__layer--busy,
.wcg-atc--slide .wcg-atc__layer--done,
.wcg-atc--slide .wcg-atc__layer--fail,
.wcg-atc--slide .wcg-atc__layer--max {
	transform: translateY(100%);
	opacity: 0;
}

.wcg-atc--slide .is-busy .wcg-atc__layer--idle,
.wcg-atc--slide .is-done .wcg-atc__layer--idle,
.wcg-atc--slide .is-fail .wcg-atc__layer--idle,
.wcg-atc--slide .is-max .wcg-atc__layer--idle {
	transform: translateY(-100%);
	opacity: 0;
}

.wcg-atc--slide .is-busy .wcg-atc__layer--busy,
.wcg-atc--slide .is-done .wcg-atc__layer--done,
.wcg-atc--slide .is-fail .wcg-atc__layer--fail,
.wcg-atc--slide .is-max .wcg-atc__layer--max {
	transform: translateY(0);
	opacity: 1;
}

/* ----------------------------- fade: one dissolves into the next --------- */

.wcg-atc--fade .wcg-atc__layer {
	transition: opacity 0.22s ease;
}

.wcg-atc--fade .wcg-atc__layer--busy,
.wcg-atc--fade .wcg-atc__layer--done,
.wcg-atc--fade .wcg-atc__layer--fail,
.wcg-atc--fade .wcg-atc__layer--max {
	opacity: 0;
}

.wcg-atc--fade .is-busy .wcg-atc__layer--idle,
.wcg-atc--fade .is-done .wcg-atc__layer--idle,
.wcg-atc--fade .is-fail .wcg-atc__layer--idle,
.wcg-atc--fade .is-max .wcg-atc__layer--idle {
	opacity: 0;
}

.wcg-atc--fade .is-busy .wcg-atc__layer--busy,
.wcg-atc--fade .is-done .wcg-atc__layer--done,
.wcg-atc--fade .is-fail .wcg-atc__layer--fail,
.wcg-atc--fade .is-max .wcg-atc__layer--max {
	opacity: 1;
}

/* --------------------------------- none: swapped, with nothing in between */

.wcg-atc--none .wcg-atc__layer--busy,
.wcg-atc--none .wcg-atc__layer--done,
.wcg-atc--none .wcg-atc__layer--fail,
.wcg-atc--none .wcg-atc__layer--max {
	opacity: 0;
}

.wcg-atc--none .is-busy .wcg-atc__layer--idle,
.wcg-atc--none .is-done .wcg-atc__layer--idle,
.wcg-atc--none .is-fail .wcg-atc__layer--idle,
.wcg-atc--none .is-max .wcg-atc__layer--idle {
	opacity: 0;
}

.wcg-atc--none .is-busy .wcg-atc__layer--busy,
.wcg-atc--none .is-done .wcg-atc__layer--done,
.wcg-atc--none .is-fail .wcg-atc__layer--fail,
.wcg-atc--none .is-max .wcg-atc__layer--max {
	opacity: 1;
}

/* -------------------------------------------------------------- states */

.wcg-atc .wcg-atc__button.wcg-atc__button.is-done {
	background: var(--wcg-atc-done-bg);
	color: var(--wcg-atc-done-text);
}

.wcg-atc .wcg-atc__button.wcg-atc__button.is-fail {
	background: var(--wcg-atc-fail-bg);
	color: var(--text-inverse);
}

/* Not a failure: nothing broke, the number was too big. It reads as the
   button gone quiet rather than as the button gone wrong, so it borrows the
   disabled greys instead of the fail red. */
.wcg-atc .wcg-atc__button.wcg-atc__button.is-max {
	background: var(--bg-press);
	color: var(--wcg-atc-muted, var(--text-tertiary));
}

.wcg-atc .wcg-atc__button.wcg-atc__button.is-busy {
	cursor: progress;
}

.wcg-atc__spinner {
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: wcg-atc-spin 0.7s linear infinite;
}

@keyframes wcg-atc-spin {
	to {
		transform: rotate(360deg);
	}
}

/* --------------------------------------------------------------- around */

/* The shopper has asked for more than there is. Said in the danger colour,
   under the row, and taken back as soon as the figure moves again. */
.wcg-atc__notice {
	margin: 8px 0 0;
	color: var(--wcg-atc-fail-bg, var(--text-danger));
	font-size: 0.875em;
	font-weight: 600;
}

.wcg-atc__notice[hidden] {
	display: none;
}

/* A nudge rather than a jolt: enough to draw the eye back to the figure that
   did not move. */
@keyframes wcg-atc-nudge {
	20% { transform: translateX(-3px); }
	40% { transform: translateX(3px); }
	60% { transform: translateX(-2px); }
	80% { transform: translateX(2px); }
}

.wcg-atc__qty.is-maxed {
	animation: wcg-atc-nudge 0.35s ease;
	border-color: var(--wcg-atc-fail-bg, var(--text-danger));
}

/* Ink 500, the system's muted text, rather than the body colour faded: a
   real token reads the same on every ground. */
.wcg-atc__stock {
	margin: 8px 0 0;
	color: var(--wcg-atc-muted, var(--text-tertiary));
	font-size: 0.875em;
}

/* What is in the cart already. Not a warning and not an error - it is the one
   line on the page that is simply true - so it takes the ink colour at the
   same size as the stock line beside it. */
.wcg-atc__in-cart {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 8px 0 0;
	color: var(--wcg-atc-text, var(--text-primary));
	font-size: 0.875em;
	font-weight: 600;
}

.wcg-atc__in-cart[hidden] {
	display: none;
}

/* Nothing to say, nothing to draw. The dot below is decoration on a sentence,
   and a sentence that is empty must not leave its decoration behind - with a
   link it is the link that is empty, so both shapes are covered. */
.wcg-atc__in-cart:empty,
.wcg-atc__in-cart:has(> .wcg-atc__in-cart-link:empty) {
	display: none;
}

/* A small filled dot in the accent, so the line reads as a state of the cart
   rather than as another sentence about stock. */
.wcg-atc__in-cart::before {
	content: "";
	width: 8px;
	height: 8px;
	flex: none;
	border-radius: 50%;
	background: var(--wcg-atc-bg);
}

.wcg-atc .wcg-atc__in-cart-link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
}

.wcg-atc .wcg-atc__in-cart-link:hover,
.wcg-atc .wcg-atc__in-cart-link:focus-visible {
	color: inherit;
	text-decoration-thickness: 2px;
}

.wcg-atc__live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.wcg-atc--loading .wcg-atc__inner::before {
	content: "";
	display: block;
	height: var(--wcg-atc-height);
	border-radius: var(--wcg-atc-radius);
	background: repeating-linear-gradient(135deg, var(--bg-subtle), var(--bg-subtle) 12px, var(--bg-press) 12px, var(--bg-press) 24px);
}

@media (prefers-reduced-motion: reduce) {
	.wcg-atc__layer,
	.wcg-atc__button {
		transition: none;
	}

	.wcg-atc__qty.is-maxed {
		animation: none;
	}

	.wcg-atc__spinner {
		animation-duration: 2s;
	}
}

/* ------------------------------------------------------------------ size */

/* The three control heights of the design system. They are custom properties
   rather than rules of their own so that everything in the row takes the same
   one: the quantity selector is as tall as the button beside it without being
   told twice, and the compact selector can still take the air out locally.

   44px is the middle one because it is the smallest comfortable tap target;
   32px is for a card or a list, where the button is not what the page is for.
   The size lives on the element rather than in the settings for the same
   reason the layout does - it is a property of where the button is put. */

.wcg-atc--size-sm {
	--wcg-atc-height: var(--control-sm);
	--wcg-atc-font: 14px;
	--wcg-atc-pad: 14px;
	--wcg-atc-min: 120px;
	--wcg-atc-gap: 8px;
}

.wcg-atc--size-md {
	--wcg-atc-height: var(--control-md);
	--wcg-atc-font: 16px;
	--wcg-atc-pad: 20px;
	--wcg-atc-min: 160px;
}

.wcg-atc--size-lg {
	--wcg-atc-height: var(--control-lg);
	--wcg-atc-font: 16px;
	--wcg-atc-pad: 28px;
	--wcg-atc-min: 200px;
}

/* The steppers have to fit inside the control they sit in - a 38px round
   button does not go into a 32px field, and a selector that outgrows the
   button beside it stretches the whole row past the height it was asked for.
   Last in the file and matched as tightly as the base rule, so these are the
   ones that hold. */
.wcg-atc--size-sm .wcg-atc__step.wcg-atc__step {
	width: 24px;
	height: 24px;
}

.wcg-atc--size-md .wcg-atc__step.wcg-atc__step {
	width: 34px;
	height: 34px;
}

.wcg-atc--size-sm .wcg-atc__qty {
	padding: 3px;
	gap: 0;
}

.wcg-atc--size-sm .wcg-atc__step .wcg-atc__icon {
	width: 14px;
	height: 14px;
}

.wcg-atc--size-lg .wcg-atc__step.wcg-atc__step {
	width: 40px;
	height: 40px;
}

/* The cart glyph rides with the label, so it scales with it. */
.wcg-atc--size-sm .wcg-atc__layer .wcg-atc__icon {
	width: 16px;
	height: 16px;
}

.wcg-atc--size-lg .wcg-atc__layer .wcg-atc__icon {
	width: 22px;
	height: 22px;
}

/* Nothing left to add. The button keeps the greys of a disabled one, because
   that is what it is saying, but it is not disabled: it opens the cart it
   filled, so it takes the pointer of something that can be pressed. The
   quantity selector is hidden by the script - there is no number to choose. */
.wcg-atc .wcg-atc__button.wcg-atc__button.is-maxed-out {
	background: var(--bg-press);
	color: var(--wcg-atc-muted, var(--text-tertiary));
	cursor: pointer;
	filter: none;
}

.wcg-atc .wcg-atc__button.wcg-atc__button.is-maxed-out:hover {
	filter: brightness(0.96);
}

/* In the cart, it stays on "added", in greys - the done colour
   is for the moment it went in, not for every visit after. Pressing it still
   adds more while there is more, and opens the cart once there is not. */
.wcg-atc .wcg-atc__button.wcg-atc__button.is-done.is-resting,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-done.is-resting:hover,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-done.is-resting:focus,
.wcg-atc .wcg-atc__button.wcg-atc__button.is-done.is-resting:active {
	background: var(--bg-press);
	color: var(--wcg-atc-muted, var(--text-tertiary));
}

.wcg-atc .wcg-atc__button.wcg-atc__button.is-done.is-resting:hover {
	filter: brightness(0.96);
}

.wcg-atc.is-maxed-out .wcg-atc__qty[hidden] {
	display: none;
}

/* --------------------------------------------- the cart's own stepper

   Both controls are in the markup and one is shown, so removing the last of
   something swaps back to the button without a fetch or a flicker. */

.wcg-atc [data-wcg-atc-controls][hidden],
.wcg-atc__row[hidden] {
	display: none;
}

.wcg-atc__cart-qty {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: var(--wcg-atc-height);
	padding: 0;
	border: 1px solid var(--wcg-atc-qty-border, var(--border-control));
	border-radius: var(--wcg-atc-radius);
	overflow: hidden;
}

/* It stands where the button and the selector stood, so it is as wide as the
   two of them were - not a bar across the row. */
.wcg-atc__row--cart {
	justify-content: flex-start;
}

.wcg-atc.is-full .wcg-atc__cart-qty {
	display: flex;
	width: 100%;
	justify-content: space-between;
}

.wcg-atc__cart-count {
	min-width: 3ch;
	padding: 0 4px;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	text-align: center;
}

/* Standing in for the button, it takes the button's colour as a pale tint:
   the same height, corners and type, with minus and plus on its ends and the
   number in the middle, all in the button's colour. Paler than the button, a
   card that is already in the cart stands out from the ones that are not. A
   product card and a phone are where it lives, so it fills the row. */
.wcg-atc .wcg-atc__row--cart {
	width: 100%;
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__cart-qty {
	/* The button's height, not the compact selector's it shares a class with. */
	--wcg-atc-height: inherit;
	--wcg-atc-tint: color-mix(in oklab, var(--wcg-atc-bg), var(--bg-surface) 88%);
	--wcg-atc-ink: color-mix(in oklab, var(--wcg-atc-bg), var(--bg-inverse) 15%);
	display: flex;
	width: 100%;
	min-height: var(--wcg-atc-height);
	justify-content: space-between;
	border: 0;
	border-radius: var(--wcg-atc-radius);
	background: var(--wcg-atc-tint);
	color: var(--wcg-atc-ink);
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__step.wcg-atc__step {
	width: var(--wcg-atc-height);
	height: var(--wcg-atc-height);
	border-radius: 0;
	background: transparent;
	color: var(--wcg-atc-ink);
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__step.wcg-atc__step:hover:not(:disabled) {
	background: color-mix(in oklab, var(--wcg-atc-bg), var(--bg-surface) 76%);
	filter: none;
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__step.wcg-atc__step:disabled {
	opacity: 1;
	color: color-mix(in oklab, var(--wcg-atc-ink), transparent 60%);
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__step.wcg-atc__step:focus-visible {
	outline: 2px solid var(--wcg-atc-ink);
	outline-offset: -4px;
}

/* With all of it in the cart the stepper greys out like the button that
   says so: the same grey and muted ink, plus faded. Minus still works. */
.wcg-atc .wcg-atc__row--cart .wcg-atc__cart-qty.is-maxed-out {
	--wcg-atc-ink: var(--wcg-atc-muted, var(--text-tertiary));
	background: var(--bg-press);
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__cart-qty.is-maxed-out .wcg-atc__step.wcg-atc__step:hover:not(:disabled) {
	background: var(--bg-press);
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__icon {
	width: 18px;
	height: 18px;
}

.wcg-atc .wcg-atc__row--cart .wcg-atc__cart-count {
	display: block;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	padding: 0 6px;
	color: inherit;
	font-size: var(--wcg-atc-font, inherit);
	font-weight: 600;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Minus at the last one is a bin. */
.wcg-atc__cart-qty .wcg-atc__icon--trash,
.wcg-atc__cart-qty.is-last .wcg-atc__icon--minus {
	display: none;
}

.wcg-atc__cart-qty.is-last .wcg-atc__icon--trash {
	display: block;
}

/* While the cart is being written to, the figure has already moved. Saying so
   quietly is better than blocking the control the shopper is using. */
.wcg-atc.is-writing .wcg-atc__cart-qty {
	opacity: 0.7;
}

/* WooCommerce's own "view cart" link, if something else on the page hands its
   listener a button of ours. The element says what it has done itself, in the
   button and in the line under it; a second link saying it again belongs to a
   different design. */
.wcg-atc .added_to_cart,
.wcg-atc + .added_to_cart {
	display: none;
}

/* Something of this is in the cart. The button says so instead of inviting
   again, and stays pressable because there is more to be had - so only the
   words change. The class is here for a shop that wants to tell the two apart
   from its own stylesheet. */

/* DS v3.5: a field's edge goes one step darker under the pointer. */
.wcg-atc__qty:hover:not(:focus-within) {
	border-color: var(--input-hover-border);
}
