/**
 * Bag drawer and header trigger.
 *
 * Global chrome: the trigger sits in the header on every page, so these styles
 * load everywhere alongside assets/js/cart.js. Cart- and checkout-page styling
 * lives in checkout.css, which loads only on those two surfaces.
 */

/* -------------------------------------------------------------------------
 * 1. Header trigger
 * ---------------------------------------------------------------------- */

.lib-cart-trigger {
	align-items: center;
	background: none;
	border: 0;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	display: inline-flex;
	gap: 0.45rem;
	padding: 0.35rem 0;
}

.lib-cart-count {
	background: var(--wp--preset--color--bone);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.68rem;
	font-weight: 600;
	line-height: 1;
	min-width: 1.35rem;
	padding: 0.3em 0.35em;
	text-align: center;
}

.lib-cart-count.is-filled {
	background: var(--wp--preset--color--signal);
	color: var(--wp--preset--color--bone);
}

/* -------------------------------------------------------------------------
 * 2. Drawer
 * ---------------------------------------------------------------------- */

body.lib-drawer-open {
	overflow: hidden;
}

.lib-drawer {
	inset: 0;
	position: fixed;
	z-index: 200;
}

.lib-drawer__scrim {
	background: rgba(10, 10, 10, 0.6);
	inset: 0;
	opacity: 0;
	position: absolute;
	transition: opacity var(--wp--custom--transition--base);
}

.lib-drawer.is-open .lib-drawer__scrim {
	opacity: 1;
}

.lib-drawer__panel {
	background: var(--wp--preset--color--bone);
	bottom: 0;
	display: flex;
	flex-direction: column;
	max-width: 26rem;
	position: absolute;
	right: 0;
	top: 0;
	transform: translateX(100%);
	transition: transform var(--wp--custom--transition--base);
	width: 100%;
}

.lib-drawer.is-open .lib-drawer__panel {
	transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
	.lib-drawer__panel,
	.lib-drawer__scrim {
		transition: none;
	}
}

.lib-drawer__head {
	align-items: center;
	background: var(--wp--preset--color--ink);
	border-bottom: var(--wp--custom--rule--structural) solid var(--wp--preset--color--signal);
	color: var(--wp--preset--color--bone);
	display: flex;
	justify-content: space-between;
	padding: 1rem 1.25rem;
}

.lib-drawer__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-s);
	font-weight: 400;
	margin: 0;
	text-transform: uppercase;
}

.lib-drawer__close {
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	font-size: 1.75rem;
	line-height: 1;
	padding: 0 0.25rem;
}

.lib-drawer__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	overflow-y: auto;
}

.lib-drawer__body.is-busy {
	opacity: 0.5;
	pointer-events: none;
}

.lib-drawer__empty {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: var(--wp--preset--spacing--30);
	text-align: center;
}

.lib-drawer__empty-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-s);
	margin: 0;
	text-transform: uppercase;
}

.lib-drawer__empty .lib-btn {
	align-self: center;
}

/* -------------------------------------------------------------------------
 * 3. Free shipping bar
 * ---------------------------------------------------------------------- */

.lib-freeship {
	border-bottom: 1px solid var(--wp--preset--color--rule);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 0.9rem 1.25rem;
}

.lib-freeship__text {
	margin: 0;
}

.lib-freeship.is-met .lib-freeship__text {
	color: var(--wp--preset--color--signal-deep);
}

.lib-freeship__track {
	background: var(--wp--preset--color--bone-deep);
	height: 4px;
	overflow: hidden;
}

.lib-freeship__fill {
	background: var(--wp--preset--color--ink);
	display: block;
	height: 100%;
	transition: width var(--wp--custom--transition--base);
}

.lib-freeship.is-met .lib-freeship__fill {
	background: var(--wp--preset--color--signal-deep);
}

/* -------------------------------------------------------------------------
 * 4. Lines
 * ---------------------------------------------------------------------- */

