/* ==========================================================================
   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;
}
.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;
		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: relative; /* each submenu panel anchors under its own item */
		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;
	}
	/* Hover, open, and current section: light gray with black text, as on
	   production (#000 on #d2d2d2 is 14.4:1). */
	.hcup-nav__bar {
		position: relative;
	}
	.hcup-nav__bar:hover,
	.hcup-nav__item.is-open > .hcup-nav__bar,
	.hcup-nav__item.active > .hcup-nav__bar {
		background: #d2d2d2;
	}
	.hcup-nav__bar:hover .hcup-nav__link,
	.hcup-nav__item.is-open > .hcup-nav__bar .hcup-nav__link,
	.hcup-nav__item.active > .hcup-nav__bar .hcup-nav__link {
		color: #000000 !important;
	}
	.hcup-nav__bar:hover .hcup-nav__link:focus,
	.hcup-nav__item.is-open > .hcup-nav__bar .hcup-nav__link:focus,
	.hcup-nav__item.active > .hcup-nav__bar .hcup-nav__link:focus {
		outline-color: #000000;
	}

	.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;
	}
	/* Submenu toggle: no visible chevron, as on production; mouse users open
	   submenus by hover. The button stays in the tab order for keyboard and
	   screen reader users (WCAG 2.1.1) and appears at the right edge of the
	   item only while it has keyboard focus (WCAG 2.4.7). */
	.hcup-nav__toggle {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		margin: 0;
		padding: 0;
		background: var(--nav-bg-hover);
		border: 0;
		color: var(--nav-text);
		cursor: pointer;
		clip-path: inset(50%);
	}
	.hcup-nav__toggle:focus {
		clip-path: none;
	}
	.hcup-nav__toggle:focus:not(:focus-visible) {
		clip-path: inset(50%);
	}

	/* Submenu panel: drops down under its own item at a fixed width rather
	   than spanning the whole bar, and opens instantly on hover with no fade
	   or slide, to match the production menu. The header script shifts a
	   panel sideways if it would run past either edge of the bar. */
	.hcup-nav__panel {
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 1110;
		width: 720px;
		max-width: calc(100vw - 32px);
		background: var(--nav-bg-panel);
		box-shadow: 0 14px 28px rgba(0, 0, 0, .35);
		visibility: hidden;
	}
	.hcup-nav__item.is-open > .hcup-nav__panel {
		visibility: visible;
	}
	#hcup-nav-sub-research {
		width: 1020px;
	}
	/* Reports & Publications sits toward the right end of the bar, so its
	   panel opens leftward from the item's right edge. */
	#hcup-nav-sub-reports {
		left: auto;
		right: 0;
	}

	.hcup-nav__panel-inner {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
		gap: 4px 32px;
		padding: 14px 24px 22px;
	}
	.hcup-nav__group--wide {
		grid-column: 1 / -1;
	}
	.hcup-nav__cols {
		columns: 2 260px;
		column-gap: 32px;
	}
	.hcup-nav__cols li {
		break-inside: avoid;
	}

	/* Panel contents styled like production: white headings with a white
	   rule, and links that turn white with black text on hover. */
	.hcup-nav .hcup-nav__group-title {
		border-bottom-color: #ffffff;
		color: var(--nav-text);
		font-size: 16px;
		font-weight: 500;
		letter-spacing: normal;
		text-transform: none;
	}
	.hcup-nav .hcup-nav__group a:hover {
		background: #ffffff;
		color: #000000 !important;
		text-decoration: none !important;
	}
}

/* ---------- 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;
}
.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;
	}

	/* No "Do Your Own Analysis" / "Explore Expert Research" headings in the
	   mobile menu. display:none still lets aria-labelledby name each list. */
	.hcup-nav__section-title {
		display: none;
	}

	.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;
	}
}
