/**
 * Site header (UI §A8, IA §2 and §12).
 *
 * Sticky header that hides on scroll down, optional announcement bar,
 * primary navigation with click-to-open dropdowns, search that opens as a bar
 * under the header, Subscribe button, tablet topic scroller and the menu
 * drawer used below 1024px. Values come from theme.json presets only.
 */

/* ---------------------------------------------------------------------
 * 1. Sticky header. Sticky keeps its space in the layout, so hiding never
 *    shifts content (PERF-03).
 * ------------------------------------------------------------------- */
.tip-site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 100;
	background-color: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--bg);
	box-shadow: 0 1px 0 rgb(255 255 255 / 6%);
	transition: transform 0.2s ease;
}

/* Everything in the navy bar is light: links, menu, title, buttons. */
.tip-site-header :where(a:not(.wp-element-button), .wp-block-navigation, .wp-block-site-title a, .wp-block-navigation__responsive-container-open) {
	color: var(--wp--preset--color--bg);
}

.tip-site-header :focus-visible {
	outline-color: var(--wp--preset--color--on-dark-link);
}

/* Brand: logo mark + wordmark with the "Pro" accent (inc/brand.php). */
.tip-site-header__brand {
	gap: var(--wp--preset--spacing--3);
}

.tip-site-header .wp-block-site-title {
	font-size: clamp(1.1875rem, 1rem + 0.6vw, 1.4375rem);
	line-height: 1;
	white-space: nowrap;
}

.tip-site-header .wp-block-site-title a {
	text-decoration: none;
}

.tip-wordmark-accent {
	color: var(--wp--preset--color--signature);
}

.tip-site-header .wp-block-site-logo img {
	width: clamp(30px, 2.4vw, 36px);
	height: auto;
}

/* Primary menu: pill hover/current state on navy. */
.tip-site-header nav.tip-primary-nav .wp-block-navigation-item__content {
	padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--3);
	border-radius: var(--wp--custom--radius--chip);
	color: #d7dff0;
	text-decoration: none;
}

.tip-site-header nav.tip-primary-nav .wp-block-navigation-item__content:hover,
.tip-site-header nav.tip-primary-nav .current-menu-item > .wp-block-navigation-item__content,
.tip-site-header nav.tip-primary-nav [aria-current="page"] {
	background-color: rgb(255 255 255 / 8%);
	color: var(--wp--preset--color--bg);
}

.tip-site-header nav.tip-primary-nav .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--1);
}

/* Dropdowns: white panel with dark text. */
.tip-site-header .wp-block-navigation__submenu-container {
	padding: var(--wp--preset--spacing--2) !important; /* Core sets inline-level padding with high specificity. */
	border: 0 !important; /* Core draws a 1px border on submenus. */
	border-radius: var(--wp--custom--radius--card);
	background-color: var(--wp--preset--color--bg) !important; /* Core inherits the navy bar color. */
	box-shadow: var(--wp--preset--shadow--raised);
}

.tip-site-header nav.tip-primary-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	color: var(--wp--preset--color--text) !important; /* Readable on the white panel. */
}

.tip-site-header nav.tip-primary-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background-color: var(--wp--preset--color--surface-alt);
}

.tip-site-header.is-hidden {
	transform: translateY(-100%);
}

.tip-site-header__inner {
	gap: var(--wp--preset--spacing--4);
	min-height: 62px;
	padding-inline: var(--tip-gutter);
}

@media (min-width: 1024px) {

	.tip-site-header__inner {
		min-height: 76px;
	}
}

/* ---------------------------------------------------------------------
 * 2. Announcement bar. Hidden while the "Announcement bar" template part
 *    is empty, so it's switched on and off in the Site Editor.
 * ------------------------------------------------------------------- */
.tip-announcement {
	padding-block: var(--wp--preset--spacing--2);
	padding-inline: var(--tip-gutter);
	background-color: var(--wp--preset--color--navy-deep);
	color: #d7dff0;
	font-size: var(--wp--preset--font-size--meta);
	line-height: var(--wp--custom--line-height--tight);
	text-align: center;
}

.tip-announcement > * {
	margin-block: 0;
}

.tip-site-header .tip-announcement a {
	color: inherit;
	font-weight: 600;
}

.tip-announcement :focus-visible {
	outline-color: var(--wp--preset--color--bg);
}

.tip-announcement:not(:has(*)) {
	display: none;
}

/* ---------------------------------------------------------------------
 * 3. Subscribe: hidden on mobile, where the menu drawer has it (UI §A8).
 *    Scoped under .tip-site-header to outrank core's
 *    "body .is-layout-flex" display rule.
 * ------------------------------------------------------------------- */
.tip-site-header .tip-site-header__subscribe {
	display: none;
}

