/* Side drawers — assets/js/drawer.js (side cart, phone menu). A <dialog> sliding in from one side and back out the
   same way, rounded on its inner side, over a dimmed backdrop; the page behind doesn't scroll. --start = from the
   right (RTL start), --end = from the left. 440px wide; 88% on phones. Content styles live with each drawer. */
.drawer {
	position: fixed;
	inset-block: 0;
	width: min(440px, 100%);
	max-width: 100%;
	height: 100%;
	max-height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--n-20);
	background: var(--n-100);
	box-shadow: 0 0 48px rgb(0 0 0 / .18);
	transition: translate .3s cubic-bezier(.4, 0, .2, 1), overlay .3s allow-discrete, display .3s allow-discrete;
}
.drawer--end { inset-inline: auto 0; border-start-start-radius: var(--r-24); border-end-start-radius: var(--r-24); translate: -100% 0; }
.drawer--start { inset-inline: 0 auto; border-start-end-radius: var(--r-24); border-end-end-radius: var(--r-24); translate: 100% 0; }
.drawer[open] { translate: 0 0; }
.drawer--end[open].is-closing { translate: -100% 0; }
.drawer--start[open].is-closing { translate: 100% 0; }
@starting-style { .drawer--end[open] { translate: -100% 0; } .drawer--start[open] { translate: 100% 0; } }
.drawer::backdrop { background: rgb(0 0 0 / .45); opacity: 0; transition: opacity .3s, overlay .3s allow-discrete, display .3s allow-discrete; }
.drawer[open]::backdrop { opacity: 1; }
.drawer.is-closing::backdrop { opacity: 0; }
@starting-style { .drawer[open]::backdrop { opacity: 0; } }
html:has(.drawer[open]) { overflow: hidden; }

/* Shared head: title + round close button */
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-12); padding: var(--sp-16) var(--sp-24); border-bottom: 1px solid var(--n-95); }
.drawer__close { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; color: var(--n-40); background: var(--n-97); cursor: pointer; transition: color .15s, background-color .15s; }
.drawer__close:hover { color: var(--n-10); background: var(--n-93); }
.drawer__close .icon { font-size: 18px; }

@media (max-width: 769px) {
	.drawer { width: 88%; } /* the page stays visible beside it */
	.drawer__head { padding-inline: var(--sp-16); }
}
@media (prefers-reduced-motion: reduce) {
	.drawer, .drawer::backdrop { transition: none; }
}
