/**
 * Custom Navigation Menu Styles
 * Matches screenshots exactly:
 *   Desktop  — black bar, horizontal items, chevron on parents only
 *   Mobile   — standalone black hamburger button
 *   Drawer   — black panel, red X, large text, oval chevron toggle buttons
 */

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
.cnm-nav {
	--cnm-bg:            #0a0a0a;
	--cnm-text:          #ffffff;
	--cnm-text-dim:      rgba(255,255,255,0.55);   /* "Home" muted style */
	--cnm-text-sub:      rgba(255,255,255,0.70);
	--cnm-accent:        #e03030;                  /* red close button   */
	--cnm-hover-bg:      rgba(255,255,255,0.07);
	--cnm-divider:       rgba(255,255,255,0.10);
	--cnm-drawer-width:  68vw;
	--cnm-drawer-max:    360px;
	--cnm-overlay-bg:    rgba(0,0,0,0.60);
	--cnm-ease:          0.28s cubic-bezier(0.4,0,0.2,1);
	--cnm-bar-height:    64px;
	--cnm-z-overlay:     10000;
	--cnm-z-drawer:      10001;

	/* ── FONT SIZES — change these to resize the whole menu ── */
	--cnm-font-desktop:        15px;   /* desktop top-level items          */
	--cnm-font-dropdown:       14px;   /* desktop dropdown items           */
	--cnm-font-mobile:         22px;   /* mobile drawer top-level items    */
	--cnm-font-mobile-sub:     18px;   /* mobile drawer sub-items          */
	--cnm-font-mobile-sub2:    16px;   /* mobile drawer level-3 items      */
}

/* ============================================================
   RESET
   ============================================================ */
.cnm-nav *, .cnm-nav *::before, .cnm-nav *::after {
	box-sizing: border-box; margin: 0; padding: 0;
}
.cnm-nav ul  { list-style: none; }
.cnm-nav a   { text-decoration: none; color: inherit; }
.cnm-nav button {
	cursor: pointer; border: none; background: none;
	font: inherit; color: inherit; line-height: 1;
}

/* ============================================================
   DESKTOP BAR  (hidden on mobile ≤ 768px)
   ============================================================ */
.cnm-desktop-bar {
	display: none;
	align-items: center;
	background: var(--cnm-bg);
	color: var(--cnm-text);
	min-height: var(--cnm-bar-height);
	width: 100%;
	padding: 0 24px;
}

/* Hide the hamburger inside the desktop bar on desktop */
.cnm-desktop-bar .cnm-hamburger {
	display: none;
}

/* Desktop nav fills the bar */
.cnm-desktop-nav {
	width: 100%;
}

/* Top-level list */
.cnm-list--desktop {
	display: flex;
	align-items: center;
	height: var(--cnm-bar-height);
	gap: 0;
}

/* Every top-level <li> */
.cnm-list--desktop > .cnm-item {
	position: relative;
	height: 100%;
	display: flex;
	align-items: center;
}

/* Top-level link */
.cnm-list--desktop > .cnm-item > .cnm-link {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 100%;
	padding: 0 20px;
	font-size: var(--cnm-font-desktop);
	font-weight: 500;
	letter-spacing: 0.01em;
	color: var(--cnm-text);
	white-space: nowrap;
	transition: color var(--cnm-ease);
}

/* "Home" appears slightly dimmer — matches screenshot */
.cnm-list--desktop > .cnm-item:first-child > .cnm-link {
	color: var(--cnm-text-dim);
}

.cnm-list--desktop > .cnm-item > .cnm-link:hover,
.cnm-list--desktop > .cnm-item > .cnm-link:focus-visible {
	color: var(--cnm-text);
	outline: none;
}

/* Chevron */
.cnm-list--desktop > .cnm-item > .cnm-link .cnm-chevron {
	display: flex;
	align-items: center;
	transition: transform var(--cnm-ease);
}
.cnm-list--desktop > .cnm-item.cnm-open > .cnm-link .cnm-chevron {
	transform: rotate(-180deg);
}

/* ---- DESKTOP DROPDOWN ---- */
.cnm-dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 210px;
	background: #111111;
	box-shadow: 0 10px 32px rgba(0,0,0,0.55);
	border-top: 2px solid var(--cnm-accent);
	border-radius: 0 0 6px 6px;
	padding: 6px 0;
	z-index: 300;
}

/* Open on HOVER (primary) */
.cnm-list--desktop > .cnm-item.cnm-has-children:hover > .cnm-dropdown {
	display: block;
	animation: cnmFadeDown 0.16s ease both;
}

/* Also open on click via .cnm-open class (JS fallback / keyboard) */
.cnm-list--desktop > .cnm-item.cnm-open > .cnm-dropdown {
	display: block;
	animation: cnmFadeDown 0.16s ease both;
}

