/* Site polish (CR, 2026-11-19, ideas taken from Apple): a sticky frosted header and quiet scroll reveals.
   Loaded on every page except the festival pages (they have their own header). polish.js sets the classes. */

/* 1. Sticky header. It stays at the top while scrolling; once the page has moved it turns to frosted glass
   (like the mega-menu panels). --stj-header-h (set by polish.js) keeps in-page links and sticky rails clear of it. */
#masthead { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 900; transition: background-color .25s ease, box-shadow .25s ease; }
html { scroll-padding-top: calc(var(--stj-header-h, 0px) + var(--wp-admin--admin-bar--height, 0px) + 12px); }
html.stj-scrolled #masthead { box-shadow: 0 10px 28px -22px rgb(24 56 44 / .55); }
/* The frost is drawn on a ::before layer behind the header, not on the header itself: an element with backdrop-filter
   stops its children's backdrop-filter from seeing the page, which made the frosted mega-menu panels look see-through. */
#masthead::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .25s ease; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	html.stj-scrolled #masthead,
	html.stj-scrolled #masthead .site-header-row-container-inner,
	html.stj-scrolled #masthead .site-main-header-wrap,
	html.stj-scrolled #masthead .site-header-wrap { background-color: transparent; }
	html.stj-scrolled #masthead::before { opacity: 1; background-color: rgb(255 253 248 / .8); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
	/* Phones: a little more solid and a lighter blur, which is cheaper to draw while scrolling. */
	@media (max-width: 767px) {
		html.stj-scrolled #masthead::before { background-color: rgb(255 253 248 / .9); -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3); }
	}
}
@media (prefers-reduced-transparency: reduce) {
	html.stj-scrolled #masthead::before { background-color: #fffdf8; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* 2. Quiet scroll reveals: photos and panels below the first screen fade up 8px as they come into view, once.
   Only after polish.js has started (html.stj-reveal), never with reduced motion, and only opacity/transform,
   which the browser animates without re-laying out the page. */
@media (prefers-reduced-motion: no-preference) {
	html.stj-reveal .stj-rv { opacity: 0; transform: translateY(8px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
	html.stj-reveal .stj-rv.stj-rv-in { opacity: 1; transform: none; }
}

/* 3. Phone and tablet menu (CR, 2026-11-19; applies wherever the ☰ menu sheet can open, up to 1279px since 2026-11-22: normally below 1025px, plus the menu-button fallback with enlarged text): a full-width frosted forest-green sheet instead of the solid side panel.
   The page shows through softly behind it; white text keeps strong contrast (the green is 86% solid). It eases up
   12px as it opens. Mass Times = solid ivory, Give = ivory outline, square like the rest of the site. */
@media (max-width: 1279.98px) {
	#mobile-drawer .drawer-overlay { background: transparent; }
	#mobile-drawer .drawer-inner { width: 100%; max-width: none; background: rgb(24 56 44 / .86); box-shadow: none; }
	@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
		#mobile-drawer .drawer-inner { -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); }
	}
	@media (prefers-reduced-transparency: reduce) { #mobile-drawer .drawer-inner { background: #18382c; -webkit-backdrop-filter: none; backdrop-filter: none; } }
	#mobile-drawer .drawer-content { max-width: 560px; margin-inline: auto; padding-inline: 24px; }
	#mobile-drawer .stj-mobile-quick { gap: 10px; }
	#mobile-drawer .stj-mobile-quick a { border-radius: 0; padding: .8rem .5rem; font-size: 1rem; }
	#mobile-drawer .stj-mobile-quick a:first-child { background: #fffdf8; border-color: #fffdf8; color: #18382c !important; }
	#mobile-drawer .stj-mobile-quick a:last-child { border-color: rgb(231 203 145 / .8); }
	#mobile-drawer #mobile-menu > li > .drawer-nav-drop-wrap > a,
	#mobile-drawer #mobile-menu > li > a { font: 500 1.45rem/1.2 var(--stj-font-serif, "EB Garamond", Georgia, serif); letter-spacing: -.01em; }
}
@media (max-width: 1279.98px) and (prefers-reduced-motion: no-preference) {
	#mobile-drawer .drawer-inner { transform: translateY(12px); transition: opacity .25s ease, transform .35s cubic-bezier(.2, .7, .2, 1); }
	#mobile-drawer.show-drawer.active .drawer-inner { transform: none; }
}

/* 4. Touch feedback (CR, 2026-11-19): on touch screens, buttons, cards and menu rows press in slightly while
   touched, so a tap visibly registers. Transform only, so nothing on the page moves. */
@media (hover: none) and (prefers-reduced-motion: no-preference) {
	:where(main, #mobile-drawer, .site-footer) :is(a, button, summary) { transition: transform .12s ease, opacity .12s ease; -webkit-tap-highlight-color: transparent; }
	:where(main, #mobile-drawer, .site-footer) :is(.wp-block-button__link, .button, .hero-button, .stj-page-card a, .tile a, .panel a, .video-link, summary, .stj-mobile-quick a, button):active { transform: scale(.97); opacity: .85; }
	:where(main, #mobile-drawer) :is(.stj-page-card, .tile, .card):active { transform: scale(.99); }
	#mobile-menu a:active { opacity: .7; }
}
