.mwf-menu {
	--mwf-bg: #ece6d8;
	--mwf-panel: #ede7da;
	--mwf-border: rgba(31, 45, 61, 0.12);
	--mwf-text: #1f2d3d;
	--mwf-hover: rgba(31, 45, 61, 0.045);
	--mwf-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
	--mwf-width: 196px;
	position: relative;
	width: 100%;
	max-width: var(--mwf-width);
	z-index: 30;
	font: inherit;
	font-weight: 400;
	color: var(--mwf-text);
}

.mwf-menu *,
.mwf-menu *::before,
.mwf-menu *::after {
	box-sizing: border-box;
}

/* Heading is a label, not another flyout choice. */
.mwf-menu__heading {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	margin: 0 0 4px;
	padding: 8px 10px;
	border: 1px solid var(--mwf-border);
	border-radius: 8px;
	background: var(--mwf-bg);
	color: var(--mwf-text);
	font: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.25;
	text-align: center;
	cursor: default;
}

.mwf-level {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* The menu is a stack of separate rounded choices rather than one large box. */
.mwf-level--root {
	position: relative;
	display: grid;
	gap: 4px;
	border: 0;
	border-radius: 0;
	background: transparent;
}

.mwf-item {
	position: relative;
	margin: 0;
	padding: 0;
}

.mwf-item + .mwf-item {
	border-top: 0;
}

.mwf-row {
	display: flex;
	align-items: stretch;
	min-width: 0;
	min-height: 40px;
	border: 1px solid var(--mwf-border);
	border-radius: 8px;
	background: var(--mwf-panel);
	overflow: hidden;
}

.mwf-link {
	display: block;
	min-width: 0;
	color: var(--mwf-text);
	text-decoration: none;
	line-height: 1.3;
	font-weight: 400;
}

.mwf-link:hover,
.mwf-link:focus-visible {
	color: var(--mwf-text);
	text-decoration: none;
}

/* Main categories match the site's navigation/product-title scale. */
.mwf-level--root > .mwf-item > .mwf-row .mwf-link--category {
	font-size: 16px;
}

.mwf-link--category {
	flex: 1 1 auto;
	padding: 9px 10px;
	font-size: 15px;
	font-weight: 400;
}

/* Subcategories and products are one pixel smaller than the main choices. */
.mwf-level--sub .mwf-link--category,
.mwf-link--product {
	font-size: 15px;
	font-weight: 400;
}

.mwf-link--product {
	width: 100%;
	padding: 9px 10px;
	border: 1px solid var(--mwf-border);
	border-radius: 8px;
	background: var(--mwf-panel);
}

.mwf-row:hover,
.mwf-row:focus-within,
.mwf-item--product:hover .mwf-link--product,
.mwf-item--product:focus-within .mwf-link--product {
	background: var(--mwf-hover);
}

.mwf-toggle {
	display: grid;
	place-items: center;
	flex: 0 0 32px;
	width: 32px;
	min-height: 38px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--mwf-text);
	cursor: pointer;
}

.mwf-toggle > span {
	display: block;
	width: 7px;
	height: 7px;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 160ms ease;
}

.mwf-toggle:focus-visible,
.mwf-menu__heading:focus-visible,
.mwf-link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

/* Every flyout level uses the same fixed width as the main menu. */
.mwf-level--sub {
	display: none;
	position: absolute;
	top: -4px;
	left: calc(100% + 4px);
	width: var(--mwf-width);
	max-width: var(--mwf-width);
	max-height: none;
	padding: 3px;
	overflow: visible;
	border: 1px solid var(--mwf-border);
	border-radius: 10px;
	background: rgba(236, 230, 216, 0.96);
	box-shadow: var(--mwf-shadow);
}

.mwf-level--sub > .mwf-item + .mwf-item {
	margin-top: 4px;
}

/* Category panels must allow another flyout to extend beyond them.
   Product-only panels can scroll vertically because they are the final level. */
.mwf-level--products {
	max-height: min(70vh, 680px);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.mwf-level--sub .mwf-level--sub {
	z-index: 2;
}

.mwf-menu--no-heading > .mwf-level--root {
	border: 0;
	border-radius: 0;
}

.mwf-has-children:hover > .mwf-level--sub,
.mwf-has-children:focus-within > .mwf-level--sub,
.mwf-has-children.is-open > .mwf-level--sub {
	display: block;
}

.mwf-has-children.is-open > .mwf-row .mwf-toggle > span {
	transform: rotate(135deg);
}

@media (max-width: 900px) {
	.mwf-menu {
		max-width: none;
		--mwf-width: 100%;
	}

	.mwf-menu__heading {
		cursor: pointer;
	}

	.mwf-level--root {
		display: none;
	}

	.mwf-menu.is-root-open > .mwf-level--root {
		display: grid;
	}

	.mwf-menu--no-heading > .mwf-level--root {
		display: grid;
	}

	.mwf-level--sub,
	.mwf-has-children:hover > .mwf-level--sub,
	.mwf-has-children:focus-within > .mwf-level--sub {
		display: none;
		position: static;
		width: 100%;
		max-width: none;
		max-height: none;
		margin-top: 4px;
		padding: 4px 0 0 10px;
		overflow: visible;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background: transparent;
	}

	.mwf-has-children.is-open > .mwf-level--sub {
		display: block;
	}

	.mwf-level--sub .mwf-link--category,
	.mwf-level--sub .mwf-level--sub .mwf-link--category,
	.mwf-level--sub .mwf-link--product,
	.mwf-level--sub .mwf-level--sub .mwf-link--product {
		padding-left: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mwf-toggle > span {
		transition: none;
	}
}

/* Automatic WooCommerce archive placement. */
.mwf-archive-layout {
	display: grid;
	grid-template-columns: 196px minmax(0, 1fr);
	gap: clamp(18px, 2vw, 28px);
	align-items: start;
	width: 100%;
	clear: both;
}

.mwf-archive-sidebar {
	position: relative;
	top: auto;
	z-index: 5;
	width: 196px;
	min-width: 0;
}

.mwf-archive-layout--sticky .mwf-archive-sidebar {
	position: sticky;
	top: calc(var(--mwf-sticky-top, 230px) + var(--mwf-sticky-gap, 24px));
}

.mwf-archive-results {
	min-width: 0;
}

.mwf-archive-results::after {
	display: table;
	clear: both;
	content: "";
}

@media (max-width: 900px) {
	.mwf-archive-layout {
		display: block;
	}

	/* Desktop sticky rules have greater selector specificity, so explicitly
	   neutralize them here. The mobile menu is always part of normal flow. */
	.mwf-archive-layout--sticky .mwf-archive-sidebar,
	.mwf-archive-sidebar {
		position: static;
		top: auto;
		width: 100%;
		margin-bottom: 24px;
	}

	/* Optional phone behavior for the automatically placed archive menu. */
	.mwf-archive-layout--mobile-hide .mwf-archive-sidebar {
		display: none;
	}
}
