/*
 * Homepage hero — full-bleed background video with the site header merged over
 * it. The merge itself is done by the GeneratePress Header Element, not here;
 * this file only styles the video, the scrim and the play/pause control.
 */

/*
 * Sizing lives here, not in the block's own `css` attribute.
 *
 * GenerateBlocks collects a block's generated CSS into the *page's* stylesheet,
 * and it does not scan a Header Element's `_generate_element_content` when it
 * does so. The rule for .gb-element-vimhero1 was therefore never emitted and the
 * hero collapsed to 0px tall with the video still in the DOM. Targeting the
 * className instead keeps this independent of that pipeline.
 */
.vim-hero {
	position: relative;
	isolation: isolate;
	width: 100%;

	/*
	 * The hero always fits above the fold, leaving 25px of the section below it
	 * showing as a scroll cue.
	 *
	 * No alert-bar arithmetic is needed here: the whole header wrap — alert bar
	 * AND header together — is absolutely positioned over the hero, so the
	 * hero's top edge sits at y=0 whether or not an alert is published. Measure
	 * before changing this; it is not obvious from the markup.
	 *
	 * svh rather than vh: on mobile, 100vh is the LARGEST viewport, measured
	 * with the browser chrome retracted, so vh would push the next section below
	 * the fold whenever the chrome is showing — the exact thing this rule
	 * promises not to do. svh is the small viewport, so the promise holds in
	 * both states. dvh would resize the hero mid-scroll, which reads as jank.
	 * The vh line is the fallback for browsers without svh.
	 */
	height: calc(100vh - 25px);
	height: calc(100svh - 25px);

	/*
	 * Capped at 900px for very large screens (Tom, 2026-10-26). The video is
	 * 1920x850, so on a tall window an uncapped hero upscales it and crops the
	 * sides away. Phones never reach this: below 768px the rule further down
	 * sets height:auto and the band is a ~172px still.
	 */
	max-height: 900px;
	overflow: hidden;
	background-color: var(--teal-900);
}

.vim-hero__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	z-index: -1;
}

/*
 * The comp runs a soft dark scrim down the top of the hero so the white nav
 * stays legible over whatever frame the video happens to be on. Built from
 * --ink rather than a raw rgba so it stays on the palette.
 */
.vim-hero::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 55%;
	background-image: linear-gradient(
		to bottom,
		color-mix(in srgb, var(--ink) 62%, transparent),
		transparent
	);
	pointer-events: none;
	z-index: 0;
}

/* Play/pause. WCAG 2.2.2 — anything that moves for more than five seconds needs
   a control, and the control has to stay reachable and visible. */
.vim-hero__toggle {
	position: absolute;
	right: clamp(1rem, 3vw, 2.5rem);
	bottom: clamp(1rem, 3vw, 2.5rem);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.25rem;
	height: 3.25rem;
	padding: 0;
	border: 2px solid var(--white);
	border-radius: 999px;
	background-color: color-mix(in srgb, var(--ink) 55%, transparent);
	color: var(--white);
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.vim-hero__toggle:hover,
.vim-hero__toggle:focus-visible {
	background-color: var(--white);
	color: var(--ink);
}

.vim-hero__toggle:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 3px;
}

.vim-hero__icon {
	display: flex;
	line-height: 0;
}

.vim-hero__icon[hidden] {
	display: none;
}

.vim-hero__icon svg {
	width: 1.5rem;
	height: 1.5rem;
	display: block;
}

/*
 * With the header merged over the hero, GeneratePress makes the header
 * transparent and overlays it. The nav needs to sit above the scrim.
 */
.vim-hero-active .site-header {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 20;
	background-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
	.vim-hero__video {
		/* The script also pauses the video; this stops any residual animation. */
		animation: none !important;
	}
}

/*
 * Mobile: a static still instead of the video, shown whole as a bar across.
 *
 * Two halves, and both are needed — dropping either one leaves a phone either
 * downloading a video it never shows, or showing nothing at all:
 *
 *   1. The <source> in Element 46929 carries media="(min-width: 768px)", so
 *      resource selection skips the file entirely below that width and the
 *      3.4 MB MP4 is never requested. (Verified in Chrome: a non-matching
 *      source leaves networkState at NETWORK_NO_SOURCE with currentSrc empty.)
 *   2. The still is painted here as the section's own background rather than
 *      as an <img> in the markup, because a background-image declared inside a
 *      media query is only ever fetched when that query matches — an <img>
 *      hidden with display:none would still be downloaded by desktop.
 *
 * 🚨 The still is the FULL first frame, and the band's aspect-ratio is the
 * frame's own 1536:680. Do not crop it and do not give the band a fixed
 * height. An earlier version did both — a 450px band filled with a 700x850
 * pre-crop of the building — and the crop threw away the clinic sign, which is
 * the only thing in the frame that says whose site this is. Tom's verdict
 * (2026-08-26): "too wide on mobile and all i see is a bush." Matching the
 * ratio to the file means the whole frame is in shot at every phone width, so
 * `contain` needs no letterbox bars and `cover` would trim nothing; the band
 * is simply as tall as the image is, which is ~172px at 390px wide.
 *
 * The URLs are root-relative so they survive the move to the live domain. The
 * plain url() is the fallback for browsers without image-set() (Safari below
 * 17); 1024w is the middle derivative and stays sharp on a 2x phone.
 *
 * 🚨 The query is written as the exact logical complement of the <source>'s
 * `(min-width: 768px)`, NOT as `(max-width: 767px)`. On a fractional viewport
 * — a 767.5px wide window at devicePixelRatio 1.5, which is ordinary on
 * Windows and on plenty of Android phones — BOTH of those match nothing:
 * 767.5 is neither <= 767 nor >= 768. The video then has no source and the
 * poster rule never applies, and the hero renders as a bare teal band. Keep
 * these two queries complementary; do not "tidy" this back to a max-width.
 */
@media not all and (min-width: 768px) {
	/*
	 * 🚨 SUPERSEDED 2026-10-27 (Tom: "on mobile can just hide the hero"): phones
	 * get NO hero. The poster-still approach described above is retired; the
	 * page opens on the first content band under the solid header. No background
	 * image is declared here, so the poster is never downloaded either — which
	 * also removes the image PageSpeed flagged as the slow mobile LCP. The
	 * play/pause toggle goes with it, so nothing unfocusable is left behind.
	 * Above 767px nothing changes: the video hero is exactly as before.
	 */
	.vim-hero {
		display: none;
	}

	/*
	 * Solid header on mobile (Tom, 2026-08-26), and out of the hero's way.
	 *
	 * The merge is GeneratePress's own Page Hero feature, not this file: GP
	 * emits `.header-wrap{position:absolute}` plus
	 * `.header-wrap .site-header{background:transparent}` into
	 * <style id="generate-style-inline-css">, which is printed before hero.css,
	 * so a plain same-specificity override here wins. (The .vim-hero-active
	 * rule further up this file matches nothing — that class is never printed.)
	 *
	 * Overlaying a ~100px header on a ~172px band would cover most of the
	 * image, so the header goes back into normal flow and the band sits under
	 * it at full height.
	 */
	.header-wrap {
		position: static;
	}

	.header-wrap .site-header {
		background-color: var(--teal-900);
	}
}