@media (min-width: 600px) {

	.tip-site-header .tip-site-header__subscribe {
		display: flex;
	}
}

.tip-site-header__subscribe .wp-block-button__link {
	white-space: nowrap;
}

.tip-site-header__actions {
	gap: var(--wp--preset--spacing--3);
}

/* ---------------------------------------------------------------------
 * 4. Search. A secondary action (outline, UI §A11). When opened, the field
 *    becomes a full-width bar under the header (UI §A8). Opening, Escape
 *    and closing on focus-out are core behaviour; no theme JavaScript.
 * ------------------------------------------------------------------- */
.tip-site-header .wp-block-search__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--wp--custom--touch-target);
	padding: 0;
	border: 1px solid rgb(255 255 255 / 28%);
	border-radius: 50%;
	background-color: transparent;
	color: var(--wp--preset--color--bg);
}

.tip-site-header .wp-block-search__button:hover {
	background-color: rgb(255 255 255 / 8%);
}

.tip-site-header .wp-block-search__button svg {
	fill: currentcolor;
}

/* Mobile menu button: round, outlined like search (core decides when it shows). */
.tip-site-header .wp-block-navigation__responsive-container-open {
	align-items: center;
	justify-content: center;
	width: var(--wp--custom--touch-target);
	height: var(--wp--custom--touch-target);
	border: 1px solid rgb(255 255 255 / 28%);
	border-radius: 50%;
}

.tip-header-search:not(.wp-block-search__searchfield-hidden) .wp-block-search__input {
	position: absolute;
	inset-inline: var(--tip-gutter);
	inset-block-start: calc(100% + var(--wp--preset--spacing--2));
	z-index: 1;
	width: auto;
	min-height: var(--wp--custom--touch-target);
	padding-inline: var(--wp--preset--spacing--4);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--button);
	background-color: var(--wp--preset--color--bg);
	color: var(--wp--preset--color--text);
	box-shadow: var(--wp--preset--shadow--card);
	font-size: var(--wp--preset--font-size--body);
}

/* ---------------------------------------------------------------------
 * 5. Tablet topic scroller (600–1023px): one sideways-scrolling row of
 *    topic links under the header. Hidden on articles to save space.
 *    Dropdowns are not used here; topic links go straight to the hub.
 *    Selectors name the <nav>: core copies the block class onto its <ul> too.
 * ------------------------------------------------------------------- */
.tip-site-header nav.tip-topic-scroller {
	display: none;
}

@media (min-width: 600px) and (max-width: 1023.98px) {

	.tip-site-header nav.tip-topic-scroller {
		display: block;
		padding-block: var(--wp--preset--spacing--2);
		padding-inline: var(--tip-gutter);
		border-block-start: 1px solid rgb(255 255 255 / 8%);
		background-color: var(--wp--preset--color--navy-raised);
		font-size: var(--wp--preset--font-size--meta);
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x proximity;
	}
}

.single .tip-site-header nav.tip-topic-scroller {
	display: none;
}

/* ---------------------------------------------------------------------
 * 6. Menu drawer (custom navigation overlay, IA §12.2). WordPress handles
 *    opening, the focus trap, Escape and returning focus to the button.
 * ------------------------------------------------------------------- */
.tip-drawer {
	box-sizing: border-box;
	min-height: 100%;
	padding-block: var(--wp--preset--spacing--4) var(--wp--preset--spacing--7);
	padding-inline: var(--tip-gutter);
	background-color: var(--wp--preset--color--bg);
	color: var(--wp--preset--color--text);
}

.tip-drawer > * + * {
	margin-block-start: var(--wp--preset--spacing--5);
}

.tip-drawer__top {
	min-height: var(--wp--custom--touch-target);
}

.tip-drawer__heading {
	margin-block-end: calc(-1 * var(--wp--preset--spacing--3));
	color: var(--wp--preset--color--text-muted);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tip-drawer__subscribe .wp-block-button {
	width: 100%;
}

/* The drawer sits inside the navy header but is a white panel: dark text again. */
.tip-site-header .tip-drawer,
.tip-site-header .tip-drawer :where(a:not(.wp-element-button), .wp-block-navigation, .wp-block-site-title a) {
	color: var(--wp--preset--color--text);
}

.tip-site-header nav.tip-primary-nav .tip-drawer .wp-block-navigation .wp-block-navigation-item__content {
	padding-inline: 0;
	background-color: transparent;
	color: var(--wp--preset--color--text);
}

.tip-site-header nav.tip-primary-nav .tip-drawer .wp-block-navigation .wp-block-navigation-item__content:hover {
	text-decoration: underline;
}

.tip-site-header .tip-drawer .wp-block-navigation__responsive-container-close,
.tip-site-header .tip-drawer :focus-visible {
	color: var(--wp--preset--color--text);
	outline-color: var(--wp--preset--color--brand);
}
