/**
 * Off-canvas drawer — shared structure.
 *
 * Paired with assets/js/drawer.js. Any panel using the `data-ff-drawer`
 * contract gets its layout and transitions from here; the cart drawer only
 * adds what is its own.
 *
 * Mobile-first: the panel is a bottom-anchored sheet on small screens and a
 * side panel from 40em up.
 *
 * @package FairyFlower_Custom
 */

.ff-drawer {
	position: fixed;
	inset: 0;
	z-index: var(--ff-z-drawer);
	visibility: hidden;
	pointer-events: none;
}

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

/* Overlay ---------------------------------------------------------------- */
.ff-drawer__overlay {
	position: absolute;
	inset: 0;
	background: var(--ff-color-overlay);
	opacity: 0;
	transition: opacity var(--ff-transition);
}
.ff-drawer.is-open .ff-drawer__overlay { opacity: 1; }

/* Panel: a sheet from the bottom on phones ------------------------------- */
.ff-drawer__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	background: var(--ff-color-panel);
	box-shadow: var(--ff-shadow-panel);
	border-radius: var(--ff-radius-lg) var(--ff-radius-lg) 0 0;
	transform: translateY(100%);
	transition: transform var(--ff-transition);
	will-change: transform;
}
.ff-drawer.is-open .ff-drawer__panel { transform: translateY(0); }

/* ...and a side panel from tablet up. */
@media (min-width: 40em) {
	.ff-drawer__panel {
		top: 0;
		bottom: 0;
		left: auto;
		right: 0;
		height: 100%;
		max-height: none;
		width: min(420px, 90vw);
		border-radius: 0;
		transform: translateX(100%);
	}
	.ff-drawer.is-open .ff-drawer__panel { transform: translateX(0); }
}

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

/* Head ------------------------------------------------------------------- */
.ff-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ff-space-sm);
	padding: var(--ff-space-sm) var(--ff-space-md);
	border-bottom: 1px solid var(--ff-color-border);
	flex: 0 0 auto;
}

.ff-drawer__title {
	margin: 0;
	font-size: 1.35rem;
}

.ff-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-right: calc(var(--ff-space-2xs) * -1);
	padding: 0;
	border: 0;
	border-radius: var(--ff-radius-sm);
	background: none;
	color: var(--ff-color-muted);
	cursor: pointer;
	transition: color var(--ff-transition-fast), background-color var(--ff-transition-fast);
}
.ff-drawer__close:hover,
.ff-drawer__close:focus-visible {
	background: var(--ff-color-surface);
	color: var(--ff-color-text);
}
.ff-drawer__close .ff-icon { width: 24px; height: 24px; }

/* Scrollable body -------------------------------------------------------- */
.ff-drawer__content {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: var(--ff-space-md);
	display: flex;
	flex-direction: column;
}

/* Optional pinned footer for actions. */
.ff-drawer__foot {
	flex: 0 0 auto;
	padding: var(--ff-space-sm) var(--ff-space-md);
	border-top: 1px solid var(--ff-color-border);
	background: var(--ff-color-panel);
}
