/* ==========================================================================
   HCUP-US main navigation (CM-979)
   Markup: header.jsp (#hcup-main-nav). Behavior: script at the end of header.jsp.

   Accessibility notes (Section 508 / WCAG 2.0 AA first, then WCAG 2.1/2.2):
   - Submenus open by click, Enter/Space, or hover; Esc closes (2.1.1, 1.4.13).
   - Closed panels use visibility:hidden so hidden links are out of the tab order.
   - Visible focus ring on every control (2.4.7); targets are at least 24px (2.5.8).
   - Text contrast: white on #292929 is 14.6:1; #66cccc on #292929 is 7.7:1;
     #1b1b1b on #66cccc is 9.1:1.
   - Below 1100px the nav collapses behind a "Menu" button and submenus become
     accordions, so the layout reflows at narrow widths (1.4.10).
   ========================================================================== */

/* Skip link (WCAG 2.4.1 Bypass Blocks): first focusable element on every page. */
.hcup-skip-link {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2000;
	padding: 10px 16px;
	background: #ffffff;
	border: 3px solid #006699;
	border-radius: 4px;
	color: #1b1b1b !important;
	font-family: 'Open Sans', Roboto, Arial, sans-serif;
	font-size: 16px;
	font-weight: 700;
	text-decoration: underline;
	transform: translateY(-200%);
}
.hcup-skip-link:focus {
	transform: none;
	outline: 3px solid #1b1b1b;
	outline-offset: 2px;
}
#main-content:focus {
	outline: none;
}

.hcup-nav {
	--nav-bg: #292929;
	--nav-bg-hover: #3d3d3d;
	--nav-bg-panel: #292929;
	--nav-accent: #66cccc;
	--nav-text: #ffffff;
	--nav-rule: #4a4a4a;
	clear: both;
	position: relative;
	z-index: 1100;
	width: 100%;
	margin: 0 0 15px;
	background: var(--nav-bg);
	font-family: 'Open Sans', Roboto, Arial, sans-serif;
}

.hcup-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.hcup-nav p {
	margin: 0;
}

/* Focus: always visible, never clipped by the bar (inset outline). */
.hcup-nav a:focus,
.hcup-nav button:focus {
	outline: 3px solid var(--nav-accent);
	outline-offset: -3px;
}
.hcup-nav a:focus:not(:focus-visible),
.hcup-nav button:focus:not(:focus-visible) {
	outline: none;
}

.hcup-nav__chevron {
	display: block;
	transition: transform .2s ease;
}
.hcup-nav__item.is-open > .hcup-nav__bar .hcup-nav__chevron {
	transform: rotate(180deg);
}

