/* Every adjustment is limited to phone widths. Desktop stays untouched. */
@media (max-width: 767px) {
	/* The sticky-header script stores a desktop height in an inline wrapper. */
	header.wp-block-template-part .sticky-wrapper {
		height: auto !important;
	}

	/* Keep the brand, logo, and CTA compact and predictable at phone widths. */
	#sticky-header {
		width: 100% !important;
		padding: 16px 20px !important;
	}

	#sticky-header > .wp-block-group {
		display: grid !important;
		grid-template-areas:
			'brand logo'
			'cta cta';
		grid-template-columns: minmax(0, 1fr) 64px;
		gap: 16px !important;
		align-items: center !important;
	}

	#sticky-header > .wp-block-group > :first-child {
		grid-area: brand;
		min-width: 0;
	}

	#sticky-header .wp-block-site-title {
		margin: 0;
		font-size: 1.1rem !important;
		line-height: 1.25;
	}

	#sticky-header .wp-block-site-tagline {
		margin-top: 4px;
		font-size: 0.72rem !important;
		line-height: 1.5;
	}

	#sticky-header > .wp-block-group > .wp-block-site-logo {
		grid-area: logo;
		width: 64px;
		height: 64px;
		justify-self: end;
	}

	#sticky-header .wp-block-site-logo .custom-logo {
		width: 64px !important;
		height: 64px !important;
		object-fit: contain;
	}

	#sticky-header > .wp-block-group > .wp-block-buttons {
		grid-area: cta;
		width: 100%;
	}

	#sticky-header .wp-block-button,
	#sticky-header .wp-block-button__link {
		width: 100%;
	}

	#sticky-header .wp-block-button__link {
		display: block;
		min-height: 44px;
		padding: 12px 16px !important;
		font-size: 0.92rem;
		text-align: center;
	}

	/* Home-page hero: remove the desktop 1000px minimum and scale its title. */
	body.home .wp-site-blocks > .wp-block-cover > .wp-block-cover__inner-container > .wp-block-group {
		min-height: 560px !important;
	}

	body.home .wp-site-blocks > .wp-block-cover .wp-block-heading {
		padding: 1.5rem 1.25rem !important;
		font-size: clamp(1.9rem, 8vw, 2.35rem) !important;
		line-height: 1.22 !important;
	}

	/* Prevent the parent theme's desktop gaps from creating excessive mobile whitespace. */
	.wp-site-blocks .wp-block-columns {
		gap: 2rem 1rem !important;
	}

	footer.wp-block-template-part .wp-block-columns {
		gap: 2rem !important;
	}

	/* Keep archive metadata readable instead of squeezing the author and date together. */
	body.archive .wp-block-post-template .wp-block-group.is-nowrap {
		flex-wrap: wrap !important;
		gap: 0.35rem 0.75rem !important;
		align-items: flex-start;
	}

	body.archive .wp-block-post-author__name {
		margin: 0;
		font-size: 0.75rem;
		overflow-wrap: anywhere;
	}

	/* Long tables retain their content without widening the entire page. */
	body.single main figure:has(table) {
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}
