/* Design tokens — global (:root) rather than scoped to .davimo-cart-drawer,
   since other surfaces (e.g. the product page) reuse cart-drawer components
   like the cross-sell block outside the drawer's own DOM subtree and need
   the same custom properties to inherit correctly. */
:root {
	--davimo-green: #1B2624;
	--davimo-offwhite: #EAE7E1;
	--davimo-rose: #BC8F8F;

	/* Design system: --davimo-radius-button (4px) applies to single-purpose
	   actionable buttons (Checkout, cross-sell ADD). Pill/fully-rounded
	   shapes are reserved for compound input controls and status indicators
	   (qty-stepper container, progress bar) - not actionable buttons. */
	--davimo-radius-button: 4px;
	--davimo-text-primary: #1B2624;
	--davimo-text-secondary: #5C6B65;
	--davimo-crosssell-thumb-size: 64px;

	/* Design system: spacing scale. New margin/padding/gap values on shop
	   and PDP layout should be picked from this set rather than an
	   arbitrary rem/px value — "gap looks a bit off" has come up several
	   times as a real, separately-fixed bug (e.g. the shop page headline
	   spacing this covers), and a shared scale is what actually prevents
	   the next one rather than just patching each instance as it's found.
	   Not a strict rule for EVERY spacing value already in this codebase —
	   plenty of existing rem-based spacing predates this token set and
	   hasn't been swapped over; treat off-scale values you find as a
	   flag for a later cleanup pass, not something to silently rewrite
	   mid-unrelated-task. */
	--davimo-space-xs: 8px;
	--davimo-space-sm: 16px;
	--davimo-space-md: 24px;
	--davimo-space-lg: 32px;
	--davimo-space-xl: 48px;

	/* Design system: type scale. Same rationale as the spacing scale above
	   — undeclared/inconsistent weights (a page H1 left at Storefront's
	   default 300, product names at the browser default 400 next to
	   PDP cross-sell names that are bold) are the same class of bug as an
	   arbitrary spacing value, just in the weight/size axis instead.
	   Size and weight are kept as separate custom properties per level
	   (not one bundled `font` shorthand token) — font-weight needs to be
	   reused on its own in places that don't want the size (see the shop
	   product-title rule in shop-grid.css), and font: also resets
	   font-family/line-height, which risks silently drifting from
	   Storefront's actual font stack.
	   Values are the real ones already established, not invented: 2.618rem
	   is Storefront's own default h1 size (already in effect before this
	   token existed, a golden-ratio modular-scale value); 1.2rem/700 is
	   the de-facto "section header" convention already used by every PDP
	   below-fold heading (.davimo-pdp__section-title in product-page.css);
	   0.85rem is the most frequently repeated "secondary text" size
	   already scattered across product-page.css. This does not
	   retroactively rewrite every existing font-size in the codebase —
	   see the commit notes for what's flagged for a later cleanup pass. */
	--davimo-text-h1-size: 2.618rem;
	--davimo-text-h1-weight: 700;
	--davimo-text-h2-size: 1.2rem;
	--davimo-text-h2-weight: 700;
	--davimo-text-body-size: 1rem;
	--davimo-text-body-weight: 400;
	--davimo-text-small-size: 0.85rem;
	--davimo-text-small-weight: 400;
}

.davimo-cart-drawer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	visibility: hidden;
	pointer-events: none;
}

.davimo-cart-drawer.is-open {
	visibility: visible;
	pointer-events: auto;
}

.davimo-cart-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(27, 38, 36, 0.45);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.davimo-cart-drawer.is-open .davimo-cart-drawer__overlay {
	opacity: 1;
}

.davimo-cart-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: 100%;
	max-width: 400px;
	background: var(--davimo-offwhite);
	color: var(--davimo-green);
	box-shadow: -4px 0 24px rgba(27, 38, 36, 0.2);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s ease;
}

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

/* Tablet: same side-panel approach, slightly narrower than desktop. */
@media (min-width: 768px) and (max-width: 1024px) {
	.davimo-cart-drawer__panel {
		max-width: 360px;
	}
}