/* ---------- Desktop (1100px and wider) ---------- */
@media screen and (min-width: 1100px) {
	.hcup-nav__menu-toggle {
		display: none;
	}

	.hcup-nav__menu {
		position: relative; /* panels anchor to the full width of the bar */
		display: flex;
	}

	.hcup-nav__section {
		display: flex;
		flex-direction: column;
		min-width: 0;
	}
	.hcup-nav__section--analysis { flex: 5 1 0; }
	.hcup-nav__section--expert { flex: 2 1 0; }

	.hcup-nav__section-title {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 40px; /* fits two lines when the 2-column label wraps */
		padding: 0 8px;
		background: var(--nav-accent);
		color: #1b1b1b;
		font-size: 13px;
		font-weight: 600;
		letter-spacing: 1.5px;
		line-height: 1.2;
		text-align: center;
		text-transform: uppercase;
		border-top: 1px solid #eee;
		border-bottom: 1px solid #eee;
	}
	.hcup-nav__section--analysis .hcup-nav__section-title {
		border-right: 1px solid #fff;
	}

	.hcup-nav__list {
		display: flex;
		flex: 1 1 auto;
	}

	.hcup-nav__item {
		position: static;
		flex: 1 1 0;
		min-width: 0;
		border-right: 1px solid var(--nav-rule);
	}
	.hcup-nav__section--expert .hcup-nav__item:last-child {
		border-right: 0;
	}

	.hcup-nav__bar {
		display: flex;
		align-items: stretch;
		height: 56px;
		transition: background-color .15s ease;
	}
	.hcup-nav__bar:hover,
	.hcup-nav__item.is-open > .hcup-nav__bar {
		background: var(--nav-bg-hover);
	}
	/* Current section: teal underline instead of a flat gray block. */
	.hcup-nav__item.active > .hcup-nav__bar {
		background: var(--nav-bg-hover);
		box-shadow: inset 0 -4px 0 var(--nav-accent);
	}

	.hcup-nav__link {
		display: flex;
		flex: 1 1 auto;
		align-items: center;
		justify-content: center;
		min-width: 0;
		padding: 6px 8px;
		color: var(--nav-text) !important;
		font-size: 13px;
		font-weight: 600;
		letter-spacing: 1px;
		line-height: 1.35;
		text-align: center;
		text-decoration: none !important;
		text-transform: uppercase;
	}
	.hcup-nav__item--has-sub .hcup-nav__link {
		padding-right: 2px;
	}

	.hcup-nav__toggle {
		display: flex;
		flex: 0 0 30px;
		align-items: center;
		justify-content: center;
		margin: 0;
		padding: 0 8px 0 0;
		background: transparent;
		border: 0;
		color: var(--nav-text);
		cursor: pointer;
	}

	/* Mega-menu panel: full width of the nav bar. */
	.hcup-nav__panel {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 1110;
		background: var(--nav-bg-panel);
		border-top: 3px solid var(--nav-accent);
		box-shadow: 0 14px 28px rgba(0, 0, 0, .35);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-6px);
		transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
	}
	.hcup-nav__item.is-open > .hcup-nav__panel {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition-delay: 0s;
	}

	.hcup-nav__panel-inner {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
		gap: 4px 48px;
		max-width: 1400px;
		margin: 0 auto;
		padding: 14px 40px 22px;
	}
	.hcup-nav__group--wide {
		grid-column: 1 / -1;
	}
	.hcup-nav__cols {
		columns: 2 280px;
		column-gap: 48px;
	}
	.hcup-nav__cols li {
		break-inside: avoid;
	}
}

/* ---------- Panel contents (all sizes) ---------- */
.hcup-nav__group-title {
	margin: 12px 0 6px !important;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--nav-rule);
	color: var(--nav-accent);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.hcup-nav__group a {
	display: block;
	min-height: 24px;
	margin: 0 -8px;
	padding: 5px 8px;
	border-radius: 3px;
	color: var(--nav-text) !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	text-decoration: none !important;
	transition: background-color .12s ease;
}
.hcup-nav__group a:hover {
	background: var(--nav-bg-hover);
	text-decoration: underline !important;
}

