/*
 * B45 — the grouped PHONE menu (her mockup, 5 Nov 2026:
 * docs/client-mockups/B45-menu-mockup-client-2026-11-05.png).
 *
 * Fahad, 9 Nov 2026: the desktop main menu stays exactly as it was; only the
 * phone/tablet menu is her grouped slide-in panel. So the grouped list is a
 * separate "Mobile Menu" (OC_Menu_Groups, location oc_mobile) printed inside
 * the same <nav> as the main menu, with .oc-nav__list--mobile and
 * .oc-nav__list--grouped. theme.js adds .oc-nav--drawer to the <nav> when it is
 * there. Without a Mobile Menu nothing here applies and the old phone dropdown
 * shows the main menu as before.
 *
 * Below the 1180 px hamburger breakpoint (style.css): a full-height drawer from
 * the left, ~78 % wide, logo and close at the top, groups under small grey
 * capitals, every row icon + label + chevron, nothing collapsed.
 */

/* Never on desktop: the Mobile Menu list, the drawer's own top row, the group
   headings and row chevrons. The main menu above them is untouched. */
.oc-nav__list--mobile,
.oc-drawer__head,
.oc-nav__group-heading,
.oc-nav__row-chev,
.oc-nav-overlay { display: none; }
/* style.css lays out every list in the nav with `.oc-nav ul { display: flex }`
   (0,1,1), which beat the plain rule above and showed the phone list beside
   the desktop menu (9 Nov). This one is stronger; the open drawer below is
   stronger still. */
.oc-nav ul.oc-nav__list--mobile { display: none; }

/* Rows: icon + label (+ chevron). Icon in the brand colour, label in ink. */
.oc-nav__list--grouped .oc-nav__row > a {
	display: flex;
	align-items: center;
	gap: 14px;
}
.oc-nav__icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: var(--oc-burgundy);
}
.oc-nav__icon-svg { display: block; width: 22px; height: 22px; }
.oc-nav__label { flex: 1 1 auto; min-width: 0; }

