/* ---------- Menu toggle ---------- */

.bf-menu-toggle {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	cursor: pointer;
}

.bf-menu-toggle__bar {
	position: absolute;
	left: 12px;
	width: 18px;
	height: 2px;
	border-radius: 1px;
	background: currentColor;
	transition: transform 0.35s var(--bf-ease), opacity 0.2s ease;
}

.bf-menu-toggle__bar:nth-child(1) {
	top: 14px;
}

.bf-menu-toggle__bar:nth-child(2) {
	top: 20px;
}

.bf-menu-toggle__bar:nth-child(3) {
	top: 26px;
}

.bf-drawer-open .bf-menu-toggle__bar:nth-child(1) {
	transform: translateY(6px) rotate(45deg);
}

.bf-drawer-open .bf-menu-toggle__bar:nth-child(2) {
	opacity: 0;
}

.bf-drawer-open .bf-menu-toggle__bar:nth-child(3) {
	transform: translateY(-6px) rotate(-45deg);
}

.bf-menu-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---------- Drawer ---------- */

.bf-drawer {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 40;
	box-sizing: border-box;
	width: var(--bf-drawer-w);
	height: 100svh;
	margin: 0;
	overflow-y: auto;
	background: var(--wp--preset--color--surface);
	transform: translateX(-100%);
	visibility: hidden;
	transition: transform 0.5s var(--bf-ease), visibility 0s linear 0.5s;
}

.bf-drawer-open .bf-drawer {
	transform: none;
	visibility: visible;
	transition: transform 0.5s var(--bf-ease), visibility 0s;
}

.bf-drawer__inner {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-sizing: border-box;
	min-height: 100%;
	padding: calc(var(--bf-header-h) + 24px) 28px 28px;
}

.bf-drawer__inner > * {
	margin: 0;
}

.bf-drawer__nav {
	font-size: clamp(28px, 3vw, 36px);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.02em;
	text-transform: uppercase;
}

.bf-drawer__nav .wp-block-navigation__container {
	gap: 10px;
}

.bf-drawer__nav a,
.bf-drawer__nav .wp-block-navigation-submenu__toggle {
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.bf-drawer__nav .wp-block-navigation__container:hover :is(a, .wp-block-navigation-submenu__toggle) {
	opacity: 0.45;
}

.bf-drawer__nav .wp-block-navigation__container :is(a, .wp-block-navigation-submenu__toggle):is(:hover, :focus-visible),
.bf-drawer__nav .current-menu-item > a {
	opacity: 1;
}

/* Galleries: accordion instead of core's floating dropdown. */
.bf-drawer__nav .wp-block-navigation-submenu {
	flex-wrap: wrap;
	align-items: center;
	gap: 0 8px;
}

.bf-drawer__nav .wp-block-navigation-submenu__toggle {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.bf-drawer__nav .wp-block-navigation__submenu-icon {
	width: 14px;
	height: 14px;
	margin: 0;
	padding: 0;
	pointer-events: none;
	transition: transform 0.35s var(--bf-ease);
}

.bf-drawer__nav .wp-block-navigation__submenu-icon svg {
	width: 14px;
	height: 14px;
	margin: 0;
	stroke: currentColor;
}

.bf-drawer__nav [aria-expanded="true"] + .wp-block-navigation__submenu-icon {
	transform: rotate(180deg);
}

.bf-drawer__nav .has-child .wp-block-navigation__submenu-container {
	position: static;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex-basis: 100%;
	width: auto;
	min-width: 0;
	height: 0;
	padding: 0 0 0 2px;
	border: 0;
	background: none;
	color: rgb(244 244 242 / 0.6);
	font-size: 0.6em;
	letter-spacing: 0;
	opacity: 0;
	visibility: hidden;
	overflow: hidden;
	interpolate-size: allow-keywords;
	transition: height 0.4s var(--bf-ease), padding 0.4s var(--bf-ease), opacity 0.3s ease, visibility 0s linear 0.4s;
}

.bf-drawer__nav .has-child .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
	width: auto;
	min-width: 0;
	height: auto;
	padding-block: 14px 6px;
	opacity: 1;
	visibility: visible;
	overflow: hidden;
	transition: height 0.4s var(--bf-ease), padding 0.4s var(--bf-ease), opacity 0.3s ease 0.05s, visibility 0s;
}

.bf-drawer__nav.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0;
	color: inherit;
}

.bf-drawer__nav .wp-block-navigation__submenu-container a:is(:hover, :focus-visible),
.bf-drawer__nav .wp-block-navigation__submenu-container .current-menu-item > a {
	color: var(--wp--preset--color--contrast);
}

/* ---------- Contact drawer ---------- */

.bf-contact {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 40;
	box-sizing: border-box;
	width: var(--bf-contact-w);
	height: 100svh;
	margin: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--wp--preset--color--surface);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 0.5s var(--bf-ease), visibility 0s linear 0.5s;
}

/* On the Contact page itself the pattern renders nothing. */
.bf-contact:empty {
	display: none;
}

.bf-contact-open .bf-contact {
	transform: none;
	visibility: visible;
	transition: transform 0.5s var(--bf-ease), visibility 0s;
}

.bf-contact__inner {
	box-sizing: border-box;
	min-height: 100%;
	padding: 0 28px 28px;
}

.bf-contact__inner > * {
	margin-block: 0 24px;
}

.bf-contact__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	height: var(--bf-header-h);
	margin-bottom: 24px;
}

.bf-contact__title {
	margin: 0;
	font-size: clamp(28px, 3vw, 36px);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.02em;
	text-transform: uppercase;
}

.bf-contact__close {
	position: relative;
	flex: none;
	width: 44px;
	height: 44px;
	margin-right: -12px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.bf-contact__close:hover {
	background-color: color-mix(in srgb, currentColor 12%, transparent);
}

.bf-contact__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.bf-contact__close-bar {
	position: absolute;
	top: 21px;
	left: 13px;
	width: 18px;
	height: 2px;
	border-radius: 1px;
	background: currentColor;
	transform: rotate(45deg);
}

.bf-contact__close-bar + .bf-contact__close-bar {
	transform: rotate(-45deg);
}

/* Clicking the pushed page closes the drawer. */
.bf-scrim {
	position: fixed;
	inset: 0;
	z-index: 35;
	display: none;
}

:is(.bf-drawer-open, .bf-contact-open) .bf-scrim {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.bf-drawer,
	.bf-drawer-open .bf-drawer,
	.bf-contact,
	.bf-contact-open .bf-contact,
	.bf-menu-toggle__bar,
	.bf-drawer__nav .wp-block-navigation__submenu-icon,
	.bf-drawer__nav .has-child .wp-block-navigation__submenu-container,
	.bf-drawer__nav .has-child .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
		transition: none;
	}
}
