/* ============================================================
   Header: sticky; the large logo shrinks once the page scrolls; centred
   menu and "Enquire to stay" from 1181px, a menu button below that opens
   the menu over the whole screen.
   (prototype: .site-header, .brand, .nav, .menu-btn)
   ============================================================ */

/* Fill the notch area above the sticky header on phones. */
body::before {
	content: "";
	position: fixed;
	inset: 0 0 auto;
	z-index: 60;
	height: env(safe-area-inset-top, 0px);
	background: var(--color-surface-light);
}

/* The header floats over the page (fixed) above a reserved space of its
   full height (--header-h on body), so shrinking it on scroll never moves
   the page. The prototype's sticky header sat in the flow: shrinking it
   pulled the page up 92px, the browser's scroll anchoring moved the scroll
   back under 10px, the header grew, and so on - a loop that flickered even
   with no scrolling (Miles 2026-11-24).
   main.js shrinks the header only once the reserved space has scrolled
   under the small header; the space is also painted the header's colour,
   so a fast scroll back up never flashes a white strip while the header
   grows back (Miles 2026-11-24: "white strip ... under the navbar"). */
body {
	padding-top: var(--header-h);
	background-image: linear-gradient(var(--color-surface-light), var(--color-surface-light));
	background-repeat: no-repeat;
	background-size: 100% var(--header-h);
}

.site-header {
	--header-top: env(safe-area-inset-top, 0px);
	position: fixed;
	top: var(--header-top);
	right: 0;
	left: 0;
	z-index: 50;
}

/* The background sits on its own layer: a backdrop-filter on the header
   itself would make the full-screen menu inside it only as large as the
   header. */
.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -2;
	background: var(--color-surface-light);
	transition: box-shadow 0.4s var(--ease), background-color 0.4s var(--ease);
}

