/**
 * CFUL 2026 — Header
 *
 * Sticky site header: top bar (logo + top_menu subsite links) and the
 * angled primary-nav strip below it. Colors/spacing/type come exclusively
 * from assets/css/tokens.css custom properties.
 */

/* -------------------------------------------------------------------- */
/* Shared accessibility utility (also used by footer + search markup)   */
/* -------------------------------------------------------------------- */

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal;
}

.screen-reader-text:focus {
	background-color: var(--cful-white);
	border-radius: var(--radius-card);
	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.4);
	clip: auto !important;
	clip-path: none;
	color: var(--cful-black);
	display: block;
	font-size: var(--text-sm);
	height: auto;
	left: var(--space-2);
	line-height: var(--leading-normal);
	padding: var(--space-2) var(--space-3);
	text-decoration: none;
	top: var(--space-2);
	width: auto;
	z-index: 1000000;
}

.cful-skip-link {
	left: -9999px;
	position: absolute;
	top: 0;
	z-index: 1000000;
}

.cful-skip-link:focus {
	left: var(--space-2);
}

/* -------------------------------------------------------------------- */
/* Site header shell                                                    */
/* -------------------------------------------------------------------- */

.cful-site-header {
	background: var(--cful-white);
	position: sticky;
	top: 0;
	z-index: 100;
}

/* -------------------------------------------------------------------- */
/* Top bar: logo (left) + top_menu subsite links (right)                */
/* -------------------------------------------------------------------- */

.cful-top-bar {
	background: var(--cful-white);
	border-bottom: var(--border-hairline);
	width: 100%;
}

.cful-top-bar__inner {
	align-items: flex-end;
	display: flex;
	height: var(--header-bar-h);
	justify-content: space-between;
	margin: 0 auto;
	max-width: var(--container-max);
	padding: 1.5rem var(--container-pad) 1rem;
}

.cful-top-bar__logo {
	display: flex;
	flex: 0 0 auto;
}

.cful-logo-link {
	display: inline-flex;
}

.cful-logo {
	display: block;
	height: 1.625rem;
	max-width: 100%;
	width: auto;
}

.cful-logo-text {
	color: var(--cful-black);
	font-family: var(--font-sans);
	font-size: var(--text-lg);
	font-weight: var(--fw-semibold);
	letter-spacing: 0.02em;
}

.cful-top-menu {
	flex: 0 0 auto;
}

.cful-top-menu__list {
	align-items: center;
	display: flex;
	gap: var(--space-6);
	list-style: none;
	margin: 0;
	padding: 0;
}

.cful-top-menu__list .menu-item a {
	color: var(--cful-black);
	font-family: var(--font-sans);
	font-size: var(--text-md);
	font-weight: var(--fw-semibold);
	text-decoration: none;
}

.cful-top-menu__list .menu-item a:hover,
.cful-top-menu__list .menu-item a:focus {
	text-decoration: underline;
}

/* On the comp, "Home" is represented by the logo itself; hide the
   duplicate "Home" text link from the rendered top_menu so only the
   subsite names (HPhil / LanCog / Praxis) show at the right. */
.cful-top-menu__list .menu-item:first-child {
	display: none;
}

/* The mobile menu panel (the primary strip) carries a second copy of the
   subsite nav for small screens; keep that copy out of the desktop layout.
   It's revealed inside the open panel in the mobile media block below. */
.cful-primary-strip .cful-top-menu {
	display: none;
}

/* -------------------------------------------------------------------- */
/* Angled strip: primary_menu                                           */
/* -------------------------------------------------------------------- */

.cful-primary-strip {
	background: var(--cful-white);
	border-bottom: var(--border-hairline);
	min-height: var(--header-strip-h);
	width: 100%;
}

.cful-primary-strip__inner {
	align-items: center;
	display: flex;
	margin: 0 auto;
	max-width: var(--container-max);
	min-height: var(--header-strip-h);
	padding: 0 var(--container-pad);
}

.cful-primary-nav {
	flex: 1 1 auto;
}

.cful-primary-nav__list {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-5) var(--space-6);
	list-style: none;
	margin: 0;
	padding: 0;
}

.cful-primary-nav__list .menu-item a {
	color: var(--cful-black);
	font-family: var(--font-sans);
	font-size: var(--text-sm);
	font-weight: var(--fw-regular);
	text-decoration: none;
}

.cful-primary-nav__list .menu-item a:hover,
.cful-primary-nav__list .menu-item a:focus {
	text-decoration: underline;
}

/* -------------------------------------------------------------------- */
/* Department accent bar (subsites only) — the flat off-white inline     */
/* logo on the department accent. Rendered by                           */
/* template-parts/header/dept-bar.php only on /hphil, /lancog, /praxis.  */
/* -------------------------------------------------------------------- */

.cful-dept-bar {
	background: var(--color-primary);
	width: 100%;
}

.cful-dept-bar__inner {
	align-items: center;
	display: flex;
	margin: 0 auto;
	max-width: var(--container-max);
	padding: var(--space-6) var(--container-pad);
}

/* Link wraps the lockup only, so the click target hugs the logo. */
.cful-dept-bar__link {
	display: inline-flex;
	align-items: center;
}

/* Logo ships flat #f6f0ed (--cful-white); no filter. Sized by width like
   .cful-logo so width stays auto and the lockup never distorts. */
.cful-dept-bar__logo {
	display: block;
	max-width: 100%;
	width: auto;
	height: 1.625rem;
}

@media (max-width: 56.25em) {
	.cful-dept-bar__logo {
		height: 1rem;
	}
}

