/* ==========================================================================
   AiMoneyGuideCo custom header
   All design values live in :root below. No font-family is declared anywhere.
   Breakpoint: 960px (search this file for "BREAKPOINT" to change it — CSS
   variables cannot be used inside media queries, so it appears in 2 places).
   ========================================================================== */

:root {
	--amg-header-primary: #004bf6;
	--amg-header-primary-hover: #003bc4;
	--amg-header-primary-soft: rgba(0, 75, 246, 0.08);
	--amg-header-focus-ring: 0 0 0 3px rgba(0, 75, 246, 0.3);

	--amg-header-text: #111827;
	--amg-header-text-muted: #4b5563;

	--amg-header-bg: rgba(255, 255, 255, 0.86);
	--amg-header-bg-scrolled: rgba(255, 255, 255, 0.94);
	--amg-header-bg-solid: rgba(255, 255, 255, 0.98);
	--amg-header-blur: 14px;

	--amg-header-border: 1px solid rgba(15, 23, 42, 0.07);
	--amg-header-border-scrolled: 1px solid rgba(15, 23, 42, 0.1);
	--amg-header-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	--amg-header-shadow-scrolled: 0 8px 24px rgba(15, 23, 42, 0.08);
	--amg-header-shadow-panel: 0 12px 32px rgba(15, 23, 42, 0.12);

	--amg-header-height: 60px;
	--amg-header-top-space: 12px;
	--amg-header-side-space: 16px;
	--amg-header-max-width: 1240px;
	--amg-header-radius: 14px;
	--amg-header-radius-sm: 9px;
	--amg-header-inner-pad: 20px;

	--amg-header-logo-height: 30px;
	--amg-header-z: 9990;
	--amg-header-speed: 0.2s;
	--amg-header-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tablet + mobile values. BREAKPOINT (1 of 2) */
@media (max-width: 960px) {
	:root {
		--amg-header-height: 54px;
		--amg-header-top-space: 8px;
		--amg-header-side-space: 10px;
		--amg-header-inner-pad: 14px;
		--amg-header-logo-height: 26px;
	}
}

/* --------------------------------------------------------------------------
   Remove any leftover GeneratePress header/navigation (safety net; PHP already
   unhooks it). Scoped so it never touches .amg-* elements.
   -------------------------------------------------------------------------- */
body.amg-has-custom-header #masthead,
body.amg-has-custom-header .site-header:not(.amg-header),
body.amg-has-custom-header #site-navigation,
body.amg-has-custom-header .main-navigation,
body.amg-has-custom-header #mobile-header,
body.amg-has-custom-header .mobile-header-navigation,
body.amg-has-custom-header .slideout-navigation,
body.amg-has-custom-header .menu-bar-items {
	display: none !important;
}

/* --------------------------------------------------------------------------
   Wrapper (sticky, floating)
   -------------------------------------------------------------------------- */
.amg-header {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: var(--amg-header-z);
	/* Intentional top gap is PADDING, not margin: a top margin on the first child of <body>
	   collapses through <body> and exposes the <html> canvas as a stray strip. */
	margin: 0;
	padding: var(--amg-header-top-space) var(--amg-header-side-space) 0;
	box-sizing: border-box;
	pointer-events: none; /* only the bar itself is clickable */
	color: var(--amg-header-text);
	font-size: 15px;
	line-height: 1.4;
}

body.admin-bar .amg-header {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .amg-header {
		top: 46px;
	}
}

.amg-header *,
.amg-header *::before,
.amg-header *::after {
	box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Bar
   -------------------------------------------------------------------------- */
.amg-header-inner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	width: 100%;
	max-width: var(--amg-header-max-width);
	height: var(--amg-header-height);
	margin: 0 auto;
	padding: 0 12px 0 var(--amg-header-inner-pad);
	background: var(--amg-header-bg);
	-webkit-backdrop-filter: saturate(180%) blur(var(--amg-header-blur));
	backdrop-filter: saturate(180%) blur(var(--amg-header-blur));
	border: var(--amg-header-border);
	border-radius: var(--amg-header-radius);
	box-shadow: var(--amg-header-shadow);
	pointer-events: auto;
	transition: background-color var(--amg-header-speed) var(--amg-header-ease),
		box-shadow var(--amg-header-speed) var(--amg-header-ease),
		border-color var(--amg-header-speed) var(--amg-header-ease);
}

.amg-header.amg-is-scrolled .amg-header-inner {
	background: var(--amg-header-bg-scrolled);
	border: var(--amg-header-border-scrolled);
	box-shadow: var(--amg-header-shadow-scrolled);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.amg-header-inner {
		background: var(--amg-header-bg-solid);
	}
}

/* --------------------------------------------------------------------------
   Reset theme button/input styles inside the header
   -------------------------------------------------------------------------- */
.amg-header button,
.amg-header input[type="search"] {
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}

.amg-header button {
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	color: inherit;
	cursor: pointer;
	font-size: inherit;
	line-height: inherit;
}

.amg-header ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.amg-header a {
	text-decoration: none;
}

.amg-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Focus states */
.amg-header a:focus-visible,
.amg-header button:focus-visible,
.amg-header input:focus-visible {
	outline: 2px solid var(--amg-header-primary);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */
.amg-header-logo {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	height: 100%;
	color: var(--amg-header-text);
	border-radius: 6px;
}

.amg-header .amg-header-logo-img {
	display: block;
	width: auto;
	max-width: none;
	height: var(--amg-header-logo-height);
}

.amg-header-logo-text {
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -0.01em;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Right group (nav + actions)
   -------------------------------------------------------------------------- */
.amg-header-right {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.amg-header-nav {
	display: block;
}

.amg-header-menu {
	display: flex;
	align-items: center;
	gap: 2px;
}

.amg-header-menu li {
	position: relative;
	margin: 0;
}

.amg-header-menu a {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 0 12px;
	border-radius: var(--amg-header-radius-sm);
	color: var(--amg-header-text);
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
	transition: color var(--amg-header-speed) var(--amg-header-ease),
		background-color var(--amg-header-speed) var(--amg-header-ease);
}

.amg-header-menu a:hover,
.amg-header-menu li:focus-within > a {
	color: var(--amg-header-primary);
	background: var(--amg-header-primary-soft);
}

.amg-header-menu .current-menu-item > a,
.amg-header-menu .current-menu-ancestor > a,
.amg-header-menu .current_page_item > a,
.amg-header-menu .current_page_ancestor > a,
.amg-header-menu a[aria-current="page"] {
	color: var(--amg-header-primary);
	font-weight: 600;
}

/* Dropdown chevron */
.amg-header-menu .menu-item-has-children > a::after,
.amg-header-menu .page_item_has_children > a::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.6;
}

/* Dropdown */
.amg-header-menu .sub-menu,
.amg-header-menu .children {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 220px;
	padding: 6px;
	background: var(--amg-header-bg-solid);
	border: var(--amg-header-border-scrolled);
	border-radius: 12px;
	box-shadow: var(--amg-header-shadow-panel);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity var(--amg-header-speed) var(--amg-header-ease),
		transform var(--amg-header-speed) var(--amg-header-ease),
		visibility var(--amg-header-speed);
}

/* hover bridge so the menu doesn't close crossing the gap */
.amg-header-menu .sub-menu::before,
.amg-header-menu .children::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 0;
	right: 0;
	height: 10px;
}

.amg-header-menu li:hover > .sub-menu,
.amg-header-menu li:focus-within > .sub-menu,
.amg-header-menu li:hover > .children,
.amg-header-menu li:focus-within > .children {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.amg-header-menu .sub-menu a,
.amg-header-menu .children a {
	min-height: 40px;
	white-space: normal;
}

/* --------------------------------------------------------------------------
   Actions: Sign In + icon buttons
   -------------------------------------------------------------------------- */
.amg-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.amg-header .amg-header-signin {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 38px;
	margin-left: 8px;
	padding: 0 18px;
	background: var(--amg-header-primary);
	border: 0;
	border-radius: var(--amg-header-radius-sm);
	color: #fff;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	transition: background-color var(--amg-header-speed) var(--amg-header-ease),
		box-shadow var(--amg-header-speed) var(--amg-header-ease);
}

.amg-header .amg-header-signin:hover {
	background: var(--amg-header-primary-hover);
	color: #fff;
}

.amg-header .amg-header-signin:focus-visible {
	color: #fff;
	outline: 2px solid var(--amg-header-primary);
	outline-offset: 2px;
}

.amg-header .amg-header-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--amg-header-radius-sm);
	color: var(--amg-header-text);
	transition: color var(--amg-header-speed) var(--amg-header-ease),
		background-color var(--amg-header-speed) var(--amg-header-ease);
}

.amg-header .amg-header-icon-btn:hover,
.amg-header .amg-header-icon-btn[aria-expanded="true"] {
	color: var(--amg-header-primary);
	background: var(--amg-header-primary-soft);
}

/* Menu toggle hidden on desktop */
.amg-header .amg-header-menu-toggle {
	display: none;
}

/* Burger icon */
.amg-header-burger {
	position: relative;
	display: block;
	width: 18px;
	height: 12px;
}

.amg-header-burger span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform var(--amg-header-speed) var(--amg-header-ease),
		top var(--amg-header-speed) var(--amg-header-ease);
}