@media (max-width: 1179px) {
	/* In the drawer the Mobile Menu replaces the main menu. */
	.oc-nav--drawer .oc-nav__list:not(.oc-nav__list--mobile) { display: none !important; }
	.oc-nav--drawer.oc-nav--open ul.oc-nav__list--mobile { display: block; }

	/* The drawer itself. Fixed to the left edge, full height with its own
	   scroll — never taller than the screen, so the last row is always
	   reachable (USER-JOURNEY: "a menu that ate the screen"). */
	.oc-nav--drawer.oc-nav--open {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		right: auto;
		width: 78vw;
		max-width: 360px;
		min-width: 280px;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
		border: 0;
		border-radius: 0;
		background: var(--oc-white);
		box-shadow: 8px 0 32px rgba(31, 27, 26, 0.18);
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		z-index: 100001;
		animation: oc-drawer-in .22s ease-out;
	}
	@keyframes oc-drawer-in {
		from { transform: translateX(-100%); }
		to   { transform: translateX(0); }
	}

	/* The drawer and its overlay are position:fixed INSIDE the header, and a
	   header with backdrop-filter is the containing block for its fixed
	   children (style.css gives the home header and every stuck header a
	   blur). Found 18 Nov 2026 on live, WebKit iPhone 14: the overlay shrank
	   to the 64px header, the page beside the drawer stayed bright, a tap
	   there closed nothing, and a swipe on the page carried the drawer off
	   the top (iOS lets the body scroll under overflow:hidden). While the
	   drawer is open the blur sits behind the overlay anyway, so drop it. */
	body.oc-no-scroll .oc-site-header,
	body.oc-no-scroll #masthead .oc-site-header--widget {
		-webkit-backdrop-filter: none !important;
		backdrop-filter: none !important;
		filter: none !important;
		transform: none !important;
	}

	/* The dimmed page behind it; a tap here closes the drawer. */
	.oc-nav-overlay.is-visible {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(31, 27, 26, 0.6);
		z-index: 100000;
		animation: oc-overlay-in .22s ease-out;
	}
	@keyframes oc-overlay-in { from { opacity: 0; } to { opacity: 1; } }

	/* Top row: logo left, close right, a hairline under it. */
	.oc-nav--drawer.oc-nav--open .oc-drawer__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		position: sticky;
		top: 0;
		z-index: 1;
		padding: 16px 16px 16px 24px;
		padding-top: calc(16px + env(safe-area-inset-top, 0px));
		background: var(--oc-white);
		border-bottom: 1px solid var(--oc-border);
	}
	/* The logo link sits inside the nav, so the menu's own link rules (padding,
	   radius, the cream hover/active fill) would reach it; it gets none of them. */
	.oc-nav--drawer.oc-nav--open .oc-drawer__brand,
	.oc-nav--drawer.oc-nav--open .oc-drawer__brand:hover,
	.oc-nav--drawer.oc-nav--open .oc-drawer__brand:focus {
		display: inline-flex;
		align-items: center;
		min-width: 0;
		padding: 0;
		border-radius: 0;
		background: none;
		text-decoration: none;
	}
	.oc-nav--drawer.oc-nav--open .oc-drawer__brand:focus-visible { outline: 3px solid var(--oc-gold); outline-offset: 4px; }
	.oc-drawer__brand img { display: block; max-height: 40px; width: auto; max-width: 100%; }
	.oc-drawer__close {
		flex: 0 0 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		border-radius: 8px;
		background: transparent;
		color: var(--oc-ink);
		cursor: pointer;
	}
	.oc-drawer__close:hover { background: var(--oc-cream); }
	.oc-drawer__close:focus-visible { outline: 3px solid var(--oc-gold); outline-offset: 2px; }

	/* The list: groups stacked, nothing indented, nothing collapsed. */
	.oc-nav--drawer.oc-nav--open .oc-nav__list--grouped {
		padding: 0;
		margin: 0;
	}
	.oc-nav--drawer.oc-nav--open .oc-nav__group {
		display: block;
		width: 100%;
		position: relative;
		padding: 0;
	}
	/* Inset hairline between groups, as in the mockup. */
	.oc-nav--drawer.oc-nav--open .oc-nav__group + .oc-nav__group::before {
		content: '';
		display: block;
		height: 1px;
		margin: 8px 24px 0;
		background: var(--oc-border);
	}
	.oc-nav--drawer.oc-nav--open .oc-nav__group-heading {
		display: block;
		padding: 20px 24px 6px;
		font-size: 0.75rem;
		font-weight: 500;
		letter-spacing: 0.16em;
		text-transform: uppercase;
		color: var(--oc-stone);
		line-height: 1.4;
	}

	/* Groups are always open: her ask was that the tools "stand on their own
	   and be visible once someone clicks on the menu". */
	.oc-nav--drawer.oc-nav--open .oc-nav__group > .sub-menu,
	.oc-nav--drawer.oc-nav--open .oc-nav__group > .sub-menu.sub-menu-open {
		display: block !important;
		position: static;
		margin: 0;
		padding: 0;
		border: 0;
		box-shadow: none;
		background: transparent;
		min-width: 0;
		opacity: 1;
		visibility: visible;
		transform: none;
	}
	.oc-nav--drawer.oc-nav--open .oc-nav__row { display: block; width: 100%; }
	.oc-nav--drawer.oc-nav--open .oc-nav__row > a {
		min-height: 52px;
		padding: 10px 20px 10px 24px;
		border-radius: 0;
		font-size: 1rem;
		font-weight: 400;
		line-height: 1.3;
		color: var(--oc-ink);
		white-space: normal; /* a long label wraps inside its row at 320 px */
		background: transparent;
	}
	.oc-nav--drawer.oc-nav--open .oc-nav__row > a:hover,
	.oc-nav--drawer.oc-nav--open .oc-nav__row > a:focus-visible { background: var(--oc-cream); }
	.oc-nav--drawer.oc-nav--open .oc-nav__row > a:focus-visible { outline: 3px solid var(--oc-gold); outline-offset: -3px; }
	/* The page you are on: tint, weight and the brand colour (never colour alone). */
	.oc-nav--drawer.oc-nav--open .oc-nav__row.current-menu-item > a {
		background: var(--oc-cream);
		color: var(--oc-burgundy);
		font-weight: 600;
		box-shadow: inset 3px 0 0 var(--oc-burgundy);
	}
	.oc-nav--drawer.oc-nav--open .oc-nav__row-chev {
		display: inline-block;
		flex: 0 0 auto;
		width: 8px;
		height: 8px;
		margin-left: 8px;
		border-right: 1.75px solid currentColor;
		border-top: 1.75px solid currentColor;
		transform: rotate(45deg);
		opacity: 0.7;
	}
}

@media (prefers-reduced-motion: reduce) {
	.oc-nav--drawer.oc-nav--open,
	.oc-nav-overlay.is-visible { animation: none; }
}
