/*
 * FuseHub's phone header and menu panel (docs/plans/responsive-header.md). Added by FuseHub on
 * every deploy; an edit here is lost on the next one. Named .min.css so a minifying plugin
 * leaves it alone; it is kept readable on purpose.
 *
 * Two parts. The PHONE ROW (#fh-mhead) is ordinary CSS prefixed with its id, so it wins over
 * the header's class rules and a design's own assets/css/header-mobile.css (loaded later, also
 * prefixed #fh-mhead) wins over it. The PANEL (#fh-drawer) lives in two cascade layers: the
 * reset layer reverts every property of the dialog and everything in it to the browser's own
 * defaults, and the drawer layer then sets what the panel needs, every declaration !important.
 * For !important declarations an EARLIER layer wins and any layer beats unlayered CSS, so no
 * theme, core, plugin or Additional CSS rule reaches the open panel (the leak the 2026-10-31
 * preview found). Custom properties are not touched by `all`, so the design's tokens arrive.
 *
 * The switch itself (which width shows the phone row) is printed per request by the kit's PHP.
 */

@layer fusehub-drawer, fusehub-reset;

:root {
	--fh-drawer-bg: Canvas;
	--fh-drawer-fg: CanvasText;
	--fh-drawer-accent: LinkText;
	--fh-drawer-font: inherit;
	--fh-drawer-width: min(280px, 85vw);
	--fh-backdrop: #000;
	--fh-row-bg: var(--fh-drawer-bg);
	--fh-row-fg: var(--fh-drawer-fg);
	--fh-call-bg: var(--fh-drawer-accent);
	--fh-call-fg: var(--fh-drawer-bg);
	--fh-icon-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18'/%3E%3C/svg%3E");
	--fh-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
	--fh-icon-phone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z'/%3E%3C/svg%3E");
	--fh-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	scroll-padding-top: calc(var(--fh-scroll-offset, 0px) + var(--wp-admin--admin-bar--height, 0px) + .5rem);
}

/* ── the phone row ─────────────────────────────────────────────────────────────────────── */

#fh-mhead {
	display: none !important;
}

/* The row's text sizes are in em from this one size, never rem: a theme that sets
   html{font-size:62.5%} would otherwise shrink the row to 10px text (review 2026-10-31). A
   larger root size, the visitor's own setting included, still scales it. */
#fh-mhead .fh-mhead__bar {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 56px;
	box-sizing: border-box;
	margin: 0;
	padding: 6px 16px;
	background: var(--fh-row-bg);
	color: var(--fh-row-fg);
	font-size: max(1rem, 16px);
	border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent);
}

#fh-mhead .fh-mhead__brand {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

#fh-mhead .fh-mhead__brand > * {
	margin: 0;
	max-width: 100%;
}

/* A long name wraps to a second line rather than being cut: a design's title link is often
   inline-flex (Copperleaf's leaf), where an ellipsis never shows and the name is cut mid-letter
   (review 2026-10-31). Two lines at most; the script gives the number way to the phone icon
   when the name needs the room. */
#fh-mhead .fh-mhead__brand .wp-block-site-title {
	font-size: 1.125em;
	line-height: 1.2;
	max-height: 2.4em;
	overflow: hidden;
	overflow-wrap: anywhere;
	white-space: normal;
}

/* Top-aligned, so a two-line inline-flex link adds no space below its line (measured: 2px
   past the two lines on Copperleaf, which read as a cut name). */
#fh-mhead .fh-mhead__brand .wp-block-site-title a {
	max-width: 100%;
	vertical-align: top;
	white-space: normal;
}

#fh-mhead .fh-mhead__brand img {
	display: block;
	max-height: 40px;
	width: auto;
}

#fh-mhead .fh-call {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0 14px;
	border-radius: 999px;
	background: var(--fh-call-bg);
	color: var(--fh-call-fg);
	font-size: .9375em;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
}

#fh-mhead .fh-menu-button {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--fh-row-fg);
	cursor: pointer;
}

#fh-mhead .fh-icon {
	display: block;
	flex: none;
	background-color: currentColor;
	-webkit-mask: var(--fh-icon) center / contain no-repeat;
	mask: var(--fh-icon) center / contain no-repeat;
}