/* Mobile: full-width takeover instead of a narrow side sliver. */
@media (max-width: 767px) {
	.davimo-cart-drawer__panel {
		max-width: 100vw;
		width: 100vw;
	}
}

.davimo-cart-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid rgba(27, 38, 36, 0.15);
}

.davimo-cart-drawer__title {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--davimo-green);
}

.davimo-cart-drawer__close {
	background: none;
	border: none;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: var(--davimo-green);
	padding: 0;
}

.davimo-cart-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem 1.5rem;
	display: flex;
	flex-direction: column;
}

.davimo-cart-drawer__empty {
	color: rgba(27, 38, 36, 0.7);
}

/* Free shipping progress */

.davimo-cart-drawer__progress {
	margin-bottom: 1.25rem;
}

.davimo-cart-drawer__progress-message {
	margin: 0 0 0.5rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--davimo-green);
}

/* Progress track/fill are a status indicator, not a button — pill shape stays intentional here. */
.davimo-cart-drawer__progress-track {
	height: 6px;
	border-radius: 999px;
	background: rgba(27, 38, 36, 0.12);
	overflow: hidden;
}

.davimo-cart-drawer__progress-fill {
	height: 100%;
	background: var(--davimo-rose);
	border-radius: 999px;
	transition: width 0.3s ease;
}

.davimo-cart-drawer__items {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
}

.davimo-cart-drawer__item {
	display: flex;
	gap: 0.75rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid rgba(27, 38, 36, 0.1);
}

.davimo-cart-drawer__item-thumb img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 4px;
}

.davimo-cart-drawer__item-details {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
	flex: 1;
}

.davimo-cart-drawer__item-name {
	font-weight: 500;
	color: var(--davimo-text-primary);
	text-decoration: none;
}

.davimo-cart-drawer__item-name:hover {
	text-decoration: underline;
}

.davimo-cart-drawer__item-qty-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 0.35rem;
}

.davimo-cart-drawer__item-qty-controls {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.davimo-cart-drawer__qty-stepper {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	background: rgba(27, 38, 36, 0.06);
	border-radius: 999px;
	padding: 0.15rem;
}

.davimo-cart-drawer__qty-stepper.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.davimo-cart-drawer__qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	min-height: 32px;
	background: none;
	border: none;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	color: var(--davimo-green);
	padding: 0;
}

/* Mobile/tablet: guarantee a comfortable 44px thumb target. */
@media (max-width: 1024px) {
	.davimo-cart-drawer__qty-btn {
		min-width: 44px;
		min-height: 44px;
	}
}

.davimo-cart-drawer__qty-value {
	min-width: 1.4em;
	text-align: center;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--davimo-green);
}

.davimo-cart-drawer__item-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	min-height: 32px;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	color: var(--davimo-text-secondary);
}

.davimo-cart-drawer__item-remove svg {
	width: 16px;
	height: 16px;
}

.davimo-cart-drawer__item-remove:hover {
	color: var(--davimo-green);
}

/* Mobile/tablet: guarantee a comfortable 44px thumb target. */
@media (max-width: 1024px) {
	.davimo-cart-drawer__item-remove {
		min-width: 44px;
		min-height: 44px;
	}
}

.davimo-cart-drawer__item-price {
	font-size: 0.9rem;
	font-weight: 400;
	color: var(--davimo-text-secondary);
}

/* Complete Your Routine cross-sell */

.davimo-cart-drawer__crosssell {
	margin: 0.5rem 0 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(27, 38, 36, 0.1);
}

.davimo-cart-drawer__crosssell-heading {
	margin: 0 0 0.75rem;
	font-size: 0.85rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--davimo-green);
}

.davimo-cart-drawer__crosssell-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* .crosssell-item is now a small column: the top row (thumb + details +
   button), then the reason line below it, full item width — instead of
   the reason being squeezed inside the details column between name and
   price. Same shared component/markup on the PDP (see product-page.css),
   where the .crosssell-top row becomes the "image bold-left, name/price/
   button right" card layout and .crosssell-reason sits below it. */
.davimo-cart-drawer__crosssell-item {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding-bottom: 1.1rem;
	border-bottom: 1px solid rgba(27, 38, 36, 0.08);
}

