From d99fb0d2db15c22bd38966cbfdb048c0dd5271a1 Mon Sep 17 00:00:00 2001 From: Lamont Crook Date: Wed, 8 Jul 2026 14:01:50 -0600 Subject: [PATCH 1/4] Refactor hero into a variant-driven video backdrop with poster The `video` variant now uses the authored image as the LCP poster and layers an authored .mp4/.webm URL on top as a muted, looping, autoplay backdrop. The poster is loaded eagerly at high priority; the video is attached only after the page load event to protect LCP, and is skipped entirely under prefers-reduced-motion or when autoplay is blocked (poster remains). Video is now gated on the .video variant instead of URL-guessing heuristics; the YouTube/Vimeo embed paths were removed in favor of direct video files. Co-Authored-By: Claude Opus 4.8 --- blocks/hero/hero.css | 15 ++-- blocks/hero/hero.js | 178 ++++++++++++++++++++++++------------------- 2 files changed, 104 insertions(+), 89 deletions(-) diff --git a/blocks/hero/hero.css b/blocks/hero/hero.css index 83f3ece..52d63ba 100644 --- a/blocks/hero/hero.css +++ b/blocks/hero/hero.css @@ -26,17 +26,14 @@ object-fit: cover; } -.hero .hero-video-embed { - width: 100%; - height: 100%; +/* video layers over the poster image and fades in once it is playing */ +.hero .hero-video { + opacity: 0; + transition: opacity 0.6s ease; } -.hero .hero-video-embed iframe { - width: 100%; - height: 100%; - object-fit: cover; - position: absolute; - inset: 0; +.hero .hero-video.is-playing { + opacity: 1; } /* Overlay gradient */ diff --git a/blocks/hero/hero.js b/blocks/hero/hero.js index 86db8d5..1263b55 100644 --- a/blocks/hero/hero.js +++ b/blocks/hero/hero.js @@ -1,107 +1,125 @@ /** - * Hero Block — supports both image and video backgrounds (full width). + * Hero Block * - * Authoring structure: - * Row 1: image OR video (as link, plain URL text, or