/* Frosted stained-glass header (CR, 2026-11-21). See glass-header.php. All widths, phones included (CR, 2026-11-21). */
@media all {
	/* The header's own white backgrounds step aside; the gold line (row border) stays. */
	#masthead,
	#masthead .site-header-wrap,
	#masthead .site-main-header-wrap,
	#masthead .site-header-row-container-inner,
	#masthead .site-mobile-header-wrap,
	#masthead .site-mobile-header-wrap .site-header-row-container-inner { background-color: transparent !important; }

	/* Solid fallback first (browsers without blur, reduced transparency): warm white with the glass texture. */
	#masthead::before {
		opacity: 1;
		background:
			url("glass-a.webp?v=2") repeat-x center center / 600px auto,
			url("glass-b.webp?v=2") repeat-x 63% 40% / 870px auto,
			#fbfaf8;
	}
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	@media all {
		/* Frosted: the page shows softly through the glass, at the top of the page and when scrolled. */
		#masthead::before,
		html.stj-scrolled #masthead::before {
			opacity: 1;
			background:
				url("glass-a.webp?v=2") repeat-x center center / 600px auto,
				url("glass-b.webp?v=2") repeat-x 63% 40% / 870px auto,
				rgb(255 255 255 / .4);
			-webkit-backdrop-filter: blur(18px) saturate(1.35);
			backdrop-filter: blur(18px) saturate(1.35);
		}

	}
}

@media (prefers-reduced-transparency: reduce) {
	#masthead::before,
	html.stj-scrolled #masthead::before {
		background:
			url("glass-a.webp?v=2") repeat-x center center / 600px auto,
			url("glass-b.webp?v=2") repeat-x 63% 40% / 870px auto,
			#fbfaf8;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}
}

/* Logo size (CR, 2026-11-21): 215px at every width from 430px (large phones) up to 8K, except small laptops
   (1025–1279px), where it is 200px so the full menu and the Give button still fit on one row. Phones narrower
   than 430px keep 180px (215px would push the search/Menu buttons off a 360–390px screen).
   Replaces the older stepped sizes (150 / 165 / 200 / 215) from Additional CSS and mega-menu.css. */
@media (min-width: 430px) {
	#masthead .site-branding a.brand img,
	#masthead .site-header-main-section-left .site-branding .custom-logo { width: 215px !important; max-width: 215px !important; min-width: 0 !important; height: auto; }
}
@media (min-width: 1025px) and (max-width: 1279.98px) {
	#masthead .site-branding a.brand img,
	#masthead .site-header-main-section-left .site-branding .custom-logo { width: 200px !important; max-width: 200px !important; }
}

/* Phones (CR, 2026-11-21): search and Menu sit closer together so the logo can be 215px from a 390px phone up
   (iPhone 12–16 and larger). On smaller phones it is as large as fits: 203px at 375px, 188px at 360px.
   Tap targets are unchanged (search 34px wide, Menu button keeps its full height). */
@media (max-width: 767.98px) {
	#masthead .site-mobile-header-wrap .site-header-main-section-right { gap: 4px; }
	#masthead .site-mobile-header-wrap .site-header-main-section-right > .site-header-item { margin-right: 0; }
	#masthead .site-mobile-header-wrap .menu-toggle-open { padding-left: 4px; padding-right: 4px; }
	#masthead .site-mobile-header-wrap .site-header-main-section-left { margin-right: 12px; padding-right: 0; }
	#masthead .site-mobile-header-wrap .site-branding a.brand img { width: min(215px, calc(100vw - 172px)) !important; max-width: none !important; min-width: 0 !important; height: auto; }
}

@media (forced-colors: active) {
	#masthead::before { display: none; }
}

/* Scroll flicker (CR, 2026-11-22: "random flickering when a title goes underneath the header", iPhone Safari).
   The frosted layer behind the sticky header gets its own GPU layer, so Safari re-blurs it in place instead of
   repainting the header while content slides underneath. Visual result is unchanged. (No transform on #masthead
   itself: that would trap the fixed-position menus inside it.) */
#masthead::before { -webkit-transform: translate3d(0,0,0); transform: translate3d(0,0,0); -webkit-backface-visibility: hidden; backface-visibility: hidden; will-change: transform; }
