/*
 * ExamNeed header styles.
 *
 * functions.php adds a class to <body>: header-style-classic (default,
 * styled in style.css), header-style-centered, header-style-minimal or
 * header-style-compact. Chosen in Appearance > Customize > ExamNeed Layout.
 * Colours come from the theme variables, so Customizer colours and dark
 * mode keep working.
 */

/* Parts used only by some styles are hidden everywhere else */
.header-join {
	display: none;
	gap: 6px;
}

.brand-badge,
.search-toggle,
.pill-nav {
	display: none;
}

/* ==========================================================
   Centered
   ========================================================== */
.header-style-centered .header-main-inner {
	flex-direction: column;
	gap: 10px;
	padding-top: 18px;
	padding-bottom: 14px;
	text-align: center;
}

.header-style-centered .site-branding {
	flex: 0 0 auto;
}

.header-style-centered .site-title {
	font-size: 32px;
	letter-spacing: 0.01em;
}

.header-style-centered .custom-logo-link img {
	margin: 0 auto;
}

.header-style-centered .header-search {
	flex: 0 0 auto;
	width: 100%;
	max-width: 560px;
}

.header-style-centered .menu-toggle {
	position: absolute;
	top: 14px;
	right: 14px;
}

.header-style-centered .header-main-inner {
	position: relative;
}

.header-style-centered .main-navigation {
	background: var(--c-card);
	border-top: 1px solid var(--c-border);
	border-bottom: 3px solid var(--c-primary);
}

.header-style-centered .main-navigation .menu {
	justify-content: center;
}

.header-style-centered .main-navigation .menu a {
	color: var(--c-text);
}

.header-style-centered .main-navigation .menu a:hover,
.header-style-centered .main-navigation .menu a:focus,
.header-style-centered .main-navigation .current-menu-item > a {
	background: transparent;
	color: var(--c-primary);
	box-shadow: inset 0 -3px 0 var(--c-accent);
}

.header-style-centered .main-navigation .sub-menu {
	background: var(--c-card);
	border: 1px solid var(--c-border);
	box-shadow: var(--shadow);
}

/* ==========================================================
   Minimal
   ========================================================== */
.header-style-minimal .site-header {
	box-shadow: none;
	border-bottom: 1px solid var(--c-border);
}

.header-style-minimal .topbar {
	background: transparent;
	color: var(--c-muted);
	border-bottom: 1px solid var(--c-border);
	font-size: 13px;
}

.header-style-minimal .header-main-inner {
	padding-top: 16px;
	padding-bottom: 16px;
}

.header-style-minimal .site-title {
	font-size: 28px;
	letter-spacing: -0.01em;
}

.header-style-minimal .search-field,
.header-style-minimal .search-form input[type="search"] {
	border-radius: 999px;
	padding-left: 16px;
}

.header-style-minimal .search-submit,
.header-style-minimal .search-form input[type="submit"] {
	border-radius: 999px;
}

.header-style-minimal .main-navigation {
	background: var(--c-card);
}

.header-style-minimal .main-navigation .menu a {
	padding: 11px 14px;
	color: var(--c-text);
	font-size: 14.5px;
	border-bottom: 3px solid transparent;
}

.header-style-minimal .main-navigation .menu a:hover,
.header-style-minimal .main-navigation .menu a:focus,
.header-style-minimal .main-navigation .current-menu-item > a {
	background: transparent;
	color: var(--c-primary);
	border-bottom-color: var(--c-accent);
}

.header-style-minimal .main-navigation .sub-menu {
	background: var(--c-card);
	border: 1px solid var(--c-border);
	box-shadow: var(--shadow);
}

.header-style-minimal .main-navigation .sub-menu a {
	border-bottom: 0;
}

/* ==========================================================
   Compact + sticky
   ========================================================== */
.header-style-compact .site-header {
	position: sticky;
	top: 0;
	z-index: 100;
}

.admin-bar.header-style-compact .site-header {
	top: 32px;
}

.header-style-compact .topbar,
.header-style-compact .site-tagline {
	display: none;
}

.header-style-compact .header-main-inner {
	gap: 12px;
	padding-top: 6px;
	padding-bottom: 6px;
}

.header-style-compact .site-title {
	font-size: 22px;
}

.header-style-compact .custom-logo-link img {
	max-height: 38px;
}