.davimo-cart-drawer__crosssell-item:last-child {
	padding-bottom: 0;
	border-bottom: none;
}

.davimo-cart-drawer__crosssell-top {
	display: flex;
	align-items: center;
	gap: 0.65rem;
}

.davimo-cart-drawer__crosssell-thumb img {
	width: var(--davimo-crosssell-thumb-size);
	height: var(--davimo-crosssell-thumb-size);
	object-fit: cover;
	border-radius: 4px;
	flex-shrink: 0;
}

.davimo-cart-drawer__crosssell-details {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	flex: 1;
	min-width: 0;
}

.davimo-cart-drawer__crosssell-name {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--davimo-text-primary);
}

.davimo-cart-drawer__crosssell-reason {
	margin: 0;
	font-size: 0.75rem;
	line-height: 1.35;
	color: rgba(27, 38, 36, 0.7);
}

.davimo-cart-drawer__crosssell-price {
	font-size: 0.8rem;
	font-weight: 400;
	color: var(--davimo-text-secondary);
}

.davimo-cart-drawer__crosssell-add {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: var(--davimo-radius-button);
	padding: 0.4rem 1rem;
	font-size: 0.8rem;
	font-weight: 600;
	background: var(--davimo-rose);
	color: var(--davimo-green);
	cursor: pointer;
	transition: opacity 0.15s ease;
}

/* Mobile/tablet: guarantee a comfortable 44px thumb target. */
@media (max-width: 1024px) {
	.davimo-cart-drawer__crosssell-add {
		min-height: 44px;
		min-width: 44px;
	}
}

.davimo-cart-drawer__crosssell-add:hover {
	opacity: 0.85;
}

.davimo-cart-drawer__crosssell-add.is-loading {
	opacity: 0.6;
	cursor: default;
}

/* Narrow phones: stack the top row's content instead of squeezing thumb + text + button into one row. */
@media (max-width: 380px) {
	.davimo-cart-drawer__crosssell-top {
		flex-wrap: wrap;
	}

	.davimo-cart-drawer__crosssell-details {
		flex-basis: 100%;
		order: 1;
	}

	.davimo-cart-drawer__crosssell-thumb {
		order: 0;
	}

	.davimo-cart-drawer__crosssell-add {
		order: 2;
		margin-left: auto;
	}
}

.davimo-cart-drawer__subtotal {
	display: flex;
	justify-content: space-between;
	font-weight: 600;
	padding: 1rem 0;
	border-top: 1px solid rgba(27, 38, 36, 0.15);
	color: var(--davimo-green);
	margin-top: auto;
}

.davimo-cart-drawer__reassurance {
	margin: 0 0 1rem;
	font-size: 0.78rem;
	text-align: center;
	color: rgba(27, 38, 36, 0.7);
}

.davimo-cart-drawer__actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding-bottom: 0.5rem;
}

.davimo-cart-drawer__checkout {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	text-align: center;
	padding: 0.7rem 1rem;
	border-radius: var(--davimo-radius-button);
	text-decoration: none;
	font-weight: 700;
	font-size: 1.05rem;
	background: var(--davimo-green);
	color: var(--davimo-offwhite);
}

.davimo-cart-drawer__checkout:hover {
	opacity: 0.9;
}

.davimo-cart-drawer__view-cart {
	text-align: center;
	text-decoration: underline;
	font-size: 0.8rem;
	font-weight: 400;
	color: rgba(27, 38, 36, 0.65);
}

.davimo-cart-drawer__view-cart:hover {
	color: var(--davimo-green);
}

body.davimo-cart-drawer-open {
	overflow: hidden;
}

/* WooCommerce's own add-to-cart.js listens globally for the "added_to_cart"
   event on document.body (see its AddToCartHandler.onAddedToCart) — the
   exact same event our own scripts trigger to open the drawer, on both the
   shop loop and the product page. As a side effect it always injects a
   "View cart" link next to whatever button fired the event. Redundant here
   since the drawer already opens automatically; hidden site-wide rather
   than fighting WC's own handler (which also does other things we still
   want, like the .added button state). */
a.added_to_cart.wc-forward {
	display: none !important;
}
