/* ==========================================================================
   DD — slide-in cart drawer
   Prefix: ddpc-
   ========================================================================== */

html.ddpc-lock { overflow: hidden; }
html.ddpc-lock body { padding-right: var(--ddpc-sbw, 0px); }

.ddpc {
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: none;
	visibility: hidden;
	font-family: var(--dd-font);
	color: #111;
	-webkit-font-smoothing: antialiased;
}

.ddpc *,
.ddpc *::before,
.ddpc *::after { box-sizing: border-box; }

.ddpc-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 17, 17, .5);
	opacity: 0;
	transition: opacity .25s ease;
}

.ddpc-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 92vw);
	display: flex;
	flex-direction: column;
	background: #fff;
	box-shadow: -16px 0 48px rgba(0, 0, 0, .2);
	transform: translateX(100%);
	will-change: transform;
	transition: transform .32s cubic-bezier(.22, .61, .36, 1);
}

.ddpc.is-open {
	visibility: visible;
	pointer-events: auto;
}
.ddpc.is-open .ddpc-backdrop { opacity: 1; }
.ddpc.is-open .ddpc-panel { transform: translateX(0); }

/* ---------- Head ---------- */
.ddpc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: 0 0 auto;
	padding: 16px 18px;
	border-bottom: 1px solid #ececef;
}

.ddpc-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-family: var(--dd-font);
	font-size: 17px;
	line-height: 1.2;
	font-weight: 700;
	color: #111;
}

.ddpc-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: #111;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}
.ddpc.is-empty .ddpc-count { display: none; }

.ddpc-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #f2f2f4;
	color: #111;
	cursor: pointer;
	transition: background .2s;
}
.ddpc-close:hover,
.ddpc-close:focus-visible { background: #e5e5ea; }

/* ---------- Body ---------- */
.ddpc-body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 4px 18px;
}

.ddpc-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	text-align: center;
	font-size: 15px;
	line-height: 1.6;
	color: #6b7280;
}
.ddpc-empty p { margin: 0; }

.ddpc-items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ddpc-item {
	position: relative;
	display: flex;
	gap: 12px;
	padding: 16px 0;
	border-bottom: 1px solid #f0f0f2;
	list-style: none;
}
.ddpc-item:last-child { border-bottom: 0; }

.ddpc-thumb {
	display: block;
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	border-radius: 12px;
	overflow: hidden;
	background: #f4f4f6;
}
.ddpc .ddpc-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ddpc-meta {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	padding-right: 26px;
}

.ddpc-name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: #111 !important;
	text-decoration: none !important;
	overflow-wrap: anywhere;
}
a.ddpc-name:hover { text-decoration: underline !important; }

.ddpc-variant {
	font-size: 12px;
	line-height: 1.4;
	color: #6b7280;
}
.ddpc-variant p { margin: 0; }
.ddpc-variant dl,
.ddpc-variant dd,
.ddpc-variant dt { margin: 0; }

.ddpc-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 6px;
}

.ddpc-qty {
	display: inline-flex;
	align-items: center;
	height: 30px;
	border: 1px solid #e3e3e8;
	border-radius: 999px;
	background: #fff;
}
.ddpc-qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 27px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: none;
	color: #111;
	font: 600 15px/1 var(--dd-font);
	cursor: pointer;
	transition: background .15s;
}
.ddpc-qty-btn:hover { background: #f2f2f4; }
.ddpc-qty-val {
	min-width: 22px;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
}

.ddpc-qty-static { font-size: 12px; color: #6b7280; }

.ddpc-line {
	font-size: 14px;
	font-weight: 700;
	color: #111;
	white-space: nowrap;
}
.ddpc-line .amount { color: inherit; }

.ddpc-remove {
	position: absolute;
	top: 14px;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	color: #9ca3af;
	cursor: pointer;
	transition: color .15s;
}
.ddpc-remove:hover { color: #e53935; }

/* ---------- Foot ---------- */
.ddpc-foot {
	flex: 0 0 auto;
	padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid #ececef;
	background: #fff;
}
.ddpc.is-empty .ddpc-foot { display: none; }

.ddpc-sub {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
	font-size: 14px;
	color: #374151;
}
.ddpc-subtotal {
	font-size: 17px;
	font-weight: 700;
	color: #111;
}
.ddpc-subtotal .amount { color: inherit; }

.ddpc-checkout {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	border-radius: 999px;
	background: #111;
	color: #fff !important;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	transition: background .2s;
}
.ddpc-checkout:hover { background: #262626; color: #fff !important; }

.ddpc-continue {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 10px;
	border: 0;
	background: none;
	color: #374151;
	font: 500 13px var(--dd-font);
	text-decoration: underline;
	cursor: pointer;
}
.ddpc-continue:hover { color: #111; }

/* ---------- Loading state on the clicked button ---------- */
a.is-loading,
button.is-loading {
	opacity: .55;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.ddpc-backdrop,
	.ddpc-panel,
	.ddpc-qty-btn,
	.ddpc-close,
	.ddpc-checkout { transition: none; }
}
