/*
 * PS2 mobile header refinements.
 * Keeps the desktop Blockpress layout unchanged while making the sticky
 * header, search form and responsive navigation substantially more compact.
 */

@media (max-width: 781px) {
	/* The original template uses 25px top/bottom padding. On a phone that
	 * makes the sticky header cover too much of the document. */
	header.site-header > .fr-sticky-header {
		position: relative;
		padding-top: 10px !important;
		padding-bottom: 10px !important;
	}

	/* Put the hamburger in the upper-right corner instead of dedicating a
	 * separate full-width row to the Navigation block. */
	header.site-header > .fr-sticky-header > .wp-block-navigation {
		position: absolute;
		top: 10px;
		right: max(14px, var(--wp--custom--spacing--outer, 14px));
		z-index: 5;
		margin: 0 !important;
	}

	header.site-header > .fr-sticky-header > .wp-block-navigation .wp-block-navigation__responsive-container-open {
		min-width: 40px;
		min-height: 40px;
		padding: 7px;
		align-items: center;
		justify-content: center;
	}

	/* Header content becomes a compact vertical stack. The navigation toggle
	 * is absolutely positioned, so reserve room for it next to the title. */
	header.site-header > .fr-sticky-header > .wp-block-group.alignwide {
		display: grid !important;
		grid-template-columns: minmax(0, 1fr) !important;
		gap: 7px !important;
		align-items: start !important;
		justify-content: stretch !important;
		width: 100%;
	}

	header.site-header > .fr-sticky-header > .wp-block-group.alignwide > .wp-block-site-title {
		margin: 0 !important;
		padding-right: 56px;
		font-size: clamp(22px, 6vw, 28px) !important;
		line-height: 1.15 !important;
		text-align: left !important;
	}

	header.site-header > .fr-sticky-header > .wp-block-group.alignwide > p {
		margin: 0 !important;
		font-size: 15px !important;
		line-height: 1.35 !important;
		max-width: 31rem;
	}

	/* The Search block is 100% wide in the saved template. Keep it usable,
	 * but make it a small utility control on mobile. */
	header.site-header > .fr-sticky-header .wp-block-search {
		width: 190px !important;
		max-width: 62vw !important;
		margin: 2px 0 0 !important;
	}

	header.site-header > .fr-sticky-header .wp-block-search__inside-wrapper {
		min-width: 0 !important;
		height: 38px;
	}

	header.site-header > .fr-sticky-header .wp-block-search__input {
		min-width: 0 !important;
		min-height: 38px !important;
		height: 38px;
		padding: 5px 9px !important;
		font-size: 14px !important;
		line-height: 1.2 !important;
	}

	header.site-header > .fr-sticky-header .wp-block-search__button {
		min-width: 42px;
		min-height: 38px !important;
		height: 38px;
		padding: 6px 10px !important;
		margin-left: 4px !important;
	}

	header.site-header > .fr-sticky-header .wp-block-search__button svg {
		width: 20px;
		height: 20px;
	}

	/* Once scrolling starts, the header should behave like a small toolbar,
	 * not like a second hero section. Search and long description remain
	 * available at the top of the page but do not cover content while sticky. */
	header.site-header.fr-sticky-enable {
		top: 0 !important;
	}

	header.site-header.fr-sticky-enable > .fr-sticky-header {
		padding-top: 6px !important;
		padding-bottom: 6px !important;
	}

	header.site-header.fr-sticky-enable > .fr-sticky-header > .wp-block-group.alignwide {
		gap: 0 !important;
	}

	header.site-header.fr-sticky-enable > .fr-sticky-header > .wp-block-group.alignwide > .wp-block-site-title {
		font-size: 19px !important;
		line-height: 1.2 !important;
	}

	header.site-header.fr-sticky-enable > .fr-sticky-header > .wp-block-group.alignwide > p,
	header.site-header.fr-sticky-enable > .fr-sticky-header .wp-block-search {
		display: none !important;
	}

	header.site-header.fr-sticky-enable > .fr-sticky-header > .wp-block-navigation {
		top: 4px;
	}
}

@media (max-width: 599px) {
	/* Compact the full-screen navigation list. WordPress still provides the
	 * accessible modal menu; this only removes the excessive vertical gaps. */
	header.site-header .wp-block-navigation__responsive-container.is-menu-open {
		padding: 18px 20px 24px !important;
		overflow-y: auto;
	}

	header.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		padding-top: 42px;
	}

	header.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		font-size: 18px !important;
		gap: 7px !important;
	}

	header.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
		line-height: 1.35 !important;
		padding-top: 4px;
		padding-bottom: 4px;
	}

	header.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
		font-size: 0.9em !important;
		gap: 4px !important;
		padding: 0 22px 10px !important;
	}

	header.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container::before {
		top: 4px !important;
	}
}

@media (max-width: 380px) {
	header.site-header > .fr-sticky-header > .wp-block-group.alignwide > .wp-block-site-title {
		font-size: 21px !important;
	}

	header.site-header > .fr-sticky-header > .wp-block-group.alignwide > p {
		font-size: 14px !important;
	}

	header.site-header > .fr-sticky-header .wp-block-search {
		width: 170px !important;
	}
}
