/**
 * Mobile menu: template-parts/header/mobile-menu.php (2304:1268), below 1280.
 * White panel under the header, rounded bottom corners, page dimmed below.
 * The primary menu is a horizontally scrolling tab strip; the selected
 * category's mega menu content is stacked below it (.mega--stacked).
 */

/* Fixed, not absolute: the page cannot scroll while the menu is open, and a
 * short page would otherwise clip it. navigation.js sets --xat-menu-top to the
 * header's bottom edge. */
.mobile-menu {
	position: fixed;
	z-index: 2;
	top: var(--xat-menu-top, 95px);
	right: 0;
	left: 0;
	box-sizing: border-box;
	max-height: calc(100dvh - var(--xat-menu-top, 95px));
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 20px 32px;
	border-radius: 0 0 var(--radius-xl) var(--radius-xl);
	background: var(--color-white);
	box-shadow: var(--shadow-panel);
}

.mobile-menu[hidden] {
	display: none;
}

.mobile-menu-dim {
	position: fixed;
	top: var(--xat-menu-top, 95px);
	bottom: 0;
	height: auto;
}

.mobile-menu__nav {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
}

/* Tab strip: the cream nav pill, scrolling sideways past the right edge. */

.mobile-menu__tabs {
	display: flex;
	gap: 6px;
	margin: 0 -20px 0 0;
	padding: 6px;
	overflow-x: auto;
	border-radius: var(--radius-pill) 0 0 var(--radius-pill);
	background: var(--color-cream);
	list-style: none;
	scrollbar-width: none;
}

.mobile-menu__tabs::-webkit-scrollbar {
	display: none;
}

.mobile-menu__tab-item {
	flex: none;
}

.mobile-menu__tab {
	display: flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: 48px;
	margin: 0;
	padding: 6px 14px 6px 6px;
	border: 0;
	border-radius: var(--radius-pill);
	background: none;
	color: var(--color-ink);
	font-family: inherit;
	font-size: var(--text-label-m);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-label-m);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

a.mobile-menu__tab:not(:has(img)) {
	padding: 12px 14px;
}

.mobile-menu__tab[aria-expanded="true"],
.mobile-menu__tab[aria-current="page"] {
	background: var(--color-white);
}

.mobile-menu__thumb {
	display: block;
	flex: none;
	width: auto;
	max-width: 36px;
	height: auto;
	max-height: 36px;
	object-fit: contain;
}

.mobile-menu__chevron {
	flex: none;
	transition: transform 0.15s ease;
}

.mobile-menu__tab[aria-expanded="true"] .mobile-menu__chevron {
	transform: rotate(180deg);
}

/* Mega menu content, stacked: types, divider, SHOP, promo. */

.mega--stacked {
	position: static;
	border-radius: 0;
	background: none;
	box-shadow: none;
}

.mega--stacked .mega__inner {
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-md);
	max-width: none;
	padding: 0;
}

.mega--stacked .mega__subs,
.mega--stacked .mega__shop {
	width: auto;
}

.mega--stacked .mega__divider {
	order: 1;
	width: auto;
	height: 1px;
}

.mega--stacked .mega__shop {
	order: 2;
}

.mega--stacked .mega__promo {
	order: 3;
	height: auto;
	padding: 28px 24px;
	border-radius: var(--radius-lg);
}

.mega--stacked .mega__promo-copy {
	gap: var(--space-sm);
	max-width: none;
}

.mega--stacked .mega__promo-title {
	font-size: 32px;
}

.mega--stacked .mega__promo-text {
	max-width: none;
	font-size: var(--text-body-s);
	line-height: var(--leading-body-s);
}

/* Page behind the open menu does not scroll. On <html> only: overflow on
 * <body> would make it the sticky header's scroll container, and a header
 * stuck further down the page would scroll away with it. */
.is-menu-open {
	overflow: hidden;
}

@media (min-width: 768px) {
	.mobile-menu {
		padding-inline: var(--container-gutter);
	}

	.mobile-menu__tabs {
		margin-right: calc(var(--container-gutter) * -1);
	}
}

@media (min-width: 1280px) {
	.mobile-menu,
	.mobile-menu-dim {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mobile-menu__chevron {
		transition: none;
	}
}