.lib-drawer__items {
	flex: 1;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lib-line {
	border-bottom: 1px solid var(--wp--preset--color--rule);
	display: grid;
	gap: 0.9rem;
	grid-template-columns: 5.5rem minmax(0, 1fr);
	margin: 0;
	padding: 1rem 1.25rem;
}

.lib-line__media {
	background: var(--wp--preset--color--bone-deep);
	display: block;
}

.lib-line__media img {
	aspect-ratio: 4 / 5;
	display: block;
	height: auto;
	object-fit: cover;
	width: 100%;
}

.lib-line__detail {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
}

.lib-line__name {
	color: inherit;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.05rem;
	letter-spacing: 0.01em;
	line-height: 1.05;
	text-decoration: none;
	text-transform: uppercase;
}

.lib-line__name:hover {
	color: var(--wp--preset--color--signal-deep);
}

.lib-line__variant {
	margin: 0;
}

.lib-line__controls {
	align-items: center;
	display: flex;
	gap: 0.75rem;
	justify-content: space-between;
	margin-top: 0.15rem;
}

.lib-qty {
	align-items: stretch;
	border: 1px solid var(--wp--preset--color--rule);
	display: inline-flex;
}

.lib-qty__btn {
	background: none;
	border: 0;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	padding: 0.4rem 0.6rem;
}

.lib-qty__btn:hover {
	background: var(--wp--preset--color--bone-deep);
}

.lib-qty__value {
	align-items: center;
	display: flex;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	justify-content: center;
	min-width: 2rem;
}

.lib-line__price {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	font-variant-numeric: tabular-nums;
}

.lib-line__remove {
	align-self: start;
	background: none;
	border: 0;
	color: var(--wp--preset--color--ash);
	cursor: pointer;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.68rem;
	letter-spacing: 0.1em;
	padding: 0;
	text-decoration: underline;
	text-transform: uppercase;
	text-underline-offset: 3px;
}

.lib-line__remove:hover {
	color: var(--wp--preset--color--signal);
}

/* -------------------------------------------------------------------------
 * 5. Drawer footer
 * ---------------------------------------------------------------------- */

.lib-drawer__foot {
	background: var(--wp--preset--color--paper);
	border-top: 1px solid var(--wp--preset--color--rule);
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: var(--wp--preset--spacing--20) 1.25rem;
}

.lib-drawer__subtotal {
	align-items: baseline;
	display: flex;
	justify-content: space-between;
	margin: 0;
}

.lib-drawer__amount {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--lead);
	font-weight: 600;
}

.lib-drawer__foot .lib-label {
	margin: 0;
}

.lib-drawer__keep {
	background: none;
	border: 0;
	cursor: pointer;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	letter-spacing: var(--wp--custom--tracking--label);
	padding: 0.35rem 0;
	text-decoration: underline;
	text-transform: uppercase;
	text-underline-offset: 3px;
}

.single_add_to_cart_button.is-busy {
	opacity: 0.6;
}


/* -------------------------------------------------------------------------
 * 6. Drawer fixes and additions
 * ---------------------------------------------------------------------- */

/*
 * .lib-btn--block carries `flex: 1 1 12rem` for the product page, where the
 * button sits in a row. The drawer footer is a column, so the same basis
 * became a HEIGHT and made Checkout a 192px red slab.
 */
.lib-drawer__foot .lib-btn--block {
	flex: 0 0 auto;
	padding-block: 1.05rem;
	width: 100%;
}

/* The list no longer grows to push the footer down; suggestions take the space. */
.lib-drawer__items {
	flex: 0 0 auto;
}

.lib-suggest {
	flex: 1 0 auto;
	padding: var(--wp--preset--spacing--20) 1.25rem;
}

.lib-suggest__title {
	margin: 0 0 0.75rem;
}

.lib-suggest__list {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.lib-suggest__item {
	color: inherit;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	text-decoration: none;
}

.lib-suggest__item img {
	aspect-ratio: 4 / 5;
	background: var(--wp--preset--color--bone-deep);
	display: block;
	object-fit: cover;
	width: 100%;
}

.lib-suggest__name {
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.95rem;
	line-height: 1;
	text-transform: uppercase;
}

.lib-suggest__item:hover .lib-suggest__name {
	color: var(--wp--preset--color--signal-deep);
}

.lib-suggest__price {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
}

/* -------------------------------------------------------------------------
 * 7. Delivery promise — shared by product page, bag, cart and checkout
 * ---------------------------------------------------------------------- */

.lib-delivery {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lib-delivery li {
	align-items: center;
	color: var(--lib-dim);
	display: flex;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	gap: 0.55rem;
	letter-spacing: 0.06em;
	margin: 0;
	text-transform: uppercase;
}

.lib-delivery li::before {
	background: var(--wp--preset--color--signal);
	content: "";
	flex: none;
	height: 6px;
	width: 6px;
}

.lib-delivery--stack {
	border-top: 1px solid var(--wp--preset--color--rule);
	padding-top: var(--wp--preset--spacing--20);
}