.header-style-compact .header-search {
	flex-basis: 260px;
}

.header-style-compact .search-field,
.header-style-compact .search-form input[type="search"],
.header-style-compact .search-submit,
.header-style-compact .search-form input[type="submit"] {
	padding-top: 6px;
	padding-bottom: 6px;
	font-size: 14px;
}

.header-style-compact .header-join {
	display: flex;
}

.header-style-compact .header-join .join-btn {
	padding: 6px 12px;
	font-size: 13px;
}

.header-style-compact .main-navigation .menu a {
	padding: 8px 14px;
	font-size: 14px;
}

@media (max-width: 782px) {
	.admin-bar.header-style-compact .site-header {
		top: 46px;
	}
}

@media (max-width: 800px) {
	/* Phones: logo, small join buttons and the menu button on one row;
	   the search row is hidden to keep the sticky bar slim */
	.header-style-compact .header-join .join-btn {
		padding: 6px 9px;
		font-size: 12px;
	}

	.header-style-compact .header-search {
		display: none;
	}

	.header-style-centered .menu-toggle {
		top: 12px;
		right: 12px;
	}

	.header-style-centered .header-main-inner {
		padding-right: 52px;
		padding-left: 52px;
	}
}

@media (max-width: 400px) {
	.header-style-compact .header-join {
		display: none;
	}
}

/* Mobile menu list: keep readable on light menu bars */
@media (max-width: 800px) {
	.header-style-centered .main-navigation .menu a,
	.header-style-minimal .main-navigation .menu a {
		border-top: 1px solid var(--c-border);
		border-bottom: 0;
	}

	.header-style-centered .main-navigation .sub-menu,
	.header-style-minimal .main-navigation .sub-menu {
		background: rgba(127, 127, 127, 0.08);
		border: 0;
		box-shadow: none;
	}
}

@media print {
	.header-style-compact .site-header {
		position: static;
	}
}

/* ==========================================================
   App (default): rounded bar, logo badge, inline menu, search
   icon. On phones: search icon | centred logo | menu button,
   with a swipeable pill menu underneath.
   ========================================================== */
.header-style-app {
	--app-ink: #12305a;
	--app-tint: #f1f5fb;
	--app-line: #dbe4f0;
}

.header-style-app .site-header {
	display: grid;
	grid-template-columns: auto 1fr auto auto auto;
	align-items: center;
	column-gap: 14px;
	width: min(100% - 24px, var(--container));
	margin: 12px auto 0;
	padding: 12px 18px;
	border: 1px solid var(--app-line);
	border-radius: 14px;
	background: var(--app-tint);
	box-shadow: none;
}

/* Let the logo, search and menu button sit directly in the grid */
.header-style-app .header-main,
.header-style-app .header-main-inner {
	display: contents;
}

.header-style-app .topbar,
.header-style-app .header-join {
	display: none;
}

/* Logo badge + name + tagline */
.header-style-app .site-branding {
	grid-column: 1;
	grid-row: 1;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 12px;
	align-items: center;
}

.header-style-app .brand-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	grid-row: 1 / span 2;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--app-ink);
	color: #fff;
	font-size: 20px;
	font-weight: 800;
	line-height: 1;
}

.header-style-app .custom-logo-link {
	grid-row: 1 / span 2;
}

.header-style-app .custom-logo-link img {
	max-height: 44px;
	border-radius: 8px;
}

.header-style-app .site-title {
	color: var(--app-ink);
	font-size: 19px;
	font-weight: 800;
	line-height: 1.2;
}

.header-style-app .site-tagline {
	font-size: 12.5px;
	line-height: 1.3;
}

/* Inline menu with dots between the items */
.header-style-app .main-navigation {
	grid-column: 2;
	grid-row: 1;
	justify-self: end;
	background: transparent;
}

.header-style-app .main-navigation .container {
	max-width: none;
	padding: 0;
}

.header-style-app .main-navigation .menu {
	flex-wrap: nowrap;
	align-items: center;
}

.header-style-app .main-navigation .menu > li + li::before {
	content: "\00b7";
	position: absolute;
	left: -2px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--app-ink);
	font-weight: 800;
}

.header-style-app .main-navigation .menu a {
	padding: 8px 10px;
	color: var(--app-ink);
	font-size: 15px;
	font-weight: 500;
	white-space: nowrap;
}