/* Rotate chevron on hover too */
.cnm-list--desktop > .cnm-item.cnm-has-children:hover > .cnm-link .cnm-chevron {
	transform: rotate(-180deg);
}
@keyframes cnmFadeDown {
	from { opacity:0; transform:translateY(-5px); }
	to   { opacity:1; transform:translateY(0); }
}

.cnm-dropdown .cnm-link {
	display: block;
	padding: 11px 22px;
	font-size: var(--cnm-font-dropdown);
	font-weight: 400;
	color: rgba(255,255,255,0.85);
	transition: background var(--cnm-ease), color var(--cnm-ease);
	white-space: nowrap;
}
.cnm-dropdown .cnm-link:hover,
.cnm-dropdown .cnm-link:focus-visible {
	background: var(--cnm-hover-bg);
	color: #fff;
	outline: none;
}

/* Nested level-2 flyout */
.cnm-dropdown .cnm-item.cnm-has-children { position: relative; }
.cnm-dropdown .cnm-item.cnm-has-children > .cnm-dropdown {
	top: 0; left: 100%;
	border-top: none; border-left: 2px solid var(--cnm-accent);
}
.cnm-dropdown .cnm-item.cnm-has-children:hover > .cnm-dropdown,
.cnm-dropdown .cnm-item.cnm-open > .cnm-dropdown { display: block; }

/* ============================================================
   MOBILE HAMBURGER  (standalone block, visible only ≤ 768px)
   ============================================================ */
.cnm-mobile-trigger-wrap {
	display: block;
}
.cnm-hamburger-standalone {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	background: var(--cnm-bg);
	color: var(--cnm-text);
	border-radius: 6px;
	transition: background var(--cnm-ease);
}
.cnm-hamburger-standalone:hover { background: #1a1a1a; }
.cnm-hamburger-standalone:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* ============================================================
   OVERLAY
   ============================================================ */
.cnm-overlay {
	position: fixed; inset: 0;
	background: var(--cnm-overlay-bg);
	z-index: var(--cnm-z-overlay);
	opacity: 0; visibility: hidden;
	transition: opacity var(--cnm-ease), visibility var(--cnm-ease);
}
.cnm-overlay.cnm-overlay--visible {
	opacity: 1; visibility: visible;
}

/* ============================================================
   MOBILE DRAWER
   ============================================================ */
.cnm-drawer {
	position: fixed;
	top: 0; left: 0;
	width: var(--cnm-drawer-width);
	max-width: var(--cnm-drawer-max);
	height: 100%; height: 100dvh;
	background: var(--cnm-bg);
	color: var(--cnm-text);
	z-index: var(--cnm-z-drawer);
	transform: translateX(-110%);
	transition: transform var(--cnm-ease);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	will-change: transform;
}
.cnm-drawer.cnm-drawer--open {
	transform: translateX(0);
}

/* ---- Close button row (top of drawer) ---- */
.cnm-drawer-header {
	display: flex;
	align-items: center;
	justify-content: flex-end;   /* X button flush right */
	padding: 14px 16px;
	flex-shrink: 0;
}

/* Red square X button — matches screenshot exactly */
.cnm-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	background: var(--cnm-accent);
	color: #ffffff;
	border-radius: 6px;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0;
	transition: background var(--cnm-ease);
	flex-shrink: 0;
}
.cnm-close:hover  { background: #c01818; }
.cnm-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---- Drawer scrollable body ---- */
.cnm-drawer-body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 8px 0 40px;
	-webkit-overflow-scrolling: touch;
}
.cnm-drawer-body::-webkit-scrollbar { width: 4px; }
.cnm-drawer-body::-webkit-scrollbar-track { background: transparent; }
.cnm-drawer-body::-webkit-scrollbar-thumb {
	background: rgba(255,255,255,0.15); border-radius: 4px;
}

/* ============================================================
   MOBILE MENU LIST
   ============================================================ */
.cnm-list--mobile {
	width: 100%;
	padding-top: 12px;
}

/* Each top-level item — generous vertical gap between items */
.cnm-list--mobile > .cnm-item {
	width: 100%;
}

/* Plain leaf item + catch-all for WooCommerce/custom items like Logout */
.cnm-list--mobile > .cnm-item > .cnm-link,
.cnm-list--mobile > li > a:not(.cnm-toggle) {
	display: flex;
	align-items: center;
	font-size: var(--cnm-font-mobile);
	font-weight: 500;
	color: var(--cnm-text);
	letter-spacing: 0.01em;
	padding: 14px 24px;
	min-height: 64px;
	width: 100%;
	text-decoration: none;
	transition: color var(--cnm-ease);
}

