/*
 * NSEMM Site Header block styles.
 *
 * Faithful port of the home-v6 wireframe header CSS. Per-block CSS loads
 * independently, so the shared local-var mapping is redefined here at :root
 * (it must NOT hard-code brand hex, so Brand-Sync keeps recolouring this).
 * gold-dark is a hover shade not present in the locked palette.
 *
 * SCOPING: WordPress puts "page"/"home"/etc. on <body> and wraps template
 * parts in their own elements, so every styling hook here is namespaced.
 * Bare landmark selectors (header, nav) are scoped under .hdr-wrap so they
 * cannot leak onto WordPress's template-part wrappers; the global html
 * scroll-behavior is owned by the theme, not redefined here.
 */
:root {
	--blue: var(--wp--preset--color--university-blue);
	--gold: var(--wp--preset--color--knowledge-gold);
	--teal: var(--wp--preset--color--discovery-teal);
	--brown: var(--wp--preset--color--foundational-brown);
	--sandy: var(--wp--preset--color--sandy-brown);
	--midnight: var(--wp--preset--color--midnight);
	--bg: var(--wp--preset--color--white);
	--gold-dark: #D4AC00;
	--r-hdr: 20px;
	--r-btn-scrolled: 12px;
	--r-pill: 9999px;
	--r-card: 16px;
	--aql-h: 64px;
	--body: var(--wp--preset--font-family--readex-pro);
	--head: var(--wp--preset--font-family--sora);
}

