/* =====================================================================
   VM Sport — Cart Drawer (offcanvas, full)
   ---------------------------------------------------------------------
   Lähde: vm-sport-design-system/project/ui_kits/web/styles.css
   (rivit 470–820) + Cart.jsx (componenttilogiikan inspiraatio).
   Tokenit --vm-* tulevat assets/css/vm-header.css :root-lohkosta.
   Missä raw-arvo on käytetty, on fallback inline.
   ===================================================================== */

/* ---------- Backdrop ---------- */
.vm-cart-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(13, 43, 60, 0.5);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	opacity: 0;
	pointer-events: none;
	z-index: 100;
	transition: opacity 320ms var(--vm-ease-out, cubic-bezier(0.22, 0.61, 0.36, 1));
}
.vm-cart-backdrop.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* ---------- Drawer ---------- */
.vm-cart-drawer {
	position: fixed;
	top: 0; right: 0; bottom: 0;
	width: min(460px, 100vw);
	background: var(--vm-bg, #fff);
	z-index: 101;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 360ms var(--vm-ease-out, cubic-bezier(0.22, 0.61, 0.36, 1));
	box-shadow: -20px 0 60px rgba(13, 43, 60, 0.18);
	will-change: transform;
	visibility: hidden;
}
.vm-cart-drawer.is-open {
	transform: translateX(0);
	visibility: visible;
}

/* ---------- Header ---------- */
.vm-cart-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 20px 24px 16px;
	border-bottom: 1px solid var(--vm-border-subtle, #dedede);
	flex-shrink: 0;
}
.vm-cart-header h2 {
	font-family: "parabolica", "Big Shoulders Display", "Saira Condensed", Impact, sans-serif;
	font-weight: 900;
	font-style: italic;
	font-size: 1.875rem;
	line-height: 1;
	letter-spacing: var(--vm-tracking-tight, -0.01em);
	text-transform: uppercase;
	color: var(--vm-brand-deep, #0d2b3c);
	margin: 0;
}
.vm-cart-count {
	font-size: var(--vm-fs-12, 0.75rem);
	color: var(--vm-fg-muted, #5a5a5a);
	letter-spacing: 0.02em;
	display: block;
	margin-top: 2px;
}
.vm-cart-close {
	background: var(--vm-bg-card, #f0f0f0);
	border: 0;
	width: 40px; height: 40px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: var(--vm-brand-deep, #0d2b3c);
	cursor: pointer;
	transition: background var(--vm-dur-fast, 120ms) var(--vm-ease-out, cubic-bezier(0.22, 0.61, 0.36, 1));
}
.vm-cart-close:hover { background: var(--vm-border, #d1d1d1); }

/* ---------- Body (fragment-target, flex-container) ----------
   Pakollinen wrapper jotta WC fragments osuu yhteen selektoriin
   (data-vm-cart-fragment). Korvaa drawerin flex-column-roolin niin
   että ship/scroll/footer säilyttävät rakenteen.                  */
.vm-cart-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0; /* sallii inner-scrollin overflow-y:lla */
	overflow: hidden;
}

/* ---------- Free shipping bar ---------- */
.vm-cart-ship {
	padding: 14px 24px 16px;
	background: var(--vm-bg-subtle, #f5f6f4);
	border-bottom: 1px solid var(--vm-border-subtle, #dedede);
	flex-shrink: 0;
	transition: background var(--vm-dur-base, 200ms) var(--vm-ease-out, cubic-bezier(0.22, 0.61, 0.36, 1));
}
.vm-cart-ship.is-free {
	background: color-mix(in srgb, #4FBA00 12%, var(--vm-bg, #fff));
}
.vm-cart-ship-text {
	display: flex; align-items: center; gap: 10px;
	font-size: var(--vm-fs-13, 0.8125rem);
	color: var(--vm-brand-deep, #0d2b3c);
	margin-bottom: 10px;
}
.vm-cart-ship.is-free .vm-cart-ship-text { color: #1f6b00; }
.vm-cart-ship-text strong { font-weight: 700; }
.vm-cart-progress {
	height: 6px;
	background: var(--vm-border-subtle, #dedede);
	border-radius: 999px;
	overflow: hidden;
	position: relative;
}
.vm-cart-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--vm-brand, #2D5C87) 0%, var(--vm-brand-deep, #0d2b3c) 100%);
	border-radius: 999px;
	transition: width 500ms var(--vm-ease-out, cubic-bezier(0.22, 0.61, 0.36, 1));
}
.vm-cart-ship.is-free .vm-cart-progress-fill {
	background: linear-gradient(90deg, #4FBA00 0%, #2f9000 100%);
}

/* ---------- Scrollable area ---------- */
.vm-cart-scroll {
	flex: 1;
	overflow-y: auto;
	padding: 0 24px 24px;
	scrollbar-width: thin;
	scrollbar-color: var(--vm-border, #d1d1d1) transparent;
}
.vm-cart-scroll::-webkit-scrollbar { width: 6px; }
.vm-cart-scroll::-webkit-scrollbar-thumb { background: var(--vm-border, #d1d1d1); border-radius: 3px; }

/* ---------- Cart line ---------- */
.vm-cart-lines { padding: 18px 0; display: flex; flex-direction: column; gap: 18px; list-style: none; margin: 0; }
.vm-cart-line {
	display: flex; gap: 14px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--vm-border-subtle, #dedede);
}
.vm-cart-lines .vm-cart-line:last-child { border-bottom: 0; padding-bottom: 0; }
.vm-cart-line.is-just-added { animation: vm-cart-flash 800ms var(--vm-ease-out, cubic-bezier(0.22, 0.61, 0.36, 1)); }
@keyframes vm-cart-flash {
	0%   { background: color-mix(in srgb, var(--vm-brand, #2D5C87) 12%, transparent); }
	100% { background: transparent; }
}

.vm-cart-line-img {
	flex-shrink: 0;
	width: 96px; height: 96px;
	background: var(--vm-bg-card, #f0f0f0);
	display: flex; align-items: center; justify-content: center;
	padding: 6px;
}
.vm-cart-line-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

.vm-cart-line-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.vm-cart-line-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }

.vm-cart-line-brand {
	font-family: var(--vm-font-body);
	font-size: var(--vm-fs-12, 0.75rem);
	letter-spacing: var(--vm-tracking-eyebrow, 0.12em);
	text-transform: uppercase;
	color: var(--vm-fg-muted, #5a5a5a);
	font-weight: 600;
}
.vm-cart-line-name {
	font-family: var(--vm-font-body);
	font-weight: 600;
	font-size: var(--vm-fs-14, 0.875rem);
	line-height: 1.3;
	color: var(--vm-fg, #000);
	margin: 2px 0 4px;
	text-decoration: none;
	display: block;
}
.vm-cart-line-name:hover { color: var(--vm-brand, #2D5C87); text-decoration: underline; }
.vm-cart-line-meta { font-size: var(--vm-fs-12, 0.75rem); color: var(--vm-fg-muted, #5a5a5a); }
.vm-cart-line-remove {
	background: transparent; border: 0;
	width: 28px; height: 28px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: var(--vm-fg-muted, #5a5a5a);
	cursor: pointer;
	flex-shrink: 0;
	transition: color var(--vm-dur-fast, 120ms) var(--vm-ease-out), background var(--vm-dur-fast, 120ms) var(--vm-ease-out);
	text-decoration: none;
	font-size: 0; /* WC default "×" tekstinä — piilotetaan, SVG päälle */
}
.vm-cart-line-remove::before {
	content: "";
	width: 16px; height: 16px;
	display: block;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 6 6 18M6 6l12 12'/></svg>");
	background-repeat: no-repeat;
	background-position: center;
}
.vm-cart-line-remove:hover {
	color: var(--vm-sale, #b72a00);
	background: color-mix(in srgb, var(--vm-sale, #b72a00) 8%, transparent);
}
.vm-cart-line-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.vm-cart-line-price { white-space: nowrap; text-align: right; }
.vm-cart-line-price .now { font-weight: 700; font-size: var(--vm-fs-16, 1rem); color: var(--vm-fg, #000); white-space: nowrap; }
.vm-cart-line-price.is-sale .now { color: var(--vm-sale, #b72a00); }
.vm-cart-line-price .was { font-size: var(--vm-fs-12, 0.75rem); color: var(--vm-fg-muted, #5a5a5a); text-decoration: line-through; margin-left: 6px; }

/* ---------- Qty stepper ---------- */
.vm-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--vm-border, #d1d1d1);
	border-radius: var(--vm-radius-2, 4px);
	background: var(--vm-bg, #fff);
	overflow: hidden;
	height: 32px;
}
.vm-qty button {
	width: 32px; height: 32px;
	background: transparent; border: 0;
	display: flex; align-items: center; justify-content: center;
	color: var(--vm-brand-deep, #0d2b3c);
	cursor: pointer;
	padding: 0;
	transition: background var(--vm-dur-fast, 120ms) var(--vm-ease-out), color var(--vm-dur-fast, 120ms) var(--vm-ease-out);
}
.vm-qty button:hover:not(:disabled) { background: var(--vm-bg-card, #f0f0f0); color: var(--vm-brand, #2D5C87); }
.vm-qty button:active:not(:disabled) { transform: scale(0.92); }
.vm-qty button:disabled { opacity: 0.4; cursor: not-allowed; }
.vm-qty-val {
	min-width: 32px;
	text-align: center;
	font-family: var(--vm-font-body);
	font-weight: 600;
	font-size: var(--vm-fs-14, 0.875rem);
	color: var(--vm-fg, #000);
	user-select: none;
}

/* ---------- Upsells ---------- */
.vm-cart-upsells { padding: 8px 0 24px; }
.vm-cart-section-title {
	display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
	margin-bottom: 12px;
	padding-top: 18px;
	border-top: 1px solid var(--vm-border-subtle, #dedede);
}
.vm-cart-section-title > span:first-child {
	font-family: var(--vm-font-body);
	font-weight: 700;
	font-size: var(--vm-fs-12, 0.75rem);
	letter-spacing: var(--vm-tracking-eyebrow, 0.12em);
	text-transform: uppercase;
	color: var(--vm-brand-deep, #0d2b3c);
	white-space: nowrap;
}
.vm-cart-section-hint { font-size: var(--vm-fs-12, 0.75rem); color: var(--vm-fg-muted, #5a5a5a); }
.vm-cart-upsells-row { display: flex; flex-direction: column; gap: 10px; }
.vm-cart-upsell {
	display: flex; gap: 12px; align-items: center;
	background: var(--vm-bg-subtle, #f5f6f4);
	padding: 10px;
	transition: background var(--vm-dur-fast, 120ms) var(--vm-ease-out);
}
.vm-cart-upsell:hover { background: var(--vm-bg-card, #f0f0f0); }
.vm-cart-upsell-img {
	flex-shrink: 0;
	width: 56px; height: 56px;
	background: var(--vm-bg, #fff);
	display: flex; align-items: center; justify-content: center;
	padding: 4px;
}
.vm-cart-upsell-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vm-cart-upsell-body { flex: 1; min-width: 0; }
.vm-cart-upsell-brand {
	font-size: var(--vm-fs-12, 0.75rem);
	letter-spacing: var(--vm-tracking-eyebrow, 0.12em);
	text-transform: uppercase;
	color: var(--vm-fg-muted, #5a5a5a);
	font-weight: 600;
}
.vm-cart-upsell-name {
	font-family: var(--vm-font-body);
	font-weight: 600;
	font-size: var(--vm-fs-13, 0.8125rem);
	line-height: 1.3;
	margin: 2px 0 4px;
	color: var(--vm-fg, #000);
}
.vm-cart-upsell-foot { display: flex; justify-content: space-between; align-items: center; }
.vm-cart-upsell-price { font-weight: 700; font-size: var(--vm-fs-14, 0.875rem); color: var(--vm-fg, #000); }
.vm-cart-upsell-add {
	background: var(--vm-brand-deep, #0d2b3c);
	color: #fff;
	border: 0;
	width: 32px; height: 32px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	padding: 0;
	transition: background var(--vm-dur-fast, 120ms) var(--vm-ease-out), transform var(--vm-dur-fast, 120ms) var(--vm-ease-out);
}
.vm-cart-upsell-add:hover { background: var(--vm-brand, #2D5C87); transform: scale(1.08); }
.vm-cart-upsell-add:active { transform: scale(0.95); }
.vm-cart-upsell-add[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Empty state ---------- */
.vm-cart-empty {
	display: flex; flex-direction: column; align-items: center; text-align: center;
	padding: 60px 24px;
}
.vm-cart-empty-icon {
	width: 88px; height: 88px;
	border-radius: 50%;
	background: var(--vm-bg-card, #f0f0f0);
	display: flex; align-items: center; justify-content: center;
	color: var(--vm-brand, #2D5C87);
	margin-bottom: 18px;
}
.vm-cart-empty h3 {
	font-family: var(--vm-font-body);
	font-weight: 700;
	font-size: 1.25rem;
	margin: 0 0 8px;
	color: var(--vm-fg, #000);
}
.vm-cart-empty p { color: var(--vm-fg-muted, #5a5a5a); margin: 0 0 24px; max-width: 280px; }
.vm-cart-empty-ctas { display: flex; gap: 8px; flex-direction: column; width: 100%; max-width: 280px; }
.vm-cart-empty-ctas .vm-btn { justify-content: center; }

/* ---------- Footer (sticky) ---------- */
.vm-cart-footer {
	border-top: 1px solid var(--vm-border, #d1d1d1);
	background: var(--vm-bg, #fff);
	padding: 18px 24px 20px;
	flex-shrink: 0;
	display: flex; flex-direction: column; gap: 12px;
}
.vm-cart-totals { display: flex; flex-direction: column; gap: 6px; }
.vm-cart-row {
	display: flex; justify-content: space-between; align-items: baseline;
	font-size: var(--vm-fs-14, 0.875rem);
	color: var(--vm-fg, #000);
}
.vm-cart-row .amt { font-weight: 600; white-space: nowrap; }
.vm-cart-row.is-save { color: var(--vm-sale, #b72a00); }
.vm-cart-row.is-save .amt { color: var(--vm-sale, #b72a00); }
.vm-cart-row.is-total {
	padding-top: 8px;
	margin-top: 4px;
	border-top: 1px solid var(--vm-border-subtle, #dedede);
	font-family: var(--vm-font-body);
	font-weight: 700;
	font-size: 1.125rem;
}
.vm-cart-row.is-total .amt { font-weight: 700; font-size: 1.25rem; }

.vm-cart-eta {
	display: flex; align-items: center; gap: 8px;
	background: var(--vm-bg-subtle, #f5f6f4);
	padding: 8px 10px;
	font-size: var(--vm-fs-12, 0.75rem);
	color: var(--vm-fg, #000);
	margin-top: 6px;
}
.vm-cart-eta strong { font-weight: 700; }
.vm-cart-eta svg { flex-shrink: 0; }

/* Checkout-painike — käyttää vm-btn-namespace + lisäykset */
.vm-cart-checkout {
	width: 100%;
	justify-content: space-between;
	font-size: var(--vm-fs-16, 1rem);
	padding: 16px 24px;
	letter-spacing: 0.02em;
}

.vm-cart-continue {
	background: transparent;
	border: 0;
	font-family: var(--vm-font-body);
	font-size: var(--vm-fs-13, 0.8125rem);
	color: var(--vm-fg-muted, #5a5a5a);
	text-decoration: underline;
	cursor: pointer;
	padding: 4px;
	align-self: center;
}
.vm-cart-continue:hover { color: var(--vm-brand, #2D5C87); }

.vm-cart-trust {
	display: flex; gap: 12px; flex-wrap: wrap;
	padding-top: 10px;
	border-top: 1px solid var(--vm-border-subtle, #dedede);
}
.vm-cart-trust-item {
	display: flex; align-items: center; gap: 6px;
	font-size: var(--vm-fs-12, 0.75rem);
	color: var(--vm-fg-muted, #5a5a5a);
}
.vm-cart-trust-item svg { color: #4FBA00; flex-shrink: 0; }

.vm-cart-pay { display: flex; gap: 6px; flex-wrap: wrap; }
.vm-cart-pay-chip {
	font-family: var(--vm-font-mono, "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	background: var(--vm-bg-card, #f0f0f0);
	color: var(--vm-fg-muted, #5a5a5a);
	padding: 4px 8px;
	border-radius: var(--vm-radius-2, 4px);
}

/* ---------- WC /kori-sivun cross-sells -näkymä ----------
   Drawer-tyyliset upsell-kortit, mutta sivulla isompi grid ja otsikko. */
.vm-cart-page-upsells {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--vm-border-subtle, #dedede);
}
.vm-cart-page-upsells-title {
	font-family: "parabolica", "Big Shoulders Display", "Saira Condensed", Impact, sans-serif;
	font-weight: 700;
	font-style: italic;
	font-size: clamp(1.5rem, 2.5vw, 2.25rem);
	line-height: 1.15;
	letter-spacing: var(--vm-tracking-tight, -0.01em);
	text-transform: uppercase;
	color: var(--vm-fg, #000);
	margin: 0 0 24px;
}
.vm-cart-page-upsells-row {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 12px;
}
.vm-cart-page-upsells .vm-cart-upsell-img {
	width: 72px;
	height: 72px;
}

/* ---------- Body-lock when drawer is open ---------- */
body.vm-cart-open {
	overflow: hidden;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
	.vm-cart-drawer {
		width: 100vw;
	}
	.vm-cart-header { padding: 16px 20px 12px; }
	.vm-cart-ship { padding: 12px 20px 14px; }
	.vm-cart-scroll { padding: 0 20px 20px; }
	.vm-cart-footer { padding: 14px 20px 16px; }
	.vm-cart-line-img { width: 80px; height: 80px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.vm-cart-backdrop,
	.vm-cart-drawer,
	.vm-cart-progress-fill {
		transition: none !important;
	}
	.vm-cart-line.is-just-added { animation: none !important; }
}