.header-style-app .main-navigation .menu a:hover,
.header-style-app .main-navigation .menu a:focus,
.header-style-app .main-navigation .current-menu-item > a {
	background: transparent;
	color: var(--c-accent);
	text-decoration: none;
}

.header-style-app .main-navigation .current-menu-item > a {
	font-weight: 700;
}

.header-style-app .main-navigation .sub-menu {
	background: var(--c-card);
	border: 1px solid var(--app-line);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(15, 42, 74, 0.12);
	overflow: hidden;
}

.header-style-app .main-navigation .sub-menu a {
	border-top: 0;
}

/* Search icon */
.header-style-app .search-toggle {
	grid-column: 3;
	grid-row: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--app-ink);
	cursor: pointer;
}

.header-style-app .search-toggle:hover,
.header-style-app .search-toggle:focus-visible,
.header-style-app .site-header.search-open .search-toggle {
	background: rgba(18, 48, 90, 0.1);
}

.header-style-app .search-toggle:focus-visible,
.header-style-app .search-toggle:hover {
	background: rgba(18, 48, 90, 0.1);
}

/* Search box opens as its own row under the bar */
.header-style-app .header-search {
	display: none;
}

.header-style-app .site-header.search-open .header-search {
	display: block;
	grid-column: 1 / -1;
	grid-row: 2;
	margin-top: 10px;
	flex: none;
}

.header-style-app .menu-toggle {
	grid-column: 5;
	grid-row: 1;
	border: 0;
	background: transparent;
}

.header-style-app .menu-toggle-bar {
	background: var(--app-ink);
}

.header-style-app .news-ticker {
	margin-top: 12px;
}