.amg-header-burger span:nth-child(1) {
	top: 1px;
}

.amg-header-burger span:nth-child(2) {
	top: 9px;
}

.amg-header-menu-toggle[aria-expanded="true"] .amg-header-burger span:nth-child(1) {
	top: 5px;
	transform: rotate(45deg);
}

.amg-header-menu-toggle[aria-expanded="true"] .amg-header-burger span:nth-child(2) {
	top: 5px;
	transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Search panel (inside the bar)
   -------------------------------------------------------------------------- */
.amg-header-search {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	padding: 0 10px 0 var(--amg-header-inner-pad);
	background: var(--amg-header-bg-solid);
	border-radius: inherit;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-3px);
	transition: opacity var(--amg-header-speed) var(--amg-header-ease),
		transform var(--amg-header-speed) var(--amg-header-ease),
		visibility var(--amg-header-speed);
}

.amg-header.amg-search-open .amg-header-search {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.amg-header-search-form {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 0;
}

.amg-header-search-icon {
	flex: 0 0 auto;
	color: var(--amg-header-text-muted);
}

.amg-header .amg-header-search-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	margin: 0;
	padding: 0 4px;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: var(--amg-header-text);
	font-size: 16px; /* prevents iOS zoom on focus */
	line-height: 1.4;
}

