/*
 * Site header, desktop nav, mobile menu sheet (PLAN §7.2, DESIGN §10.1).
 * Both menus are in the HTML; CSS picks one at 1080px. JS only toggles state.
 */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	box-shadow: inset 0 -1px 0 transparent;
	transition: background-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.site-header.is-compact {
	background: color-mix(in srgb, var(--page) 84%, transparent);
	-webkit-backdrop-filter: blur(14px) saturate(1.15);
	backdrop-filter: blur(14px) saturate(1.15);
	box-shadow: inset 0 -1px 0 var(--line);
}
/* An open menu needs an opaque bar above the sheet. */
.site-header.is-open { background: var(--page); box-shadow: inset 0 -1px 0 var(--line); }

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	height: var(--header-h);
	transition: height 300ms var(--ease);
}
.site-header.is-compact .site-header__inner { height: var(--header-h-compact); }

/* ---- Wordmark ---- */
.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	color: var(--fg);
	text-decoration: none;
	font-family: var(--font-display);
	font-variation-settings: "SOFT" 50;
	font-size: 22px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: -.01em;
	white-space: nowrap;
}
.wordmark:hover { color: var(--fg); }
.wordmark em { font-style: italic; font-weight: 400; }
.wordmark__arch { width: 15px; height: 22px; color: var(--accent); }

/* ---- Desktop nav ---- */
.site-nav ul {
	display: flex;
	align-items: center;
	gap: 2px;
}
.site-nav a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 10px 9px;
	color: var(--fg);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--copper); }

.site-header__actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* ---- Theme button: icon swaps with CSS so cached HTML is identical for everyone ---- */
.theme-btn { position: relative; }
.theme-btn .icon {
	grid-area: 1 / 1;
	transition: transform 200ms var(--ease), opacity 200ms var(--ease);
}
.theme-btn .icon-moon { width: 18px; height: 18px; }
.theme-btn .icon-sun { width: 20px; height: 20px; opacity: 0; transform: rotate(90deg) scale(.6); }
[data-theme="dark"] .theme-btn .icon-moon { opacity: 0; transform: rotate(-90deg) scale(.6); }
[data-theme="dark"] .theme-btn .icon-sun { opacity: 1; transform: none; }
.theme-btn > * { pointer-events: none; }
.theme-btn { display: grid; }

/* ---- Menu button ---- */
.menu-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: var(--fg);
	color: var(--page);
	font-size: 14px;
	font-weight: 700;
}
.menu-btn[aria-expanded="true"] .menu-btn__open,
.menu-btn[aria-expanded="false"] .menu-btn__close { display: none; }

/* ---- Mobile sheet ---- */
.menu-sheet {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 20;
	height: calc(100dvh - var(--header-h));
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 12px var(--gutter) 32px;
	background: var(--page);
	border-top: 1px solid var(--line);
}
.site-header.is-compact .menu-sheet { height: calc(100dvh - var(--header-h-compact)); }
.menu-sheet__inner { max-width: var(--content); margin-inline: auto; }

.menu-sheet__list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	border-bottom: 1px solid var(--line);
	color: var(--fg);
	font-family: var(--font-display);
	font-variation-settings: "SOFT" 50;
	font-size: 26px;
	line-height: 1.1;
	text-decoration: none;
}
.menu-sheet__list a[aria-current="page"] { color: var(--accent); font-style: italic; }
.menu-sheet__num {
	font-family: var(--font-arabic);
	font-size: 16px;
	font-style: normal;
	color: var(--gold-ink);
}

.menu-sheet__theme {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	border-bottom: 1px solid var(--line);
	font-family: var(--font-display);
	font-variation-settings: "SOFT" 50;
	font-size: 20px;
	font-weight: 500;
}

/* Switch 52×30, role=switch. On = dark theme. */
.switch {
	position: relative;
	width: 52px;
	height: 30px;
	flex: none;
	padding: 0;
	border: 1px solid var(--gold-line);
	border-radius: 999px;
	background: transparent;
	transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}
.switch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 3px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--gold-line);
	transition: transform 200ms var(--ease), background-color 200ms var(--ease);
}
.switch[aria-checked="true"] { background: var(--copper-2); border-color: var(--copper-2); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--navy); }

.menu-sheet__cta { margin-top: 24px; font-size: 16px; }

html.menu-open { overflow: hidden; }

/* ---- Breakpoint: full menu from 1080px (CSS only) ---- */
@media (min-width: 1080px) {
	.menu-btn,
	.menu-sheet { display: none !important; }
}
@media (max-width: 1079.98px) {
	.site-nav,
	.site-header__cta { display: none; }
	.site-header__actions { gap: 8px; }
}

/* Logged-in admins: keep the sticky header below the WP admin bar. */
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}
@media (max-width: 600px) {
	.admin-bar .site-header { top: 0; } /* admin bar scrolls away here */
}