/* ---- Phones and small tablets ---- */
@media (max-width: 800px) {
	.header-style-app .site-header {
		grid-template-columns: 44px minmax(0, 1fr) 40px 44px;
		width: 100%;
		margin: 0;
		padding: 8px 12px 0;
		border-width: 0 0 1px;
		border-radius: 0;
		background: var(--c-card);
	}

	.header-style-app .search-toggle {
		grid-column: 4;
		grid-row: 1;
		width: 44px;
		height: 44px;
	}

	.header-style-app .site-branding {
		grid-column: 2;
		grid-row: 1;
		justify-self: center;
		max-width: 100%;
	}

	.header-style-app .brand-badge {
		width: 42px;
		height: 42px;
		border-radius: 12px;
		font-size: 21px;
	}

	.header-style-app .site-title {
		font-size: 19px;
	}

	.header-style-app .site-tagline {
		display: block;
		overflow: hidden;
		font-size: 10.5px;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.header-style-app .site-branding {
		column-gap: 10px;
	}

	.header-style-app .menu-toggle {
		grid-column: 1;
		grid-row: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
	}

	.header-style-app .menu-toggle-bar {
		width: 24px;
		height: 3px;
		border-radius: 2px;
	}

	/* Search row (when opened) */
	.header-style-app .site-header.search-open .header-search {
		grid-row: 2;
		margin: 4px 0 8px;
	}

	/* Swipeable pill menu */
	.header-style-app .pill-nav {
		display: block;
		grid-column: 1 / -1;
		grid-row: 3;
		margin: 0 -12px;
		padding: 8px 12px 12px;
		border-top: 1px solid var(--app-line);
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.header-style-app .pill-nav::-webkit-scrollbar {
		display: none;
	}

	.header-style-app .pill-nav .menu {
		display: flex;
		flex-wrap: nowrap;
		gap: 8px;
		margin: 0;
		padding: 0;
		list-style: none;
		width: max-content;
	}

	.header-style-app .pill-nav .menu a {
		display: block;
		padding: 9px 16px;
		border-radius: 999px;
		color: var(--app-ink);
		font-size: 15px;
		font-weight: 600;
		white-space: nowrap;
	}

	.header-style-app .pill-nav .menu a:hover,
	.header-style-app .pill-nav .menu a:focus {
		text-decoration: none;
		background: var(--app-tint);
	}

	.header-style-app .pill-nav .current-menu-item > a,
	.header-style-app .pill-nav .current-menu-ancestor > a,
	.header-style-app .pill-nav .current_page_item > a {
		background: var(--app-ink);
		color: #fff;
	}

	.header-style-app .pill-nav .sub-menu {
		display: none;
	}

	/* Full menu from the menu button: a clean white list under the pills */
	.header-style-app .main-navigation {
		grid-column: 1 / -1;
		grid-row: 4;
		justify-self: stretch;
		margin: 0 -12px;
		background: var(--c-card);
		border-top: 1px solid var(--app-line);
	}

	.header-style-app .main-navigation .container {
		padding: 0;
	}

	.header-style-app .main-navigation .menu {
		flex-direction: column;
		align-items: stretch;
	}

	.header-style-app .main-navigation .menu > li + li::before {
		content: none;
	}

	.header-style-app .main-navigation .menu a {
		padding: 13px 16px;
		border-top: 1px solid var(--app-line);
		font-size: 15.5px;
	}

	.header-style-app .main-navigation .sub-menu {
		background: rgba(127, 127, 127, 0.06);
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	.header-style-app .news-ticker {
		margin-top: 0;
	}
}

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .header-style-app,
	:root:not([data-theme="light"]) body.header-style-app {
		--app-ink: #e6edf7;
		--app-tint: #16202e;
		--app-line: #2a3a50;
	}

	:root:not([data-theme="light"]) .header-style-app .brand-badge,
	:root:not([data-theme="light"]) .header-style-app .pill-nav .current-menu-item > a {
		background: #2f6fe0;
		color: #fff;
	}
}

:root[data-theme="dark"] .header-style-app,
:root[data-theme="dark"] body.header-style-app {
	--app-ink: #e6edf7;
	--app-tint: #16202e;
	--app-line: #2a3a50;
}

:root[data-theme="dark"] .header-style-app .brand-badge,
:root[data-theme="dark"] .header-style-app .pill-nav .current-menu-item > a {
	background: #2f6fe0;
	color: #fff;
}

/* ==========================================================
   Dark navy (default): the App layout in navy, with an orange
   line under the header and the latest ticker right below it.
   Body has both header-style-app and header-style-navy.
   ========================================================== */
.header-style-navy {
	--app-ink: #ffffff;
	--navy-bg: #0f2a4a;
	--app-tint: var(--navy-bg);
	--app-line: rgba(255, 255, 255, 0.16);
	--navy-soft: #a9bfdc;
	--navy-hot: #ff8a4c;
}

.header-style-navy .site-header {
	width: 100%;
	margin: 0;
	padding: 12px max(16px, calc((100% - var(--container)) / 2));
	border: 0;
	border-bottom: 3px solid var(--c-accent);
	border-radius: 0;
	background: var(--navy-bg);
	box-shadow: 0 2px 10px rgba(15, 42, 74, 0.25);
}

.header-style-navy .brand-badge {
	background: var(--c-accent) !important;
	color: #fff !important;
}

.header-style-navy .site-title {
	color: #fff;
}

.header-style-navy .site-tagline {
	color: var(--navy-soft);
}

.header-style-navy .main-navigation .menu > li + li::before {
	color: rgba(255, 255, 255, 0.55);
}

.header-style-navy .main-navigation .menu a {
	color: #fff;
}

.header-style-navy .main-navigation .menu a:hover,
.header-style-navy .main-navigation .menu a:focus,
.header-style-navy .main-navigation .current-menu-item > a {
	color: var(--navy-hot);
}

.header-style-navy .main-navigation .sub-menu {
	background: color-mix(in srgb, var(--navy-bg) 78%, #000);
	border-color: rgba(255, 255, 255, 0.14);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.header-style-navy .search-toggle {
	color: #fff;
}

.header-style-navy .search-toggle:hover,
.header-style-navy .search-toggle:focus-visible,
.header-style-navy .site-header.search-open .search-toggle {
	background: rgba(255, 255, 255, 0.14);
}

.header-style-navy .menu-toggle-bar {
	background: #fff;
}

/* Ticker sits directly under the orange line */
.header-style-navy .news-ticker {
	margin-top: 0;
}

@media (max-width: 800px) {
	.header-style-navy .site-header {
		padding: 8px 12px 0;
		background: var(--navy-bg);
	}

	.header-style-navy .pill-nav {
		border-top-color: rgba(255, 255, 255, 0.16);
	}

	.header-style-navy .pill-nav .menu a {
		color: #e4ecf8;
	}

	.header-style-navy .pill-nav .menu a:hover,
	.header-style-navy .pill-nav .menu a:focus {
		background: rgba(255, 255, 255, 0.1);
	}

	.header-style-navy .pill-nav .current-menu-item > a,
	.header-style-navy .pill-nav .current-menu-ancestor > a,
	.header-style-navy .pill-nav .current_page_item > a {
		background: var(--c-accent) !important;
		color: #fff !important;
	}

	/* Menu-button list: dark panel with light links */
	.header-style-navy .main-navigation {
		background: color-mix(in srgb, var(--navy-bg) 78%, #000);
		border-top-color: rgba(255, 255, 255, 0.16);
	}

	.header-style-navy .main-navigation .menu a {
		border-top-color: rgba(255, 255, 255, 0.12);
	}

	.header-style-navy .main-navigation .sub-menu {
		background: rgba(255, 255, 255, 0.05);
	}
}


/* Dark-mode button (added by np-custom-scripts.js): sits in the grid */
.header-style-app .theme-toggle {
	grid-column: 4;
	grid-row: 1;
	width: 40px;
	height: 40px;
	border: 0;
	background: transparent;
	color: var(--app-ink);
	font-size: 19px;
}

.header-style-app .theme-toggle:hover,
.header-style-app .theme-toggle:focus-visible {
	background: rgba(127, 127, 127, 0.18);
}

@media (max-width: 800px) {
	.header-style-app .theme-toggle {
		grid-column: 3;
		width: 40px;
	}

	.header-style-app .custom-logo-link img {
		max-width: 100%;
		object-fit: contain;
	}
}

/* ==========================================================
   Secondary menu: a slim strip of extra links under the header
   (Appearance > Menus > Manage Locations > Secondary Menu)
   ========================================================== */
.secondary-navigation {
	border-top: 1px solid var(--c-border);
	background: var(--c-card);
}

.secondary-navigation .menu {
	display: flex;
	flex-wrap: nowrap;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.secondary-navigation .menu::-webkit-scrollbar {
	display: none;
}

.secondary-navigation .menu a {
	display: block;
	padding: 8px 12px;
	color: var(--c-text);
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
}

.secondary-navigation .menu a:hover,
.secondary-navigation .menu a:focus,
.secondary-navigation .current-menu-item > a {
	color: var(--c-primary);
	text-decoration: none;
	box-shadow: inset 0 -2px 0 var(--c-accent);
}

/* In the App and Navy headers the strip is the last row of the header */
.header-style-app .secondary-navigation {
	grid-column: 1 / -1;
	grid-row: 5;
	margin-top: 10px;
	border-top: 1px solid var(--app-line);
	background: transparent;
}

.header-style-app .secondary-navigation .container {
	max-width: none;
	padding: 0;
}

.header-style-app .secondary-navigation .menu a {
	padding: 9px 12px 2px;
	color: var(--app-ink);
	font-size: 13.5px;
	font-weight: 500;
}

.header-style-app .secondary-navigation .menu a:hover,
.header-style-app .secondary-navigation .menu a:focus,
.header-style-app .secondary-navigation .current-menu-item > a {
	color: var(--c-accent);
	box-shadow: none;
}

.header-style-app .secondary-navigation .menu li:first-child a {
	padding-left: 0;
}

.header-style-navy .secondary-navigation .menu a {
	color: #cfe0ff;
}

.header-style-navy .secondary-navigation .menu a:hover,
.header-style-navy .secondary-navigation .menu a:focus,
.header-style-navy .secondary-navigation .current-menu-item > a {
	color: var(--navy-hot);
}

@media (max-width: 800px) {
	.header-style-app .secondary-navigation {
		margin: 0 -12px;
		padding: 0 12px;
		border-top: 1px solid var(--app-line);
	}

	.header-style-app .secondary-navigation .menu a {
		padding: 9px 11px;
	}

	.header-style-app .secondary-navigation .menu li:first-child a {
		padding-left: 0;
	}
}

@media print {
	.secondary-navigation {
		display: none;
	}
}

/* Phones: only one scrolling menu (the pills). The secondary strip is for larger screens. */
@media (max-width: 800px) {
	.secondary-navigation,
	.header-style-app .secondary-navigation {
		display: none;
	}
}