#fh-mhead .fh-icon--menu {
	--fh-icon: var(--fh-icon-menu);
	width: 26px;
	height: 26px;
}

#fh-mhead .fh-icon--phone {
	--fh-icon: var(--fh-icon-phone);
	width: 18px;
	height: 18px;
}

/* The ring is drawn OUTSIDE the button, on the row, so it takes the row's text colour, which
   the deploy holds at 4.5:1 or more against the row; the button's own text colour is the call
   button's, which can be the row's background (review 2026-10-31: paper on cream, 1.05:1). */
#fh-mhead .fh-call:focus-visible,
#fh-mhead .fh-menu-button:focus-visible {
	outline: 2px solid var(--fh-row-fg);
	outline-offset: 2px;
}

/* Forced colours (Windows High Contrast) replace backgrounds, and the icons are drawn as a
   background through a mask, so they would vanish; they keep a system colour instead. */
@media (forced-colors: active) {
	#fh-mhead .fh-icon {
		forced-color-adjust: none;
		background-color: ButtonText;
	}

	#fh-mhead .fh-call .fh-icon {
		background-color: LinkText;
	}
}

/* The number gives way to a phone icon when it does not fit (the script adds the class when
   the row overflows; the media query covers no script). */
#fh-mhead.fh-mhead--tight .fh-call__number {
	display: none;
}

#fh-mhead.fh-mhead--tight .fh-call {
	justify-content: center;
	width: 44px;
	padding: 0;
}

@media (max-width: 419px) {
	#fh-mhead .fh-call__number {
		display: none;
	}

	#fh-mhead .fh-call {
		justify-content: center;
		width: 44px;
		padding: 0;
	}
}

/* At 600px and narrower WordPress lets the admin bar scroll away (it becomes position:
   absolute), so a sticky header goes back to the top. */
@media screen and (max-width: 600px) {
	.admin-bar .site-header,
	.admin-bar .wp-site-blocks > header.wp-block-template-part,
	.admin-bar .fh-dhead {
		top: 0 !important;
	}
}

/* Scroll lock while the panel is open, with the scrollbar's width given back so nothing moves. */
html:has(#fh-drawer[open]),
html.fh-drawer-open {
	overflow: hidden !important;
}

html.fh-drawer-open {
	padding-inline-end: var(--fh-scrollbar, 0px) !important;
}

/* ── the panel ─────────────────────────────────────────────────────────────────────────── */

@layer fusehub-reset {
	#fh-drawer,
	#fh-drawer *,
	#fh-drawer *::before,
	#fh-drawer *::after,
	#fh-drawer::backdrop {
		all: revert !important;
	}
}

