/**
 * TBH Kitchen — cart drawer and toast.
 *
 * The drawer is a bottom sheet on mobile (thumb-reachable) and a right-hand
 * panel on desktop.
 */

/* ---------------------------------------------------------------
 * Overlay
 * ------------------------------------------------------------- */

.tbh-drawer__overlay {
	position: fixed;
	inset: 0;
	background: rgba(49, 14, 12, .5);
	opacity: 0;
	transition: opacity .26s ease;
	z-index: 998;
	backdrop-filter: blur(2px);
}

.tbh-drawer-root.is-open .tbh-drawer__overlay {
	opacity: 1;
}

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

/* ---------------------------------------------------------------
 * Panel — bottom sheet on mobile
 * ------------------------------------------------------------- */

.tbh-drawer {
	position: fixed;
	z-index: 999;
	background: var(--tbh-cream, #FCFAF5);
	display: flex;
	flex-direction: column;
	font-family: var(--tbh-sans, sans-serif);

	left: 0;
	right: 0;
	bottom: 0;
	max-height: 88vh;
	border-radius: 20px 20px 0 0;
	transform: translateY(100%);
	transition: transform .28s cubic-bezier(.32, .72, 0, 1);
	box-shadow: 0 -8px 40px rgba(49, 14, 12, .22);
}

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

.tbh-drawer-root.is-open .tbh-drawer {
	transform: translateY(0);
}

/* Header */

.tbh-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 20px 14px;
	border-bottom: 1px solid var(--tbh-line, #EFDEC0);
	background: var(--tbh-green, #4B1612);
	border-radius: 20px 20px 0 0;
	flex-shrink: 0;
}

.tbh-drawer__title {
	font-family: var(--tbh-serif, serif);
	font-size: 1.35rem;
	font-weight: 600;
	color: var(--tbh-gold-light, #DCB674);
	margin: 0;
}

/* !important because the parent theme and WooCommerce both style bare
   <button> elements; without it the close control inherited a bright
   accent background that belongs to neither palette. */
.tbh-drawer .tbh-drawer__close {
	width: 40px;
	height: 40px;
	border: none;
	background: rgba(255, 255, 255, .12) !important;
	color: var(--tbh-cream, #FCFAF5) !important;
	font-size: 1.5rem;
	line-height: 1;
	border-radius: 50%;
	cursor: pointer;
	transition: background .16s ease;
}

.tbh-drawer__close:hover,
.tbh-drawer__close:focus-visible {
	background: rgba(255, 255, 255, .2);
}

/* ---------------------------------------------------------------
 * Delivery / collection
 * ------------------------------------------------------------- */

.tbh-fulfil {
	flex-shrink: 0;
	padding: 14px 20px 4px;
}

.tbh-fulfil[hidden] {
	display: none;
}

.tbh-fulfil__toggle {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	background: var(--tbh-cream-warm, #F9F3E9);
	padding: 4px;
	border-radius: 12px;
}

.tbh-fulfil__opt {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 9px 8px;
	border: none;
	background: transparent;
	border-radius: 9px;
	cursor: pointer;
	font-family: inherit;
	transition: background .18s ease, box-shadow .18s ease;
}

.tbh-fulfil__opt.is-active {
	background: var(--tbh-white, #fff);
	box-shadow: 0 1px 3px rgba(75, 22, 18, .12);
}

.tbh-fulfil__label {
	font-size: .88rem;
	font-weight: 700;
	color: var(--tbh-charcoal, #2D1411);
}

.tbh-fulfil__opt.is-active .tbh-fulfil__label {
	color: var(--tbh-green, #4B1612);
}

.tbh-fulfil__note {
	font-size: .72rem;
	font-weight: 600;
	color: var(--tbh-gray, #826863);
	font-variant-numeric: tabular-nums;
}

/* Savings and "Free" are the reason to choose an option, so they carry
   the one colour the eye should land on. */
.tbh-fulfil__note--save {
	color: var(--tbh-veg, #4A7C39);
}

/* Progress toward free delivery */

.tbh-freeship {
	margin-top: 12px;
}

.tbh-freeship[hidden] {
	display: none;
}

.tbh-freeship__text {
	margin: 0 0 6px;
	font-size: .76rem;
	font-weight: 600;
	color: var(--tbh-gray, #826863);
}

.tbh-freeship__text.is-unlocked {
	color: var(--tbh-veg, #4A7C39);
}

.tbh-freeship__track {
	height: 4px;
	background: var(--tbh-line, #EFDEC0);
	border-radius: 999px;
	overflow: hidden;
}

.tbh-freeship__bar {
	display: block;
	height: 100%;
	width: 0;
	background: var(--tbh-gold, #C7891E);
	border-radius: 999px;
	transition: width .4s cubic-bezier(.32, .72, 0, 1);
}

.tbh-freeship__text.is-unlocked + .tbh-freeship__track .tbh-freeship__bar {
	background: var(--tbh-veg, #4A7C39);
}

/* Body */

.tbh-drawer__body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 8px 20px;
}

.tbh-drawer__body:empty {
	padding: 0;
}

/* Cart line */

.tbh-line {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px 0;
	border-bottom: 1px solid var(--tbh-line, #EFDEC0);
}

.tbh-line:last-child {
	border-bottom: none;
}

.tbh-line__info {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 14px;
}

.tbh-line__name {
	font-size: .94rem;
	font-weight: 600;
	color: var(--tbh-charcoal, #2D1411);
	line-height: 1.35;
}

.tbh-line__price {
	font-size: .94rem;
	font-weight: 700;
	color: var(--tbh-green, #4B1612);
	white-space: nowrap;
}

.tbh-line__controls {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tbh-line__step {
	width: 36px;
	height: 36px;
	border: 1.5px solid var(--tbh-line, #EFDEC0);
	background: var(--tbh-white, #fff);
	color: var(--tbh-green, #4B1612);
	font-size: 1.1rem;
	line-height: 1;
	border-radius: 50%;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}

.tbh-line__step:hover,
.tbh-line__step:focus-visible {
	border-color: var(--tbh-green, #4B1612);
	background: var(--tbh-green, #4B1612);
	color: var(--tbh-gold-light, #DCB674);
}

.tbh-line__qty {
	min-width: 24px;
	text-align: center;
	font-weight: 700;
	font-size: .92rem;
	font-variant-numeric: tabular-nums;
}

.tbh-line__remove {
	margin-left: auto;
	border: none;
	background: none;
	color: var(--tbh-gray, #826863);
	font-size: .8rem;
	text-decoration: underline;
	cursor: pointer;
	padding: 8px 4px;
}

.tbh-line__remove:hover,
.tbh-line__remove:focus-visible {
	color: var(--tbh-chilli, #B23A22);
}

/* Empty state */

.tbh-drawer__empty {
	padding: 44px 24px;
	text-align: center;
}

.tbh-drawer__empty[hidden] {
	display: none;
}

.tbh-drawer__empty-title {
	font-family: var(--tbh-serif, serif);
	font-size: 1.2rem;
	color: var(--tbh-green, #4B1612);
	margin: 0 0 6px;
}

.tbh-drawer__empty-text {
	font-size: .88rem;
	color: var(--tbh-gray, #826863);
	margin: 0 0 20px;
}

/* Footer */

.tbh-drawer__foot {
	flex-shrink: 0;
	padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--tbh-line, #EFDEC0);
	background: var(--tbh-white, #fff);
}

.tbh-drawer__foot[hidden] {
	display: none;
}

.tbh-drawer__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: .92rem;
	margin-bottom: 6px;
	color: var(--tbh-gray, #826863);
	font-variant-numeric: tabular-nums;
}

.tbh-drawer__row[hidden] {
	display: none;
}

.tbh-drawer__row--save {
	color: var(--tbh-veg, #4A7C39);
	font-weight: 600;
}

.tbh-drawer__row--total {
	font-size: 1.05rem;
	color: var(--tbh-charcoal, #2D1411);
	padding-top: 10px;
	margin-top: 4px;
	border-top: 1px solid var(--tbh-line, #EFDEC0);
	margin-bottom: 12px;
}

.tbh-drawer__row strong {
	font-size: 1.24rem;
	color: var(--tbh-green, #4B1612);
	font-weight: 700;
}

/* Below the delivery minimum */

.tbh-drawer__warn {
	margin: 0 0 12px;
	padding: 10px 12px;
	background: rgba(178, 58, 34, .08);
	border-radius: 8px;
	font-size: .8rem;
	line-height: 1.45;
	color: var(--tbh-chilli, #B23A22);
	font-weight: 600;
}

.tbh-drawer__warn[hidden] {
	display: none;
}

/* A checkout that would fail server-side should not look available. */
.tbh-btn.is-disabled {
	opacity: .45;
	cursor: not-allowed;
	pointer-events: none;
}

.tbh-drawer__note {
	font-size: .76rem;
	color: var(--tbh-gray, #826863);
	margin: 0 0 14px;
}

.tbh-drawer__viewcart {
	display: block;
	text-align: center;
	margin-top: 12px;
	font-size: .85rem;
	color: var(--tbh-green, #4B1612);
	text-decoration: underline;
}

/* ---------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------- */

.tbh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 50px;
	padding: 0 28px;
	border: none;
	border-radius: 999px;
	font-family: inherit;
	font-size: .95rem;
	font-weight: 700;
	letter-spacing: .02em;
	text-decoration: none;
	cursor: pointer;
	transition: background .18s ease, transform .1s ease;
}

.tbh-btn--gold {
	background: var(--tbh-gold, #C7891E);
	color: var(--tbh-green-deep, #310E0C);
}

.tbh-btn--gold:hover,
.tbh-btn--gold:focus-visible {
	background: var(--tbh-gold-light, #DCB674);
	color: var(--tbh-green-deep, #310E0C);
}

.tbh-btn--ghost {
	background: transparent;
	border: 1.5px solid var(--tbh-green, #4B1612);
	color: var(--tbh-green, #4B1612);
}

.tbh-btn--ghost:hover,
.tbh-btn--ghost:focus-visible {
	background: var(--tbh-green, #4B1612);
	color: var(--tbh-gold-light, #DCB674);
}

.tbh-btn--block {
	display: flex;
	width: 100%;
}

.tbh-btn:active {
	transform: scale(.985);
}

/* ---------------------------------------------------------------
 * Toast
 * ------------------------------------------------------------- */

.tbh-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 16px);
	z-index: 1001;
	background: var(--tbh-green-deep, #310E0C);
	color: var(--tbh-gold-light, #DCB674);
	padding: 13px 22px;
	border-radius: 999px;
	font-size: .87rem;
	font-weight: 600;
	font-family: var(--tbh-sans, sans-serif);
	box-shadow: 0 8px 28px rgba(49, 14, 12, .3);
	opacity: 0;
	transition: opacity .24s ease, transform .24s ease;
	max-width: calc(100vw - 40px);
	text-align: center;
	pointer-events: none;
}

.tbh-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

.tbh-toast.is-error {
	background: var(--tbh-chilli, #B23A22);
	color: #fff;
}

.tbh-toast[hidden] {
	display: none;
}

/* ---------------------------------------------------------------
 * Desktop — side panel
 * ------------------------------------------------------------- */

@media (min-width: 768px) {

	.tbh-drawer {
		left: auto;
		top: 0;
		right: 0;
		bottom: 0;
		width: 420px;
		max-height: 100vh;
		border-radius: 0;
		transform: translateX(100%);
		box-shadow: -8px 0 40px rgba(49, 14, 12, .18);
	}

	.tbh-drawer-root.is-open .tbh-drawer {
		transform: translateX(0);
	}

	.tbh-drawer__head {
		border-radius: 0;
		padding: 24px 24px 18px;
	}

	.tbh-drawer__body,
	.tbh-drawer__foot {
		padding-inline: 24px;
	}

	.tbh-toast {
		bottom: 32px;
		left: 32px;
		transform: translate(0, 16px);
	}

	.tbh-toast.is-visible {
		transform: translate(0, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.tbh-drawer,
	.tbh-drawer__overlay,
	.tbh-toast {
		transition: none;
	}
}