.site-header.is-scrolled::before {
	background: var(--color-header-scrolled);
	box-shadow: 0 1px 0 var(--color-line);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

/* Lift the header below the WordPress toolbar for logged-in editors. */
.admin-bar .site-header {
	--header-top: calc(env(safe-area-inset-top, 0px) + var(--wp-admin--admin-bar--height, 0px));
}

@media (max-width: 600px) {
	.admin-bar .site-header {
		--header-top: env(safe-area-inset-top, 0px);
	}
}

.site-header__inner {
	position: relative;
	display: flex;
	align-items: center;
	gap: 40px;
	min-height: var(--header-h);
	padding-block: 12px;
	transition: min-height 0.45s var(--ease);
}

.site-header.is-scrolled .site-header__inner {
	min-height: var(--header-h-scrolled);
}

.site-header__brand {
	display: block;
	flex: none;
	text-decoration: none;
	transition: transform 0.5s var(--ease);
}

.site-header__brand img {
	width: auto;
	height: 98px;
	transition: height 0.45s var(--ease);
}

.site-header.is-scrolled .site-header__brand img {
	height: 52px;
}

@media (hover: hover) {
	.site-header__brand:hover {
		transform: rotate(-3deg);
	}
}

/* The menu below 1181px: the whole screen, opened by the button (Miles
   2026-11-24: "can it fill the whole screen ... add the social links to the
   bottom"): from under the header, which stays with its logo and button in
   the same colour, to the foot of the screen. It scrolls if the screen is
   short (a phone on its side). Emma wanted only that: the pages keep the
   prototype's list (small capitals, left, a line under each), at the top;
   the social links sit at the foot. */
.site-header__nav {
	--nav-top: calc(var(--header-top) + var(--header-h));
	position: fixed;
	inset: var(--nav-top) 0 0;
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding: 4px var(--gutter-r) calc(24px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--color-surface-light);
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.25s var(--ease), visibility 0s linear 0.25s;
}

.site-header.is-scrolled .site-header__nav {
	--nav-top: calc(var(--header-top) + var(--header-h-scrolled));
}

.site-header__nav.is-open {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.25s var(--ease), visibility 0s;
}

/* The page behind stays where it is; where a scrollbar goes away (a narrow
   desktop window) its width is kept (--scrollbar, main.js), so nothing
   shifts. */
.is-menu-open {
	overflow: hidden;
}

.is-menu-open body,
.is-menu-open .site-header {
	padding-right: var(--scrollbar, 0px);
}

.is-menu-open .site-header::before {
	background: var(--color-surface-light);
	box-shadow: none;
}

.site-header__menu {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header__menu a {
	position: relative;
	display: block;
	padding: 16px 0;
	border-bottom: 1px solid var(--color-line);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	text-decoration: none;
}

.site-header__nav .site-header__social {
	flex: none;
	align-self: center;
	justify-content: center;
	gap: 8px 28px;
	width: min(100%, 420px);
	margin-top: auto;
	padding-top: 22px;
	background: var(--dots-line) 0 0 / 8px 3px space no-repeat;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

/* The list drops in with the menu, the social links follow. */
@media (max-width: 1180px) {
	.site-header__nav.is-open .site-header__menu {
		animation: tlo-menu-drop 0.45s var(--ease);
	}
}

@media (max-width: 1180px) and (prefers-reduced-motion: no-preference) {
	.site-header__nav.is-open .site-header__social {
		animation: tlo-enter-rise 0.4s var(--ease) 0.2s backwards;
	}
}

.site-header__cta {
	display: none;
	color: var(--color-text);
}

.site-header__toggle {
	display: block;
	width: 48px;
	height: 48px;
	margin-left: auto;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--color-text);
	cursor: pointer;
}

.site-header__toggle span {
	display: block;
	width: 30px;
	height: 1.5px;
	margin: 7px auto;
	background: currentColor;
	transition: transform 0.4s var(--ease), opacity 0.3s;
}

.site-header__toggle[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(8.5px) rotate(45deg);
}

.site-header__toggle[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}

.site-header__toggle[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-8.5px) rotate(-45deg);
}

@keyframes tlo-menu-drop {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (min-width: 481px) {
	.site-header__brand img {
		height: 124px;
	}

	.site-header.is-scrolled .site-header__brand img {
		height: 58px;
	}
}

/* Desktop: the menu in the bar, a dotted underline under the current page
   and on hover. */
@media (min-width: 1181px) {
	.site-header__brand img {
		height: 150px;
	}

	.site-header.is-scrolled .site-header__brand img {
		height: 66px;
	}

	.site-header__nav,
	.site-header__nav.is-open {
		position: static;
		flex: 1;
		flex-direction: row;
		justify-content: center;
		padding: 0;
		overflow: visible;
		background: none;
		visibility: visible;
		opacity: 1;
		transition: none;
	}

	.site-header__menu {
		flex-direction: row;
		gap: 34px;
	}

	.site-header__menu a {
		padding: 8px 0;
		border-bottom: 0;
		font-size: var(--size-label);
	}

	.site-header__nav .site-header__social {
		display: none;
	}

	/* The dotted rule under the current page and on hover / focus (the
	   --dots tokens in main.css, shared with the arrow links): from the
	   first letter to the last (right: the trailing letter-spacing), whole
	   dots at both ends, revealed dot by dot, never stretched. */
	.site-header__menu a::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0.22em;
		bottom: 2px;
		height: 3px;
		background: var(--dots);
		-webkit-mask: var(--dots-mask);
		mask: var(--dots-mask);
		-webkit-mask-position: var(--dots-hidden);
		mask-position: var(--dots-hidden);
		transition: var(--dots-transition);
	}

	.site-header__menu a[aria-current="page"]::after,
	.site-header__menu a:focus-visible::after {
		-webkit-mask-position: var(--dots-shown);
		mask-position: var(--dots-shown);
	}

	.site-header__cta {
		display: inline-flex;
	}

	.site-header__toggle {
		display: none;
	}
}

@media (min-width: 1181px) and (hover: hover) {
	.site-header__menu a:hover::after {
		-webkit-mask-position: var(--dots-shown);
		mask-position: var(--dots-shown);
	}
}
