/**
 * Header/footer frame: slots, main menu, search panel and the narrow-screen panel
 * (Q018, B040, B106, B114, B120).
 *
 * Theme-owned classes use the `.ut-th-` prefix. Colours come from the ui-core
 * brand presets; nothing here is a node value.
 */

.ut-th-slot {
	min-width: 0;
}

/* The search panel is positioned against the whole header, not the actions group. */
.ut-sticky-chrome-root {
	position: relative;
}

/* Long site names wrap instead of pushing the actions off screen. */
.ut-th-identity {
	flex: 1 1 auto;
	min-width: 0;
}

.ut-th-identity .wp-block-site-title {
	min-width: 0;
	overflow-wrap: anywhere;
}

.ut-th-actions {
	flex: none;
}

.ut-th-slot--main-menu,
.ut-th-slot--object-menu {
	flex: 1 1 auto;
}

/* The object-menu row exists only where the object menu applies (B042, B107). */
.ut-th-header-row-object:not(:has(.ut-th-slot)) {
	display: none;
}

.ut-th-menu,
.ut-th-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ut-th-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
}

.ut-th-menu a {
	display: inline-block;
	padding: 0.5rem 0;
	color: inherit;
	text-decoration: none;
}

.ut-th-menu a:hover,
.ut-th-menu a:focus-visible {
	text-decoration: underline;
}

.ut-th-menu .current-menu-item > a {
	font-weight: 600;
}

/* Footer: the site's published languages (B048/B114/B118). */
.ut-th-language-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ut-th-language a {
	color: inherit;
	text-decoration: none;
}

.ut-th-language a:hover,
.ut-th-language a:focus-visible {
	text-decoration: underline;
}

.ut-th-language.is-current > span {
	font-weight: 600;
}

/* Footer: who runs this site (B028). The value is a node value; only the
   presentation is the theme's. */
.ut-th-operator {
	margin: 0;
	font-size: var(--wp--preset--font-size--ut-prose, 1rem);
}

.ut-th-footernav .ut-th-menu {
	flex-direction: column;
	gap: 0;
}

.ut-th-panel-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 44px;
	padding: 0.5rem 0.75rem;
	border: 1px solid currentColor;
	border-radius: 0.5rem;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.ut-th-panel-toggle-icon {
	width: 20px;
	height: 20px;
	flex: none;
}

.ut-th-panel-toggle:focus-visible,
.ut-th-slot--account a:focus-visible {
	outline: 2px solid var(--wp--preset--color--ut-focus-ring-color, currentColor);
	outline-offset: 2px;
}

/* Account button (content from unitedtech-navigation, frame from the theme; B038/B043). */
.ut-th-slot--account a {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 44px;
	padding: 0.5rem 0.875rem;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--ut-interactive, #1f2937);
	color: var(--wp--preset--color--ut-on-brand, #ffffff);
	text-decoration: none;
	white-space: nowrap;
}

.ut-th-slot--account a:hover {
	background: var(--wp--preset--color--ut-interactive-hover, #111827);
}

.ut-th-slot--account svg {
	width: 18px;
	height: 18px;
	flex: none;
}


/* Icon entries a plugin puts in a header slot (notifications, B111/B112).
   The plugin owns the content; the theme owns how it sits in the frame. A count
   marks itself with [data-ut-slot-badge] and is placed on the icon here. */
.ut-th-slot--notifications a {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0.5rem;
	border-radius: 0.5rem;
	color: inherit;
	text-decoration: none;
}

.ut-th-slot--notifications a:hover {
	background: var(--ut-hover-surface, rgba(0, 0, 0, 0.06));
}

.ut-th-slot--notifications a:focus-visible {
	outline: 2px solid var(--wp--preset--color--ut-focus-ring-color, currentColor);
	outline-offset: 2px;
}

.ut-th-slot--notifications svg {
	width: 20px;
	height: 20px;
	flex: none;
}

.ut-th-slot [data-ut-slot-badge] {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 1.1rem;
	padding: 0 0.25rem;
	border-radius: 999px;
	background: var(--wp--preset--color--ut-brand, #47704c);
	color: var(--wp--preset--color--ut-on-brand, #ffffff);
	font-size: 0.6875rem;
	line-height: 1.1rem;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* A badge with no text content (B036: a dot, not a number) shrinks to a plain
   dot instead of an empty numeral-sized pill. Plugins that do need a visible
   count keep the sizing above by putting text inside the badge. */
.ut-th-slot [data-ut-slot-badge]:empty {
	min-width: 0.5rem;
	width: 0.5rem;
	height: 0.5rem;
	padding: 0;
}

/* Search (B120): icon in the header actions, panel under the header at every width. */
.ut-th-panel-toggle--icon {
	padding: 0.5rem;
	min-width: 44px;
	justify-content: center;
}

.ut-th-panel-toggle--icon .ut-th-panel-toggle-label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.ut-th-panel--search {
	display: none;
	position: absolute;
	z-index: 60;
	top: 100%;
	left: 0;
	right: 0;
	padding: 1rem;
	background: var(--ut-surface, #ffffff);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.ut-th-panel--search.is-open {
	display: block;
}

.ut-th-search-scope {
	display: block;
	margin-bottom: 0.5rem;
	font-size: var(--wp--preset--font-size--ut-prose, 1rem);
}

.ut-th-searchform-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ut-th-search-field {
	flex: 1 1 12rem;
	min-width: 0;
	min-height: 44px;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--ut-border, currentColor);
	border-radius: 0.5rem;
	font: inherit;
}

.ut-th-search-submit {
	flex: none;
	min-height: 44px;
	padding: 0.5rem 1rem;
	border: 0;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--ut-interactive, #1f2937);
	color: var(--wp--preset--color--ut-on-brand, #ffffff);
	font: inherit;
	cursor: pointer;
}

.ut-th-search-submit:hover {
	background: var(--wp--preset--color--ut-interactive-hover, #111827);
}

.ut-th-search-field:focus-visible,
.ut-th-search-submit:focus-visible {
	outline: 2px solid var(--wp--preset--color--ut-focus-ring-color, currentColor);
	outline-offset: 2px;
}

@media (min-width: 1024px) {
	.ut-th-panel-toggle:not(.ut-th-panel-toggle--icon) {
		display: none;
	}

	.ut-th-menu li {
		position: relative;
	}

	.ut-th-mainnav .sub-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 50;
		min-width: 14rem;
		padding: 0.5rem 1rem;
		background: #ffffff;
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
	}

	.ut-th-mainnav li:hover > .sub-menu,
	.ut-th-mainnav li:focus-within > .sub-menu {
		display: block;
	}
}

@media (max-width: 1023.98px) {
	.ut-th-mainnav {
		display: flex;
		flex-wrap: wrap;
		width: 100%;
	}

	.ut-th-panel {
		display: none;
		flex: 1 1 100%;
		padding: 0.5rem 0;
	}

	.ut-th-panel.is-open {
		display: block;
	}

	.ut-th-panel .ut-th-menu {
		flex-direction: column;
		gap: 0;
	}

	.ut-th-panel .sub-menu {
		padding-left: 1rem;
	}

	/* One open panel: the header stays, the page content below it is hidden (B106). */
	html[data-ut-open-panel] .wp-site-blocks > :not(header) {
		display: none;
	}
}