/* ── UTILITY BAR ── */
.util { background: var(--blue); padding: 7px 48px; display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 300; max-height: 80px; overflow: hidden; transition: opacity .28s ease, max-height .3s ease, padding .3s ease; }
.util-tag { font-size: 12px; color: var(--gold); font-weight: 500; font-family: var(--head); letter-spacing: .01em; }
.util-nav { display: flex; gap: 20px; }
.util-nav a { font-size: 12px; color: color-mix(in srgb, #fff 92%, transparent); text-decoration: none; transition: color .15s; }
.util-nav a:hover { color: #fff; }

/* ── DARK-MODE TOGGLE (utility-bar instance) ──
   Sits in the util-nav row on the University-Blue utility bar. Gold glyph to echo
   .util-tag, ≥44px hit target (the visible chip is smaller but the padded button
   meets the target). The icon swap is attribute-driven: by default (light, or no
   explicit choice on a light OS) the MOON shows to offer dark; under
   html[data-theme="dark"] (and the system-dark default) the SUN shows to offer
   light. All of this is gated so light mode is untouched aside from this new,
   self-contained control. */
.nsemm-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	margin: -11px 0; /* keep the 44px target without growing the 7px-tall bar */
	padding: 0 8px;
	background: transparent;
	border: none;
	cursor: pointer;
	color: var(--gold);
	line-height: 0;
	transition: color .15s, opacity .15s;
	opacity: .85;
}
.nsemm-theme-toggle:hover { opacity: 1; color: #fff; }
.nsemm-theme-toggle .nsemm-toggle-icon { display: block; }
/* Default (light / unset): show the moon (action = go dark), hide the sun. */
.nsemm-theme-toggle .nsemm-toggle-sun { display: none; }
.nsemm-theme-toggle .nsemm-toggle-moon { display: block; }
/* Explicit dark: show the sun (action = go light), hide the moon. */
html[data-theme="dark"] .nsemm-theme-toggle .nsemm-toggle-sun { display: block; }
html[data-theme="dark"] .nsemm-theme-toggle .nsemm-toggle-moon { display: none; }
/* System dark with no explicit choice: same as explicit dark. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]):not([data-theme="dark"]) .nsemm-theme-toggle .nsemm-toggle-sun { display: block; }
	:root:not([data-theme="light"]):not([data-theme="dark"]) .nsemm-theme-toggle .nsemm-toggle-moon { display: none; }
}

/* ── HEADER MORPH: flat full-width → floating rounded rectangle ── */
.hdr-wrap {
	position: sticky; top: 0; z-index: 200;
	transition: padding .45s cubic-bezier(.4,0,.2,1),
				transform .35s cubic-bezier(.4,0,.2,1),
				opacity .3s ease;
}
/* Flat header at top: slides up and away */
.hdr-wrap.nav-open { transform: translateY(-110%); opacity: 0; pointer-events: none; }
/* Scrolled pill: just fades – a pill sliding off-screen looks wrong */
.hdr-wrap.nav-open-fade { opacity: 0; pointer-events: none; }
.hdr-wrap header {
	background: var(--gold); border-radius: 0;
	padding: 14px 24px 14px 40px;
	display: flex; align-items: center; justify-content: space-between;
	position: relative; /* anchor for the absolutely-positioned hamburger crossfade */
	max-width: 100%; margin: 0 auto; box-shadow: none;
	transition:
		border-radius .45s cubic-bezier(.4,0,.2,1),
		padding .45s cubic-bezier(.4,0,.2,1),
		max-width .45s cubic-bezier(.4,0,.2,1),
		margin .45s cubic-bezier(.4,0,.2,1),
		box-shadow .45s cubic-bezier(.4,0,.2,1),
		background .3s ease;
}
.hdr-wrap.scrolled { padding: 10px 16px; }
.hdr-wrap.scrolled header {
	border-radius: var(--r-hdr); max-width: 1300px; margin: 0 auto;
	padding: 11px 20px;
	box-shadow: 0 6px 32px color-mix(in srgb, #000 13%, transparent), 0 1px 6px color-mix(in srgb, #000 7%, transparent);
}
.hdr-wrap.scrolled header.light { background: #fff; }

/* LOGO */
.hdr-wrap .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.hdr-wrap .logo-img { height: 40px; width: auto; display: block; }
.hdr-wrap .logo-mark {
	width: 38px; height: 38px; background: var(--blue); border-radius: 10px;
	display: flex; align-items: center; justify-content: center;
	font-family: var(--head); font-weight: 700; font-size: 15px; color: var(--gold);
	flex-shrink: 0; transition: transform .2s;
}
.hdr-wrap .logo:hover .logo-mark { transform: scale(1.06); }
.hdr-wrap .logo-text { font-family: var(--head); font-weight: 700; font-size: 20px; color: var(--brown); transition: color .3s; }
.hdr-wrap header.light .logo-text { color: var(--blue); }

/* ── NAV ── */
.hdr-wrap nav { display: flex; gap: 2px; align-items: center; }

/* ── RESPONSIVE CROSSFADE (desktop = nav + buttons shown) ──
   Crossing the 900px line crossfades the full nav + the CTA buttons OUT and the
   hamburger IN (see the 900px block + the hamburger rule). nav/.ctag stay in the
   flex flow and collapse via opacity + max-width (overflow:hidden) so they
   reserve no width once hidden and never produce a horizontal scrollbar; the
   max-width is generous so it never constrains the real content on desktop. The
   media query flips these values on resize, which animates the transition. */
.hdr-wrap nav,
.hdr-wrap .ctag {
	opacity: 1;
	max-width: 760px;
	transition: opacity .28s ease, max-width .32s ease;
}
.ni { position: relative; }
.ni > a {
	font-family: var(--head); font-size: 14px; font-weight: 600; color: var(--brown);
	text-decoration: none; padding: 9px 13px; border-radius: 10px;
	display: flex; align-items: center; gap: 5px;
	transition: background .15s, color .15s, opacity .15s;
	white-space: nowrap; cursor: pointer; opacity: .8;
}
.hdr-wrap header.light .ni > a { color: var(--blue); }
.ni > a:hover, .ni:hover > a { background: color-mix(in srgb, #000 7%, transparent); opacity: 1; }
.chev { display: inline-block; transition: transform .25s; opacity: .55; flex-shrink: 0; }
.ni:hover > a .chev { transform: rotate(180deg); opacity: .9; }

/* ── MEGA PANEL
   All items the same height: fixed icon, title on one line, subtitle on one
   line (truncated). Layout (grid-template-columns + min-width) is set inline by
   the walker per child count, matching the wireframe. ── */
.mega {
	position: absolute; top: calc(100% + 4px); left: 50%;
	transform: translateX(-50%) translateY(6px);
	background: var(--sandy); border-radius: var(--r-card);
	padding: 10px;
	box-shadow: 0 12px 44px color-mix(in srgb, #000 13%, transparent), 0 2px 8px color-mix(in srgb, #000 5%, transparent);
	border: 1px solid color-mix(in srgb, #000 6%, transparent);
	display: grid; gap: 2px;
	opacity: 0; pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
}
/* Invisible bridge covers the gap so mouse can travel from trigger to panel */
.mega::before {
	content: ''; position: absolute;
	top: -20px; left: -20px; right: -20px; height: 24px;
	background: transparent;
}
.ni:hover .mega { opacity: 1; pointer-events: all; transform: translateX(-50%) translateY(0); }
.ml {
	display: flex; align-items: center; gap: 11px;
	padding: 10px 12px; border-radius: 10px; text-decoration: none;
	min-height: 56px;
	transition: background .15s;
}
.ml:hover { background: color-mix(in srgb, #000 5%, transparent); }
.ml-ic {
	width: 32px; height: 32px; border-radius: 8px; background: var(--blue);
	display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ml-ic i { font-size: 15px; line-height: 1; color: #fff; }
.ml-t { flex: 1; min-width: 0; }
.ml-t strong {
	display: block; font-family: var(--head); font-size: 13px; font-weight: 600; color: var(--blue);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ml-t span {
	font-size: 12px; color: var(--midnight); opacity: .6; line-height: 1.3;
	display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── HEADER CTA BUTTONS
   Unscrolled: full pill. Scrolled: 12px – echoes the header's rounded-rect. ── */
.ctag { display: flex; gap: 8px; margin-right: -4px; }
.btn-p {
	background: var(--blue); color: #fff;
	font-family: var(--head); font-size: 13px; font-weight: 600;
	padding: 9px 22px;
	border-radius: 20px;
	transition: background .18s ease, transform .18s ease, box-shadow .18s ease,
				border-radius .45s cubic-bezier(.4,0,.2,1),
				opacity .25s ease;
	text-decoration: none; border: none; cursor: pointer; opacity: 1;
}
.btn-p:hover { background: #152d55; transform: translateY(-1px); box-shadow: 0 4px 14px color-mix(in srgb, var(--blue) 28%, transparent); }

.btn-o {
	background: transparent; color: var(--brown);
	font-family: var(--head); font-size: 13px; font-weight: 600;
	padding: 9px 22px;
	border-radius: 20px;
	text-decoration: none;
	border: 2px solid color-mix(in srgb, var(--brown) 35%, transparent);
	transition: border-color .18s ease, background .18s ease, transform .18s ease,
				color .18s ease, border-radius .45s cubic-bezier(.4,0,.2,1),
				opacity .25s ease;
	cursor: pointer; opacity: 1;
}
.hdr-wrap header.light .btn-o { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.btn-o:hover { background: color-mix(in srgb, #000 5%, transparent); border-color: var(--brown); transform: translateY(-1px); }
/* Floating header: buttons morph to --r-btn-scrolled (rounded-rect echo) */
.hdr-wrap.scrolled header .btn-p,
.hdr-wrap.scrolled header .btn-o { border-radius: var(--r-btn-scrolled); }

/* ── Mobile-drawer CTA buttons (full pill, hero style) ──
   The bare .btn-hl/.btn-hs classes are OWNED by the hero block (shared layer).
   Scoped here to .mob-ctas only so the header stylesheet styles just the drawer
   CTAs and never competes with / depends on the hero block's definition. */
.mob-ctas .btn-hl {
	background: var(--blue); color: #fff; font-family: var(--head); font-size: 16px; font-weight: 600;
	padding: 14px 30px; border-radius: var(--r-pill); text-decoration: none;
	transition: background .18s, transform .18s, box-shadow .18s;
	box-shadow: 0 2px 8px color-mix(in srgb, var(--blue) 25%, transparent);
}
.mob-ctas .btn-hl:hover { background: #152d55; transform: translateY(-2px); box-shadow: 0 6px 20px color-mix(in srgb, var(--blue) 35%, transparent); }
.mob-ctas .btn-hs {
	background: var(--gold); color: var(--brown); font-family: var(--head); font-size: 16px; font-weight: 600;
	padding: 14px 30px; border-radius: var(--r-pill); text-decoration: none;
	transition: background .18s, transform .18s, box-shadow .18s;
	box-shadow: 0 2px 8px color-mix(in srgb, var(--gold) 28%, transparent);
}
.mob-ctas .btn-hs:hover { background: var(--gold-dark); transform: translateY(-2px); box-shadow: 0 6px 20px color-mix(in srgb, var(--gold) 40%, transparent); }

/* ── HAMBURGER – clean three-line icon, styled to match brand ── */
.hdr-wrap .hamburger {
	display: flex; flex-direction: column; justify-content: center; gap: 6px;
	background: var(--blue); border: none; cursor: pointer;
	width: 38px; height: 38px; border-radius: 8px;
	padding: 10px 9px;
	/* Crossfade: out of flow + hidden on desktop so it never disturbs the nav
	   row's space-between; it fades IN at <=900 where it rests at right:20px (the
	   header's mobile content edge), so there is no fade-in position jump. */
	position: absolute; top: 50%; right: 20px; transform: translateY(-50%);
	opacity: 0; pointer-events: none;
	transition: opacity .28s ease, background .15s;
}
.hamburger:hover { background: #152d55; opacity: 1; }
.hamburger span {
	display: block; width: 100%; height: 2px;
	background: #fff; border-radius: 2px;
	transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .25s ease, width .3s ease;
}
/* Animate to × */
.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* MOBILE NAV – right-side drawer */
.mob-nav {
	position: fixed; top: 0; right: 0; bottom: 0;
	width: min(340px,100vw); z-index: 190;
	display: flex; flex-direction: column;
	background: var(--bg);
	box-shadow: -8px 0 40px color-mix(in srgb, #000 16%, transparent);
	transform: translateX(100%);
	transition: transform .35s cubic-bezier(.4,0,.2,1);
	pointer-events: none; overflow-y: auto;
}
.mob-nav.open { transform: translateX(0); pointer-events: all; }
/* Dark overlay behind drawer */
.mob-overlay {
	position: fixed; inset: 0; z-index: 189;
	background: color-mix(in srgb, #000 35%, transparent);
	opacity: 0; pointer-events: none;
	transition: opacity .35s ease;
}
.mob-overlay.open { opacity: 1; pointer-events: all; }

.mob-nav-head {
	background: var(--blue); padding: 0 20px;
	display: flex; align-items: center; justify-content: space-between;
	flex-shrink: 0; min-height: 64px;
	border-bottom: none;
}
.mob-logo {
	font-family: var(--head); font-weight: 700; font-size: 18px; color: #fff;
	display: flex; align-items: center; gap: 10px;
}
.mob-logo-badge {
	width: 32px; height: 32px; border-radius: 8px;
	background: var(--gold); display: flex; align-items: center; justify-content: center;
	font-size: 13px; font-weight: 800; color: var(--brown); letter-spacing: -.5px;
}
.mob-close {
	background: color-mix(in srgb, #fff 12%, transparent); color: #fff; border: none; cursor: pointer;
	width: 36px; height: 36px; border-radius: var(--r-pill);
	font-size: 16px; font-weight: 600;
	display: flex; align-items: center; justify-content: center;
	transition: background .15s; line-height: 1;
}
.mob-close:hover { background: color-mix(in srgb, #fff 25%, transparent); }

.mob-links { display: flex; flex-direction: column; padding: 12px 12px 8px; gap: 2px; flex: 1; }
/* Leading Font Awesome icons in drawer rows: dim, fixed-width, like the wireframe SVGs. */
.mob-link i, .mob-acc-btn i { width: 16px; text-align: center; font-size: 15px; flex-shrink: 0; opacity: .5; }
.mob-div { height: 1px; background: color-mix(in srgb, #000 7%, transparent); margin: 6px 0 6px 3px; }

/* – Accordion sections – */
.mob-acc-btn {
	width: 100%; display: flex; align-items: center; gap: 10px;
	background: none; border: none; cursor: pointer; text-align: left;
	font-family: var(--head); font-size: 15px; font-weight: 600; color: var(--blue);
	padding: 12px 14px; border-radius: 10px;
	transition: background .15s, opacity .15s; opacity: .75;
}
.mob-acc-btn:hover { background: var(--sandy); opacity: 1; }
.mob-acc.open .mob-acc-btn { background: var(--sandy); opacity: 1; }

/* Chevron – rotates when open */
.mob-chev {
	width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none;
	stroke-linecap: round; stroke-linejoin: round;
	margin-left: auto; flex-shrink: 0; opacity: .5;
	transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.mob-acc.open .mob-chev { transform: rotate(180deg); opacity: .8; }

/* Drop container */
.mob-acc-drop {
	overflow: hidden; max-height: 0;
	transition: max-height .3s cubic-bezier(.4,0,.2,1);
}
.mob-acc.open .mob-acc-drop { max-height: 320px; }
.mob-acc-drop a {
	display: block; text-decoration: none;
	font-family: var(--body); font-size: 14px; font-weight: 500; color: var(--blue);
	padding: 9px 14px 9px 42px;
	border-radius: 8px; opacity: .7;
	border: none;
	transition: background .12s, opacity .12s;
}
.mob-acc-drop a:hover { background: color-mix(in srgb, #000 6%, transparent); opacity: 1; }
/* Active page – sub-item */
.mob-acc-drop a[aria-current="page"] {
	background: var(--blue); color: #fff; opacity: 1; font-weight: 600;
}
.mob-acc-drop a[aria-current="page"]:hover { background: #152d55; }

/* Active section header (when a child is the current page) */
.mob-acc.active > .mob-acc-btn { color: var(--blue); opacity: 1; font-weight: 700; }

/* Simple standalone links */
.mob-link {
	display: flex; align-items: center; gap: 10px; text-decoration: none;
	font-family: var(--head); font-size: 15px; font-weight: 600; color: var(--blue);
	padding: 12px 14px; border-radius: 10px;
	transition: background .15s, opacity .15s; opacity: .75;
}
.mob-link:hover { background: var(--sandy); opacity: 1; }
.mob-link[aria-current="page"] { background: var(--blue); color: #fff; opacity: 1; }
.mob-link[aria-current="page"]:hover { background: #152d55; }
.mob-link[aria-current="page"] i { opacity: .7; }

.mob-ctas {
	display: flex; flex-direction: column; gap: 10px;
	padding: 16px 12px 24px; border-top: 1px solid color-mix(in srgb, #000 8%, transparent); flex-shrink: 0;
}
.mob-ctas .btn-hl, .mob-ctas .btn-hs {
	text-align: center; display: block;
	font-size: 15px; padding: 13px 24px; border-radius: var(--r-pill);
}

/* ── §12 FOCUS RING – visible but pretty: on-brand gold ring (header scope) ── */
.util a:focus-visible,
.hdr-wrap a:focus-visible, .hdr-wrap button:focus-visible,
.mob-nav a:focus-visible, .mob-nav button:focus-visible {
	outline: 3px solid var(--gold);
	outline-offset: 3px;
	border-radius: 8px;
	box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 25%, transparent);
	transition: outline-offset .15s ease, box-shadow .15s ease;
}
/* On the dark utility bar and the scrolled header pill, lift the glow a touch */
.util a:focus-visible, .hamburger:focus-visible, .mob-nav-head button:focus-visible {
	outline-color: var(--gold);
	box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 35%, transparent);
}

/* ── NAV COMPRESSION at tablet – shrink before hamburger kicks in ── */
@media (max-width: 1140px) {
	.ni > a { font-size: 13px; padding: 8px 10px; }
	.ctag { gap: 6px; }
	.btn-p, .btn-o { font-size: 12px; padding: 8px 14px; }
	.hdr-wrap header { padding: 12px 28px; }
}
@media (max-width: 1000px) {
	.ni > a { font-size: 12px; padding: 7px 8px; gap: 3px; }
	.hdr-wrap .logo-text { font-size: 17px; }
	.btn-p, .btn-o { font-size: 12px; padding: 7px 12px; }
	.hdr-wrap header { padding: 10px 20px; }
}

/* ── FULL MOBILE – hamburger at 900px ── */
@media (max-width: 900px) {
	.util { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; pointer-events: none; }
	.hdr-wrap.scrolled header { max-width: calc(100% - 24px); }
	.hdr-wrap header { padding: 12px 20px; }
	.hdr-wrap nav, .hdr-wrap .ctag { opacity: 0; max-width: 0; overflow: hidden; pointer-events: none; }
	.hdr-wrap .hamburger { opacity: 1; pointer-events: auto; }
}

/* ── REDUCED MOTION – instant state, no header morph or drawer slide ── */
@media (prefers-reduced-motion: reduce) {
	.hdr-wrap, .hdr-wrap header,
	.btn-p, .btn-o, .mob-ctas .btn-hl, .mob-ctas .btn-hs,
	.logo-mark, .chev, .mega, .ml,
	.hamburger, .hamburger span,
	.mob-nav, .mob-overlay, .mob-chev, .mob-acc-drop,
	.mob-acc-btn, .mob-link, .mob-close,
	.util-nav a, .ni > a {
		transition: none !important;
	}
}
