/**
 * Bag components — shared by the bag drawer (every page), the cart page and
 * checkout. Loaded sitewide (inc/cart-drawer.php); css/checkout.css and
 * css/cart.css depend on it, so these rules come first and the page files
 * refine them.
 *
 * Moved here unchanged on 2026-10-10 (Phase 4 of the cart work) from:
 * - css/checkout.css: Figma Form/Button (.vco-btn, Secondary as
 *   .vco-btn.vco-btn--secondary so it still beats Thank You's
 *   .vco-ty-btn:active), 16px icons, the bag list and Cart/Line Item
 *   (.vco-item: image, name, meta, price, "Item unavailable", stepper,
 *   REMOVE, busy, unavailable, ≤991 tap areas).
 * - css/cart.css: Feedback/Notice (.vcart-notice), its UNDO / TRY AGAIN
 *   button, and the Empty State (YOUR BAG IS EMPTY).
 *
 * Rules that needed the checkout `.vco` wrapper now use `.vbag`, which the
 * cart page, the empty cart and the drawer carry. .vco-btn reads
 * --vco-btn-h (set on .vco) with a 55px fallback outside checkout.
 *
 * Tokens: style.css :root (--ink_text, --bg_clr1, --bg_clr2, --b_clr,
 * --h_clr, --rare_clr, --msg_red, --msg_red_tint, --msg_green, --space_*,
 * --font1, --font2).
 */

/* ---------------------------------------------------------------------------
 * Form/Button — Primary (+ Secondary)
 * ------------------------------------------------------------------------ */

.vco-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 348px;
	max-width: 100%;
	height: var(--vco-btn-h, 55px);
	padding: 0 16px;
	border: 1px solid var(--ink_text);
	border-radius: 0;
	background: var(--ink_text);
	color: var(--bg_clr1);
	font-family: var(--font2), sans-serif;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.vco-btn:hover,
.vco-btn:focus-visible {
	background: var(--bg_clr1);
	color: var(--ink_text);
}

.vco-btn:focus-visible {
	outline: 2px solid var(--ink_text);
	outline-offset: 2px;
}

.vco-btn.is-loading {
	opacity: 0.6;
	cursor: wait;
}

/* Figma disabled language: stone fill, sand border, taupe text. Loading
 * buttons are also :disabled but keep the loading look above. */
.vco-btn:disabled:not(.is-loading) {
	border-color: var(--b_clr);
	background: var(--bg_clr2);
	color: var(--h_clr);
	cursor: not-allowed;
}

.vco-btn.vco-btn--secondary {
	background: var(--bg_clr1);
	color: var(--ink_text);
}

.vco-btn.vco-btn--secondary:hover,
.vco-btn.vco-btn--secondary:focus-visible,
.vco-btn.vco-btn--secondary:active {
	background: var(--ink_text);
	color: var(--bg_clr1);
}

/* 16px line icons (vataly_checkout_icon()). */
.vco-icon {
	flex: 0 0 16px;
	display: block;
}

/* ---------------------------------------------------------------------------
 * Bag list + Cart/Line Item (compact: 72×90; the cart page sets 96×120)
 * ------------------------------------------------------------------------ */

.vco-items {
	margin: var(--space_8) 0 0;
	padding: 0;
	list-style: none;
}

.vco-item {
	display: flex;
	align-items: flex-start;
	gap: var(--space_16);
	margin: 0;
	padding: var(--space_16) 0;
	border-bottom: 1px solid var(--b_clr);
}

.vco-item__image {
	flex: 0 0 72px;
	width: 72px;
	height: 90px;
	overflow: hidden;
	background: var(--bg_clr2);
}

.vco-item__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.vco-item__details {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: var(--space_8);
	min-width: 0;
}

.vco-item__details p {
	margin: 0;
}

.vco-item__name,
.vco-item__price {
	color: var(--ink_text);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.36;
}

.vco-item__name {
	overflow-wrap: anywhere;
}

/* Drawer and cart page: image and name link to the product page, with no
 * change to the look (template-parts/cart/line-item.php `link`). */
.vco-item .vco-item__link,
.vco-item .vco-item__link:hover,
.vco-item .vco-item__link:focus {
	color: inherit;
	text-decoration: none;
}

.vco-item__image .vco-item__link {
	display: block;
	height: 100%;
}

.vco-item .vco-item__link:focus-visible {
	outline: 2px solid var(--ink_text);
	outline-offset: 2px;
}

.vco-item__meta {
	color: var(--h_clr);
	font-size: 12px;
	font-weight: 300;
	line-height: 1.36;
}

.vco-item__sep {
	white-space: pre;
}

.vco-item__price {
	flex: none;
	margin: 0;
	text-align: right;
	white-space: nowrap;
}

.vco-item__notice {
	display: flex;
	align-items: center;
	gap: var(--space_4);
	color: var(--msg_red);
	font-size: 12px;
	font-weight: 300;
	line-height: 1.36;
}

.vco-item__notice[hidden] {
	display: none;
}

.vco-item__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space_8) var(--space_16);
}