.amg-header .amg-header-search-input:focus,
.amg-header .amg-header-search-input:focus-visible {
	outline: 0;
	box-shadow: none;
	background: transparent;
	border: 0;
}

.amg-header-search-input::placeholder {
	color: var(--amg-header-text-muted);
	opacity: 0.8;
}

.amg-header-search-input::-webkit-search-cancel-button {
	display: none;
}

.amg-header .amg-header-search-submit {
	flex: 0 0 auto;
	height: 38px;
	padding: 0 16px;
	background: var(--amg-header-primary);
	border-radius: var(--amg-header-radius-sm);
	color: #fff;
	font-size: 14.5px;
	font-weight: 600;
	transition: background-color var(--amg-header-speed) var(--amg-header-ease);
}

.amg-header .amg-header-search-submit:hover {
	background: var(--amg-header-primary-hover);
}

/* Results dropdown */
.amg-header-search-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	max-height: min(60vh, 460px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 6px;
	background: var(--amg-header-bg-solid);
	border: var(--amg-header-border-scrolled);
	border-radius: 12px;
	box-shadow: var(--amg-header-shadow-panel);
}

.amg-header-search-results[hidden] {
	display: none;
}

.amg-header-search-results li {
	margin: 0;
}

.amg-header .amg-header-search-results a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 44px;
	padding: 8px 12px;
	border-radius: var(--amg-header-radius-sm);
	color: var(--amg-header-text);
	font-size: 15px;
	font-weight: 500;
}

