/*
 * Black Cat Books side cart drawer. A dark panel, in the site's surface colours, that slides in from the right over a dark overlay.
 * Type sizes come from the shared scale in site.css (--bcb-fs-*), so they step down with the rest of the site.
 */

.bcb-sc {
	--sc-bg: var(--bcb-surface, #101012);
	--sc-ink: var(--bcb-ink, #f2ece1);
	--sc-muted: var(--bcb-ink-muted, #bdb6aa);
	--sc-line: var(--bcb-line, #2a2a2e);
	--sc-soft: var(--bcb-raised, #18181b);
	--sc-field: var(--bcb-field, #1e1e21);
	--sc-hover: var(--bcb-gold, #e6c06e);
	--sc-accent: var(--bcb-red, #c9282c);
	--sc-accent-deep: var(--bcb-red-deep, #a51f23);
	--sc-pad: 28px;
	--sc-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 100001;
	display: flex;
	width: min(440px, 100%);
	background: var(--sc-bg);
	color: var(--sc-ink);
	font-family: var(--bcb-sans);
	font-size: var(--bcb-fs-body);
	line-height: 1.5;
	box-shadow: -24px 0 48px rgba(0, 0, 0, 0.6); border-left: 1px solid var(--sc-line);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 320ms var(--sc-ease), visibility 0s linear 320ms;
	outline: none;
}
.bcb-sc.is-open { transform: none; visibility: visible; transition: transform 320ms var(--sc-ease); }
.bcb-sc-overlay { position: fixed; inset: 0; z-index: 100000; background: rgba(5, 5, 5, 0.7); opacity: 0; transition: opacity 320ms var(--sc-ease); }
.bcb-sc-overlay.is-open { opacity: 1; }
/* No page scroll behind the open drawer */
html.bcb-sc-lock, html.bcb-sc-lock body { overflow: hidden; }

.bcb-sc-inner { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.bcb-sc-icon { display: block; width: 20px; height: 20px; flex: none; }
.bcb-sc button { font-family: inherit; }
.bcb-sc :focus-visible { outline: 2px solid var(--sc-hover); outline-offset: 2px; }

/* Header */
.bcb-sc-head { display: flex; align-items: center; gap: 10px; padding: 22px var(--sc-pad); border-bottom: 1px solid var(--sc-line); }
.bcb-sc .bcb-sc-title { margin: 0; font-family: var(--bcb-serif); font-size: var(--bcb-fs-h4); font-weight: 500; line-height: 1.2; color: var(--sc-ink); }
.bcb-sc-count { padding: 2px 10px; border-radius: 999px; background: var(--sc-soft); color: var(--sc-muted); font-size: var(--bcb-fs-small); line-height: 1.6; }
.bcb-sc .bcb-sc-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -12px -10px auto; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--sc-ink); cursor: pointer; transition: background-color 160ms; }
.bcb-sc .bcb-sc-close:hover { background: var(--sc-soft); color: var(--sc-ink); }

/* Items */
/* Books and the note scroll together; totals and the two buttons stay pinned below */
.bcb-sc-scroll { flex: 1 1 auto; min-height: 0; padding: 0 var(--sc-pad); overflow-y: auto; overscroll-behavior: contain; }
.bcb-sc-items { margin: 0; padding: 0; list-style: none; }
.bcb-sc-item { display: flex; gap: 16px; margin: 0; padding: 20px 0; border-bottom: 1px solid var(--sc-line); transition: opacity 200ms; }
.bcb-sc-item:last-child { border-bottom: 0; }
.bcb-sc-item.is-busy { opacity: 0.55; pointer-events: none; }
.bcb-sc-item.is-removing { opacity: 0.3; }
.bcb-sc-thumb { flex: none; width: 76px; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 4px; background: var(--sc-soft); }
.bcb-sc-thumb img { display: block; width: 100%; height: 100%; margin: 0; object-fit: cover; object-position: center top; }
.bcb-sc-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 4px; }
.bcb-sc-row { display: flex; align-items: flex-start; gap: 8px; }
.bcb-sc .bcb-sc-name { flex: 1; margin: 0; font-family: var(--bcb-serif); font-size: var(--bcb-fs-h4); line-height: 1.25; }
.bcb-sc .bcb-sc-name a { color: var(--sc-ink); text-decoration: none; }
.bcb-sc .bcb-sc-name a:hover { color: var(--sc-hover); }
.bcb-sc .bcb-sc-remove { display: flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; margin: -6px -8px 0 0; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--sc-muted); cursor: pointer; transition: color 160ms, background-color 160ms; }
.bcb-sc .bcb-sc-remove .bcb-sc-icon { width: 18px; height: 18px; }
.bcb-sc .bcb-sc-remove:hover { background: var(--sc-soft); color: #ef6b6e; }
/* Variation and item data from WooCommerce (dl.variation) */
.bcb-sc dl.variation { display: grid; grid-template-columns: auto 1fr; gap: 0 6px; margin: 0; font-size: var(--bcb-fs-small); color: var(--sc-muted); }
.bcb-sc dl.variation dt { margin: 0; font-weight: 500; }
.bcb-sc dl.variation dd { margin: 0; }
.bcb-sc dl.variation dd p { margin: 0; }
.bcb-sc .bcb-sc-price { margin: 0; font-size: var(--bcb-fs-small); color: var(--sc-muted); }
.bcb-sc-qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.bcb-sc .bcb-sc-line { font-size: var(--bcb-fs-body); font-weight: 600; color: var(--sc-ink); }
.bcb-sc .bcb-sc-msg { margin: 4px 0 0; font-size: var(--bcb-fs-small); color: #ef6b6e; }
.bcb-sc .bcb-sc-msg:empty { display: none; }

/* Quantity: rounded pill with − / + */
.bcb-sc-qty { display: inline-flex; align-items: center; height: 40px; padding: 2px; border: 1px solid var(--sc-line); border-radius: 999px; }
.bcb-sc .bcb-sc-qty button { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--sc-ink); cursor: pointer; transition: background-color 160ms; }
.bcb-sc .bcb-sc-qty button .bcb-sc-icon { width: 16px; height: 16px; }
.bcb-sc .bcb-sc-qty button:hover:not(:disabled) { background: var(--sc-soft); color: var(--sc-ink); }
.bcb-sc .bcb-sc-qty button:disabled { color: var(--bcb-ink-dim, #8f897f); opacity: 0.5; cursor: not-allowed; }
.bcb-sc .bcb-sc-qty input { width: 36px; height: 34px; min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; color: var(--sc-ink); font-size: var(--bcb-fs-body); font-weight: 600; text-align: center; -moz-appearance: textfield; appearance: textfield; box-shadow: none; }
.bcb-sc .bcb-sc-qty input::-webkit-outer-spin-button,
.bcb-sc .bcb-sc-qty input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }

/* Footer: note, totals, actions */
.bcb-sc-foot { flex: none; padding: 20px var(--sc-pad) 24px; border-top: 1px solid var(--sc-line); background: var(--sc-bg); }
.bcb-sc-note { margin: 0 0 8px; border-top: 1px solid var(--sc-line); }
.bcb-sc-note summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; color: var(--sc-ink); font-size: var(--bcb-fs-small); font-weight: 500; cursor: pointer; list-style: none; }
.bcb-sc-note summary::-webkit-details-marker { display: none; }
.bcb-sc-note summary::after { content: "+"; font-size: var(--bcb-fs-h4); line-height: 1; color: var(--sc-muted); }
.bcb-sc-note[open] summary::after { content: "\2212"; }
.bcb-sc .bcb-sc-note textarea { display: block; width: 100%; min-height: 84px; margin: 4px 0 8px; padding: 12px 14px; border: 1px solid var(--sc-line); border-radius: 8px; background: var(--sc-field); color: var(--sc-ink); font-family: var(--bcb-sans); font-size: var(--bcb-fs-body); line-height: 1.5; resize: vertical; box-shadow: none; }
.bcb-sc .bcb-sc-note textarea::placeholder { color: #9d978c; font-size: var(--bcb-fs-small); }
.bcb-sc .bcb-sc-note textarea:focus { border-color: var(--sc-hover); outline: none; }
.bcb-sc .bcb-sc-note-hint { margin: 0 0 14px; font-size: var(--bcb-fs-small); color: var(--sc-muted); }
.bcb-sc-totals { margin: 0; }
.bcb-sc-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-size: var(--bcb-fs-body); }
.bcb-sc-totals dt { margin: 0; font-weight: 400; color: var(--sc-muted); }
.bcb-sc-totals dd { margin: 0; color: var(--sc-ink); }
.bcb-sc-totals .bcb-sc-discount dd { color: var(--sc-hover); }
.bcb-sc-totals .bcb-sc-net { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--sc-line); }
.bcb-sc-totals .bcb-sc-net dt,
.bcb-sc-totals .bcb-sc-net dd { font-family: var(--bcb-serif); font-size: var(--bcb-fs-h4); font-weight: 500; color: var(--sc-ink); }
.bcb-sc .bcb-sc-fine { margin: 6px 0 18px; font-size: var(--bcb-fs-small); color: var(--sc-muted); }

/* Buttons: same scale as the site's buttons */
.bcb-sc .bcb-sc-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--bcb-btn-h-lg); margin: 0; padding: 0 var(--bcb-btn-px); border: 1px solid transparent; border-radius: var(--bcb-radius); font-family: var(--bcb-sans); font-size: var(--bcb-btn-fs); font-weight: 600; line-height: 1; letter-spacing: var(--bcb-ls-caps); text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background-color 160ms, color 160ms, border-color 160ms; }
.bcb-sc .bcb-sc-btn-primary { background: var(--sc-accent); color: var(--sc-ink); }
.bcb-sc .bcb-sc-btn-primary:hover { background: var(--sc-accent-deep); color: var(--sc-ink); }
.bcb-sc .bcb-sc-btn-quiet { margin-top: 10px; border-color: var(--sc-line); background: transparent; color: var(--sc-ink); }
.bcb-sc .bcb-sc-btn-quiet:hover { border-color: var(--sc-hover); background: transparent; color: var(--sc-hover); }

/* Empty cart */
.bcb-sc-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px var(--sc-pad); text-align: center; }
.bcb-sc-empty-mark { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; margin-bottom: 12px; border-radius: 999px; background: var(--sc-soft); color: var(--sc-muted); }
.bcb-sc-empty-mark .bcb-sc-icon { width: 30px; height: 30px; }
.bcb-sc .bcb-sc-empty-title { margin: 0; font-family: var(--bcb-serif); font-size: var(--bcb-fs-h4); color: var(--sc-ink); }
.bcb-sc .bcb-sc-empty-text { max-width: 280px; margin: 0 0 20px; font-size: var(--bcb-fs-body); color: var(--sc-muted); }
.bcb-sc-empty .bcb-sc-btn { width: auto; min-width: 220px; }

/* "Added to cart!" and error toast */
.bcb-sc-toast { position: fixed; top: 92px; right: 28px; z-index: 100002; display: flex; align-items: center; gap: 10px; max-width: min(384px, calc(100% - 32px)); padding: 12px 18px; border-radius: 999px; background: var(--color-paper-ink, #131313); color: #ffffff; font-family: var(--bcb-sans); font-size: var(--bcb-fs-small); font-weight: 500; line-height: 1.4; box-shadow: 0 10px 30px rgba(5, 5, 5, 0.25); opacity: 0; transform: translateY(-8px); transition: opacity 220ms var(--bcb-ease, ease), transform 220ms ease; pointer-events: none; }
.bcb-sc-toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--bcb-gold, #e6c06e); }
.bcb-sc-toast.is-error { border-radius: 12px; background: var(--bcb-red-deep, #a51f23); }
.bcb-sc-toast.is-error::before { background: #ffffff; }
.bcb-sc-toast.is-shown { opacity: 1; transform: none; }

/* The drawer replaces WooCommerce's "View cart" link after its AJAX buttons */
.bcb-card .added_to_cart.wc-forward { display: none; }

@media (max-width: 1024px) {
	.bcb-sc { width: min(400px, 100%); }
	.bcb-sc-toast { right: 24px; max-width: min(352px, calc(100% - 32px)); }
}
@media (max-width: 640px) {
	.bcb-sc { --sc-pad: 20px; width: 100%; box-shadow: none; }
	.bcb-sc-head { padding: 16px var(--sc-pad); }
	.bcb-sc-thumb { width: 68px; }
	.bcb-sc-foot { padding: 16px var(--sc-pad) calc(16px + env(safe-area-inset-bottom)); }
	.bcb-sc .bcb-sc-qty { height: 44px; }
	.bcb-sc .bcb-sc-qty button { width: 38px; height: 38px; }
	.bcb-sc-toast { top: auto; right: 16px; bottom: 24px; left: 16px; justify-content: center; max-width: none; transform: translateY(8px); }
}
@media (prefers-reduced-motion: reduce) {
	.bcb-sc, .bcb-sc.is-open, .bcb-sc-overlay, .bcb-sc-toast { transition: none; }
}
/* QA round 3: total row matches the cart page (sans, semibold) */
.bcb-sc-totals .bcb-sc-net dt,
.bcb-sc-totals .bcb-sc-net dd { font-family: var(--bcb-sans); font-size: var(--bcb-fs-body); font-weight: 600; }

/* Drawer: same name / title sizes as the cart (18, 16 on phones); smaller stepper on very small phones so the line total never runs off the edge */
.bcb-sc .bcb-sc-title, .bcb-sc .bcb-sc-name { font-size: 18px; }
@media (max-width: 640px) { .bcb-sc .bcb-sc-title, .bcb-sc .bcb-sc-name { font-size: 16px; } }
@media (max-width: 340px) {
	.bcb-sc-qty-row { gap: 8px; }
	.bcb-sc .bcb-sc-qty { height: 42px; }
	.bcb-sc .bcb-sc-qty button { width: 34px; height: 34px; }
	.bcb-sc .bcb-sc-qty input { width: 30px; }
}