/**
 * HS Cart Drawer.
 *
 * Standalone: the plugin may run without the child theme's design system, so
 * every token has a literal fallback. Where the theme IS present these resolve
 * to the shared values and the drawer matches the rest of the site exactly.
 */

.hs-drawer {
	position: fixed;
	inset: 0;
	z-index: 1200;
}

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

.hs-drawer__scrim {
	position: absolute;
	inset: 0;
	background: rgba(0, 37, 77, .45);
	opacity: 0;
	transition: opacity .22s cubic-bezier(.4, 0, .2, 1);
}

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

.hs-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 100vw);
	display: flex;
	flex-direction: column;
	background: var(--hs-surface, #fff);
	box-shadow: -12px 0 40px rgba(0, 37, 77, .18);
	transform: translateX(100%);
	transition: transform .22s cubic-bezier(.4, 0, .2, 1);
	outline: none;
}

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

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

/* ------------------------------------------------------------- head --- */

.hs-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 24px;
	border-bottom: 1px solid var(--hs-line, #e3e7ee);
}

.hs-drawer__title {
	margin: 0;
	font-family: var(--hs-font-head, "Franklin Gothic Condensed Demi", Arial, sans-serif);
	font-size: 22px;
	line-height: 1.1;
	color: var(--hs-navy, #00254d);
}

.hs-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	color: var(--hs-navy, #00254d);
	background: transparent;
	border: 1px solid var(--hs-line, #e3e7ee);
	border-radius: 50%;
	cursor: pointer;
	transition: background .18s ease, border-color .18s ease;
}

.hs-drawer__close:hover {
	background: var(--hs-surface-soft, #f6f8fb);
	border-color: var(--hs-accent, #007cba);
}

.hs-drawer__close svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------- body --- */

.hs-drawer__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px 24px;
}

.hs-drawer__empty {
	padding: 48px 0;
	text-align: center;
	font-family: var(--hs-font-body, "Franklin Gothic Book", Arial, sans-serif);
	font-size: 16px;
	color: var(--hs-muted, #5b6573);
}

.hs-drawer__items { margin: 0; padding: 0; list-style: none; }

.hs-drawer__item {
	display: flex;
	gap: 14px;
	padding: 18px 0;
	border-bottom: 1px solid var(--hs-line, #e3e7ee);
}

.hs-drawer__media {
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--hs-line, #e3e7ee);
	border-radius: 10px;
}

.hs-drawer__media img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.hs-drawer__main { flex: 1 1 auto; min-width: 0; }

.hs-drawer__name {
	display: block;
	font-family: var(--hs-font-head, "Franklin Gothic Condensed Demi", Arial, sans-serif);
	font-size: 15px;
	line-height: 1.35;
	color: var(--hs-navy, #00254d);
	text-decoration: none;
}

.hs-drawer__name:hover { color: var(--hs-accent, #007cba); }

.hs-drawer__sku {
	margin: 2px 0 0;
	font-family: var(--hs-font-head, Arial, sans-serif);
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--hs-muted, #5b6573);
}

.hs-drawer__qtyrow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 10px;
}

.hs-drawer__qty {
	display: inline-flex;
	align-items: center;
	height: 36px;
	border: 1px solid var(--hs-line, #e3e7ee);
	border-radius: 30px;
	overflow: hidden;
}

.hs-drawer__step {
	width: 34px;
	height: 100%;
	font-family: var(--hs-font-head, Arial, sans-serif);
	font-size: 16px;
	line-height: 1;
	color: var(--hs-navy, #00254d);
	background: transparent;
	border: 0;
	cursor: pointer;
}

.hs-drawer__step:hover { background: var(--hs-surface-soft, #f6f8fb); color: var(--hs-accent, #007cba); }

.hs-drawer__qtynum {
	min-width: 34px;
	text-align: center;
	font-family: var(--hs-font-body, Arial, sans-serif);
	font-size: 15px;
	/* Explicit, so the digit sits on the pill's centre line rather than wherever
	   the body face's metrics put it. */
	line-height: 34px;
	color: var(--hs-text, #111b29);
}

.hs-drawer__line {
	font-family: var(--hs-font-head, Arial, sans-serif);
	font-size: 16px;
	color: var(--hs-navy, #00254d);
	white-space: nowrap;
}

.hs-drawer__remove {
	margin-top: 8px;
	padding: 0;
	font-family: var(--hs-font-body, Arial, sans-serif);
	font-size: 13px;
	color: var(--hs-muted, #5b6573);
	background: none;
	border: 0;
	border-bottom: 1px solid currentColor;
	cursor: pointer;
}

.hs-drawer__remove:hover { color: #dc3545; }

/* ------------------------------------------------------------- foot --- */

.hs-drawer__foot {
	flex: 0 0 auto;
	padding: 20px 24px 24px;
	border-top: 1px solid var(--hs-line, #e3e7ee);
	background: var(--hs-surface, #fff);
}

.hs-drawer__subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	font-family: var(--hs-font-head, Arial, sans-serif);
	font-size: 20px;
	color: var(--hs-navy, #00254d);
}

.hs-drawer__ship {
	margin: 10px 0 16px;
	font-family: var(--hs-font-body, Arial, sans-serif);
	font-size: 13px;
	line-height: 1.35;
	color: #6b4e11;
	background: #fffaf0;
	border: 1px solid #f2dfb8;
	border-radius: 10px;
	padding: 10px 12px;
}

.hs-drawer__checkout {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 54px;
	font-family: var(--hs-font-head, Arial, sans-serif);
	font-size: 17px;
	color: #fff;
	background: var(--hs-navy, #00254d);
	border-radius: 30px;
	text-decoration: none;
	transition: background .18s ease;
}

.hs-drawer__checkout:hover { background: var(--hs-accent-hover, #005a87); color: #fff; }

.hs-drawer__viewcart {
	display: block;
	margin-top: 12px;
	text-align: center;
	font-family: var(--hs-font-body, Arial, sans-serif);
	font-size: 14px;
	color: var(--hs-accent, #007cba);
	text-decoration: none;
}

.hs-drawer__viewcart:hover { text-decoration: underline; }

/* -------------------------------------------------- bottom sheet ------ */
/*
 * Below 576px a side panel is the wrong form factor - the thumb is at the
 * bottom of the screen. svh rather than vh so the mobile browser chrome
 * collapsing does not resize the sheet mid-scroll.
 */

@media (max-width: 575.98px) {
	.hs-drawer__panel {
		top: auto;
		left: 0;
		width: 100%;
		max-height: 88svh;
		border-radius: 18px 18px 0 0;
		transform: translateY(100%);
		box-shadow: 0 -12px 40px rgba(0, 37, 77, .18);
	}
	.hs-drawer.is-open .hs-drawer__panel { transform: translateY(0); }
}

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

/* =============================================== open/close smoothing === */
/*
 * The "jerk" was never the slide itself - it was the page jumping sideways.
 * Locking body scroll removes the scrollbar, the viewport widens by its width,
 * and everything (including position:fixed chrome) shifts left in the same
 * frame the panel starts moving. drawer.js measures that width once and
 * publishes it as --hs-sb-gap; body gets padding, and fixed chrome gets the
 * same compensation here.
 */

body.hs-drawer-open .hsh-bar,
body.hs-drawer-open .header-fixed,
body.hs-drawer-open .hs-stickybar {
	padding-right: var(--hs-sb-gap, 0px);
}

/* Promote both moving layers before they move, so the first frame is not also
   the frame that creates their compositor layers. */
.hs-drawer__panel,
.hs-drawer__scrim {
	will-change: transform, opacity;
	backface-visibility: hidden;
}

/*
 * Curve choice matters more than duration here. cubic-bezier(.32,.72,0,1) is
 * the iOS sheet curve: it front-loads velocity hard and moved the panel 85px in
 * a single frame at the 86ms mark, which reads as a snap-then-settle rather
 * than a glide. cubic-bezier(.25,.8,.25,1) spreads the same distance far more
 * evenly. The scrim still fades a touch faster than the panel travels, so the
 * background is already dimmed as the panel lands.
 */
.hs-drawer__panel {
	transition: transform .38s cubic-bezier(.25, .8, .25, 1);
}

.hs-drawer__scrim {
	transition: opacity .24s cubic-bezier(.25, .8, .25, 1);
}

@media (max-width: 575.98px) {
	/* No scrollbar to compensate for on a touch viewport, and the sheet travels
	   further, so give it a little more time. */
	.hs-drawer__panel { transition: transform .40s cubic-bezier(.25, .8, .25, 1); }
}

@media (prefers-reduced-motion: reduce) {
	.hs-drawer__panel,
	.hs-drawer__scrim {
		transition: none;
		will-change: auto;
	}
}
