/**
 * BLHS Cart Drawer — neutral styling.
 * Structure ported from a custom theme drawer; restyled to sit quietly on the
 * Bitterne Local History Society site rather than impose a look of its own.
 */

/* Floating toggle button (bottom-right) --------------------------------- */
.cart-toggle {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border: none;
	border-radius: 50%;
	background: #1c1c1c;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 3px 12px rgba( 0, 0, 0, 0.25 );
	transition: transform 0.15s ease, background 0.15s ease;
}

.cart-toggle:hover {
	background: #000;
	transform: translateY( -2px );
}

.cart-toggle svg {
	display: block;
}

.cart-toggle__count {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #b23b2e;
	color: #fff;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-sizing: border-box;
}

.cart-toggle__count--empty {
	display: none;
}

/* Overlay --------------------------------------------------------------- */
.cart-overlay {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba( 0, 0, 0, 0.4 );
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.cart-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* Panel shell ----------------------------------------------------------- */
.cart-panel {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: 100vw;
	height: 100vh;
	height: 100dvh;
	background: #fff;
	box-shadow: -4px 0 24px rgba( 0, 0, 0, 0.12 );
	transform: translateX( 100% );
	transition: transform 0.28s cubic-bezier( 0.4, 0, 0.2, 1 );
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: #222;
	-webkit-font-smoothing: antialiased;
}

.cart-panel.is-open {
	transform: translateX( 0 );
}

.cart-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	padding: 18px 22px;
	border-bottom: 1px solid #eae7e0;
}

.cart-panel__title {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.01em;
}

.cart-panel__close {
	border: none;
	background: none;
	font-size: 26px;
	line-height: 1;
	color: #999;
	cursor: pointer;
	padding: 0 2px;
	transition: color 0.12s;
}

.cart-panel__close:hover {
	color: #111;
}

.cart-panel__mini-cart {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Items ----------------------------------------------------------------- */
.cart-panel__items {
	flex: 1;
	overflow-y: auto;
	list-style: none;
	margin: 0;
	padding: 0;
}

.cart-panel__item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 22px;
	border-bottom: 1px solid #f0ede7;
}

.cart-panel__item-info {
	flex: 1;
	min-width: 0;
}

.cart-panel__item-name {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
	font-weight: 600;
	color: #1a1a1a;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

a.cart-panel__item-name:hover {
	color: #666;
}

.cart-panel__item-qty {
	font-size: 13px;
	color: #777;
}

.cart-panel__item-remove {
	flex-shrink: 0;
	padding: 2px 4px;
	font-size: 18px;
	line-height: 1;
	color: #c9c4bb;
	text-decoration: none;
	transition: color 0.12s;
}

.cart-panel__item-remove:hover {
	color: #b23b2e;
}

/* Empty state ----------------------------------------------------------- */
.cart-panel__empty {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px 22px;
}

.cart-panel__empty-msg {
	color: #a8a29a;
	font-size: 14px;
	text-align: center;
	margin: 0;
}

/* Footer ---------------------------------------------------------------- */
.cart-panel__footer {
	flex-shrink: 0;
	padding: 18px 22px 22px;
	border-top: 1px solid #eae7e0;
	background: #fff;
}

.cart-panel__subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 16px;
}

.cart-panel__subtotal-label {
	font-size: 13px;
	color: #777;
}

.cart-panel__subtotal-amount {
	font-size: 17px;
	font-weight: 700;
	color: #1a1a1a;
}

.cart-panel__checkout {
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin-bottom: 8px;
	padding: 13px;
	background: #1c1c1c;
	color: #fff;
	text-align: center;
	text-decoration: none;
	font-size: 14px;
	font-weight: 700;
	border-radius: 4px;
	transition: background 0.12s;
}

.cart-panel__checkout:hover {
	background: #000;
	color: #fff;
}

.cart-panel__view-cart {
	display: block;
	box-sizing: border-box;
	width: 100%;
	padding: 11px;
	background: none;
	color: #555;
	text-align: center;
	text-decoration: none;
	font-size: 13px;
	border: 1px solid #e0dcd3;
	border-radius: 4px;
	transition: border-color 0.12s, color 0.12s;
}

.cart-panel__view-cart:hover {
	border-color: #b7b1a6;
	color: #1a1a1a;
}

/* Lock body scroll while open ------------------------------------------- */
body.cart-panel-open {
	overflow: hidden;
}

@media ( max-width: 480px ) {
	.cart-panel {
		width: 100vw;
	}
}