/* Item row: link + oval toggle side by side (parent items) */
.cnm-item-row {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 0 16px 0 24px;
	min-height: 64px;
}

.cnm-item-row > .cnm-link {
	flex: 1;
	display: flex;
	align-items: center;
	font-size: var(--cnm-font-mobile);
	font-weight: 500;
	color: var(--cnm-text);
	letter-spacing: 0.01em;
	min-height: 64px;
	padding: 0;
	transition: color var(--cnm-ease);
}

/* "Home" slightly dimmed — matches screenshot */
.cnm-list--mobile > .cnm-item:first-child > .cnm-link,
.cnm-list--mobile > .cnm-item:first-child > .cnm-item-row > .cnm-link {
	color: var(--cnm-text-dim);
}

.cnm-list--mobile .cnm-link:hover,
.cnm-list--mobile .cnm-link:focus-visible {
	color: var(--cnm-text);
	outline: none;
}

/* ---- Oval pill toggle button ---- */
.cnm-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 40px;
	border: 1.5px solid rgba(255,255,255,0.40);
	border-radius: 999px;
	color: var(--cnm-text);
	flex-shrink: 0;
	transition: border-color var(--cnm-ease);
}
.cnm-toggle svg {
	transition: transform var(--cnm-ease);
}
.cnm-toggle[aria-expanded="true"] svg {
	transform: rotate(-180deg);
}
.cnm-toggle:hover,
.cnm-toggle:focus-visible {
	border-color: rgba(255,255,255,0.75);
	outline: none;
}

/* ---- Mobile sub-menu accordion ---- */
.cnm-sub {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.cnm-sub.cnm-sub--open {
	max-height: 1400px;
}

/* Sub items */
.cnm-sub .cnm-item { width: 100%; }

.cnm-sub > .cnm-item > .cnm-link,
.cnm-sub > .cnm-item > .cnm-item-row > .cnm-link {
	display: flex;
	align-items: center;
	font-size: var(--cnm-font-mobile-sub);
	font-weight: 400;
	color: var(--cnm-text-sub);
	padding: 12px 24px 12px 44px;
	min-height: 48px;
	transition: color var(--cnm-ease), background var(--cnm-ease);
}
.cnm-sub > .cnm-item > .cnm-link:hover,
.cnm-sub > .cnm-item > .cnm-item-row > .cnm-link:hover {
	color: #fff;
	background: var(--cnm-hover-bg);
}

/* Level-3 deeper indent */
.cnm-sub .cnm-sub > .cnm-item > .cnm-link,
.cnm-sub .cnm-sub > .cnm-item > .cnm-item-row > .cnm-link {
	padding-left: 60px;
	font-size: var(--cnm-font-mobile-sub2);
}

/* Sub-item toggle pill (slightly smaller) */
.cnm-sub .cnm-toggle {
	width: 46px;
	height: 34px;
}

/* ============================================================
   BODY SCROLL LOCK
   ============================================================ */
body.cnm-body-lock { overflow: hidden; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Desktop: show bar, hide mobile trigger */
@media (min-width: 769px) {
	.cnm-desktop-bar          { display: flex !important; }
	.cnm-mobile-trigger-wrap  { display: none !important; }
}

/* Mobile: hide desktop bar, show standalone hamburger */
@media (max-width: 768px) {
	.cnm-desktop-bar          { display: none !important; }
	.cnm-mobile-trigger-wrap  { display: block !important; }
}

/* ============================================================
   ASTRA / WOOCOMMERCE OVERRIDE FIXES
   Force correct styling regardless of theme/plugin resets
   ============================================================ */

/* Fix icon color — override Astra's button color reset */
.cnm-hamburger-standalone,
.cnm-hamburger-standalone:hover,
.cnm-hamburger-standalone:focus {
	color: #ffffff !important;
	background: #0a0a0a !important;
	background-color: #0a0a0a !important;
}

/* Make SVG lines white explicitly — currentColor not enough
   when Astra overrides color on <button> */
.cnm-hamburger-standalone svg {
	color: #ffffff !important;
	stroke: #ffffff !important;
}

.cnm-hamburger-standalone svg line {
	stroke: #ffffff !important;
}

/* Fix click offset — WooCommerce media query adds padding to all buttons
   on small screens. Zero it out and use our own padding instead. */
@media (max-width: 544px) {
	.cnm-hamburger-standalone {
		padding: 12px !important;
		margin: 0 !important;
		width: 62px !important;
		height: 62px !important;
		line-height: 1 !important;
		min-height: unset !important;
		min-width: unset !important;
		border: none !important;
		border-radius: 6px !important;
		display: flex !important;
		align-items: center !important;
		justify-content: center !important;
		position: static !important;
		top: auto !important;
		transform: none !important;
	}
}
