/*
 * Mega menu panels, per the Claude Design "Website" header (mbh-chrome.js, Nov 2026).
 *
 * Panels are wp_block posts rendered by navigation-for-woocommerce's
 * departments block. Each panel is an `.mbh-mm` group holding a term-list
 * (types + counts), a grid of product feature cards (most loved), a featured
 * card and a "ways to order" row. These rules restyle the plugin's own
 * markup inside the MBH header only; nothing here leaks to other sites.
 */

:root {
	--mbh-mm-ink: var(--wp--preset--color--main, #3a0f00);
	--mbh-mm-jam: var(--wp--preset--color--primary, #901c3b);
	--mbh-mm-jam-deep: #6e1029;
	--mbh-mm-peach: var(--wp--preset--color--primary-accent, #f2bf91);
	--mbh-mm-peach-soft: #fbe3cb;
	--mbh-mm-cream: #fff2e1;
	--mbh-mm-paper: #fffdfa;
	--mbh-mm-mute: #7e6050;
	--mbh-mm-crust: #5a1e0c;
	--mbh-mm-line: rgba(58, 15, 0, 0.12);
	--mbh-mm-sub: var(--wp--preset--font-family--subtitle);
	--mbh-mm-stamp: var(--wp--preset--font-family--heading);
	--mbh-mm-disp: var(--wp--preset--font-family--script);
	--mbh-mm-sans: var(--wp--preset--font-family--primary);
}

/* Warm scrim instead of the plugin's neutral grey. */
.mbh-header .wb-nav-departments.is-open .wb-nav-departments__scrim {
	background: rgba(58, 15, 0, 0.32);
}

@media (min-width: 901px) {
	/* ---------------------------------------------------------- Panel */
	.mbh-header .wb-nav-departments__panel {
		background: var(--mbh-mm-cream);
		color: var(--mbh-mm-ink);
		border: 0;
		border-radius: 0 0 40px 40px;
		box-shadow: 0 40px 80px rgba(58, 15, 0, 0.2);
	}

	.mbh-header .wb-nav-departments__panel-inner {
		max-width: 1320px;
		padding: 42px 56px 0;
	}

	.mbh-mm.wp-block-group {
		display: grid;
		grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr) minmax(0, 0.95fr);
		gap: 0 56px;
		align-items: start;
	}

	.mbh-mm > * {
		margin-block: 0 !important;
	}

	/* -------------------------------------------- Column 1: types */
	.mbh-mm .mbh-mm__types {
		display: flex;
		flex-direction: column;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__more {
		order: -1;
		display: inline-flex;
		align-items: center;
		gap: 12px;
		margin: 0 0 12px;
		font-family: var(--mbh-mm-stamp);
		font-size: 17px;
		font-weight: 400;
		letter-spacing: 0.02em;
		text-transform: uppercase;
		color: var(--mbh-mm-jam);
		text-decoration: none;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__more span {
		transition: transform 0.3s cubic-bezier(0.34, 1.7, 0.64, 1);
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__more:hover span {
		transform: translateX(4px);
	}

	.mbh-mm .wb-nav-term-list__eyebrow,
	.mbh-mm .mbh-mm__h {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0 0 14px;
		font-family: var(--mbh-mm-sans);
		font-size: 15px;
		font-weight: 800;
		letter-spacing: 0;
		text-transform: none;
		color: var(--mbh-mm-jam);
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__items {
		display: flex;
		flex-direction: column;
		gap: 0;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__item {
		margin: 0;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__link {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		margin: 0 -14px;
		padding: 8px 14px;
		border-radius: 14px;
		font-family: var(--mbh-mm-sub);
		font-size: 20px;
		font-weight: 400;
		line-height: 1.2;
		letter-spacing: 0.02em;
		text-transform: uppercase;
		color: var(--mbh-mm-ink);
		text-decoration: none;
		transition: background 0.15s, color 0.15s;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__name {
		font: inherit;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__trail {
		display: flex;
		align-items: center;
		flex: none;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__sr {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__count {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 30px;
		height: 24px;
		padding: 0 8px;
		border-radius: 999px;
		background: var(--mbh-mm-paper);
		font-family: var(--mbh-mm-sans);
		font-size: 13px;
		font-weight: 800;
		letter-spacing: 0;
		color: var(--mbh-mm-mute);
		transition: background 0.15s, color 0.15s;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__link:hover {
		background: var(--mbh-mm-paper);
		color: var(--mbh-mm-jam);
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__link:hover .wb-nav-term-list__count {
		background: var(--mbh-mm-jam);
		color: var(--mbh-mm-cream);
	}

	/* --------------------------------------- Column 2: most loved */
	.mbh-mm__loved > * {
		margin-block: 0 !important;
	}

	.mbh-mm__tiles.wp-block-group {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.mbh-mm__tiles > * {
		margin: 0 !important;
	}

	.mbh-mm .mbh-mm__tile.wb-nav-feature-card {
		display: flex;
		flex-direction: row;
		align-items: center;
		gap: 14px;
		height: auto;
		min-height: 0;
		padding: 8px 12px 8px 8px;
		border: 0;
		border-radius: 18px;
		background: var(--mbh-mm-paper);
		box-shadow: none;
		color: var(--mbh-mm-ink);
		text-decoration: none;
		transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.2s;
	}

	.mbh-mm .mbh-mm__tile.wb-nav-feature-card:hover {
		transform: translateY(-2px);
		box-shadow: 0 12px 24px rgba(58, 15, 0, 0.1);
	}

	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__media {
		flex: none;
		width: 64px;
		height: 64px;
		aspect-ratio: auto;
		margin: 0;
		border-radius: 12px;
		overflow: hidden;
		background: var(--mbh-mm-peach-soft);
	}

	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__media img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	/* Products without a photo get the brand mark on peach, like the design's fallback. */
	.mbh-mm .mbh-mm__tile:not(:has(.wb-nav-feature-card__media))::before {
		content: "";
		flex: none;
		width: 64px;
		height: 64px;
		border-radius: 12px;
		background: var(--mbh-mm-peach-soft) url(/wp-content/uploads/2026/04/MBH-Logos-33-300x292.png) center / 34% no-repeat;
	}

	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__body {
		display: flex;
		flex-direction: column;
		gap: 0;
		padding: 0;
		min-width: 0;
	}

	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__title {
		font-family: var(--mbh-mm-sub);
		font-size: 17px;
		font-weight: 400;
		line-height: 1.15;
		letter-spacing: 0.02em;
		text-transform: uppercase;
		color: var(--mbh-mm-ink);
	}

	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__meta {
		margin-top: 4px;
		font-family: var(--mbh-mm-sans);
		font-size: 14px;
		font-weight: 700;
		color: var(--mbh-mm-mute);
	}

	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__meta-mobile,
	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__eyebrow,
	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__text,
	.mbh-mm .mbh-mm__tile .wb-nav-feature-card__cta {
		display: none;
	}

	/* --------------------------------------- Column 3: featured */
	.mbh-mm__feat {
		position: relative;
		display: flex;
		flex-direction: column;
		overflow: hidden;
		border-radius: 28px;
		background: var(--mbh-mm-jam);
		color: var(--mbh-mm-cream);
		text-decoration: none;
	}

	.mbh-mm__feat:hover {
		color: var(--mbh-mm-cream);
	}

	.mbh-mm__feat-img {
		display: block;
		height: 150px;
		overflow: hidden;
		background: var(--mbh-mm-jam-deep);
	}

	.mbh-mm__feat-img img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1);
	}

	.mbh-mm__feat:hover .mbh-mm__feat-img img {
		transform: scale(1.05);
	}

	.mbh-mm__seal {
		position: absolute;
		top: 16px;
		right: 16px;
		display: grid;
		place-items: center;
		width: 58px;
		height: 58px;
		border-radius: 50%;
		background: var(--mbh-mm-jam);
		box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
	}

	.mbh-mm__seal img {
		width: 46%;
		height: auto;
		filter: brightness(0) invert(1);
	}

	.mbh-mm__feat-body {
		display: block;
		padding: 20px 24px 24px;
	}

	.mbh-mm__feat-title {
		display: block;
		font-family: var(--mbh-mm-stamp);
		font-size: 32px;
		font-weight: 400;
		line-height: 0.92;
		letter-spacing: 0.01em;
		text-transform: uppercase;
		text-wrap: balance;
		color: var(--mbh-mm-cream);
	}

	.mbh-mm__feat-title em {
		position: relative;
		z-index: 1;
		display: inline-block;
		margin: -0.06em 0 -0.1em;
		font-family: var(--mbh-mm-disp);
		font-size: 1.28em;
		font-style: normal;
		line-height: 0.7;
		letter-spacing: 0;
		text-transform: none;
		color: var(--mbh-mm-peach);
	}

	.mbh-mm__lead {
		display: block;
		margin-bottom: 0.1em;
		font-family: var(--mbh-mm-disp);
		font-size: 0.46em;
		line-height: 1;
		letter-spacing: 0;
		text-transform: none;
		color: var(--mbh-mm-peach);
	}

	.mbh-mm__feat-text {
		display: block;
		margin: 10px 0 14px;
		font-size: 15px;
		line-height: 1.5;
		color: #fce6d2;
	}

	.mbh-mm__feat-cta {
		display: inline-block;
		padding-bottom: 2px;
		border-bottom: 2.5px solid var(--mbh-mm-peach);
		font-size: 15px;
		font-weight: 700;
		color: var(--mbh-mm-cream);
	}

	/* ------------------------------------------- Ways to order */
	.mbh-mm > .mbh-mm__foot,
	.mbh-mm__foot {
		grid-column: 1 / -1;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 10px;
		margin-top: 32px !important;
		padding: 20px 0 26px;
		border-top: 1px solid var(--mbh-mm-line);
	}

	.mbh-mm__foot-h {
		margin-right: 6px;
		font-size: 14px;
		font-weight: 800;
		color: var(--mbh-mm-ink);
	}

	.mbh-mm__chip {
		padding: 8px 15px;
		border-radius: 999px;
		background: var(--mbh-mm-paper);
		font-size: 14px;
		font-weight: 700;
		color: var(--mbh-mm-jam);
		text-decoration: none;
		transition: background 0.15s, color 0.15s;
	}

	.mbh-mm__chip:hover {
		background: var(--mbh-mm-jam);
		color: var(--mbh-mm-cream);
	}

	.mbh-mm__aside {
		display: flex;
		align-items: center;
		gap: 9px;
		margin-left: auto;
		font-size: 14px;
		font-weight: 700;
		color: var(--mbh-mm-crust);
	}

	.mbh-mm__dot {
		display: inline-block;
		flex: none;
		width: 8px;
		height: 8px;
		border-radius: 50%;
		background: #3fa35b;
		animation: mbh-mm-blink 1.8s ease-in-out infinite;
	}
}

@media (min-width: 901px) and (max-width: 1180px) {
	.mbh-header .wb-nav-departments__panel-inner {
		padding-inline: 32px;
	}

	.mbh-mm.wp-block-group {
		gap: 0 32px;
	}
}

/* Drawer (phones and small tablets): just the type chips, as in the design's mobile menu. */
@media (max-width: 900px) {
	.mbh-mm .mbh-mm__loved,
	.mbh-mm .mbh-mm__feat,
	.mbh-mm .mbh-mm__foot {
		display: none;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__items {
		flex-wrap: wrap;
		gap: 8px;
		overflow: visible;
		-webkit-mask: none;
		mask: none;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__trail,
	.mbh-mm .mbh-mm__types .wb-nav-term-list__item::after,
	.mbh-mm .mbh-mm__types .wb-nav-term-list__link::after {
		display: none;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__item {
		width: auto;
		margin: 0;
		padding: 0;
		border: 0;
	}

	.mbh-mm .mbh-mm__types .wb-nav-term-list__link {
		padding: 9px 14px;
		border: 0;
		border-radius: 999px;
		background: var(--mbh-mm-cream);
		font-size: 15px;
		font-weight: 700;
		color: var(--mbh-mm-ink);
	}
}

@keyframes mbh-mm-blink {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.25;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mbh-mm__dot {
		animation: none;
	}

	.mbh-mm .mbh-mm__tile.wb-nav-feature-card,
	.mbh-mm__feat-img img {
		transition: none;
	}
}

/* Phone menu toggle: cream on the jam header, like the search and account icons (the plugin default is near-black). */
.mbh-header .wb-nav-departments__drawer-toggle,
.mbh-header .wb-nav-departments__drawer-toggle .wb-nav-departments__bar {
	color: var(--mbh-mm-cream);
	stroke: currentColor;
}

/* ------------------------------------------------ Keyboard focus
 * The browser's default ring is drawn in the link colour, which on the
 * red header is the header's own colour (1:1). Cream on the red bar,
 * red on the cream panels and the phone drawer: both about 8:1. */
.mbh-header :focus-visible {
	outline: 3px solid var(--mbh-cream, #fff2e1) !important;
	outline-offset: 3px;
	border-radius: 6px;
}

.mbh-header .wb-nav-departments__panel :focus-visible,
.mbh-header .wb-nav-header-actions [role="dialog"] :focus-visible {
	outline-color: var(--mbh-jam, #901c3b) !important;
}

@media (max-width: 900px) {
	.mbh-header .wb-nav-departments__drawer :focus-visible {
		outline-color: var(--mbh-jam, #901c3b) !important;
	}
}

/* Phone drawer: the logo keeps to the header row's height. */
.mbh-header .wb-nav-departments__drawer-logo {
	width: auto;
	max-width: 60vw;
	height: auto;
	max-height: 40px;
}

/* Header ticker links */
.mbh-ticker-link {
	color: inherit;
	text-decoration: none;
}

.mbh-ticker-link:hover,
.mbh-ticker-link:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Phone drawer close button: jam like the drawer's other controls. With no
 * colour of its own, iOS Safari draws a button in system blue. */
.mbh-header .wb-nav-departments__drawer-close {
	color: var(--mbh-jam, #901c3b);
	background: none;
	-webkit-tap-highlight-color: transparent;
}

/* Phone drawer search: one cream field, matching its placeholder, instead of
 * a grey frame around a cream middle. */
.mbh-header .wb-hero-search--drawer .wb-hero-search__field {
	background: var(--mbh-cream, #fffdf6);
	border-color: rgba(43, 18, 21, 0.14);
}
