/*
 * Slide-out cart drawer. Palette matches the shop.
 */

.gw-cart-drawer {
	--gw-ink: #24302a;
	--gw-ink-soft: #5a6b60;
	--gw-line: #e4e2db;
	--gw-cream: #faf8f4;
	--gw-accent: #b6553a;
	--gw-accent-deep: #8f412c;
	position: fixed;
	inset: 0;
	z-index: 100000;
	font-family: "Karla", "Helvetica Neue", Arial, sans-serif;
}

.gw-cart-drawer[hidden] {
	display: none;
}

.gw-cart-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(36, 48, 42, 0.4);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.gw-cart-drawer.is-open .gw-cart-drawer__backdrop {
	opacity: 1;
}

.gw-cart-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: min(400px, 100vw);
	background: #fff;
	display: flex;
	flex-direction: column;
	box-shadow: -8px 0 30px rgba(36, 48, 42, 0.16);
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.gw-cart-drawer.is-open .gw-cart-drawer__panel {
	transform: none;
}

.gw-cart-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 22px;
	border-bottom: 1px solid var(--gw-line);
}

.gw-cart-drawer__title {
	font-family: "Fraunces", Georgia, serif;
	font-size: 20px;
	font-weight: 500;
	color: var(--gw-ink);
}

.gw-cart-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: -8px -8px -8px 0;
	background: none;
	border: 0;
	border-radius: 50%;
	color: var(--gw-ink-soft);
	cursor: pointer;
}

.gw-cart-drawer__close:hover {
	background: var(--gw-cream);
	color: var(--gw-ink);
}

.gw-cart-drawer__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 8px 22px 22px;
}

/* WooCommerce mini-cart, restyled for the drawer. The product image is nested inside the
   product link and floated by default, so items use an absolute image rather than a grid. */
.gw-cart-drawer__body .woocommerce-mini-cart__empty-message {
	padding: 32px 0;
	text-align: center;
	color: var(--gw-ink-soft);
}

.gw-cart-drawer__body ul.woocommerce-mini-cart,
.gw-cart-drawer__body ul.cart_list,
.gw-cart-drawer__body ul.product_list_widget {
	margin: 0;
	padding: 0;
	list-style: none;
}

.gw-cart-drawer__body li.mini_cart_item,
.gw-cart-drawer__body ul.cart_list li {
	position: relative;
	list-style: none;
	min-height: 64px;
	margin: 0;
	padding: 16px 34px 16px 72px;
	border-top: 0;
	border-bottom: 1px solid var(--gw-line);
}

.gw-cart-drawer .gw-cart-drawer__body li.mini_cart_item img,
.gw-cart-drawer .gw-cart-drawer__body ul.cart_list li img,
.woocommerce .gw-cart-drawer__body li.mini_cart_item img,
.woocommerce .gw-cart-drawer__body ul.cart_list li img {
	position: absolute !important;
	top: 16px !important;
	left: 0 !important;
	right: auto !important;
	width: 56px !important;
	height: 64px !important;
	object-fit: cover;
	border-radius: 4px;
	margin: 0 !important;
	float: none !important;
}

.gw-cart-drawer__body li.mini_cart_item > a:not(.remove),
.gw-cart-drawer__body ul.cart_list li > a:not(.remove) {
	display: block;
	font-family: "Fraunces", Georgia, serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--gw-ink);
	text-decoration: none;
}

.gw-cart-drawer__body .quantity {
	display: block;
	margin-top: 4px;
	color: var(--gw-ink-soft);
	font-size: 14px;
}

.gw-cart-drawer__body a.remove,
.gw-cart-drawer__body a.remove_from_cart_button {
	position: absolute;
	top: 16px;
	right: 0;
	width: 24px;
	height: 24px;
	line-height: 22px;
	text-align: center;
	font-size: 18px;
	color: var(--gw-ink-soft) !important;
	border-radius: 50%;
}

.gw-cart-drawer__body a.remove:hover {
	color: var(--gw-accent) !important;
	background: var(--gw-cream) !important;
}

.gw-cart-drawer__body .woocommerce-mini-cart__total,
.gw-cart-drawer__body p.total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin: 18px 0 0;
	padding: 16px 0 0;
	border-top: 1px solid var(--gw-line);
	font-family: "Fraunces", Georgia, serif;
	font-size: 16px;
	color: var(--gw-ink);
}

.gw-cart-drawer__body .woocommerce-mini-cart__total .amount,
.gw-cart-drawer__body p.total .amount {
	font-size: 20px;
	font-weight: 500;
	color: var(--gw-ink);
}

/* The mini-cart's own buttons become the drawer's actions, stacked. */
.gw-cart-drawer__body .woocommerce-mini-cart__buttons,
.gw-cart-drawer__body p.buttons {
	display: flex !important;
	flex-direction: column !important;
	gap: 10px;
	margin: 20px 0 0 !important;
	padding: 0;
}

.gw-cart-drawer__body .woocommerce-mini-cart__buttons a.button,
.gw-cart-drawer__body p.buttons a.button {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 50px;
	margin: 0 !important;
	padding: 0 20px;
	border-radius: 4px;
	font-family: "Karla", sans-serif;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
}

/* Checkout is the primary action, View cart the quiet one. */
.gw-cart-drawer__body a.button.checkout,
.gw-cart-drawer__body p.buttons a.checkout {
	background: var(--gw-accent) !important;
	border: 1px solid var(--gw-accent) !important;
	color: #fff !important;
	order: 1;
}

.gw-cart-drawer__body a.button.checkout:hover {
	background: var(--gw-accent-deep) !important;
	border-color: var(--gw-accent-deep) !important;
}

.gw-cart-drawer__body a.button:not(.checkout),
.gw-cart-drawer__body p.buttons a:not(.checkout) {
	background: #fff !important;
	border: 1px solid var(--gw-line) !important;
	color: var(--gw-ink) !important;
	order: 2;
}

.gw-cart-drawer__body a.button:not(.checkout):hover {
	border-color: var(--gw-ink-soft) !important;
}

body.gw-cart-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.gw-cart-drawer__backdrop,
	.gw-cart-drawer__panel {
		transition: none;
	}
}