@layer fusehub-drawer {
	#fh-drawer[open] {
		display: block !important;
		position: fixed !important;
		inset-block: 0 !important;
		inset-inline-start: auto !important;
		inset-inline-end: 0 !important;
		box-sizing: border-box !important;
		width: var(--fh-drawer-width) !important;
		max-width: 100vw !important;
		height: 100vh !important;
		height: 100dvh !important;
		max-height: none !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 0 !important;
		overflow: hidden !important;
		background: var(--fh-drawer-bg) !important;
		box-shadow: 0 0 32px rgba(0, 0, 0, .18) !important;
		outline: none !important;
		transform: none !important;
		/* Every inherited property, set here so nothing comes in from <body> (attack A2b). */
		color: var(--fh-drawer-fg) !important;
		-webkit-text-fill-color: currentColor !important;
		font-family: var(--fh-drawer-font) !important;
		/* Never below 16px whatever the theme sets on <html>; the panel's sizes are em from it. */
		font-size: max(1rem, 16px) !important;
		font-style: normal !important;
		font-weight: 400 !important;
		font-variant: normal !important;
		line-height: 1.4 !important;
		letter-spacing: normal !important;
		word-spacing: normal !important;
		text-align: start !important;
		text-indent: 0 !important;
		text-transform: none !important;
		text-shadow: none !important;
		white-space: normal !important;
		visibility: visible !important;
		pointer-events: auto !important;
		cursor: auto !important;
		list-style: none !important;
	}

	#fh-drawer.fh-drawer--start[open] {
		inset-inline-start: 0 !important;
		inset-inline-end: auto !important;
	}

	#fh-drawer[open]::backdrop {
		background: rgba(0, 0, 0, .45) !important;
		background: color-mix(in srgb, var(--fh-backdrop, #000) 45%, transparent) !important;
	}

	#fh-drawer .fh-drawer__panel {
		display: flex !important;
		flex-direction: column !important;
		box-sizing: border-box !important;
		height: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	#fh-drawer .fh-drawer__bar {
		display: flex !important;
		flex: none !important;
		justify-content: flex-end !important;
		margin: 0 !important;
		padding: 12px 12px 4px !important;
	}

	#fh-drawer .fh-drawer__close,
	#fh-drawer .fh-sub-toggle {
		display: inline-flex !important;
		flex: none !important;
		align-items: center !important;
		justify-content: center !important;
		box-sizing: border-box !important;
		width: 44px !important;
		height: 44px !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: transparent !important;
		color: inherit !important;
		cursor: pointer !important;
	}

	#fh-drawer .fh-icon {
		display: block !important;
		flex: none !important;
		background-color: currentColor !important;
		-webkit-mask: var(--fh-icon) center / contain no-repeat !important;
		mask: var(--fh-icon) center / contain no-repeat !important;
	}

	#fh-drawer .fh-icon--close {
		--fh-icon: var(--fh-icon-close);
		width: 24px !important;
		height: 24px !important;
	}

	#fh-drawer .fh-icon--chevron {
		--fh-icon: var(--fh-icon-chevron);
		width: 20px !important;
		height: 20px !important;
	}

	#fh-drawer .fh-sub-toggle[aria-expanded="true"] .fh-icon--chevron {
		transform: rotate(180deg) !important;
	}

	/* Every focus ring in the panel is drawn on the panel, in the panel's text colour: a moved
	   button's own text colour can be the panel's background (review 2026-10-31). */
	#fh-drawer :focus-visible {
		outline: 2px solid var(--fh-drawer-fg) !important;
		outline-offset: 2px !important;
	}

	/* 4px at the top, so the first link's ring is not cut by the scrolling area's edge. */
	#fh-drawer .fh-drawer__content {
		display: block !important;
		flex: 1 1 auto !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 4px 24px 24px !important;
		overflow-y: auto !important;
		overscroll-behavior: contain !important;
	}

	#fh-drawer nav,
	#fh-drawer .fh-drawer__extras {
		display: block !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	#fh-drawer .fh-drawer__extras {
		margin-top: 24px !important;
	}

	#fh-drawer ul {
		display: block !important;
		margin: 0 !important;
		padding: 0 !important;
		list-style: none !important;
	}

	#fh-drawer li {
		display: flex !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		margin: 0 !important;
		padding: 0 !important;
		list-style: none !important;
		border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent) !important;
	}

	#fh-drawer li li:last-child {
		border-bottom: 0 !important;
	}

	#fh-drawer li > a {
		flex: 1 1 0 !important;
		min-width: 0 !important;
	}

	#fh-drawer li > ul {
		flex: 1 1 100% !important;
		padding-inline-start: 16px !important;
		border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent) !important;
	}

	#fh-drawer a {
		display: block !important;
		box-sizing: border-box !important;
		min-height: 48px !important;
		margin: 0 !important;
		padding: 13px 0 !important;
		color: inherit !important;
		font-size: 1.125em !important;
		line-height: 1.2 !important;
		text-decoration: none !important;
		overflow-wrap: anywhere !important;
		cursor: pointer !important;
	}

	#fh-drawer a[aria-current="page"],
	#fh-drawer .current-menu-item > a {
		color: var(--fh-drawer-accent) !important;
		font-weight: 600 !important;
		box-shadow: inset 3px 0 0 currentColor !important;
		padding-inline-start: 12px !important;
	}

	#fh-drawer .fh-drawer__extras a {
		padding-block: 10px !important;
		min-height: 44px !important;
	}

	#fh-drawer .wp-block-buttons {
		display: flex !important;
		flex-direction: column !important;
		gap: 12px !important;
		margin: 12px 0 0 !important;
	}

	#fh-drawer .wp-block-button__link {
		display: block !important;
		padding: 12px 20px !important;
		border-radius: 999px !important;
		background: var(--fh-call-bg) !important;
		color: var(--fh-call-fg) !important;
		font-weight: 600 !important;
		text-align: center !important;
	}

	#fh-drawer [hidden] {
		display: none !important;
	}

	#fh-drawer svg {
		width: 1.25em !important;
		height: 1.25em !important;
		fill: currentColor !important;
	}

	/* A moved image (a badge, a partner's logo) fits the panel: the reset drops its width
	   attribute and any theme rule, so it would otherwise keep its natural size and make the
	   panel scroll sideways (review 2026-10-31). */
	#fh-drawer img {
		max-width: 100% !important;
		height: auto !important;
	}

	/* Text only a screen reader reads stays hidden: the reset reverts the theme's own rule. */
	#fh-drawer .screen-reader-text {
		position: absolute !important;
		width: 1px !important;
		height: 1px !important;
		margin: -1px !important;
		padding: 0 !important;
		overflow: hidden !important;
		clip: rect(0, 0, 0, 0) !important;
		clip-path: inset(50%) !important;
		white-space: nowrap !important;
		border: 0 !important;
	}

	/* A moved form (a search box): targets of at least 44px, the panel's own text. */
	#fh-drawer input,
	#fh-drawer select,
	#fh-drawer textarea {
		box-sizing: border-box !important;
		min-height: 44px !important;
		max-width: 100% !important;
		padding: 8px 12px !important;
		border: 1px solid currentColor !important;
		border-radius: 4px !important;
		background: transparent !important;
		color: inherit !important;
		font: inherit !important;
	}

	#fh-drawer button:not(.fh-drawer__close):not(.fh-sub-toggle) {
		box-sizing: border-box !important;
		min-height: 44px !important;
		padding: 8px 16px !important;
		border: 0 !important;
		border-radius: 999px !important;
		background: var(--fh-call-bg) !important;
		color: var(--fh-call-fg) !important;
		font: inherit !important;
		cursor: pointer !important;
	}

	@media (prefers-reduced-motion: no-preference) {
		#fh-drawer[open] {
			transition: transform .28s ease, overlay .28s allow-discrete, display .28s allow-discrete !important;
		}

		#fh-drawer[open].fh-drawer--closing {
			transform: translateX(100%) !important;
		}

		#fh-drawer[open].fh-drawer--closing:dir(rtl),
		#fh-drawer[open].fh-drawer--closing.fh-drawer--start:dir(ltr) {
			transform: translateX(-100%) !important;
		}

		#fh-drawer[open].fh-drawer--closing.fh-drawer--start:dir(rtl) {
			transform: translateX(100%) !important;
		}

		#fh-drawer[open]::backdrop {
			transition: background-color .2s ease !important;
		}
	}

	@media (prefers-reduced-motion: no-preference) {
		@starting-style {
			#fh-drawer[open] {
				transform: translateX(100%) !important;
			}

			#fh-drawer[open]:dir(rtl),
			#fh-drawer[open].fh-drawer--start:dir(ltr) {
				transform: translateX(-100%) !important;
			}

			#fh-drawer[open].fh-drawer--start:dir(rtl) {
				transform: translateX(100%) !important;
			}

			#fh-drawer[open]::backdrop {
				background-color: transparent !important;
			}
		}
	}

	@media (forced-colors: active) {
		#fh-drawer[open] {
			border-inline-start: 1px solid CanvasText !important;
		}

		/* The close button's X and the submenu chevrons are masks over a background, which
		   forced colours replace; they keep a system colour instead. */
		#fh-drawer .fh-icon {
			forced-color-adjust: none !important;
			background-color: ButtonText !important;
		}
	}

	@media print {
		#fh-drawer[open] {
			display: none !important;
		}
	}
}

@media print {
	#fh-mhead {
		display: none !important;
	}
}
