/*
 * PPA Mini Cart — right-rail persistent slide-out (desktop) / bottom sheet
 * (mobile). Inherits E "Onyx Accent" tokens from ppa-base.css
 * (--ppa-teal, --ppa-parchment, --font-*, --nav-height).
 *
 * KEY CONTRACT: on desktop the panel does NOT overlay content. Body gets
 * margin-right equal to the panel width when .ppa-mini-cart-open is set.
 * Nav + footer are inside body so they shift with it.
 */

/* ── Local fallbacks (in case theme tokens aren't loaded on some page) ── */
.ppa-mini-cart {
	--mc-teal: var(--ppa-teal, #4EA8A0);
	--mc-teal-bright: #6BC4BC;
	--mc-parchment: var(--ppa-parchment, #EDE4D0);
	--mc-ink: #0C0E10;
	--mc-bg: #000;
	--mc-line: rgba(78, 168, 160, 0.18);
	--mc-line-strong: rgba(78, 168, 160, 0.35);
	--mc-nav-height: var(--nav-height, 64px);
	--mc-width: 400px;
}

/* ── Panel container ── */
.ppa-mini-cart {
	position: fixed;
	top: var(--mc-nav-height);
	right: 0 !important;       /* defensive: theme padding-right shouldn't push the panel inward */
	bottom: 0;
	width: var(--mc-width);
	max-width: 100vw;
	background: var(--mc-bg);
	color: var(--mc-parchment);
	border-left: 1px solid var(--mc-line-strong);
	border-right: 0 !important; /* defensive: kill any right-edge stripe */
	box-shadow: -16px 0 40px rgba(0, 0, 0, 0.55), inset 1px 0 0 rgba(78, 168, 160, 0.12);
	box-sizing: border-box;
	margin: 0 !important;       /* defensive: theme margin shouldn't reserve a strip */
	padding: 0;
	display: flex;
	flex-direction: column;
	z-index: 9998; /* below nav mega panels but above page */
	transform: translateX(100%);
	transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
	pointer-events: none;
	visibility: hidden;
}

/* ── Left-edge close handle (William 2026-04-21) ──
   A vertical tab overhanging the panel's LEFT edge so the user can push the
   rail back in to keep shopping without hunting for the small × in the head.
   Visible only when the cart is open. The button uses [data-ppa-mc-close]
   so the existing JS close-handler picks it up. */
.ppa-mc-handle {
	position: absolute;
	top: 88px;
	left: -36px;
	width: 36px;
	height: 110px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--mc-bg);
	color: var(--mc-parchment);
	border: 1px solid var(--mc-line-strong);
	border-right: none;
	border-radius: 4px 0 0 4px;
	cursor: pointer;
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	box-shadow: -8px 0 16px rgba(0, 0, 0, 0.45);
	pointer-events: auto;
	transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
	z-index: 1;
}
.ppa-mc-handle:hover,
.ppa-mc-handle:focus-visible {
	background: rgba(78, 168, 160, 0.1);
	color: var(--mc-teal-bright);
	box-shadow: -10px 0 22px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(78, 168, 160, 0.3);
	outline: none;
}
.ppa-mc-handle-arrow {
	font-size: 22px;
	line-height: 1;
	font-weight: 700;
	color: var(--mc-teal);
	transition: color 180ms ease, transform 180ms ease;
}
.ppa-mc-handle:hover .ppa-mc-handle-arrow,
.ppa-mc-handle:focus-visible .ppa-mc-handle-arrow {
	color: var(--mc-teal-bright);
	transform: translateX(2px);
}
.ppa-mc-handle-label {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: rgba(237, 228, 208, 0.7);
	white-space: nowrap;
}
.ppa-mc-handle:hover .ppa-mc-handle-label,
.ppa-mc-handle:focus-visible .ppa-mc-handle-label {
	color: var(--mc-parchment);
}

/* Mobile: handle hidden — bottom-sheet pattern doesn't need a side tab */
@media (max-width: 767px) {
	.ppa-mc-handle { display: none; }
}

.ppa-mini-cart.is-open,
.ppa-mini-cart.open {
	transform: translateX(0);
	pointer-events: auto;
	visibility: visible;
}

/* ── Body shift on desktop (THE spec) ── */
body.ppa-mini-cart-open {
	transition: margin-right 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (min-width: 1200px) {
	body.ppa-mini-cart-open {
		margin-right: 400px;
	}
}

@media (min-width: 768px) and (max-width: 1199px) {
	.ppa-mini-cart {
		--mc-width: 360px;
	}
	body.ppa-mini-cart-open {
		margin-right: 360px;
	}
}

/* ── Mobile: bottom sheet, overlays content (OK on small screens) ── */
@media (max-width: 767px) {
	.ppa-mini-cart {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		height: 70vh;
		border-left: none;
		border-top: 1px solid var(--mc-line-strong);
		box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.55);
		transform: translateY(100%);
		z-index: 10001; /* above nav on mobile */
	}

	.ppa-mini-cart.is-open,
	.ppa-mini-cart.open {
		transform: translateY(0);
	}

	/* No body shift on mobile */
	body.ppa-mini-cart-open {
		margin-right: 0;
	}
}

/* ── Header ── */
.ppa-mc-head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 20px;
	background: var(--mc-bg);
	border-bottom: 1px solid var(--mc-line-strong);
}

