/*
 * NEMRA Blocks — Site Header (V2). Transparent overlay nav with white text,
 * placed in the Elementor Theme Builder header. Desktop: logo + menu left,
 * Resources/Join/Member Login right. Mobile (<992px): logo + hamburger that
 * drops a navy panel.
 */

/* Elementor renders the Theme Builder header inside .elementor-location-header.
 * The header is a fixed overlay: transparent (white text) while at the top of
 * the page, switching to a white sticky bar (dark text) once scrolled so the
 * nav stays legible over every block. */
.elementor-location-header.elementor-location-header {
	position: fixed !important;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 50;
	/* The location wrapper (and its inner container) default to an opaque white
	 * background, which renders as a solid grey bar over the hero photo. The
	 * V2 header is a transparent overlay — force the wrapper and its containers
	 * transparent so the photo shows through and the white logo/nav read over
	 * it (with the ::before scrim for legibility). */
	background: transparent !important;
}

.elementor-location-header.elementor-location-header,
.elementor-location-header.elementor-location-header > .elementor,
.elementor-location-header.elementor-location-header .e-con,
.elementor-location-header.elementor-location-header .e-con-inner {
	background-color: transparent !important;
	background-image: none !important;
}

.nemra-header {
	position: relative;
	width: 100%;
	font-family: var(--nemra-font-body, 'Poppins', system-ui, sans-serif);
	transition: background-color 200ms ease, box-shadow 200ms ease;
}

/* Subtle top scrim behind the transparent header so the white logo + nav stay
 * legible over bright photos (and on any page). Sits behind the content. */
.nemra-header::before {
	content: "";
	position: absolute;
	inset: 0;
	bottom: auto;
	height: 160px;
	background: linear-gradient(180deg, rgba(4, 26, 45, 0.55) 0%, rgba(4, 26, 45, 0) 100%);
	pointer-events: none;
	z-index: 0;
}
.nemra-header__inner { position: relative; z-index: 1; }

/* Light-top pages: no scrim — the header runs in its solid state instead. */
body.nemra-light-top .nemra-header::before { display: none; }

.nemra-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 40px;
	max-width: 1440px;
	margin: 0 auto;
	padding: 16px 64px;
	box-sizing: border-box;
}

