/*
 * Site header.
 *
 * Desktop: name, a thin brass divider and the tagline on one line at the
 * left; search, theme toggle and Get updates at the right (menu links too,
 * if a menu is assigned). Stays at the top of the screen on every page;
 * core.js publishes its height as --header-height for the sidebar and
 * anchor links. The compact layout (avatar, name over tagline, round
 * buttons) is in compact.css.
 */

.site-header {
	position: sticky;
	top: var(--admin-bar);
	z-index: 30;
	background: var(--header-glow), var(--header-bg);
	border-bottom: 1px solid var(--hairline);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding-top: 18px;
	padding-bottom: 18px;
}

.site-brand {
	/*
	 * Optical alignment for the compact layout, where the tagline sits under
	 * the name: letters have built-in space before their left edge (side
	 * bearing). Manrope's "B" at 800 has 0.070em; Newsreader italic's "E" at
	 * 400 has -0.0175em (it leans left of its box). compact.css shifts the
	 * name so both inked edges line up exactly. If the site name or tagline
	 * starts with a different letter, update these numbers
	 * (docs/ARCHITECTURE.md explains how to measure them).
	 */
	--title-bearing: .07;
	--tagline-bearing: -.0175;
	/*
	 * Desktop sizes and vertical alignment. At full width the name's
	 * capitals are about 80% of the 40px buttons (44px x 0.72 cap height),
	 * in weight 700, so the name leads without outweighing the controls.
	 * On narrower desktop screens name and tagline scale down together so
	 * they always fit on one line. Name and tagline share
	 * a baseline, then the tagline is lifted by half the difference in
	 * capital heights so the middles of both lines' capitals line up
	 * (Manrope caps 0.72em, Newsreader italic caps 0.67em).
	 */
	--name-size: clamp(38px, 3.4vw, 44px);
	--name-cap: .72;
	--tagline-size: calc(var(--name-size) * .545); /* 24px beside a 44px name */
	--tagline-cap: .67;
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
}
.site-brand__avatar { display: none; }
.site-brand__text {
	/* Lifts the text so the name's capitals center on the buttons
	   (measured: about 3.3px at the 56px size, 4.6px at 40px). */
	position: relative;
	top: calc(var(--name-size) * .08 - 7.8px);
	display: flex;
	align-items: baseline;
	gap: 22px;
	min-width: 0;
}

.site-title {
	margin: 0;
	font-size: var(--name-size);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.035em;
	white-space: nowrap;
}
.site-brand__divider {
	/* Centered on the name's capitals, extending 8px above and below them. */
	position: relative;
	top: 8px;
	flex: none;
	width: 1px;
	height: calc(var(--name-size) * var(--name-cap) + 16px);
	background: var(--accent);
	opacity: .55;
}
.site-tagline {
	position: relative;
	line-height: 1;
	top: calc((var(--tagline-size) * var(--tagline-cap) - var(--name-size) * var(--name-cap)) / 2);
	margin: 0;
	color: var(--accent);
	font-family: var(--font-tagline);
	font-size: var(--tagline-size);
	font-style: italic;
	font-weight: 400;
	white-space: nowrap;
}

.site-header__actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-wrap: nowrap;
	gap: 16px;
	margin-left: auto;
}
.primary-nav { margin-right: 6px; }

/* The bell is the compact-screen face of the Get updates button. */
.updates__toggle .icon--bell { display: none; }

.primary-nav__list {
	display: flex;
	gap: 22px;
	list-style: none;
	font-size: 15px;
	font-weight: 500;
	white-space: nowrap;
}
.primary-nav a { display: inline-block; padding: 2px 0; transition: color var(--speed); }
.primary-nav a:focus-visible { outline-offset: 4px; border-radius: 4px; }
.primary-nav a:active { color: var(--accent); opacity: .7; }
.primary-nav .current-menu-item > a { color: var(--accent); }

.menu-button { display: none; }
.menu-button .icon--close,
.menu-button[aria-expanded="true"] .icon--menu { display: none; }
.menu-button[aria-expanded="true"] .icon--close { display: block; }

.updates { position: relative; }
.updates__toggle .icon--chevron { transition: transform var(--speed); }
.updates__toggle[aria-expanded="true"] .icon--chevron { transform: rotate(180deg); }

/* 3px reading-progress line along the bottom edge (posts). */
.reading-progress {
	position: absolute;
	inset: auto 0 -1px;
	height: 3px;
	pointer-events: none;
}
.reading-progress__bar {
	display: block;
	height: 100%;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: left center;
}

@media (hover: hover) {
	.primary-nav a:hover {
		color: var(--accent);
		text-decoration: underline;
		text-underline-offset: 5px;
		text-decoration-thickness: 1px;
	}
}