.ppa-mc-title {
	margin: 0;
	font-family: var(--font-display, 'Cormorant Garamond', serif);
	font-size: 22px;
	font-weight: 500;
	line-height: 1;
	color: var(--mc-parchment);
	letter-spacing: 0.02em;
}

.ppa-mc-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 7px;
	border-radius: 11px;
	background: var(--mc-teal);
	color: #0C0E10;
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1;
}

.ppa-mc-close {
	margin-left: auto;
	background: transparent;
	border: 1px solid transparent;
	color: rgba(237, 228, 208, 0.7);
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 16px;
	line-height: 1;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border-radius: 2px;
	transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ppa-mc-close:hover,
.ppa-mc-close:focus-visible {
	color: var(--mc-teal-bright);
	border-color: var(--mc-line-strong);
	background: rgba(78, 168, 160, 0.06);
	outline: none;
}

/* ── Scrollable body ── */
.ppa-mc-body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* Slim scrollbar */
.ppa-mc-body::-webkit-scrollbar {
	width: 6px;
}

.ppa-mc-body::-webkit-scrollbar-thumb {
	background: rgba(78, 168, 160, 0.2);
	border-radius: 3px;
}

.ppa-mc-body::-webkit-scrollbar-thumb:hover {
	background: rgba(78, 168, 160, 0.4);
}

/* ── Items list ── */
.ppa-mc-items {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1 1 auto;
}

.ppa-mc-item {
	display: grid;
	grid-template-columns: 56px 1fr auto;
	gap: 12px;
	align-items: flex-start;
	padding: 16px 20px;
	border-bottom: 1px solid var(--mc-line);
	position: relative;
}

.ppa-mc-item:last-child {
	border-bottom: 1px solid var(--mc-line-strong);
}

.ppa-mc-item-thumb {
	width: 56px;
	height: 56px;
	background: #0C0E10;
	border: 1px solid var(--mc-line);
	border-radius: 2px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ppa-mc-item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ppa-mc-item-thumb a {
	display: block;
	width: 100%;
	height: 100%;
}

.ppa-mc-item-main {
	min-width: 0;
}

.ppa-mc-item-name {
	font-family: var(--font-body, 'Barlow', sans-serif);
	font-size: 15px;
	line-height: 1.35;
	color: var(--mc-parchment);
	margin-bottom: 8px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ppa-mc-item-name a {
	color: inherit;
	text-decoration: none;
	transition: color 160ms ease;
}

.ppa-mc-item-name a:hover {
	color: var(--mc-teal-bright);
}

.ppa-mc-item-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

/* Qty stepper */
.ppa-mc-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--mc-line-strong);
	border-radius: 2px;
	overflow: hidden;
	background: rgba(78, 168, 160, 0.04);
}

.ppa-mc-qty-btn {
	background: transparent;
	border: none;
	color: rgba(237, 228, 208, 0.75);
	width: 28px;
	height: 28px;
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color 160ms ease, background 160ms ease;
}

.ppa-mc-qty-btn:hover,
.ppa-mc-qty-btn:focus-visible {
	color: var(--mc-teal-bright);
	background: rgba(78, 168, 160, 0.1);
	outline: none;
}

.ppa-mc-qty-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.ppa-mc-qty-num {
	min-width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 13px;
	font-weight: 500;
	color: var(--mc-parchment);
	border-left: 1px solid var(--mc-line);
	border-right: 1px solid var(--mc-line);
	padding: 0 6px;
}

.ppa-mc-item-total {
	font-family: var(--font-body, 'Barlow', sans-serif);
	font-size: 14px;
	font-weight: 600;
	color: var(--mc-teal-bright);
	white-space: nowrap;
}

.ppa-mc-item-total .amount {
	color: inherit;
}

.ppa-mc-item-remove {
	background: transparent;
	border: none;
	color: rgba(237, 228, 208, 0.35);
	cursor: pointer;
	padding: 4px 6px;
	font-size: 12px;
	line-height: 1;
	align-self: flex-start;
	transition: color 160ms ease;
}

.ppa-mc-item-remove:hover,
.ppa-mc-item-remove:focus-visible {
	color: #C0392B;
	outline: none;
}

/* Updating state: subtle fade while AJAX is in-flight */
.ppa-mc-item[data-updating="true"] {
	opacity: 0.5;
	pointer-events: none;
}

/* ── Footer (parchment surface) ── */
.ppa-mc-foot {
	position: sticky;
	bottom: 0;
	z-index: 2;
	padding: 18px 20px 20px;
	background: var(--mc-parchment);
	color: var(--mc-ink);
	border-top: 1px solid var(--mc-line-strong);
}

.ppa-mc-subtotal-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 14px;
	padding-bottom: 12px;
	border-bottom: 1px solid rgba(12, 14, 16, 0.12);
}

