/* ═════════════════════════════════════════════════════════════════
   NAVIGATION — Site header and primary nav bar
   ═════════════════════════════════════════════════════════════════ */

.site-header { position: sticky; top: 0; z-index: 200; pointer-events: none; }
.primary-nav {
	pointer-events: auto;
	padding: 1.25rem var(--container-x);
	background: rgba(245,243,239,.92);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-bottom: 1px solid transparent;
	transition: padding .35s ease, border-color .35s, margin .35s, border-radius .35s, background .35s;
}
.primary-nav-inner {
	width: 100%;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: clamp(16px, 2vw, 32px);
}

/* Floating pill state (triggered by JS on scroll) */
.primary-nav.floating {
	margin: .5rem .75rem 0;
	border-radius: 18px;
	border-color: var(--rule);
	box-shadow: 0 8px 28px rgba(0,0,0,.05);
	padding: .75rem 1.5rem;
}

/* ── Logo ── */
.nav-logo { display: inline-flex; align-items: center; }
.logo-img { height: 68px; width: auto; transition: height .35s ease; filter: drop-shadow(0px 1.5px 1.5px rgba(0,0,0,1)); }
.primary-nav.floating .logo-img { height: 52px; }

/* ── Links ── */
.nav-links { list-style: none; display: flex; gap: clamp(24px, 3.1vw, 45px); margin: 0; padding: 0; }
.nav-links > li { position: relative; }
.nav-item-placeholder {
	font-size: var(--fs-nav);
	font-weight: 500;
	color: var(--ink);
	cursor: default;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
/* Real-link variant: when a nav item has a URL it renders as an <a>.
   Override the "placeholder" default-cursor + user-agent underline/colour
   so it reads as an active link and reveals affordance on hover. */
a.nav-item-placeholder {
	cursor: pointer;
	text-decoration: none;
	color: var(--ink);
	transition: color .2s;
}
a.nav-item-placeholder:hover,
a.nav-item-placeholder:focus-visible {
	color: var(--orange);
}
/* Dropdown trigger spans — interactive but not navigational. */
.nav-links > li.has-dropdown > .nav-item-placeholder {
	cursor: pointer;
	user-select: none;
	transition: color .2s;
}
.nav-links > li.has-dropdown > .nav-item-placeholder:hover,
.nav-links > li.has-dropdown > .nav-item-placeholder:focus-visible,
.nav-links > li.has-dropdown.is-open > .nav-item-placeholder {
	color: var(--orange);
	outline: none;
}
.nav-chevron {
	flex-shrink: 0;
	opacity: 1;
	position: relative;
	top: 1px;
	transition: transform .2s ease;
}
.nav-links > li.has-dropdown:hover > .nav-item-placeholder .nav-chevron,
.nav-links > li.has-dropdown:focus-within > .nav-item-placeholder .nav-chevron,
.nav-links > li.has-dropdown.is-open > .nav-item-placeholder .nav-chevron {
	transform: rotate(180deg);
}

/* ── Dropdown panel ──
   Hidden by default; revealed on hover, keyboard focus within the <li>,
   or when JS toggles `.is-open` (touch / click-to-open support). A
   transparent hover bridge (::after) keeps the mouse path from the
   trigger to the panel continuous so the panel doesn't close between
   the two. */
.nav-links > li.has-dropdown::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	height: 14px;
	pointer-events: none;
}
.nav-links > li.has-dropdown:hover::after,
.nav-links > li.has-dropdown:focus-within::after,
.nav-links > li.has-dropdown.is-open::after {
	pointer-events: auto;
}
.nav-dropdown {
	position: absolute;
	top: calc(100% + 12px);
	left: -12px;
	min-width: 220px;
	list-style: none;
	margin: 0;
	padding: 8px;
	background: var(--cream, #F5F3EF);
	border: 1px solid var(--rule, rgba(26,26,26,0.12));
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(0,0,0,.08);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .18s ease, transform .18s ease, visibility .18s;
	pointer-events: none;
	z-index: 10;
}
.nav-links > li.has-dropdown:hover > .nav-dropdown,
.nav-links > li.has-dropdown:focus-within > .nav-dropdown,
.nav-links > li.has-dropdown.is-open > .nav-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}
.nav-dropdown > li { margin: 0; }
.nav-dropdown-link {
	display: block;
	padding: 10px 14px;
	font-size: clamp(15px, 1.5vw, 20px);
	font-weight: 500;
	color: var(--ink);
	text-decoration: none;
	border-radius: 10px;
	white-space: nowrap;
	transition: background .18s ease, color .18s ease;
}
a.nav-dropdown-link:hover,
a.nav-dropdown-link:focus-visible {
	background: rgba(26,26,26,0.05);
	color: var(--orange);
	outline: none;
}

/* Per-top-level-item hover/active overrides.
   Nav order (from header.php): 1=Business, 2=Consumer, 3=CALM,
   4=Loquat IQ, 5=About. Business (1st) uses green on hover/open —
   both on the trigger itself and on its dropdown children. Consumer
   (2nd) stays orange (the site-wide default above); repeated here for
   code symmetry so the intent is visible. Applies on every page. */
