/* Slide-out cart. The panel sits on the inline-end edge (left in RTL)
   and the native dialog supplies the top layer, focus trap, and Escape. */

.gst-cart-drawer {
	--gst-shift: 110%;
	--gst-ink: #17211c;
	--gst-muted: #5e6a64;
	--gst-line: #e4ddd2;
	--gst-paper: #fffdf9;
	--gst-yellow: #ffd814;
	--gst-yellow-edge: #f7ca00;
	--gst-green: #067d62;

	inset-block: 0;
	inset-inline-start: auto;
	inset-inline-end: 0;
	width: min(26rem, calc(100dvw - 2.5rem));
	height: 100dvh;
	max-width: none;
	max-height: 100dvh;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--gst-paper);
	color: var(--gst-ink);
	box-shadow: 0 0 40px rgb(15 23 20 / 18%);
	overflow: hidden;
	translate: var(--gst-shift) 0;
}

html[dir="rtl"] .gst-cart-drawer {
	--gst-shift: -110%;
}

:is(.gst-cart-drawer[open]):where(:not([data-closing])) {
	translate: 0 0;
}

.gst-cart-drawer:modal,
.gst-cart-drawer::backdrop {
	overscroll-behavior: contain;
}

.gst-cart-drawer::backdrop {
	background: rgb(15 23 20 / 0.48);
	overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
	.gst-cart-drawer {
		transition-property: translate, overlay, display;
		transition-duration: 0.32s;
		transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
		transition-behavior: allow-discrete;
	}

	@starting-style {
		:is(.gst-cart-drawer[open]):where(:not([data-closing])) {
			translate: var(--gst-shift) 0;
		}
	}

	.gst-cart-drawer::backdrop {
		opacity: 0;
		transition-property: opacity, overlay, display;
		transition-duration: 0.32s;
		transition-timing-function: ease;
		transition-behavior: allow-discrete;
	}

	:is(.gst-cart-drawer[open]):where(:not([data-closing]))::backdrop {
		opacity: 1;
	}

	@starting-style {
		:is(.gst-cart-drawer[open]):where(:not([data-closing]))::backdrop {
			opacity: 0;
		}
	}

	.btn-add-to-cart.is-added,
	#gst-add-to-cart-btn.is-added,
	#spotlightAdd.is-added {
		animation: gst-add-bounce 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
	}

	.cart-badge-count.gst-badge-pop {
		animation: gst-add-bounce 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
	}
}

@keyframes gst-add-bounce {
	0% { scale: 1; }
	35% { scale: 1.08; }
	58% { scale: 0.96; }
	78% { scale: 1.03; }
	100% { scale: 1; }
}

.btn-add-to-cart.is-added,
#gst-add-to-cart-btn.is-added,
#spotlightAdd.is-added,
.ag .ag-product-card__actions .btn-add-to-cart.is-added,
.product-grid .marketplace-product-card .btn-add-to-cart.is-added,
.ag #spotlightAdd.is-added,
.ag .ag-spotlight-card__btns .btn-add-to-cart.is-added {
	background: #067d62 !important;
	border-color: #067d62 !important;
	color: #fff !important;
}

.gst-cart-drawer__sheet {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

.gst-cart-drawer__head,
.gst-cart-drawer__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	border-block-end: 1px solid var(--gst-line);
}

.gst-cart-drawer__foot {
	flex-direction: column;
	align-items: stretch;
	border-block-end: 0;
	border-block-start: 1px solid var(--gst-line);
	padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.gst-cart-drawer__head h2 {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 800;
}

.gst-cart-drawer__close {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 1px solid var(--gst-line);
	border-radius: 999px;
	background: #fff;
	color: var(--gst-ink);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.gst-cart-drawer__close:focus-visible,
.gst-cart-drawer__checkout:focus-visible,
.gst-cart-drawer__qty button:focus-visible,
.gst-cart-drawer__remove:focus-visible {
	outline: 3px solid #8a4f32;
	outline-offset: 2px;
}

.gst-cart-drawer__body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	padding: 8px 18px 18px;
}

.gst-cart-drawer__empty {
	margin: 28px 0;
	color: var(--gst-muted);
	line-height: 1.7;
}

.gst-cart-drawer__empty a {
	color: #8a4f32;
	font-weight: 700;
}

.gst-cart-drawer__item {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	gap: 12px;
	padding: 14px 0;
	border-block-end: 1px solid var(--gst-line);
}

.gst-cart-drawer__media {
	width: 72px;
	height: 72px;
	border-radius: 10px;
	background: #f3eee6;
	overflow: hidden;
}

.gst-cart-drawer__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.gst-cart-drawer__name {
	margin: 0 0 4px;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.45;
}

.gst-cart-drawer__name a {
	color: inherit;
	text-decoration: none;
}

.gst-cart-drawer__price {
	margin: 0 0 8px;
	color: #b12704;
	font-weight: 800;
}

.gst-cart-drawer__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.gst-cart-drawer__qty {
	display: inline-flex;
	direction: ltr;
	border: 1px solid #d5d9d9;
	border-radius: 8px;
	overflow: hidden;
	background: #f0f2f2;
}

.gst-cart-drawer__qty button,
.gst-cart-drawer__qty input {
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	color: var(--gst-ink);
	font: inherit;
	text-align: center;
}

.gst-cart-drawer__qty button {
	cursor: pointer;
	font-weight: 700;
}

.gst-cart-drawer__qty input {
	width: 42px;
	background: #fff;
}

.gst-cart-drawer__remove {
	border: 0;
	background: transparent;
	color: #8a4f32;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	min-height: 36px;
}

.gst-cart-drawer__total {
	display: flex;
	justify-content: space-between;
	margin: 0;
	font-size: 1.05rem;
	font-weight: 800;
}

.gst-cart-drawer__checkout {
	display: block;
	padding: 14px 16px;
	border-radius: 999px;
	background: var(--gst-yellow);
	border: 1px solid var(--gst-yellow-edge);
	color: #0f1111;
	font-weight: 800;
	text-align: center;
	text-decoration: none;
}

.gst-cart-drawer__checkout:hover {
	background: #f7ca00;
}

.gst-cart-drawer__note {
	margin: 0;
	color: var(--gst-muted);
	font-size: 0.82rem;
	text-align: center;
}