.amg-header .amg-header-search-results a:hover,
.amg-header .amg-header-search-results [aria-selected="true"] a,
.amg-header .amg-header-search-results a[aria-selected="true"] {
	background: var(--amg-header-primary-soft);
	color: var(--amg-header-primary);
}

.amg-header-result-type {
	flex: 0 0 auto;
	padding: 3px 8px;
	background: rgba(15, 23, 42, 0.05);
	border-radius: 999px;
	color: var(--amg-header-text-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
}

.amg-header-search-message {
	padding: 12px;
	color: var(--amg-header-text-muted);
	font-size: 14.5px;
}

.amg-header .amg-header-search-results .amg-header-result-all a {
	margin-top: 4px;
	border-top: 1px solid rgba(15, 23, 42, 0.06);
	border-radius: 0 0 var(--amg-header-radius-sm) var(--amg-header-radius-sm);
	color: var(--amg-header-primary);
	font-weight: 600;
}

/* --------------------------------------------------------------------------
   Mobile menu panel (hidden on desktop)
   -------------------------------------------------------------------------- */
.amg-mobile-menu {
	display: none;
}

/* Search and menu never fight: the one that is not open is disabled. */
.amg-header .amg-header-icon-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

/* BREAKPOINT (2 of 2) */
@media (max-width: 960px) {
	.amg-header-nav,
	.amg-header-actions .amg-header-signin {
		display: none;
	}

	.amg-header .amg-header-menu-toggle {
		display: inline-flex;
	}

	.amg-header-actions {
		gap: 2px;
	}

	.amg-header-search-submit {
		display: none !important;
	}

	.amg-mobile-menu {
		position: absolute;
		top: calc(100% + 8px);
		left: 0;
		right: 0;
		display: flex;
		flex-direction: column;
		max-height: calc(100vh - var(--amg-header-height) - var(--amg-header-top-space) * 2 - 24px);
		max-height: calc(100dvh - var(--amg-header-height) - var(--amg-header-top-space) * 2 - 24px);
		overflow: hidden; /* only the nav area scrolls; submenus expand inside it */
		background: var(--amg-header-bg-solid);
		border: var(--amg-header-border-scrolled);
		border-radius: 12px;
		box-shadow: var(--amg-header-shadow-panel);
		opacity: 0;
		visibility: hidden;
		transform: translateY(-6px);
		transition: opacity var(--amg-header-speed) var(--amg-header-ease),
			transform var(--amg-header-speed) var(--amg-header-ease),
			visibility var(--amg-header-speed);
	}

	.amg-header.amg-menu-open .amg-mobile-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	/* Top row with the explicit close button */
	.amg-mobile-menu-top {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: space-between;
		padding: 6px 6px 6px 18px;
		border-bottom: 1px solid rgba(15, 23, 42, 0.06);
	}

	.amg-mobile-menu-title {
		color: var(--amg-header-text-muted);
		font-size: 13px;
		font-weight: 600;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	.amg-header .amg-mobile-close {
		width: 44px;
		height: 44px;
		background: rgba(15, 23, 42, 0.05);
	}

	/* Scrollable navigation area */
	.amg-mobile-nav {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 8px;
	}

	.amg-mobile-menu-list,
	.amg-mobile-sub-list {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.amg-mobile-item {
		margin: 0;
	}

	.amg-mobile-row {
		display: flex;
		align-items: stretch;
	}

	.amg-header .amg-mobile-link {
		display: flex;
		flex: 1 1 auto;
		align-items: center;
		min-height: 48px;
		padding: 0 14px;
		border-radius: var(--amg-header-radius-sm);
		color: var(--amg-header-text);
		font-size: 16px;
		font-weight: 500;
		line-height: 1.3;
		transition: color var(--amg-header-speed) var(--amg-header-ease),
			background-color var(--amg-header-speed) var(--amg-header-ease);
	}

	.amg-header .amg-mobile-link:hover {
		color: var(--amg-header-primary);
		background: var(--amg-header-primary-soft);
	}

	.amg-mobile-item.amg-is-current > .amg-mobile-link,
	.amg-mobile-item.amg-is-current > .amg-mobile-row > .amg-mobile-link {
		color: var(--amg-header-primary);
		font-weight: 600;
	}

	/* Submenu chevron button */
	.amg-header .amg-mobile-sub-toggle {
		display: inline-flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: center;
		width: 48px;
		min-height: 48px;
		border-radius: var(--amg-header-radius-sm);
		color: var(--amg-header-text-muted);
		transition: color var(--amg-header-speed) var(--amg-header-ease),
			background-color var(--amg-header-speed) var(--amg-header-ease);
	}

	.amg-header .amg-mobile-sub-toggle:hover,
	.amg-header .amg-mobile-sub-toggle[aria-expanded="true"] {
		color: var(--amg-header-primary);
		background: var(--amg-header-primary-soft);
	}

	.amg-mobile-sub-toggle svg {
		transition: transform var(--amg-header-speed) var(--amg-header-ease);
	}

	.amg-mobile-sub-toggle[aria-expanded="true"] svg {
		transform: rotate(180deg);
	}

	/* Collapsible sub-list: closed by default, expands inside the panel */
	.amg-mobile-sub {
		display: grid;
		grid-template-rows: 0fr;
		visibility: hidden;
		transition: grid-template-rows var(--amg-header-speed) var(--amg-header-ease),
			visibility var(--amg-header-speed);
	}

	.amg-mobile-sub.amg-is-open {
		grid-template-rows: 1fr;
		visibility: visible;
	}

	.amg-mobile-sub-list {
		min-height: 0;
		overflow: hidden;
		margin-left: 14px;
		padding-left: 8px;
		border-left: 1px solid rgba(15, 23, 42, 0.08);
	}

	.amg-header .amg-mobile-sub-list .amg-mobile-link {
		min-height: 44px;
		font-size: 15px;
		font-weight: 400;
	}

	/* Auth buttons: stacked, full width */
	.amg-mobile-auth {
		display: flex;
		flex: 0 0 auto;
		flex-direction: column;
		gap: 10px;
		padding: 12px;
		border-top: 1px solid rgba(15, 23, 42, 0.06);
	}

	.amg-header .amg-mobile-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 48px;
		border-radius: var(--amg-header-radius-sm);
		font-size: 16px;
		font-weight: 600;
		line-height: 1;
		transition: background-color var(--amg-header-speed) var(--amg-header-ease),
			border-color var(--amg-header-speed) var(--amg-header-ease),
			color var(--amg-header-speed) var(--amg-header-ease);
	}

	.amg-header .amg-mobile-btn-primary {
		background: var(--amg-header-primary);
		border: 1px solid var(--amg-header-primary);
		color: #fff;
	}

	.amg-header .amg-mobile-btn-primary:hover {
		background: var(--amg-header-primary-hover);
		border-color: var(--amg-header-primary-hover);
		color: #fff;
	}

	.amg-header .amg-mobile-btn-secondary {
		background: #fff;
		border: 1px solid var(--amg-header-primary);
		color: var(--amg-header-primary);
	}

	.amg-header .amg-mobile-btn-secondary:hover {
		background: var(--amg-header-primary-soft);
		color: var(--amg-header-primary);
	}
}

/* Lock page scroll while the mobile menu is open (no overlay, no blur). */
body.amg-menu-open {
	overflow: hidden;
}

/* --------------------------------------------------------------------------
   Motion + print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.amg-header *,
	.amg-header *::before,
	.amg-header *::after {
		transition-duration: 0.01ms !important;
	}
}

@media print {
	.amg-header {
		display: none;
	}
}

/* Fix sticky on mobile: parents with overflow:hidden break position:sticky */
body.amg-has-custom-header,
body.amg-has-custom-header .site,
body.amg-has-custom-header #page,
body.amg-has-custom-header .site-content,
body.amg-has-custom-header .site-grid,
body.amg-has-custom-header .inside-site-container {
	overflow: visible !important;
}