/* -------------------------------------------------------------------- */
/* Mobile nav toggle — a plus (menu closed) that becomes a minus (menu   */
/* open). Hidden on desktop; shown in the media block below. Open/close  */
/* state (aria-expanded) is driven by assets/js/navigation.js.           */
/* -------------------------------------------------------------------- */

.cful-nav-toggle {
	background: transparent;
	border: 0;
	cursor: pointer;
	display: none;
	padding: var(--space-2);
}

/* 27x30 icon box (matches the comp's plus/minus glyphs). */
.cful-nav-toggle__bars {
	display: block;
	height: 1.875rem;
	position: relative;
	width: 1.6875rem;
}

.cful-nav-toggle__bars::before,
.cful-nav-toggle__bars::after {
	background: var(--color-text);
	content: "";
	position: absolute;
}

/* Horizontal stroke — always present: the minus, and half of the plus. */
.cful-nav-toggle__bars::before {
	height: 1px;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 100%;
}

/* Vertical stroke — only while closed; with the horizontal it forms the plus. */
.cful-nav-toggle__bars::after {
	height: 100%;
	left: 50%;
	top: 0;
	transform: translateX(-50%);
	width: 1px;
}

.cful-nav-toggle[aria-expanded="true"] .cful-nav-toggle__bars::after {
	display: none;
}

/* -------------------------------------------------------------------- */
/* Shared search form (searchform.php / get_search_form()) — used by the  */
/* 404 page, the "nothing found" state, and the search page.             */
/* -------------------------------------------------------------------- */

.cful-search-form {
	display: flex;
	gap: var(--space-3);
}

.cful-search-form__field {
	border: var(--border-hairline);
	flex: 1 1 auto;
	font-family: var(--font-sans);
	font-size: var(--text-sm);
	min-height: 40px;
	padding: var(--space-3) var(--space-4);
}

.cful-search-form__submit {
	background: var(--color-primary);
	border: 0;
	color: var(--color-primary-contrast);
	cursor: pointer;
	font-family: var(--font-sans);
	font-size: var(--text-sm);
	font-weight: var(--fw-semibold);
	min-height: 40px;
	padding: var(--space-3) var(--space-5);
}

/* -------------------------------------------------------------------- */
/* Mobile header (<= 56.25em / 900px): stacked logo + plus/minus toggle. */
/* The top bar stays put as the persistent header (logo left, toggle     */
/* right); the primary strip becomes the menu panel that opens BELOW it   */
/* as a full-height cream sheet (--cful-white) — subsite links in one     */
/* right-aligned row, page links at the largest type size. Open keys off  */
/* the toggle's aria-expanded (set by assets/js/navigation.js) via :has().*/
/* -------------------------------------------------------------------- */

@media (max-width: 56.25em) {
	/* Stacked lockup is smaller/taller than the oneliner; the <picture>
	   in top-bar.php swaps the src at this same breakpoint. */
	.cful-logo {
		height: 2.5rem;
	}

	/* Top bar = logo (left) + plus/minus toggle (right). Fixed height so
	   the panel below can anchor to its bottom edge. The desktop subsite
	   nav is hidden here — its mobile copy lives inside the panel. */
	.cful-nav-toggle {
		display: block;
	}

	.cful-top-bar__inner {
		align-items: center;
		height: var(--header-bar-h);
		padding: 0 var(--container-pad);
	}

	.cful-top-bar .cful-top-menu {
		display: none;
	}

	/* Menu panel = the primary strip. Closed by default. */
	.cful-primary-strip {
		display: none;
	}

	/* -- Open: drop a full-height cream sheet from the top bar downward.
	   Background comes from the base .cful-primary-strip rule (--cful-white). */
	.cful-site-header:has(.cful-nav-toggle[aria-expanded="true"])
		.cful-primary-strip {
		border-bottom: 0;
		border-top: var(--border-hairline);
		bottom: 0;
		display: block;
		left: 0;
		overflow-y: auto;
		position: fixed;
		right: 0;
		top: var(--header-bar-h);
		z-index: 90;
	}

	/* Lock the page behind the open menu. */
	html:has(.cful-nav-toggle[aria-expanded="true"]) {
		overflow: hidden;
	}

	/* Stack the panel contents: subsite row, then the page links. */
	.cful-primary-strip__inner {
		align-items: stretch;
		flex-direction: column;
		gap: var(--space-6);
		min-height: 0;
		padding-bottom: var(--space-8);
		padding-top: var(--space-6);
	}

	/* Subsite links: one right-aligned row at their normal size, closed off
	   by a full-bleed hairline. The inner wrapper pads content by
	   --container-pad, so bleed the border to both viewport edges with a
	   negative inline margin and restore the list's alignment with matching
	   inline padding (same technique as the footer's mobile dividers). */
	.cful-primary-strip .cful-top-menu {
		border-bottom: var(--border-hairline);
		display: block;
		margin-inline: calc(var(--container-pad) * -1);
		padding-bottom: var(--space-5);
		padding-inline: var(--container-pad);
	}

	.cful-primary-strip .cful-top-menu__list {
		gap: var(--space-5);
		justify-content: flex-end;
	}

	/* Page links: stacked one per line at the biggest type size. */
	.cful-primary-nav__list {
		align-items: flex-start;
		flex-direction: column;
		gap: var(--space-4);
	}

	.cful-primary-nav__list .menu-item a {
		font-size: var(--text-3xl);
	}

	.cful-search-form {
		flex-direction: column;
	}
}