/* Quantity stepper (Figma Quantity Stepper, 130 × 42: 40 / 48 / 40). */
.vco-qty {
	display: inline-flex;
	align-items: stretch;
	width: 130px;
	height: 42px;
	border: 1px solid var(--h_clr);
}

.vco-qty__btn {
	display: flex;
	flex: 0 0 40px;
	align-items: center;
	justify-content: center;
	width: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--ink_text);
	cursor: pointer;
}

.vco-qty__btn:focus-visible {
	outline: 2px solid var(--ink_text);
	outline-offset: -2px;
}

@media (hover: hover) {
	.vco-qty__btn:not(:disabled):hover {
		background: var(--ink_text);
		color: var(--bg_clr1);
	}
}

.vco-qty__btn:disabled {
	color: var(--b_clr);
	cursor: not-allowed;
}

.vco-qty__value {
	display: flex;
	flex: 1 1 48px;
	align-items: center;
	justify-content: center;
	color: var(--ink_text);
	font-size: 14px;
	font-weight: 300;
}

.vco-item__remove {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--ink_text);
	font-family: var(--font2), sans-serif;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.36;
	letter-spacing: 0;
	text-transform: uppercase;
	cursor: pointer;
}

.vco-item__remove:hover,
.vco-item__remove:focus {
	background: transparent;
	color: var(--ink_text);
}

.vco-item__remove:focus-visible {
	outline: 2px solid var(--ink_text);
	outline-offset: 2px;
}

/* Tap area (P8): ≥ 24px on desktop, ≥ 44px at ≤ 991px (media query). */
.vco-item__remove {
	margin: -4px -8px;
	padding: 4px 8px;
}

/* The focus ring traces the tap area from the inside, so it never runs
 * into the stepper, image or card edge next to it. */
.vco-item .vco-item__remove:focus-visible {
	outline-offset: -2px;
}

.vco-item.is-busy {
	opacity: 0.6;
}

/* Unavailable line: grey text, red notice, stepper off; REMOVE stays usable
 * but greys too, as does the quantity (Figma chk-state-5 §5.1 Compact /
 * Unavailable: text/disabled, 2026-11-20). */
.vco-item.is-unavailable .vco-item__name,
.vco-item.is-unavailable .vco-item__meta,
.vco-item.is-unavailable .vco-item__price,
.vco-item.is-unavailable .vco-qty__value,
.vco-item.is-unavailable .vco-item__remove,
.vco-item.is-unavailable .vco-item__remove:hover,
.vco-item.is-unavailable .vco-item__remove:focus {
	color: var(--h_clr);
}

.vco-item.is-unavailable .vco-qty,
.vco-qty.is-disabled {
	border-color: var(--b_clr);
	background: var(--bg_clr2);
}

/* Figma Quantity Stepper Disabled (4105:465) + REMOVE in text/disabled: the
 * order-pay retry lines (template-parts/checkout/order-items.php `controls`). */
.vco-qty.is-disabled .vco-qty__value,
.vco-item__remove:disabled,
.vco-item__remove:disabled:hover {
	color: var(--h_clr);
}

.vco-item__remove:disabled {
	cursor: not-allowed;
}

/* Tap areas ≥ 44px at ≤ 991px (P8). REMOVE: 12 + 16 + 16 = 44; the row gap
 * under the stepper grows to 12px so the area stops at the stepper's edge
 * (user, 2026-10-09). */
@media (max-width: 991px) {
	.vco-item__controls {
		row-gap: var(--space_12);
	}

	.vco-item__remove {
		margin: -12px -12px -16px;
		padding: 12px 12px 16px;
	}
}

/* ---------------------------------------------------------------------------
 * Feedback/Notice + Empty State
 * ------------------------------------------------------------------------ */

/* Figma Feedback/Notice (template-parts/cart/notice.php). */
.vcart-notice {
	display: flex;
	align-items: flex-start;
	gap: var(--space_8);
	color: var(--ink_text);
	font-family: var(--font2), sans-serif;
}

.vcart-notice--banner {
	gap: var(--space_12);
	padding: var(--space_16);
	border: 1px solid var(--h_clr);
	background: var(--bg_clr1);
}

.vcart-notice--warning.vcart-notice--banner {
	border-color: var(--rare_clr);
	background: var(--bg_clr2);
}

.vcart-notice--error.vcart-notice--banner {
	border-color: var(--msg_red);
	background: var(--msg_red_tint);
}

.vcart-notice__icon {
	flex: none;
	margin-top: 1px;
	color: var(--rare_clr);
}

.vcart-notice--error .vcart-notice__icon {
	color: var(--msg_red);
}

.vcart-notice--success,
.vcart-notice--success .vcart-notice__icon {
	color: var(--msg_green);
}

.vcart-notice__content {
	display: flex;
	flex-direction: column;
	gap: var(--space_4);
	min-width: 0;
}

.vbag .vcart-notice__title,
.vbag .vcart-notice__body {
	margin: 0;
	line-height: 1.36;
}

.vcart-notice__title {
	font-size: 12px;
	font-weight: 700;
}