/* ---------- Narrow screens (below 1100px): Menu button + accordions ---------- */
@media screen and (max-width: 1099.98px) {
	.hcup-nav__menu-toggle {
		display: flex;
		align-items: center;
		gap: 12px;
		width: 100%;
		min-height: 48px;
		margin: 0;
		padding: 10px 16px;
		background: var(--nav-bg);
		border: 0;
		color: var(--nav-text);
		font-family: inherit;
		font-size: 15px;
		font-weight: 600;
		letter-spacing: 1px;
		text-transform: uppercase;
		cursor: pointer;
	}
	.hcup-nav__menu-icon {
		position: relative;
		display: inline-block;
		width: 22px;
		height: 16px;
	}
	.hcup-nav__menu-icon span {
		position: absolute;
		left: 0;
		width: 22px;
		height: 2px;
		background: currentColor;
		border-radius: 1px;
		transition: transform .2s ease, opacity .2s ease, top .2s ease;
	}
	.hcup-nav__menu-icon span:nth-child(1) { top: 0; }
	.hcup-nav__menu-icon span:nth-child(2) { top: 7px; }
	.hcup-nav__menu-icon span:nth-child(3) { top: 14px; }
	.hcup-nav.is-menu-open .hcup-nav__menu-icon span:nth-child(1) { top: 7px; transform: rotate(45deg); }
	.hcup-nav.is-menu-open .hcup-nav__menu-icon span:nth-child(2) { opacity: 0; }
	.hcup-nav.is-menu-open .hcup-nav__menu-icon span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

	.hcup-nav__menu {
		display: none;
		border-top: 1px solid var(--nav-rule);
	}
	.hcup-nav.is-menu-open .hcup-nav__menu {
		display: block;
	}

	.hcup-nav__section-title {
		padding: 8px 16px;
		background: var(--nav-accent);
		color: #1b1b1b;
		font-size: 13px;
		font-weight: 700;
		letter-spacing: 1.5px;
		text-transform: uppercase;
	}

	.hcup-nav__item {
		border-bottom: 1px solid var(--nav-rule);
	}

	.hcup-nav__bar {
		display: flex;
		align-items: stretch;
		min-height: 48px;
	}
	.hcup-nav__item.active > .hcup-nav__bar {
		box-shadow: inset 4px 0 0 var(--nav-accent);
		background: var(--nav-bg-hover);
	}

	.hcup-nav__link {
		display: flex;
		flex: 1 1 auto;
		align-items: center;
		padding: 12px 16px;
		color: var(--nav-text) !important;
		font-size: 16px;
		font-weight: 600;
		text-decoration: none !important;
	}

	.hcup-nav__toggle {
		display: flex;
		flex: 0 0 56px;
		align-items: center;
		justify-content: center;
		margin: 0;
		padding: 0;
		background: transparent;
		border: 0;
		border-left: 1px solid var(--nav-rule);
		color: var(--nav-text);
		cursor: pointer;
	}
	.hcup-nav__item.is-open > .hcup-nav__bar .hcup-nav__toggle {
		background: var(--nav-bg-hover);
	}

	.hcup-nav__panel {
		display: none;
		background: #1f1f1f;
	}
	.hcup-nav__item.is-open > .hcup-nav__panel {
		display: block;
	}
	.hcup-nav__panel-inner {
		padding: 2px 16px 14px 28px;
	}
	.hcup-nav__group a {
		padding: 8px;
		font-size: 15px;
	}

}

@media screen and (max-width: 768px) {
	/* Home | About: the blue header hides them on phones, so show them in the
	   top-right corner of the white logo row instead (not in the Menu). */
	.header-middle {
		position: relative;
	}
	/* Anchor the links to .header-middle, not to the Bootstrap columns. */
	.header-middle .header-middle-col2,
	.header-middle .header-middle-col2-col2 {
		position: static;
	}
	.header-middle ul.clearfix.header-middle-menu {
		display: flex;
		position: absolute;
		top: 6px;
		right: 8px;
		z-index: 5;
		margin: 0;
		padding: 0;
	}
	.header-middle .header-middle-menu a {
		display: inline-block;
		min-height: 24px;
		padding: 3px 4px;
		color: #006699 !important; /* 5.6:1 on white */
		font-size: 14px;
	}
	.header-middle .header-middle-menu li:after {
		-webkit-text-fill-color: #6b6b6b;
	}
	/* The old mobile menu column is gone; let the logo use the full row. */
	.header-middle .col-md-2.col-xs-8.text-center.mob_logo,
	.header-middle .col-md-10.header-middle-col2 {
		flex: 0 0 100%;
		width: 100%;
		max-width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hcup-nav *,
	.hcup-nav *::before,
	.hcup-nav *::after {
		transition: none !important;
	}
}

@media print {
	.hcup-nav {
		display: none;
	}
}
