/* ==========================================================================
   MerrySpruce — cart.css
   Slide-in cart drawer.
   ========================================================================== */

.cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	height: 100%;
	width: 420px;
	max-width: 90vw;
	background: var(--color-white);
	z-index: 500;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	box-shadow: -10px 0 40px rgba(26, 34, 56, 0.18);
}
.cart-drawer.is-open { transform: translateX(0); }

.cart-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-md);
	border-bottom: 1px solid var(--color-light-gray);
}
.cart-drawer__title { margin: 0; font-size: 1.5rem; }
.cart-drawer__close {
	background: none;
	border: none;
	font-size: 2rem;
	line-height: 1;
	color: var(--color-slate);
	transition: color var(--transition);
}
.cart-drawer__close:hover { color: var(--color-deep-navy); }

.cart-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-sm) var(--space-md);
}

.cart-item {
	display: flex;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
	border-bottom: 1px solid var(--color-light-gray);
}
.cart-item__img {
	width: 72px;
	height: 72px;
	object-fit: contain;
	background: var(--color-off-white);
	border-radius: var(--radius-sm);
	flex-shrink: 0;
}
.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name {
	font-weight: 600;
	color: var(--color-deep-navy);
	font-size: 0.92rem;
	margin: 0 0 0.25rem;
	line-height: 1.3;
}
.cart-item__price { font-family: var(--font-mono); font-weight: 600; color: var(--color-deep-navy); font-size: 0.95rem; }
.cart-item__original {
	font-family: var(--font-mono);
	text-decoration: line-through;
	color: var(--color-slate);
	font-size: 0.8rem;
	margin-left: 0.4rem;
}
.cart-item__controls {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin-top: 0.4rem;
}
.cart-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--color-light-gray);
	border-radius: var(--radius-sm);
	overflow: hidden;
}
.cart-qty__btn {
	background: var(--color-off-white);
	border: none;
	width: 28px;
	height: 28px;
	font-size: 1rem;
	color: var(--color-deep-navy);
	transition: background var(--transition);
}
.cart-qty__btn:hover { background: var(--color-light-gray); }
.cart-qty__value {
	min-width: 30px;
	text-align: center;
	font-family: var(--font-mono);
	font-size: 0.9rem;
	color: var(--color-deep-navy);
}
.cart-item__remove {
	background: none;
	border: none;
	color: var(--color-slate);
	font-size: 0.8rem;
	text-decoration: underline;
	padding: 0;
	transition: color var(--transition);
}
.cart-item__remove:hover { color: #c0392b; }

.cart-drawer__empty {
	flex: 1;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-sm);
	text-align: center;
	padding: var(--space-md);
	color: var(--color-slate);
}
.cart-drawer.is-empty .cart-drawer__empty { display: flex; }
.cart-drawer.is-empty .cart-drawer__body,
.cart-drawer.is-empty .cart-drawer__foot { display: none; }

.cart-drawer__foot {
	padding: var(--space-md);
	border-top: 1px solid var(--color-light-gray);
	background: var(--color-off-white);
}
.cart-drawer__subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 700;
	color: var(--color-deep-navy);
	margin-bottom: var(--space-xs);
}
.cart-drawer__subtotal .js-cart-subtotal { font-family: var(--font-mono); font-size: 1.25rem; }
.cart-drawer__note {
	font-size: 0.78rem;
	color: var(--color-slate);
	margin-bottom: var(--space-sm);
}

.cart-overlay {
	position: fixed;
	inset: 0;
	background: rgba(26, 34, 56, 0.5);
	z-index: 450;
	opacity: 0;
	transition: opacity var(--transition);
}
.cart-overlay.is-visible { opacity: 1; }

/* Add-to-cart flash feedback on the button */
.js-add-to-cart.is-added {
	background: var(--color-steel-teal) !important;
	border-color: var(--color-steel-teal) !important;
}

@media (max-width: 480px) {
	.cart-drawer { width: 100%; max-width: 100vw; }
}
