/**
 * Preluence Genesis — mobile header layouts.
 *
 * The masthead reuses the shared branding, icon buttons and the off-canvas
 * drawer, so a layout change is only a handful of positioning rules. The bar is
 * hidden from 1024px up; `body.pn-mob` switches it on and hides the theme's own
 * mobile bar so the page never shows two headers.
 */

.pn-mobbar {
	display: none;
	position: relative;
	z-index: 62;
	background: var(--pn-hdr-bg, var(--pn-bg));
	color: var(--pn-hdr-ink, var(--pn-text));
	border-block-end: 1px solid var(--pn-border);
}

.pn-mobbar__inner {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 58px;
	padding: 0.35rem 0.7rem;
}

/* The menu button and the actions are fixed-width; the brand takes the rest. */
.pn-mobbar .pn-menu-open,
.pn-mobbar__actions {
	flex: 0 0 auto;
}

.pn-mobbar__brand {
	flex: 1 1 auto;
	min-width: 0;
	margin-inline: 0;
	overflow: hidden;
}

/*
 * Brand arrangement on a phone: the logo and the title share one row and the
 * tagline drops to its own line. Every part can shrink, so a wide banner logo
 * or a long title truncates instead of pushing the actions off-screen.
 */
.pn-mobbar__brand .pn-branding {
	display: flex;
	flex-flow: row wrap;
	align-items: center;
	column-gap: 0.55rem;
	row-gap: 0.1rem;
	min-width: 0;
}

.pn-mobbar__brand .pn-branding__logo {
	flex: 0 0 auto;
	max-width: 42%;
	min-width: 0;
}

.pn-mobbar__brand .pn-branding__logo img,
.pn-mobbar__brand .pn-mobile-logo {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 34px;
}

