/* Cha-no-wa product-card purchase controls. Scope is deliberately limited. */
.cnw-loop-purchase {
	--cnw-action-ink: var(--cnw-shop-green, var(--cnw-catalog-green, #0d3427));
	--cnw-action-ink-deep: var(--cnw-shop-green-deep, var(--cnw-catalog-green-deep, #062d1f));
	--cnw-action-paper: var(--cnw-shop-paper, var(--cnw-catalog-ivory, #fbf8f0));
	--cnw-action-surface: #ffffff;
	--cnw-action-line: var(--cnw-shop-green-button-line, rgba(13, 52, 39, 0.34));
	--cnw-action-focus: var(--cnw-shop-gold, var(--cnw-catalog-gold, #a9832f));
	display: grid;
	grid-template-columns: minmax(86px, 0.42fr) minmax(0, 1fr);
	gap: 8px;
	align-items: stretch;
	width: 100%;
	min-width: 0;
	margin: 0;
}

.cnw-loop-purchase--link-only {
	grid-template-columns: minmax(0, 1fr);
}

.cnw-loop-quantity {
	display: grid;
	grid-template-columns: 30px minmax(26px, 1fr) 30px;
	align-items: stretch;
	min-width: 0;
	min-height: 44px;
	overflow: hidden;
	background: var(--cnw-action-surface);
	border: 1px solid var(--cnw-action-line);
	border-radius: 2px;
}

.cnw-loop-quantity__button,
.cnw-loop-quantity__input {
	min-width: 0;
	min-height: 42px;
	margin: 0;
	padding: 0;
	color: var(--cnw-action-ink);
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	line-height: 1;
}

.cnw-loop-quantity__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 16px;
	transition: background-color 160ms ease, color 160ms ease;
}

.cnw-loop-quantity__button:hover:not(:disabled) {
	background: var(--cnw-action-paper);
	color: var(--cnw-action-ink-deep);
}

.cnw-loop-quantity__button:focus-visible,
.cnw-loop-quantity__input:focus-visible {
	position: relative;
	z-index: 1;
	outline: 2px solid var(--cnw-action-focus);
	outline-offset: -2px;
}

.cnw-loop-quantity__button:active:not(:disabled) {
	background: var(--cnw-action-line);
}

.cnw-loop-quantity__button:disabled {
	cursor: not-allowed;
	opacity: 0.38;
}

.cnw-loop-quantity__input {
	box-sizing: border-box;
	width: 100%;
	padding: 0 !important;
	color: var(--cnw-action-ink) !important;
	-webkit-text-fill-color: var(--cnw-action-ink);
	background: transparent !important;
	border: 0 !important;
	font-weight: 600 !important;
	text-align: center;
	-moz-appearance: textfield;
}

.cnw-loop-quantity__input::-webkit-inner-spin-button,
.cnw-loop-quantity__input::-webkit-outer-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

ul.products li.product .cnw-loop-purchase > :is(.button, .added_to_cart),
.wc-block-grid__product .cnw-loop-purchase > :is(.button, .added_to_cart) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	width: 100%;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 10px 12px;
	color: var(--cnw-action-paper);
	background: var(--cnw-action-ink);
	border: 1px solid var(--cnw-action-ink);
	border-radius: 2px;
	box-shadow: none;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.055em;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

ul.products li.product .cnw-loop-purchase > :is(.button, .added_to_cart):hover,
.wc-block-grid__product .cnw-loop-purchase > :is(.button, .added_to_cart):hover {
	color: var(--cnw-action-paper);
	background: var(--cnw-action-ink-deep);
	border-color: var(--cnw-action-ink-deep);
}

ul.products li.product .cnw-loop-purchase > :is(.button, .added_to_cart):focus-visible,
.wc-block-grid__product .cnw-loop-purchase > :is(.button, .added_to_cart):focus-visible {
	color: var(--cnw-action-paper);
	outline: 2px solid var(--cnw-action-focus);
	outline-offset: 2px;
}

ul.products li.product .cnw-loop-purchase > :is(.button, .added_to_cart):active,
.wc-block-grid__product .cnw-loop-purchase > :is(.button, .added_to_cart):active {
	transform: translateY(1px);
}

ul.products li.product .cnw-loop-purchase > .button.loading,
.wc-block-grid__product .cnw-loop-purchase > .button.loading {
	cursor: wait;
	opacity: 0.72;
}

ul.products li.product .cnw-loop-purchase > .button.disabled,
ul.products li.product .cnw-loop-purchase > .button:disabled,
.wc-block-grid__product .cnw-loop-purchase > .button.disabled,
.wc-block-grid__product .cnw-loop-purchase > .button:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.cnw-loop-cart-icon {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.55;
}

.cnw-loop-action-label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Keep Blocksy's add-to-cart confirmation action on the Cha-no-wa palette. */
#ct-added-to-cart-popup .ct-added-to-cart-popup-cart {
	color: #f7f3e9 !important;
	background-color: #103f2d !important;
	border-color: #103f2d !important;
}

#ct-added-to-cart-popup .ct-added-to-cart-popup-cart:hover {
	color: #f7f3e9 !important;
	background-color: #0d3427 !important;
	border-color: #0d3427 !important;
}

#ct-added-to-cart-popup .ct-added-to-cart-popup-cart:focus-visible {
	outline: 2px solid #a9832f;
	outline-offset: 2px;
}

@media (max-width: 639px) {
	.cnw-loop-purchase {
		grid-template-columns: minmax(0, 1fr);
		gap: 7px;
	}

	.cnw-loop-quantity {
		grid-template-columns: 44px minmax(30px, 1fr) 44px;
	}

	.cnw-loop-quantity__button {
		min-width: 44px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cnw-loop-purchase *,
	.cnw-loop-purchase *::before,
	.cnw-loop-purchase *::after {
		transition-duration: 0.01ms !important;
	}
}