.vcart-notice__body {
	font-size: 14px;
	font-weight: 300;
}


.vcart-notice__action {
	color: var(--ink_text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.36;
	text-decoration: none;
	text-transform: uppercase;
}

.vcart-notice__action:hover,
.vcart-notice__action:focus-visible {
	color: var(--ink_text);
	text-decoration: underline;
	text-underline-offset: 3px;
}


/* JS-driven notice actions (UNDO, TRY AGAIN) are buttons. */
.vbag button.vcart-notice__action {
	align-self: flex-start;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	font-family: var(--font2), sans-serif;
	letter-spacing: 0;
	cursor: pointer;
}

.vbag button.vcart-notice__action:hover,
.vbag button.vcart-notice__action:focus {
	background: transparent;
	color: var(--ink_text);
}

.vbag button.vcart-notice__action:focus-visible {
	outline: 2px solid var(--ink_text);
	outline-offset: 2px;
}


.vcart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space_16);
	padding: 48px var(--space_20);
	text-align: center;
}

.vbag .vcart-empty__title {
	margin: 0;
	color: var(--ink_text);
	font-family: var(--font1), serif !important;
	font-size: 30px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0;
	text-transform: uppercase;
}

.vbag .vcart-empty__body {
	margin: 0;
	color: var(--h_clr);
	font-size: 14px;
	font-weight: 300;
	line-height: 1.36;
}

.vbag .vcart-empty__cta {
	width: 280px !important; /* checkout.css sets every .vco-btn to 100% !important ≤991px */
	max-width: 100%;
	text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Bag states (js/cart.js) — cart page and drawer (both carry .vbag; checkout
 * does not). Moved from css/cart.css on 2026-10-10 (Phase 5).
 * ------------------------------------------------------------------------ */

/* Stepper states (cart-states.md §8, drawer §2.6): a disabled − / + gets the stone fill
 * (At min / At max); the row saving (P1 / S2, js/cart.js `.is-busy`) shows the
 * Disabled stepper — sand border, both cells stone, taupe value — instead of
 * checkout's 0.6 opacity. Name, meta, price and REMOVE keep their colours. */
.vbag .vco-qty__btn:disabled {
	background: var(--bg_clr2);
}

.vbag .vco-item.is-busy {
	opacity: 1;
}

.vbag .vco-item.is-busy .vco-qty {
	border-color: var(--b_clr);
}

.vbag .vco-item.is-busy .vco-qty__value {
	color: var(--h_clr);
}

.vbag .vco-item.is-busy .vco-item__remove {
	pointer-events: none;
}

/* Any bag update in flight (js/cart.js `.is-updating`, aria-busy): further
 * clicks wait for it, so the controls show a progress cursor. */
.vbag.is-updating .vco-item__controls,
.vbag.is-updating .vcart-notice__action {
	cursor: progress;
}

/* Notices inside a line (drawer S1 / S3, price / stock changes on the drawer
 * and the cart page): the last children of the row, full width under image /
 * details / price, 12px below them and apart. Details' zero basis keeps
 * those three on one line (same widths). */
.vbag .vco-item:has(> .vcart-notice) {
	flex-wrap: wrap;
	row-gap: var(--space_12);
}

.vbag .vco-item:has(> .vcart-notice) .vco-item__details {
	flex-basis: 0;
}

.vbag .vco-item > .vcart-notice {
	flex: 0 0 100%;
}

/* P2 / S3: "Maximum available quantity reached…" under the row at its limit. */
.vbag .vco-items .vcart-items__notice {
	margin: 0;
	padding: var(--space_12) 0 0;
	list-style: none;
}

.vbag .vcart-items__notice .vcart-notice__body {
	font-size: 14px;
}

/* P1 / S2: CHECKOUT held while a row saves (Figma Primary / Disabled). */
.vbag .vco-btn.is-locked {
	border-color: var(--b_clr);
	background: var(--bg_clr2);
	color: var(--h_clr);
	cursor: not-allowed;
	pointer-events: none;
}

/* P9 / S8: Primary / Loading — the 3-dot indicator (4×4 dots, opacity 1 / 0.6 /
 * 0.3, 20×4) before the label, gap 8; colours stay Primary. */
.vbag .vco-btn.is-loading,
.vbag .vco-btn.is-loading:hover {
	gap: var(--space_8);
	background: var(--ink_text);
	color: var(--bg_clr1);
	opacity: 1;
	cursor: wait;
}

.vbag .vco-btn.is-loading::before {
	content: "";
	flex: none;
	width: 20px;
	height: 4px;
	background:
		radial-gradient(circle closest-side, currentColor 96%, transparent) 0 0 / 4px 4px no-repeat,
		radial-gradient(circle closest-side, color-mix(in srgb, currentColor 60%, transparent) 96%, transparent) 8px 0 / 4px 4px no-repeat,
		radial-gradient(circle closest-side, color-mix(in srgb, currentColor 30%, transparent) 96%, transparent) 16px 0 / 4px 4px no-repeat;
}