/* --- Logo --- */
.nemra-header__logo {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	text-decoration: none;
}
.nemra-header__logo img { height: 50px; width: auto; display: block; }
.nemra-header__wordmark {
	display: flex;
	flex-direction: column;
	font-family: var(--nemra-font-heading, 'Libre Baskerville', Georgia, serif);
	font-size: 22px;
	line-height: 1;
	color: var(--nemra-light, #fcfdfd);
	letter-spacing: 1px;
}
.nemra-header__wordmark span { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; font-family: var(--nemra-font-body); margin-top: 3px; }

/* --- Nav (shared) --- */
.nemra-header__nav {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: space-between;
	gap: 40px;
}
.nemra-header__menu {
	display: flex;
	align-items: center;
	gap: 30px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.nemra-header__item { margin: 0; }
.nemra-header__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	line-height: 20px;
	letter-spacing: -0.3px;
	color: var(--nemra-light, #fcfdfd);
	text-decoration: none;
	transition: opacity 150ms ease;
}
.nemra-header__link:hover { opacity: 0.7; text-decoration: none; color: var(--nemra-light, #fcfdfd); }
.nemra-header__caret { flex: 0 0 auto; }

.nemra-header__right {
	display: flex;
	align-items: center;
	gap: 16px;
}
.nemra-header__link--secondary { font-size: 14px; }
.nemra-header__right .nemra-header__link--secondary:first-child { position: relative; padding-right: 16px; }
.nemra-header__right .nemra-header__link--secondary:first-child::after {
	content: "";
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 1px;
	height: 24px;
	background: rgba(252, 253, 253, 0.4);
}
.nemra-header__button {
	display: inline-flex;
	align-items: center;
	padding: 8px 12px;
	border-radius: 5px;
	border: 1px solid rgba(252, 253, 253, 0.08);
	background: var(--nemra-blue, #2173b3);
	color: var(--nemra-light, #fcfdfd);
	font-size: 12px;
	line-height: 16px;
	text-decoration: none;
	transition: background 150ms ease;
}
.nemra-header__button:hover { background: var(--neutral-dark-88, rgba(23, 23, 26, 0.88)); color: var(--nemra-light, #fcfdfd); text-decoration: none; }

/* The header is one shared Theme Builder template, but the round-3 frames
 * tint its Member Login button with the page's accent — green on Agents
 * (797:22028), Education (797:23643) and Advocacy (797:24790), blue
 * everywhere else. The body class comes from nemra_blocks_accent_body_class(). */
.nemra-accent-green .nemra-header__button {
	background: var(--nemra-green, #4c7f39);
}

/* All buttons hover to the same neutral-dark-88 fill sitewide, regardless of
   resting colour (designer direction, 2026-08-04). */
.nemra-accent-green .nemra-header__button:hover {
	background: var(--neutral-dark-88, rgba(23, 23, 26, 0.88));
}

/* --- Hamburger (mobile only) --- */
.nemra-header__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}
.nemra-header__toggle span {
	display: block;
	height: 2px;
	width: 24px;
	background: var(--nemra-light, #fcfdfd);
	border-radius: 2px;
	transition: transform 200ms ease, opacity 200ms ease;
}

/* --- Mobile --- */
@media (max-width: 991px) {
	.nemra-header__inner { padding: 16px 20px; }
	.nemra-header__toggle { display: flex; }

	.nemra-header__nav {
		position: absolute;
		top: 100%;
		left: 0;
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 4px 20px 24px;
		background: var(--nemra-blue-dark, #042a48);
		border-top: 1px solid rgba(226, 226, 226, 0.12);
		box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
		max-height: calc(100vh - 82px);
		overflow-y: auto;
		transform: translateY(-8px);
		opacity: 0;
		visibility: hidden;
		transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
	}
	.nemra-header.is-open .nemra-header__nav {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
		transition: opacity 180ms ease, transform 180ms ease;
	}
	.nemra-header__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}
	/* Rows borrow the hero drawer's language (the comp's only mobile-menu
	 * pattern, 797:21909): full-width hairline dividers, flex rows. The
	 * link must be block-level flex — inline-flex shrinks to the text, which
	 * left each divider as a short underline under the label. */
	.nemra-header__link {
		display: flex;
		justify-content: space-between;
		padding: 14px 0;
		font-size: 16px;
		border-bottom: 1px solid rgba(226, 226, 226, 0.2);
	}
	/* No submenus exist — the carets are desktop dropdown decoration and
	 * read as broken affordances in the panel. */
	.nemra-header__caret { display: none; }
	.nemra-header__right {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		margin-top: 0;
	}
	.nemra-header__right .nemra-header__link--secondary:first-child { padding-right: 0; }
	.nemra-header__right .nemra-header__link--secondary:first-child::after { display: none; }
	.nemra-header__button { justify-content: center; padding: 12px; font-size: 14px; margin-top: 20px; }

	/* The page behind the panel shouldn't scroll while the menu is open. */
	body.nemra-header-open { overflow: hidden; }

	/* Hamburger → X when open */
	.nemra-header.is-open .nemra-header__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	.nemra-header.is-open .nemra-header__toggle span:nth-child(2) { opacity: 0; }
	.nemra-header.is-open .nemra-header__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ----------------------------------------------------------------------
 * Sticky scrolled state: once the page scrolls past the hero top, the
 * transparent overlay becomes a solid white bar with dark text so the
 * nav reads over any block. Toggled by the widget's scroll listener.
 * -------------------------------------------------------------------- */
.nemra-header.is-scrolled {
	background: #ffffff;
	box-shadow: 0 1px 0 rgba(23, 23, 26, 0.06), 0 8px 24px rgba(4, 26, 45, 0.08);
}

.nemra-header.is-scrolled::before { opacity: 0; }

.nemra-header.is-scrolled .nemra-header__inner {
	padding-top: 10px;
	padding-bottom: 10px;
}

.nemra-header.is-scrolled .nemra-header__link,
.nemra-header.is-scrolled .nemra-header__link:hover,
.nemra-header.is-scrolled .nemra-header__wordmark {
	color: var(--nemra-dark, #17171a);
}

.nemra-header.is-scrolled .nemra-header__right .nemra-header__link--secondary:first-child::after {
	background: rgba(23, 23, 26, 0.24);
}

.nemra-header.is-scrolled .nemra-header__toggle span {
	background: var(--nemra-dark, #17171a);
}

/* Logo: swap to the dark asset when provided, else darken the white one.
 *
 * Scoped through .nemra-header__logo on purpose. Bare
 * `.nemra-header__logo-img--dark` is one class (0,1,0) and loses to the
 * `.nemra-header__logo img { display: block }` rule above it (0,1,1), so
 * both logos painted side by side the moment a dark asset was first set. */
.nemra-header__logo .nemra-header__logo-img--dark { display: none; }

.nemra-header--has-dark-logo.is-scrolled .nemra-header__logo-img--light { display: none; }
.nemra-header--has-dark-logo.is-scrolled .nemra-header__logo-img--dark { display: block; height: 50px; width: auto; }

.nemra-header.is-scrolled:not(.nemra-header--has-dark-logo) .nemra-header__logo img {
	filter: brightness(0);
}

/* ----------------------------------------------------------------------
 * Mobile open state. The bar joins the panel as one navy surface — without
 * this, opening the menu while scrolled kept the white sticky bar over the
 * navy panel and, worse, the is-scrolled rules above repainted the panel's
 * links near-black (#17171a on #042a48). These sit after the sticky block
 * because they tie on specificity and must win the cascade.
 * -------------------------------------------------------------------- */
@media (max-width: 991px) {
	.nemra-header.is-open {
		background: var(--nemra-blue-dark, #042a48);
		box-shadow: none;
	}
	.nemra-header.is-open .nemra-header__link,
	.nemra-header.is-open .nemra-header__link:hover,
	.nemra-header.is-open .nemra-header__wordmark {
		color: var(--nemra-light, #fcfdfd);
	}
	.nemra-header.is-open .nemra-header__toggle span {
		background: var(--nemra-light, #fcfdfd);
	}
	.nemra-header--has-dark-logo.is-open.is-scrolled .nemra-header__logo-img--light { display: block; }
	.nemra-header--has-dark-logo.is-open.is-scrolled .nemra-header__logo-img--dark { display: none; }
	.nemra-header.is-scrolled.is-open:not(.nemra-header--has-dark-logo) .nemra-header__logo img {
		filter: none;
	}
}