.nav-links > li:nth-child(1) > .nav-item-placeholder:hover,
.nav-links > li:nth-child(1) > .nav-item-placeholder:focus-visible,
.nav-links > li:nth-child(1).has-dropdown.is-open > .nav-item-placeholder,
.nav-links > li:nth-child(1) a.nav-dropdown-link:hover,
.nav-links > li:nth-child(1) a.nav-dropdown-link:focus-visible {
	color: var(--green);
}
.nav-links > li:nth-child(2) > .nav-item-placeholder:hover,
.nav-links > li:nth-child(2) > .nav-item-placeholder:focus-visible,
.nav-links > li:nth-child(2).has-dropdown.is-open > .nav-item-placeholder,
.nav-links > li:nth-child(2) a.nav-dropdown-link:hover,
.nav-links > li:nth-child(2) a.nav-dropdown-link:focus-visible {
	color: var(--orange);
}
.nav-dropdown-link.is-disabled {
	color: rgba(26,26,26,0.45);
	cursor: default;
}

/* Primary nav CTA button — pixel-matched to design spec:
   250×71, padding 22px 32px, border-radius 12px, 22px text, line-height 1.2 */
.nav-cta {
	padding: 22px 32px;
	font-size: clamp(16px, 1.55vw, 22px);
	font-weight: 600;
	border-radius: 12px;
	line-height: 1.2;
	letter-spacing: 0;
}

/* ── Mobile burger button ── */
.nav-burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
	-webkit-tap-highlight-color: transparent;
}
.burger-bar {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--ink);
	border-radius: 2px;
	transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-burger[aria-expanded="true"] .burger-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.nav-burger[aria-expanded="true"] .burger-bar:nth-child(2) {
	opacity: 0;
	transform: scaleX(0);
}
.nav-burger[aria-expanded="true"] .burger-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}


/* ── Mobile nav overlay ── */
.mobile-nav {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 201;
	pointer-events: auto;
	background: #fefefd;
	flex-direction: column;
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 0.35s ease, visibility 0s linear 0.35s;
}
.mobile-nav.is-open {
	transform: translateX(0);
	visibility: visible;
	transition: transform 0.35s ease, visibility 0s linear 0s;
}

/* Body: vertically centred list */
.mobile-nav-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	overflow-y: auto;
	padding: clamp(48px, 18vh, 180px) 16px 24px;
}
.mobile-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	width: 100%;
}
.mobile-nav-item {
	text-align: center;
}

/* Top-level links and accordion triggers */
.mobile-nav-link,
.mobile-nav-trigger {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	font-family: var(--f-sans);
	font-size: 24px;
	font-weight: 500;
	color: var(--ink);
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: none;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}
a.mobile-nav-link:hover,
.mobile-nav-trigger:hover { color: var(--orange); }
.mobile-nav-list > li:nth-child(1) > .mobile-nav-trigger:hover,
.mobile-nav-list > li:nth-child(1) > .mobile-nav-trigger[aria-expanded="true"] { color: var(--green); }
.mobile-nav-link.is-disabled { cursor: default; color: rgba(26,26,26,0.4); }

.mobile-nav-chevron {
	flex-shrink: 0;
	transition: transform 0.25s ease;
}
.mobile-nav-trigger[aria-expanded="true"] .mobile-nav-chevron {
	transform: rotate(180deg);
}

/* Accordion sub-list */
.mobile-nav-sub-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.3s ease, margin-top 0.3s ease;
}
.mobile-nav-sub-list.is-open {
	max-height: 400px;
	margin-top: 12px;
}
.mobile-nav-sub-link {
	display: block;
	font-size: 16px;
	font-weight: 400;
	color: rgba(26, 26, 26, 0.55);
	text-decoration: none;
	padding: 4px 0;
}
a.mobile-nav-sub-link:hover { color: var(--orange); }
.mobile-nav-list > li:nth-child(1) a.mobile-nav-sub-link:hover { color: var(--green); }
.mobile-nav-sub-link.is-disabled { cursor: default; }

/* Footer: social + copyright + privacy */
.mobile-nav-footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 20px 16px 28px;
	flex-shrink: 0;
}
.mobile-nav-socials {
	display: flex;
	align-items: center;
	gap: 20px;
}
.mobile-social-icon img {
	width: 24px;
	height: 24px;
	object-fit: contain;
	opacity: 0.5;
}
.mobile-nav-footer-info {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #666;
}
.mobile-nav-privacy {
	font-size: 14px;
	color: var(--ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}
body.nav-is-open { overflow: hidden; }
body.nav-is-open .site-header { position: fixed; width: 100%; }


/* ── Responsive ── */
@media (max-width: 1024px) {
	.nav-links { gap: 1.25rem; }
	.nav-item-placeholder { font-size: 24px; }
	.logo-img { height: 48px; }
	.nav-cta { padding: 14px 20px; font-size: 16px; border-radius: 10px; }
}
@media (max-width: 767px) {
	.primary-nav {
		padding: .75rem 16px;
		background: rgba(255,255,255,.9);
		backdrop-filter: blur(4px);
		-webkit-backdrop-filter: blur(4px);
		border-bottom: 1px solid #e5e5e5;
	}
	.primary-nav.floating {
		margin: 0;
		border-radius: 0;
		border-color: #e5e5e5;
		box-shadow: none;
		padding: .75rem 16px;
	}
	.primary-nav.floating .logo-img { height: auto; width: 95px; }
	.primary-nav-inner { gap: 0; }
	.nav-links { display: none; }
	.logo-img { height: auto; min-width: 95px; width: 70%; }
	.nav-cta { margin-left: auto; padding: 10px 16px; font-size: 16px; border-radius: 6px; min-width: 0; flex-shrink: 0; }
	.nav-burger { display: flex; flex-shrink: 0; margin-left: 16px; }
	.mobile-nav { display: flex; top: 65px; }
}
