/* Site header */

.site-header-wrap {
	position: sticky;
	top: 0;
	z-index: 40;
	width: 100%;
	background: var( --wp--preset--color--background );
	border-bottom: 1px solid transparent;
	transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.site-header-wrap.is-scrolled {
	background: rgba( 11, 11, 11, 0.82 );
	backdrop-filter: saturate( 140% ) blur( 14px );
	-webkit-backdrop-filter: saturate( 140% ) blur( 14px );
	border-bottom-color: #1a1a19;
}

.site-header {
	width: 100%;
	max-width: 1360px;
	margin: 0 auto;
	box-sizing: border-box;
	padding: 12px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
}

@media ( min-width: 640px ) {
	.site-header {
		padding: 14px 40px;
	}
}

.site-logo {
	display: flex;
	align-items: center;
}

.site-logo__img {
	height: 40px;
	width: auto;
	display: block;
}

@media ( min-width: 640px ) {
	.site-logo__img {
		height: 48px;
	}
}

.site-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	/* Row gap is 4px under the design's 18px: the links' 6px tap padding
	   makes each row taller, and this keeps the wrapped row where the
	   design puts it. */
	gap: 14px 18px;
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-weight: 500;
}

@media ( min-width: 640px ) {
	.site-nav__list {
		gap: 36px;
	}
}

.site-nav__list a {
	color: #8d8c87;
	padding: 6px 0;
	display: block;
	text-decoration: none;
	transition: color 0.25s ease;
}

.site-nav__list a:hover {
	color: #ffffff;
}

/* Mobile menu (below 640px, JS only): a toggle in the logo row, the
   links drop down under the bar. Not in the design, whose wrapped menu
   took ~160px of a phone screen; without JS the menu stays as above. */

.site-nav-toggle {
	display: none;
}

@media ( max-width: 639px ) {

	.lop-js .site-header {
		flex-wrap: nowrap;
	}

	.lop-js .site-nav-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		margin-right: -10px;
		padding: 0;
		border: 0;
		background: none;
		color: var( --wp--preset--color--foreground );
		cursor: pointer;
	}

	/* Two lines that turn into a cross when open. */
	.site-nav-toggle__icon,
	.site-nav-toggle__icon::before,
	.site-nav-toggle__icon::after {
		display: block;
		width: 22px;
		height: 1.5px;
		background: currentColor;
	}

	.site-nav-toggle__icon {
		position: relative;
		background: transparent;
	}

	.site-nav-toggle__icon::before,
	.site-nav-toggle__icon::after {
		content: "";
		position: absolute;
		left: 0;
		transition: transform 0.25s ease;
	}

	.site-nav-toggle__icon::before {
		transform: translateY( -4px );
	}

	.site-nav-toggle__icon::after {
		transform: translateY( 4px );
	}

	.site-nav-toggle[aria-expanded="true"] .site-nav-toggle__icon::before {
		transform: rotate( 45deg );
	}

	.site-nav-toggle[aria-expanded="true"] .site-nav-toggle__icon::after {
		transform: rotate( -45deg );
	}

	.lop-js .site-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		box-sizing: border-box;
		padding: 8px 20px 24px;
		background: var( --wp--preset--color--surface );
		border-bottom: 1px solid #2a2a28;
		opacity: 0;
		visibility: hidden;
		transform: translateY( -8px );
		transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
	}

	.lop-js .site-header-wrap.is-menu-open .site-nav {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: opacity 0.25s ease, transform 0.25s ease;
	}

	/* Dims the page under the open panel (it fades with the panel). It is
	   part of the nav, so a tap on it lands on the nav and header.js
	   closes the menu instead of following a link underneath. */
	.lop-js .site-nav::after {
		content: "";
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		/* Zero while closed: a hidden 100vh box would still extend the
		   page's scroll area. The delay keeps it during the fade-out. */
		height: 0;
		margin-top: 1px;
		background: rgba( 0, 0, 0, 0.65 );
		transition: height 0s linear 0.25s;
	}

	.lop-js .site-header-wrap.is-menu-open .site-nav::after {
		height: 100vh;
		transition: none;
	}

	/* Bar and panel read as one lighter sheet above the dimmed page. */
	.lop-js .site-header-wrap.is-menu-open {
		background: var( --wp--preset--color--surface );
		border-bottom-color: transparent;
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}

	.lop-js .site-nav__list {
		flex-direction: column;
		gap: 0;
		font-size: 13px;
	}

	.lop-js .site-nav__list a {
		padding: 14px 0;
	}
}

@media ( max-width: 639px ) and ( prefers-reduced-motion: reduce ) {
	.lop-js .site-nav,
	.site-nav-toggle__icon::before,
	.site-nav-toggle__icon::after {
		transition: none;
	}
}

.site-nav__list .current-menu-item > a,
.site-nav__list .current_page_item > a,
.site-nav__list .current-menu-parent > a,
.site-nav__list .current_page_parent > a {
	color: var( --wp--preset--color--accent );
}

/* Site footer */

.site-footer {
	width: 100%;
	max-width: 1360px;
	margin: 0 auto;
	box-sizing: border-box;
	padding: 0 20px;
}

@media ( min-width: 640px ) {
	.site-footer {
		padding: 0 40px;
	}
}

.site-footer__row {
	margin-top: 120px;
	border-top: 1px solid #161615;
	padding: 28px 0 36px;
	display: flex;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	font-size: 13px;
	color: #7c7b77;
}

.site-footer__tagline {
	font-family: var( --wp--preset--font-family--serif );
	font-style: italic;
	font-size: 15px;
	color: var( --wp--preset--color--foreground-secondary );
}

/* Page motion (design: main fades out/in over .24s on navigation, images
   fade in over .7s as they load). All of it is off with reduced motion. */

@keyframes lop-fade-in {
	from {
		opacity: 0;
	}
}

@keyframes lop-fade-out {
	to {
		opacity: 0;
	}
}

@media ( prefers-reduced-motion: no-preference ) {

	/* Content fades in on every page load (header stays put). */
	#content {
		animation: lop-fade-in 0.24s ease backwards;
	}

	/* Cross-document view transitions (Chrome, Edge, Safari 18.2+): the
	   old page fades out, then the new one fades in, as in the design.
	   The header is its own group so it doesn't blink. Browsers without
	   support just navigate, with the fade-in above. */
	@view-transition {
		navigation: auto;
	}

	.site-header-wrap {
		view-transition-name: lop-header;
	}

	::view-transition-old( root ) {
		animation: lop-fade-out 0.24s ease both;
	}

	::view-transition-new( root ) {
		animation: lop-fade-in 0.24s ease 0.24s both;
	}

	/* Images start hidden and fade in once loaded. html.lop-fade and the
	   .is-loaded marks come from the inline script in <head> (inc/assets.php),
	   so without JS nothing is hidden. :where() keeps this default
	   transition below any component's own (hover zoom etc.). */
	:where( html.lop-fade #content img ) {
		transition: opacity 0.7s ease;
	}

	html.lop-fade #content img:not( .is-loaded ) {
		opacity: 0;
	}
}