.pn-mobbar__brand .pn-site-title {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	font-size: clamp(0.98rem, 4.2vw, 1.3rem);
	line-height: 1.15;
	letter-spacing: -0.01em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pn-mobbar__brand .pn-site-title a {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pn-mobbar__brand .pn-site-description {
	flex: 1 1 100%;
	margin: 0;
	color: var(--pn-text-muted);
	font-size: 0.72rem;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pn-mobbar__actions {
	display: flex;
	align-items: center;
	gap: 0.15rem;
	margin-inline-start: 0;
}

/* A comfortable tap target for every bar control. */
.pn-mobbar .pn-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 40px;
	min-height: 40px;
	padding: 0;
}

.pn-mobbar__label {
	display: none;
	margin-inline-start: 0.35rem;
	font-family: var(--pn-font-ui);
	font-size: 0.8rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* The text label only fits once the bar is wide enough. */
@media (min-width: 560px) {

	.pn-mobbar__label {
		display: inline;
	}
}

.pn-mobbar__search {
	padding: 0.5rem 0.7rem 0.7rem;
	border-block-start: 1px solid var(--pn-border);
}

.pn-mobbar__search .pn-search-form {
	width: 100%;
}

.pn-mobbar .pn-clock {
	font-size: 0.78rem;
	opacity: 0.85;
}

/* The clock is the first thing to go when the row is tight. */
@media (max-width: 519px) {

	.pn-mobbar .pn-clock {
		display: none;
	}
}

@media (max-width: 1023px) {

	.pn-mob .pn-mobbar {
		display: block;
		position: sticky;
		top: var(--wp-admin--admin-bar--height, 0);
	}

	/*
	 * The masthead replaces the theme's own mobile bar — but a header banner
	 * shares the brand row and must not disappear with it. The row keeps the
	 * banner lane and drops everything else, so the advert shows as its own
	 * centred band under the masthead. With no banner the row has no height, so
	 * nothing is left behind.
	 */
	.pn-mob .pn-header--modern .pn-header__brand-inner > :not(.pn-header-side):not(.pn-header-ad),
	.pn-mob .pn-header--compact .pn-header__compact-inner > :not(.pn-header-side):not(.pn-header-ad) {
		display: none;
	}

	.pn-mob .pn-header--modern .pn-header__brand-inner,
	.pn-mob .pn-header--compact .pn-header__compact-inner {
		min-height: 0;
		justify-content: center;
	}

	.pn-mob .pn-menu-open {
		display: inline-flex;
	}

	/* ---------- Layout: centered ---------- */

	.pn-mob--centered .pn-mobbar__inner {
		position: relative;
	}

	.pn-mob--centered .pn-mobbar__brand {
		position: absolute;
		inset-inline: 4.5rem;
		display: flex;
		justify-content: center;
		pointer-events: none;
	}

	.pn-mob--centered .pn-mobbar__brand a {
		pointer-events: auto;
	}

	/* ---------- Layout: minimal ---------- */

	.pn-mob--minimal .pn-mobbar__inner {
		gap: 0.25rem;
	}

	.pn-mob--minimal .pn-mobbar__brand {
		order: 1;
		margin-inline: 0;
	}

	.pn-mob--minimal .pn-mobbar__actions {
		order: 2;
	}

	.pn-mob--minimal .pn-mobbar .pn-menu-open {
		order: 3;
	}

	/* ---------- Sticky behaviour ---------- */

	/*
	 * The mobile masthead is the header on phones, so the desktop header must
	 * not stick there: its contents are hidden, which would leave an empty
	 * sticky bar above the page and keep the header stuck even when the mobile
	 * bar is set to "Not sticky". Stickiness on phones belongs to .pn-mobbar.
	 * body.-prefixed for specificity over the engine's sticky rules.
	 */
	body.pn-mob .pn-header,
	body.pn-mob .pn-header--modern,
	body.pn-mob .pn-header--compact,
	body.pn-mob .pn-sticky-target {
		position: relative;
		top: auto;
		z-index: auto;
	}

	body.pn-mob--sticky-none .pn-mobbar {
		position: relative;
		top: auto;
	}

	.pn-mob--sticky-hide .pn-mobbar {
		transition: transform 0.25s var(--pn-ease, ease);
	}

	.pn-mob--sticky-hide .pn-mobbar.is-mob-hidden {
		transform: translateY(-110%);
	}

	/* ---------- Layout: bottom (fixed bar) ---------- */

	.pn-mob--bottom {
		padding-block-end: 64px;
	}

	.pn-mob--bottom .pn-mobbar {
		position: fixed;
		inset-inline: 0;
		inset-block-end: 0;
		top: auto;
		padding-block-end: env(safe-area-inset-bottom, 0);
		border-block-start: 1px solid var(--pn-border);
		border-block-end: 0;
		box-shadow: 0 -8px 24px -18px rgb(11 16 32 / 55%);
	}

	.pn-mob--bottom .pn-mobbar__inner {
		min-height: 56px;
		justify-content: space-between;
	}

	.pn-mob--bottom .pn-mobbar__brand {
		display: none;
	}

	.pn-mob--bottom .pn-mobbar .pn-menu-open,
	.pn-mob--bottom .pn-mobbar__actions {
		flex: 1;
		justify-content: center;
		margin-inline-start: 0;
	}

	/* ---------- Drawer origin ---------- */

	.pn-mob--drawer-left .pn-drawer {
		margin-inline-start: 0;
		margin-inline-end: auto;
		box-shadow: 8px 0 32px rgb(0 0 0 / 20%);
	}

	.pn-mob--drawer-left .pn-drawer[open] {
		animation-name: pn-drawer-in-left;
	}

	.pn-mob--drawer-full .pn-drawer {
		width: 100%;
	}
}

@keyframes pn-drawer-in-left {

	from {
		transform: translateX(-100%);
	}
}

@media (prefers-reduced-motion: reduce) {

	.pn-mob--sticky-hide .pn-mobbar {
		transition: none;
	}
}

/* ---------- Mobile: premium touch + coordinated accent ---------- */
.pn-mobbar .pn-icon-button {
	border-radius: 12px;
	color: var(--pn-hdr-icon, var(--pn-hdr-ink, inherit));
	transition: background-color 0.18s var(--pn-ease, ease), transform 0.18s var(--pn-ease, ease);
}
.pn-mobbar .pn-icon-button:hover {
	background: color-mix(in srgb, currentColor 14%, transparent);
	transform: translateY(-1px);
}
.pn-mobbar .pn-icon-button:focus-visible {
	outline: 2px solid var(--pn-hdr-accent, var(--pn-primary));
	outline-offset: 2px;
}
.pn-mnav__link {
	min-height: 48px;
	display: flex;
	align-items: center;
	border-radius: 8px;
	transition: background-color 0.15s var(--pn-ease, ease), color 0.15s var(--pn-ease, ease), box-shadow 0.15s var(--pn-ease, ease);
}
.pn-mnav__link:hover,
.pn-mnav__link:focus-visible {
	color: var(--pn-menu-accent, var(--pn-accent));
	background: color-mix(in srgb, var(--pn-menu-accent, var(--pn-accent)) 10%, transparent);
}
/* Current item (when the drawer markup carries it) gets an accent rail. */
.pn-mnav__item.current-menu-item > .pn-mnav__link,
.pn-mnav__item.current-menu-ancestor > .pn-mnav__link,
.pn-mnav__link[aria-current="page"] {
	color: var(--pn-menu-accent, var(--pn-accent));
	box-shadow: inset 3px 0 0 var(--pn-menu-accent, var(--pn-accent));
	background: color-mix(in srgb, var(--pn-menu-accent, var(--pn-accent)) 8%, transparent);
}
@media (prefers-reduced-motion: reduce) {
	.pn-mobbar .pn-icon-button,
	.pn-mnav__link { transition: none; }
	.pn-mobbar .pn-icon-button:hover { transform: none; }
}

/* ---------- Header banner image & advert on phones ---------- */
@media (max-width: 1023px) {

	/*
	 * A banner sized for the desktop width would dominate a phone. Preserve its
	 * aspect ratio but cap the height and let it span the screen.
	 */
	.pn-header-image__img {
		height: auto;
		max-height: 42vw;
	}

	.pn-header-image--contained .pn-header-image__inner {
		padding-inline: 0.5rem;
	}

	/* The advert is its own centred band under the masthead. */
	.pn-header-ad {
		margin-inline: auto;
	}
}

/* ---------- Top bar on phones ---------- */
@media (max-width: 1023px) {

	.pn-mob .pn-topbar__inner {
		justify-content: center;
		text-align: center;
	}
}
