/**
 * Lean Cart — Skeleton CSS
 *
 * All rules scoped under .lean-cart.
 * Maps to theme tokens via CSS custom properties with standalone fallbacks.
 * Provides functional layout — themes override for visual polish.
 *
 * Dequeue entirely: add_filter('lean_cart_disable_styles', '__return_true');
 */

/* ── Token mapping ─────────────────────────────────────────────── */

.lean-cart {
	--lc-text:       var(--text-color, hsl(26, 50%, 24%));
	--lc-text-dark:  var(--text-color-dark, hsl(22, 56%, 13%));
	--lc-text-muted: var(--text-color-muted, hsl(30, 30%, 32%));
	--lc-bg:         var(--bg-color, #fff);
	--lc-bg-light:   var(--bg-color-light, hsl(40, 70%, 94%));
	--lc-border:     var(--border-color-light, hsl(38, 38%, 82%));
	--lc-accent:     var(--accent-color, hsl(24, 60%, 23%));
	--lc-radius:     var(--border-radius, 3px);
	--lc-success:    hsl(145, 30%, 38%);

	color: var(--lc-text);
	font-size: 14px;
	line-height: 1.4;
}

/* ── Item list ─────────────────────────────────────────────────── */

.lean-cart [data-lean-cart="items"] {
	display: flex;
	flex-direction: column;
}

.lean-cart .cart-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--lc-border);
}

.lean-cart .cart-item:last-child {
	border-bottom: none;
}

/* ── Item image ────────────────────────────────────────────────── */

.lean-cart .cart-item-image {
	flex-shrink: 0;
	display: block;
}

.lean-cart .cart-item-image img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: var(--lc-radius);
	border: 1px solid var(--lc-border);
}

/* ── Item details ──────────────────────────────────────────────── */

.lean-cart .cart-item-details {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.lean-cart .cart-item-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--lc-text-dark);
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.lean-cart .cart-item-title:hover {
	text-decoration: underline;
}

.lean-cart .cart-item-meta {
	font-size: 11px;
	color: var(--lc-text-muted);
	margin: 0;
	padding: 0;
}

.lean-cart .cart-item-meta-row {
	display: flex;
	gap: 0;
	line-height: 1.5;
}

.lean-cart .cart-item-meta dt {
	margin: 0;
	font-weight: 400;
}

.lean-cart .cart-item-meta dt:not(.screen-reader-text)::after {
	content: ':\00a0';
}

.lean-cart .cart-item-meta dd {
	margin: 0;
	font-weight: 500;
	color: var(--lc-text);
}

.lean-cart .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.lean-cart .cart-item-subscription {
	font-size: 11px;
	color: var(--lc-text-muted);
	font-style: italic;
}

/* ── Badges ────────────────────────────────────────────────────── */

.lean-cart .cart-item-badges {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

.lean-cart .cart-badge {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 1px 6px;
	border-radius: var(--lc-radius);
	background: var(--lc-bg-light);
	color: var(--lc-text-muted);
	border: 1px solid var(--lc-border);
}

/* ── Item actions (quantity + price + remove) ──────────────────── */

.lean-cart .cart-item-actions {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	flex-shrink: 0;
}

.lean-cart .cart-item-price {
	font-size: 13px;
	font-weight: 600;
	color: var(--lc-text-dark);
}

.lean-cart .cart-item-remove {
	background: none;
	border: none;
	padding: 2px;
	cursor: pointer;
	color: var(--lc-text-muted);
	opacity: 0.6;
	transition: opacity 0.15s;
}

.lean-cart .cart-item-remove:hover {
	opacity: 1;
}

/* ── Quantity control ──────────────────────────────────────────── */

.lean-cart .quantity-control {
	display: inline-flex;
	align-items: center;
}

.lean-cart .quantity-control button {
	width: 28px;
	height: 28px;
	border: 1.5px solid var(--lc-border);
	background: var(--lc-bg);
	color: var(--lc-text);
	font-size: 16px;
	font-weight: 300;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	user-select: none;
	transition: background 0.12s;
}

.lean-cart .quantity-control button:first-child {
	border-radius: var(--lc-radius) 0 0 var(--lc-radius);
	border-right: none;
}

.lean-cart .quantity-control button:last-child {
	border-radius: 0 var(--lc-radius) var(--lc-radius) 0;
	border-left: none;
}

.lean-cart .quantity-control button:hover:not(:disabled) {
	background: var(--lc-bg-light);
}

.lean-cart .quantity-control button:disabled {
	opacity: 0.35;
	cursor: default;
}

.lean-cart .quantity-control [data-cart-quantity] {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--lc-text-dark);
	border-top: 1.5px solid var(--lc-border);
	border-bottom: 1.5px solid var(--lc-border);
	background: var(--lc-bg-light);
	user-select: none;
}

/* ── MnM children ──────────────────────────────────────────────── */

.lean-cart .cart-children {
	width: 100%;
	padding-left: 20px;
	margin-top: 4px;
	border-left: 2px solid var(--lc-border);
}

.lean-cart .cart-item--child {
	padding: 4px 0;
	gap: 8px;
	font-size: 12px;
	border-bottom: none;
}

.lean-cart .cart-item--child img {
	width: 32px;
	height: 32px;
}

.lean-cart .cart-item--child .cart-item-title {
	font-size: 12px;
	font-weight: 500;
}

.lean-cart .cart-item-qty {
	font-size: 11px;
	color: var(--lc-text-muted);
	flex-shrink: 0;
}

/* ── Totals ────────────────────────────────────────────────────── */

.lean-cart [data-lean-cart="totals"] {
	border-top: 1px solid var(--lc-border);
	padding-top: 12px;
	margin-top: 8px;
}

.lean-cart .totals-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 3px 0;
}

.lean-cart .totals-label {
	font-size: 12px;
	color: var(--lc-text-muted);
}

.lean-cart .totals-value {
	font-size: 12px;
	color: var(--lc-text);
	font-weight: 500;
}

.lean-cart .totals-value--free {
	color: var(--lc-success);
	font-weight: 700;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.lean-cart .totals-divider {
	height: 1px;
	background: var(--lc-border);
	margin: 8px 0;
}

.lean-cart .totals-row--total .totals-label {
	font-size: 14px;
	font-weight: 700;
	color: var(--lc-text-dark);
}

.lean-cart .totals-row--total .totals-value {
	font-size: 16px;
	font-weight: 700;
	color: var(--lc-text-dark);
}

/* ── Empty state ───────────────────────────────────────────────── */

.lean-cart [data-lean-cart="empty"] {
	text-align: center;
	padding: 32px 16px;
	color: var(--lc-text-muted);
	font-size: 14px;
}

/* ── Error state ───────────────────────────────────────────────── */

.lean-cart [data-lean-cart="error"] {
	padding: 10px 14px;
	margin-top: 8px;
	font-size: 13px;
	color: hsl(0, 50%, 40%);
	background: hsl(0, 60%, 96%);
	border: 1px solid hsl(0, 40%, 85%);
	border-radius: var(--lc-radius);
}

/* ── Loading state ─────────────────────────────────────────────── */

.lean-cart [data-lean-cart="loading"] {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 12px 0;
}

/* ── Reduced motion ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.lean-cart,
	.lean-cart * {
		transition: none !important;
		animation: none !important;
	}
}