/* v1.1 — subtotal / view-full cart visibility boost.
   Prior: 12px 500 weight rgba(26,29,34,0.7). Lower-contrast labels
   against parchment felt secondary; William wanted them brighter.
   New: 13px 600, opacity 0.92. */
.ppa-mc-subtotal-label {
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: rgba(12, 14, 16, 0.92);
}

.ppa-mc-subtotal-value {
	font-family: var(--font-body, 'Barlow', sans-serif);
	font-size: 22px;
	font-weight: 700;
	color: var(--mc-ink);
}

.ppa-mc-subtotal-value .amount {
	color: inherit;
}

/* v1.3.1 — Go to Checkout CTA. Revert shutter (per William: shutter
   belongs on hero-level conversion catches, not inside an already-open
   cart UI). Back to SOLID-teal filled button — maximum contrast on
   parchment cart panel, unmistakable next-step affordance. */
.ppa-mc-cta {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 46px;
	background: var(--mc-teal);
	color: #0C0E10;
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	text-decoration: none;
	border: 1px solid var(--mc-teal);
	border-radius: 2px;
	overflow: hidden;
	transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
	cursor: pointer;
}

.ppa-mc-cta-label,
.ppa-mc-cta > * { position: relative; z-index: 1; }

.ppa-mc-cta:hover,
.ppa-mc-cta:focus-visible {
	background: #5BBFB6;
	box-shadow: 0 4px 18px rgba(78, 168, 160, 0.35);
	outline: none;
}

.ppa-mc-cta-label {
	position: relative;
	z-index: 1;
}

/* v1.3.1 — view-full-cart as a quiet gold ghost button (no shutter).
   Shutter was dropped per William — too much motion inside an already-open
   cart UI. Keep gold outline + readable text; it's clearly a second action
   under the solid-teal Checkout CTA. */
.ppa-mc-view-cart {
	display: block;
	margin-top: 12px;
	padding: 9px 14px;
	text-align: center;
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #8E6B29;
	background: transparent;
	border: 1px solid rgba(142, 107, 41, 0.7);
	border-radius: 2px;
	text-decoration: none;
	transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ppa-mc-view-cart:hover,
.ppa-mc-view-cart:focus-visible {
	color: #5A3F12;
	background: rgba(196, 148, 58, 0.08);
	border-color: #C4943A;
	outline: none;
}

/* ── Empty state ── */
.ppa-mc-empty {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 24px;
	text-align: center;
}

.ppa-mc-empty-lead {
	font-family: var(--font-display, 'Cormorant Garamond', serif);
	font-size: 20px;
	color: rgba(237, 228, 208, 0.7);
	margin: 0 0 16px;
}

.ppa-mc-empty-link {
	font-family: var(--font-ui, 'Barlow Condensed', sans-serif);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--mc-teal-bright);
	text-decoration: none;
	border-bottom: 1px solid var(--mc-line-strong);
	padding-bottom: 2px;
	transition: color 160ms ease, border-color 160ms ease;
}

.ppa-mc-empty-link:hover,
.ppa-mc-empty-link:focus-visible {
	color: var(--mc-parchment);
	border-bottom-color: var(--mc-teal);
	outline: none;
}

/* ── Hide the native header cart count when zero (via fragment) ── */
.ppa-nav-cart-count[style*="display:none"] {
	display: none !important;
}
