ferst-core 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +13 -4
  2. package/bin/ferst-media.mjs +96 -0
  3. package/cms/config.template.yml +11 -0
  4. package/components/Card.astro +53 -51
  5. package/components/PostCard.astro +138 -136
  6. package/components/SiteHeader.astro +1356 -1273
  7. package/components/blocks/Grid.astro +49 -48
  8. package/components/blocks/Heading.astro +4 -1
  9. package/components/recipes/Banner.astro +146 -146
  10. package/components/recipes/Book.astro +39 -4
  11. package/components/recipes/FeatureCards.astro +112 -118
  12. package/components/recipes/Gallery.astro +57 -59
  13. package/components/recipes/Hero.astro +638 -533
  14. package/components/recipes/LatestPosts.astro +295 -292
  15. package/components/recipes/Locations.astro +146 -143
  16. package/components/recipes/Marquee.astro +75 -75
  17. package/components/recipes/MediaCards.astro +213 -219
  18. package/components/recipes/Pricing.astro +149 -150
  19. package/components/recipes/Stats.astro +150 -157
  20. package/components/recipes/Tiles.astro +342 -296
  21. package/content/blocks.ts +1072 -1024
  22. package/content/imageSlots.mjs +542 -0
  23. package/content/schemas.ts +35 -2
  24. package/examples/recipes.ts +4 -0
  25. package/fonts/OFL.txt +1332 -287
  26. package/fonts/anton-latin-400-normal.woff2 +0 -0
  27. package/fonts/bangers-latin-400-normal.woff2 +0 -0
  28. package/fonts/bebas-neue-latin-400-normal.woff2 +0 -0
  29. package/fonts/bowlby-one-latin-400-normal.woff2 +0 -0
  30. package/fonts/fredoka-latin-400-normal.woff2 +0 -0
  31. package/fonts/fredoka-latin-600-normal.woff2 +0 -0
  32. package/fonts/fredoka-latin-700-normal.woff2 +0 -0
  33. package/fonts/knewave-latin-400-normal.woff2 +0 -0
  34. package/fonts/lora-latin-400-normal.woff2 +0 -0
  35. package/fonts/lora-latin-600-normal.woff2 +0 -0
  36. package/fonts/lora-latin-700-normal.woff2 +0 -0
  37. package/fonts/merriweather-latin-400-normal.woff2 +0 -0
  38. package/fonts/merriweather-latin-600-normal.woff2 +0 -0
  39. package/fonts/merriweather-latin-700-normal.woff2 +0 -0
  40. package/fonts/nunito-latin-400-normal.woff2 +0 -0
  41. package/fonts/nunito-latin-600-normal.woff2 +0 -0
  42. package/fonts/nunito-latin-700-normal.woff2 +0 -0
  43. package/fonts/oswald-latin-400-normal.woff2 +0 -0
  44. package/fonts/oswald-latin-600-normal.woff2 +0 -0
  45. package/fonts/oswald-latin-700-normal.woff2 +0 -0
  46. package/fonts/rubik-dirt-latin-400-normal.woff2 +0 -0
  47. package/integration.mjs +253 -249
  48. package/layouts/Base.astro +13 -3
  49. package/lib/book.ts +94 -1
  50. package/lib/fonts.ts +130 -0
  51. package/lib/gridRows.ts +197 -0
  52. package/lib/image-fields.ts +140 -0
  53. package/lib/image-size.mjs +108 -0
  54. package/lib/image-sizes.ts +16 -0
  55. package/lib/logo-header.ts +46 -0
  56. package/lib/media-check.mjs +524 -0
  57. package/lib/theme-preview.ts +203 -140
  58. package/lib/themeTokens.ts +235 -220
  59. package/package.json +3 -2
  60. package/styles/fonts.css +239 -76
  61. package/styles/theme.css +228 -160
  62. package/lib/gridColumns.ts +0 -22
@@ -1,533 +1,638 @@
1
- ---
2
- /**
3
- * Hero — the first Level-2 recipe: a curated page-opening band that composes
4
- * primitives (Heading + Button) into a designed layout. Presets: `centered`
5
- * (stacked and centred), `split` (text beside an image) and `media` (text over a
6
- * background — a looping video, a slow crossfade of images, or one image). A
7
- * media hero can be a band, `tall`, or fill the first `screen` edge to edge.
8
- * Recipes are locked components so quality can't drift (BLOCK-ARCHITECTURE §6).
9
- *
10
- * Moving backgrounds (video, slideshow) are accessible by construction: a pause
11
- * button (WCAG 2.2.2), still under prefers-reduced-motion (the poster / first
12
- * image), and the slideshow pauses while off-screen or the tab is hidden.
13
- */
14
- import Heading from '../blocks/Heading.astro';
15
- import Button from '../Button.astro';
16
- import { backgroundEmbed, videoEmbed } from '../../lib/video';
17
-
18
- interface Props {
19
- eyebrow?: string;
20
- title: string;
21
- subtitle?: string;
22
- cta?: { label: string; href: string };
23
- image?: { src: string; alt?: string };
24
- media?: { image?: string; images?: string[]; video?: string; poster?: string; overlay?: number; link?: string; linkLabel?: string };
25
- layout?: 'centered' | 'split' | 'media';
26
- size?: 'compact' | 'standard' | 'tall' | 'screen';
27
- parallax?: boolean;
28
- background?: 'none' | 'mesh';
29
- fullBleed?: boolean;
30
- focus?: string;
31
- }
32
- const { eyebrow, title, subtitle, cta, image, media, layout = 'centered', size = 'standard', parallax = false, background = 'none', fullBleed = false, focus } = Astro.props;
33
- // A YouTube / Vimeo link plays as an embedded background (after consent); anything else
34
- // in `video` is a file for a native <video>.
35
- const embed = media?.video ? backgroundEmbed(media.video) : null;
36
- const slides = !media?.video && (media?.images?.length ?? 0) >= 2 ? media!.images! : [];
37
- const still = media?.image ?? media?.images?.[0];
38
- const isMedia = layout === 'media' && media && (media.video || slides.length || still);
39
- const motion = isMedia ? (embed ? 'embed' : media?.video ? 'video' : slides.length ? 'slides' : undefined) : undefined;
40
- const overlay = (media?.overlay ?? 45) / 100;
41
- const isMesh = background === 'mesh' && !isMedia;
42
- // The background can lead somewhere — e.g. the full video on YouTube (new tab; the app on phones).
43
- const linkTo = media?.link ?? embed?.watchUrl; // an embedded video links to itself by default
44
- const bgLink = isMedia && linkTo && /^(https?:\/\/|\/)/i.test(linkTo) ? linkTo : undefined;
45
- const provider = bgLink ? videoEmbed(bgLink)?.provider : undefined;
46
- const watchLabel = media?.linkLabel || (provider ? `Watch the full video on ${provider}` : 'Watch the full video');
47
- // The still: the image (no motion), or an embed's poster until the player may load.
48
- const stillSrc = embed ? media?.poster ?? still : !media?.video && !slides.length ? still : undefined;
49
- // Drawn as a real <img>, never a CSS background: a picture set through a CSS variable is
50
- // found late (never by the preload scanner), so the hero sat grey until it arrived, and
51
- // some browsers kept it grey. A real image, loaded first, is found early and painted.
52
- const heroImg = isMedia && stillSrc ? stillSrc : undefined;
53
- ---
54
-
55
- <section
56
- class="b-hero"
57
- data-layout={layout}
58
- data-size={isMedia ? size : undefined}
59
- data-bg={isMesh ? 'mesh' : undefined}
60
- data-motion={motion}
61
- data-linked={bgLink ? 'true' : undefined}
62
- data-parallax={isMedia && parallax ? 'true' : undefined}
63
- data-full-bleed={isMedia && fullBleed ? 'true' : undefined}
64
- style={isMedia ? `--hero-overlay: ${overlay}${focus ? `; --hero-focus: ${focus}` : ''}` : undefined}
65
- >
66
- {isMedia && (
67
- <div class="b-hero__bg" aria-hidden="true">
68
- {heroImg && <img class="b-hero__img" src={heroImg} alt="" loading="eager" fetchpriority="high" decoding="async" />}
69
- {embed && <div class="b-hero__embed" data-embed-url={embed.embedUrl} data-provider={embed.provider}></div>}
70
- {media?.video && !embed ? (
71
- <video aria-hidden="true" tabindex="-1" autoplay muted loop playsinline poster={media.poster} preload="metadata">
72
- <source src={media.video} />
73
- </video>
74
- ) : null}
75
- {slides.map((src, i) => (
76
- <img class:list={['b-hero__slide', { 'is-on': i === 0 }]} src={src} alt="" loading={i === 0 ? 'eager' : 'lazy'} fetchpriority={i === 0 ? 'high' : undefined} decoding="async" />
77
- ))}
78
- <span class="b-hero__scrim"></span>
79
- </div>
80
- )}
81
- {bgLink && <a class="b-hero__bglink" href={bgLink} target="_blank" rel="noopener" tabindex="-1" aria-hidden="true"></a>}
82
- {isMesh && <div class="b-hero__mesh" aria-hidden="true"></div>}
83
- <div class="b-hero__text">
84
- {eyebrow && <p class="b-hero__eyebrow">{eyebrow}</p>}
85
- <Heading text={title} level={1} align={layout === 'split' ? 'start' : 'center'} />
86
- {subtitle && <p class="b-hero__subtitle">{subtitle}</p>}
87
- {cta && (
88
- <div class="b-hero__cta">
89
- <Button href={cta.href} variant={layout === 'media' ? 'cta' : 'primary'}>{cta.label}</Button>
90
- </div>
91
- )}
92
- </div>
93
- {bgLink && (
94
- <a class="b-hero__watch" href={bgLink} target="_blank" rel="noopener">
95
- <span class="b-hero__watch-icon" aria-hidden="true"></span>{watchLabel}<span class="b-hero__sr"> (opens in a new tab)</span>
96
- </a>
97
- )}
98
- {motion && (
99
- <button type="button" class="b-hero__pause" aria-pressed="false" aria-label="Pause background" hidden={motion === 'embed'}>
100
- <span class="b-hero__pause-icon" aria-hidden="true"></span>
101
- </button>
102
- )}
103
- {layout === 'split' && image && (
104
- <div class="b-hero__media">
105
- <img src={image.src} alt={image.alt ?? ''} loading="eager" decoding="async" />
106
- </div>
107
- )}
108
- </section>
109
-
110
- <script>
111
- // Moving hero backgrounds: pause button, reduced-motion, the slideshow timer, and an
112
- // embedded (YouTube / Vimeo) background that loads only once the visitor consents.
113
- import { hasConsent, onConsentChange } from '../../lib/consent-client';
114
- import { playerStarted } from '../../lib/video';
115
- const SLIDE_MS = 6000;
116
- const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
117
- for (const hero of document.querySelectorAll<HTMLElement>('.b-hero[data-motion]')) {
118
- const button = hero.querySelector<HTMLButtonElement>('.b-hero__pause');
119
- const video = hero.querySelector('video');
120
- const slides = [...hero.querySelectorAll<HTMLElement>('.b-hero__slide')];
121
- const embedSlot = hero.querySelector<HTMLElement>('.b-hero__embed');
122
- let player: HTMLIFrameElement | null = null;
123
- // Play / pause an embedded player by message, with no provider API script.
124
- const command = (play: boolean) => {
125
- if (!player?.contentWindow) return;
126
- const msg = embedSlot!.dataset.provider === 'Vimeo'
127
- ? { method: play ? 'play' : 'pause' }
128
- : { event: 'command', func: play ? 'playVideo' : 'pauseVideo', args: [] };
129
- player.contentWindow.postMessage(JSON.stringify(msg), new URL(player.src).origin);
130
- };
131
- const loadPlayer = () => {
132
- if (player || !embedSlot || reduce) return; // reduced motion keeps the still
133
- player = document.createElement('iframe');
134
- player.src = embedSlot.dataset.embedUrl!;
135
- player.title = 'Background video';
136
- player.tabIndex = -1;
137
- player.setAttribute('aria-hidden', 'true');
138
- player.allow = 'autoplay; encrypted-media; picture-in-picture';
139
- // Keep the poster up until the player says it is PLAYING, then cross-fade: no black,
140
- // loading player on screen. Ask it to report (YouTube 'listening' / Vimeo listener).
141
- const provider = embedSlot.dataset.provider!;
142
- const origin = new URL(player.src).origin;
143
- window.addEventListener('message', (e) => {
144
- if (e.origin !== origin || e.source !== player!.contentWindow) return;
145
- if (playerStarted(provider, e.data)) embedSlot.classList.add('is-on');
146
- });
147
- player.addEventListener('load', () => {
148
- const hello = provider === 'Vimeo' ? { method: 'addEventListener', value: 'play' } : { event: 'listening', id: 1, channel: 'widget' };
149
- player!.contentWindow?.postMessage(JSON.stringify(hello), origin);
150
- });
151
- embedSlot.appendChild(player);
152
- if (button) button.hidden = false;
153
- sync();
154
- };
155
- let paused = reduce;
156
- let visible = true;
157
- let index = 0;
158
- let timer: number | undefined;
159
-
160
- const tick = () => {
161
- slides[index].classList.remove('is-on');
162
- index = (index + 1) % slides.length;
163
- slides[index].classList.add('is-on');
164
- };
165
- const sync = () => {
166
- const run = !paused && visible && !document.hidden;
167
- if (video) {
168
- if (run) void video.play().catch(() => {});
169
- else video.pause();
170
- }
171
- if (player) command(run);
172
- if (slides.length > 1) {
173
- window.clearInterval(timer);
174
- timer = run ? window.setInterval(tick, SLIDE_MS) : undefined;
175
- }
176
- if (button) {
177
- button.setAttribute('aria-pressed', String(paused));
178
- button.setAttribute('aria-label', paused ? 'Play background' : 'Pause background');
179
- }
180
- hero.toggleAttribute('data-paused', paused);
181
- };
182
- button?.addEventListener('click', () => { paused = !paused; sync(); });
183
- document.addEventListener('visibilitychange', sync);
184
- new IntersectionObserver(([e]) => { visible = e.isIntersecting; sync(); }).observe(hero);
185
- if (embedSlot) {
186
- // Warm the connection the moment it's allowed, so the video starts sooner.
187
- const preconnect = () => {
188
- const href = new URL(embedSlot.dataset.embedUrl!).origin;
189
- if (document.querySelector(`link[rel="preconnect"][href="${href}"]`)) return;
190
- const l = document.createElement('link');
191
- l.rel = 'preconnect';
192
- l.href = href;
193
- document.head.appendChild(l);
194
- };
195
- if (hasConsent()) { preconnect(); loadPlayer(); }
196
- onConsentChange((allowed) => { if (allowed) { preconnect(); loadPlayer(); } });
197
- }
198
- sync();
199
- }
200
- // Parallax: the background drifts more slowly than the page. Transform-based, so it works
201
- // for an image, slides, a <video> or an embedded player alike. Off on touch devices
202
- // (coarse pointers) and under reduced motion; only runs while the hero is on screen.
203
- const fine = window.matchMedia('(pointer: fine)').matches;
204
- for (const hero of document.querySelectorAll<HTMLElement>('.b-hero[data-parallax]')) {
205
- const bg = hero.querySelector<HTMLElement>('.b-hero__bg');
206
- if (!bg || reduce || !fine) continue;
207
- hero.classList.add('is-parallax');
208
- let ticking = false;
209
- let onScreen = true;
210
- const move = () => {
211
- ticking = false;
212
- const top = hero.getBoundingClientRect().top;
213
- bg.style.transform = `translate3d(0, ${Math.round(Math.max(0, -top) * 0.35)}px, 0)`;
214
- };
215
- const queue = () => { if (onScreen && !ticking) { ticking = true; requestAnimationFrame(move); } };
216
- new IntersectionObserver(([e]) => { onScreen = e.isIntersecting; if (onScreen) queue(); }).observe(hero);
217
- window.addEventListener('scroll', queue, { passive: true });
218
- move();
219
- }
220
- </script>
221
-
222
- <style>
223
- .b-hero {
224
- display: grid;
225
- gap: 2rem;
226
- padding-block: 3rem;
227
- }
228
- @media (min-width: 48em) {
229
- .b-hero[data-layout='split'] {
230
- grid-template-columns: 1fr 1fr;
231
- align-items: center;
232
- }
233
- }
234
- .b-hero__text {
235
- display: flex;
236
- flex-direction: column;
237
- gap: 1rem;
238
- }
239
- .b-hero[data-layout='centered'] .b-hero__text {
240
- max-width: var(--max);
241
- margin-inline: auto;
242
- align-items: center;
243
- text-align: center;
244
- }
245
- .b-hero__eyebrow {
246
- margin: 0;
247
- text-transform: uppercase;
248
- letter-spacing: 0.12em;
249
- font-size: 0.8125rem;
250
- font-weight: 600;
251
- color: var(--gold);
252
- }
253
- .b-hero__subtitle {
254
- margin: 0;
255
- font-size: 1.125rem;
256
- line-height: 1.6;
257
- color: var(--muted);
258
- max-width: var(--max);
259
- }
260
- .b-hero__cta {
261
- margin-top: 0.5rem;
262
- }
263
-
264
- /* ── Mesh background: a soft, slowly drifting brand gradient behind the text.
265
- Low opacity + blur keeps normal (dark) text perfectly readable. ── */
266
- .b-hero[data-bg='mesh'] {
267
- position: relative;
268
- isolation: isolate;
269
- overflow: hidden;
270
- border-radius: var(--radius);
271
- padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 4vw, 3rem);
272
- }
273
- .b-hero__mesh {
274
- position: absolute;
275
- inset: 0;
276
- z-index: -1;
277
- background: var(--bg);
278
- }
279
- .b-hero__mesh::before {
280
- content: '';
281
- position: absolute;
282
- inset: -25%;
283
- background:
284
- radial-gradient(35% 45% at 20% 25%, var(--gold), transparent 70%),
285
- radial-gradient(35% 45% at 80% 20%, var(--accent-2, var(--gold)), transparent 70%),
286
- radial-gradient(40% 50% at 65% 85%, var(--gold-light), transparent 70%);
287
- opacity: 0.35;
288
- filter: blur(50px);
289
- animation: b-hero-mesh 20s ease-in-out infinite alternate;
290
- }
291
- @keyframes b-hero-mesh {
292
- from { transform: translate3d(-3%, -2%, 0) scale(1.05); }
293
- to { transform: translate3d(3%, 4%, 0) scale(1.18); }
294
- }
295
- @media (prefers-reduced-motion: reduce) {
296
- .b-hero__mesh::before { animation: none; }
297
- }
298
- .b-hero__media img {
299
- display: block;
300
- width: 100%;
301
- height: auto;
302
- border-radius: 8px;
303
- }
304
-
305
- /* ── Media layout: image / slideshow / video background with a legibility scrim ── */
306
- .b-hero[data-layout='media'] {
307
- position: relative;
308
- min-height: min(68vh, 38rem);
309
- display: grid;
310
- place-items: center;
311
- text-align: center;
312
- padding: clamp(3rem, 8vw, 6rem) 1.5rem;
313
- border-radius: var(--radius);
314
- overflow: hidden;
315
- isolation: isolate;
316
- }
317
- /* A narrow band for a short, wide header strip: close to the strip's own shape, so it
318
- isn't cropped to its middle and blown up. Less padding and a smaller title to fit. */
319
- .b-hero[data-size='compact'] {
320
- min-height: clamp(8rem, 18vw, 16rem);
321
- padding-block: clamp(1.25rem, 3vw, 2.25rem);
322
- }
323
- .b-hero[data-size='compact'] :global(h1) {
324
- font-size: clamp(1.6rem, 3.4vw, 2.6rem);
325
- }
326
- /* Edge to edge across the screen, like a full-bleed banner. */
327
- .b-hero[data-full-bleed='true'] {
328
- width: 100vw;
329
- margin-inline: calc(50% - 50vw);
330
- border-radius: 0;
331
- }
332
- .b-hero[data-size='tall'] {
333
- min-height: min(85vh, 52rem);
334
- }
335
- /* The full first screen below the sticky header, edge to edge — breaks out of the page
336
- column. --header-h is the header's measured full height (SiteHeader); the fallback is
337
- its usual height until that runs. */
338
- .b-hero[data-size='screen'] {
339
- width: 100vw;
340
- margin-inline: calc(50% - 50vw);
341
- min-height: calc(100svh - var(--header-h, 60px));
342
- border-radius: 0;
343
- }
344
- @media (min-width: 64em) {
345
- .b-hero[data-size='screen'] {
346
- min-height: calc(100svh - var(--header-h, 64px));
347
- }
348
- }
349
- .b-hero__bg {
350
- position: absolute;
351
- inset: 0;
352
- z-index: -1;
353
- background-color: var(--bg-section);
354
- }
355
- /* The picture (and each rotating slide) covers the band, framed by `focus`. */
356
- .b-hero__img,
357
- .b-hero__slide {
358
- position: absolute;
359
- inset: 0;
360
- width: 100%;
361
- height: 100%;
362
- object-fit: cover;
363
- object-position: var(--hero-focus, center);
364
- display: block;
365
- max-width: none;
366
- }
367
- /* Parallax: give the background room to drift (up to 35% of the hero) without uncovering
368
- an edge. The room is split evenly above and below, so at rest the picture or video is
369
- centred on the hero, not pushed down by the extra room. Any gap the drift opens at the
370
- top stays above the screen. */
371
- .b-hero.is-parallax .b-hero__bg {
372
- inset: -17.5% 0 -17.5% 0;
373
- will-change: transform;
374
- }
375
- .b-hero__bg video {
376
- width: 100%;
377
- height: 100%;
378
- object-fit: cover;
379
- object-position: var(--hero-focus, center);
380
- }
381
- /* An embedded background player, sized to COVER the hero like object-fit (16:9 kept,
382
- overflow cropped). Never interactive; fades in once it has started. */
383
- .b-hero__embed {
384
- position: absolute;
385
- inset: 0;
386
- overflow: hidden;
387
- pointer-events: none;
388
- container-type: size;
389
- opacity: 0;
390
- transition: opacity 1.2s ease;
391
- }
392
- .b-hero__embed.is-on {
393
- opacity: 1;
394
- }
395
- .b-hero__embed :global(iframe) {
396
- position: absolute;
397
- top: 50%;
398
- left: 50%;
399
- width: max(100cqw, 177.78cqh);
400
- height: max(100cqh, 56.25cqw);
401
- max-width: none; /* the global media reset caps iframes at 100%: cover must overflow */
402
- transform: translate(-50%, -50%);
403
- border: 0;
404
- }
405
- .b-hero__pause[hidden] {
406
- display: none;
407
- }
408
- .b-hero__slide {
409
- opacity: 0;
410
- transition: opacity 1.6s ease-in-out;
411
- }
412
- .b-hero__slide.is-on {
413
- opacity: 1;
414
- }
415
- @media (prefers-reduced-motion: reduce) {
416
- .b-hero__slide { transition: none; }
417
- }
418
- .b-hero__scrim {
419
- position: absolute;
420
- inset: 0;
421
- background: rgba(8, 10, 18, var(--hero-overlay, 0.45));
422
- }
423
- .b-hero[data-layout='media'] .b-hero__text {
424
- max-width: var(--max);
425
- align-items: center;
426
- color: #fff;
427
- }
428
- .b-hero[data-layout='media'] .b-hero__subtitle {
429
- color: rgba(255, 255, 255, 0.9);
430
- margin-inline: auto;
431
- }
432
- .b-hero[data-layout='media'] .b-hero__eyebrow {
433
- color: #fff;
434
- opacity: 0.9;
435
- }
436
- .b-hero[data-layout='media'] :global(h1) {
437
- color: #fff;
438
- }
439
-
440
- /* A linked background: the whole picture opens the full video; the text and
441
- its CTA stay clickable on top, and a visible cue carries the keyboard link. */
442
- .b-hero__bglink {
443
- position: absolute;
444
- inset: 0;
445
- z-index: 0;
446
- cursor: pointer;
447
- }
448
- .b-hero[data-linked] .b-hero__text {
449
- position: relative;
450
- z-index: 1;
451
- pointer-events: none;
452
- }
453
- .b-hero[data-linked] .b-hero__text :global(a),
454
- .b-hero[data-linked] .b-hero__text :global(button) {
455
- pointer-events: auto;
456
- }
457
- .b-hero__watch {
458
- position: absolute;
459
- left: clamp(0.75rem, 2vw, 1.25rem);
460
- bottom: clamp(0.75rem, 2vw, 1.25rem);
461
- z-index: 2;
462
- display: inline-flex;
463
- align-items: center;
464
- gap: 0.5rem;
465
- padding: 0.5rem 0.9rem;
466
- border-radius: 999px;
467
- border: 1px solid rgba(255, 255, 255, 0.55);
468
- background: rgba(8, 10, 18, 0.45);
469
- color: #fff;
470
- font-size: 0.875rem;
471
- font-weight: 600;
472
- text-decoration: none;
473
- }
474
- .b-hero__watch:hover {
475
- background: rgba(8, 10, 18, 0.65);
476
- }
477
- .b-hero__watch:focus-visible {
478
- outline: 3px solid #fff;
479
- outline-offset: 2px;
480
- }
481
- .b-hero__watch-icon {
482
- width: 0;
483
- height: 0;
484
- border-block: 0.35rem solid transparent;
485
- border-inline-start: 0.6rem solid currentColor;
486
- }
487
- .b-hero__sr {
488
- position: absolute;
489
- width: 1px;
490
- height: 1px;
491
- overflow: hidden;
492
- clip-path: inset(50%);
493
- white-space: nowrap;
494
- }
495
-
496
- /* Pause / play for moving backgrounds — small, quiet, always reachable. */
497
- .b-hero__pause {
498
- position: absolute;
499
- z-index: 2;
500
- right: clamp(0.75rem, 2vw, 1.25rem);
501
- bottom: clamp(0.75rem, 2vw, 1.25rem);
502
- width: 2.5rem;
503
- height: 2.5rem;
504
- display: grid;
505
- place-items: center;
506
- border-radius: 50%;
507
- border: 1px solid rgba(255, 255, 255, 0.55);
508
- background: rgba(8, 10, 18, 0.45);
509
- color: #fff;
510
- cursor: pointer;
511
- }
512
- .b-hero__pause:hover {
513
- background: rgba(8, 10, 18, 0.65);
514
- }
515
- .b-hero__pause:focus-visible {
516
- outline: 3px solid #fff;
517
- outline-offset: 2px;
518
- }
519
- /* Two bars (pause) → a triangle (play) when paused. */
520
- .b-hero__pause-icon {
521
- width: 0.75rem;
522
- height: 0.875rem;
523
- border-inline: 0.25rem solid currentColor;
524
- }
525
- .b-hero[data-paused] .b-hero__pause-icon {
526
- width: 0;
527
- height: 0;
528
- border-inline: 0;
529
- border-block: 0.45rem solid transparent;
530
- border-inline-start: 0.75rem solid currentColor;
531
- margin-inline-start: 0.2rem;
532
- }
533
- </style>
1
+ ---
2
+ /**
3
+ * Hero — the first Level-2 recipe: a curated page-opening band that composes
4
+ * primitives (Heading + Button) into a designed layout. Presets: `centered`
5
+ * (stacked and centred), `split` (text beside an image) and `media` (text over a
6
+ * background — a looping video, a slow crossfade of images, or one image). A
7
+ * media hero can be a band, `tall`, or fill the first `screen` edge to edge.
8
+ * Recipes are locked components so quality can't drift (BLOCK-ARCHITECTURE §6).
9
+ *
10
+ * Moving backgrounds (video, slideshow) are accessible by construction: a pause
11
+ * button (WCAG 2.2.2), still under prefers-reduced-motion (the poster / first
12
+ * image), and the slideshow pauses while off-screen or the tab is hidden.
13
+ */
14
+ import Heading from '../blocks/Heading.astro';
15
+ import Button from '../Button.astro';
16
+ import { backgroundEmbed, videoEmbed } from '../../lib/video';
17
+ import { imageSizeOf } from '../../lib/image-sizes';
18
+
19
+ interface Props {
20
+ eyebrow?: string;
21
+ title: string;
22
+ titleImage?: { src: string; width?: 'small' | 'medium' | 'large'; shadow?: boolean };
23
+ titleHidden?: boolean;
24
+ subtitle?: string;
25
+ cta?: { label: string; href: string };
26
+ image?: { src: string; alt?: string };
27
+ media?: { image?: string; images?: string[]; video?: string; poster?: string; overlay?: number; link?: string; linkLabel?: string; fit?: 'cover' | 'contain' };
28
+ layout?: 'centered' | 'split' | 'media';
29
+ size?: 'compact' | 'standard' | 'tall' | 'screen';
30
+ parallax?: boolean;
31
+ background?: 'none' | 'mesh';
32
+ fullBleed?: boolean;
33
+ focus?: string;
34
+ }
35
+ const { eyebrow, title, titleImage, titleHidden = false, subtitle, cta, image, media, layout = 'centered', size = 'standard', parallax = false, background = 'none', fullBleed = false, focus } = Astro.props;
36
+ // A YouTube / Vimeo link plays as an embedded background (after consent); anything else
37
+ // in `video` is a file for a native <video>.
38
+ const embed = media?.video ? backgroundEmbed(media.video) : null;
39
+ const slides = !media?.video && (media?.images?.length ?? 0) >= 2 ? media!.images! : [];
40
+ const still = media?.image ?? media?.images?.[0];
41
+ const isMedia = layout === 'media' && media && (media.video || slides.length || still);
42
+ const motion = isMedia ? (embed ? 'embed' : media?.video ? 'video' : slides.length ? 'slides' : undefined) : undefined;
43
+ const overlay = (media?.overlay ?? 45) / 100;
44
+ const isMesh = background === 'mesh' && !isMedia;
45
+ // The background can lead somewhere — e.g. the full video on YouTube (new tab; the app on phones).
46
+ const linkTo = media?.link ?? embed?.watchUrl; // an embedded video links to itself by default
47
+ const bgLink = isMedia && linkTo && /^(https?:\/\/|\/)/i.test(linkTo) ? linkTo : undefined;
48
+ const provider = bgLink ? videoEmbed(bgLink)?.provider : undefined;
49
+ const watchLabel = media?.linkLabel || (provider ? `Watch the full video on ${provider}` : 'Watch the full video');
50
+ // The still: the image (no motion), or an embed's poster until the player may load.
51
+ const stillSrc = embed ? media?.poster ?? still : !media?.video && !slides.length ? still : undefined;
52
+ // Drawn as a real <img>, never a CSS background: a picture set through a CSS variable is
53
+ // found late (never by the preload scanner), so the hero sat grey until it arrived, and
54
+ // some browsers kept it grey. A real image, loaded first, is found early and painted.
55
+ const heroImg = isMedia && stillSrc ? stillSrc : undefined;
56
+ // The title as a picture (a wordmark): drawn inside the h1, described by the title, with its
57
+ // own width and height when the build read them, so its box keeps the picture's shape.
58
+ const titleImageSize = imageSizeOf(titleImage?.src);
59
+ const titleAlt = title.replace(/\s+/g, ' ').trim();
60
+ // A title hidden from view stays the h1 (titleHidden). A title picture is already the
61
+ // visible title, so it stays shown.
62
+ const hideTitle = titleHidden && !titleImage;
63
+ // A picture shown whole (media.fit "contain"), e.g. a designed poster: the band takes the
64
+ // picture's own shape (when the build read it), with no scrim or drift, and the words sit
65
+ // below it. A video always covers.
66
+ const contain = Boolean(isMedia && media?.fit === 'contain' && !media.video);
67
+ const posterSize = contain ? imageSizeOf(heroImg ?? slides[0]) : undefined;
68
+ const wordsBelow = Boolean(eyebrow || subtitle || cta || !hideTitle);
69
+ const heroStyle = isMedia
70
+ ? `--hero-overlay: ${overlay}${focus ? `; --hero-focus: ${focus}` : ''}${posterSize ? `; --hero-ratio: ${posterSize.width} / ${posterSize.height}` : ''}`
71
+ : undefined;
72
+ ---
73
+
74
+ <section
75
+ class="b-hero"
76
+ data-layout={layout}
77
+ data-size={isMedia ? size : undefined}
78
+ data-bg={isMesh ? 'mesh' : undefined}
79
+ data-motion={motion}
80
+ data-linked={bgLink ? 'true' : undefined}
81
+ data-parallax={isMedia && parallax && !contain ? 'true' : undefined}
82
+ data-full-bleed={isMedia && fullBleed ? 'true' : undefined}
83
+ data-fit={contain ? 'contain' : undefined}
84
+ data-title-hidden={hideTitle ? '' : undefined}
85
+ style={heroStyle}
86
+ >
87
+ {isMedia && (
88
+ <div class="b-hero__bg" aria-hidden="true">
89
+ {heroImg && <img class="b-hero__img" src={heroImg} alt="" width={posterSize?.width} height={posterSize?.height} loading="eager" fetchpriority="high" decoding="async" />}
90
+ {embed && <div class="b-hero__embed" data-embed-url={embed.embedUrl} data-provider={embed.provider}></div>}
91
+ {media?.video && !embed ? (
92
+ <video aria-hidden="true" tabindex="-1" autoplay muted loop playsinline poster={media.poster} preload="metadata">
93
+ <source src={media.video} />
94
+ </video>
95
+ ) : null}
96
+ {slides.map((src, i) => (
97
+ <img class:list={['b-hero__slide', { 'is-on': i === 0 }]} src={src} alt="" width={i === 0 ? posterSize?.width : undefined} height={i === 0 ? posterSize?.height : undefined} loading={i === 0 ? 'eager' : 'lazy'} fetchpriority={i === 0 ? 'high' : undefined} decoding="async" />
98
+ ))}
99
+ {!contain && <span class="b-hero__scrim"></span>}
100
+ </div>
101
+ )}
102
+ {bgLink && <a class="b-hero__bglink" href={bgLink} target="_blank" rel="noopener" tabindex="-1" aria-hidden="true"></a>}
103
+ {isMesh && <div class="b-hero__mesh" aria-hidden="true"></div>}
104
+ <div class="b-hero__text" data-display-title data-words={contain && !wordsBelow ? 'none' : undefined}>
105
+ {eyebrow && <p class="b-hero__eyebrow">{eyebrow}</p>}
106
+ <Heading text={title} level={1} align={layout === 'split' ? 'start' : 'center'}>
107
+ {titleImage && (
108
+ <img
109
+ class="b-hero__title-image"
110
+ src={titleImage.src}
111
+ alt={titleAlt}
112
+ width={titleImageSize?.width}
113
+ height={titleImageSize?.height}
114
+ data-width={titleImage.width ?? 'medium'}
115
+ data-shadow={titleImage.shadow ? '' : undefined}
116
+ loading="eager"
117
+ fetchpriority="high"
118
+ decoding="async"
119
+ />
120
+ )}
121
+ </Heading>
122
+ {subtitle && <p class="b-hero__subtitle">{subtitle}</p>}
123
+ {cta && (
124
+ <div class="b-hero__cta">
125
+ <Button href={cta.href} variant={layout === 'media' ? 'cta' : 'primary'}>{cta.label}</Button>
126
+ </div>
127
+ )}
128
+ </div>
129
+ {bgLink && (
130
+ <a class="b-hero__watch" href={bgLink} target="_blank" rel="noopener">
131
+ <span class="b-hero__watch-icon" aria-hidden="true"></span>{watchLabel}<span class="b-hero__sr"> (opens in a new tab)</span>
132
+ </a>
133
+ )}
134
+ {motion && (
135
+ <button type="button" class="b-hero__pause" aria-pressed="false" aria-label="Pause background" hidden={motion === 'embed'}>
136
+ <span class="b-hero__pause-icon" aria-hidden="true"></span>
137
+ </button>
138
+ )}
139
+ {layout === 'split' && image && (
140
+ <div class="b-hero__media">
141
+ <img src={image.src} alt={image.alt ?? ''} loading="eager" decoding="async" />
142
+ </div>
143
+ )}
144
+ </section>
145
+
146
+ <script>
147
+ // Moving hero backgrounds: pause button, reduced-motion, the slideshow timer, and an
148
+ // embedded (YouTube / Vimeo) background that loads only once the visitor consents.
149
+ import { hasConsent, onConsentChange } from '../../lib/consent-client';
150
+ import { playerStarted } from '../../lib/video';
151
+ const SLIDE_MS = 6000;
152
+ const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
153
+ for (const hero of document.querySelectorAll<HTMLElement>('.b-hero[data-motion]')) {
154
+ const button = hero.querySelector<HTMLButtonElement>('.b-hero__pause');
155
+ const video = hero.querySelector('video');
156
+ const slides = [...hero.querySelectorAll<HTMLElement>('.b-hero__slide')];
157
+ const embedSlot = hero.querySelector<HTMLElement>('.b-hero__embed');
158
+ let player: HTMLIFrameElement | null = null;
159
+ // Play / pause an embedded player by message, with no provider API script.
160
+ const command = (play: boolean) => {
161
+ if (!player?.contentWindow) return;
162
+ const msg = embedSlot!.dataset.provider === 'Vimeo'
163
+ ? { method: play ? 'play' : 'pause' }
164
+ : { event: 'command', func: play ? 'playVideo' : 'pauseVideo', args: [] };
165
+ player.contentWindow.postMessage(JSON.stringify(msg), new URL(player.src).origin);
166
+ };
167
+ const loadPlayer = () => {
168
+ if (player || !embedSlot || reduce) return; // reduced motion keeps the still
169
+ player = document.createElement('iframe');
170
+ player.src = embedSlot.dataset.embedUrl!;
171
+ player.title = 'Background video';
172
+ player.tabIndex = -1;
173
+ player.setAttribute('aria-hidden', 'true');
174
+ player.allow = 'autoplay; encrypted-media; picture-in-picture';
175
+ // Keep the poster up until the player says it is PLAYING, then cross-fade: no black,
176
+ // loading player on screen. Ask it to report (YouTube 'listening' / Vimeo listener).
177
+ const provider = embedSlot.dataset.provider!;
178
+ const origin = new URL(player.src).origin;
179
+ window.addEventListener('message', (e) => {
180
+ if (e.origin !== origin || e.source !== player!.contentWindow) return;
181
+ if (playerStarted(provider, e.data)) embedSlot.classList.add('is-on');
182
+ });
183
+ player.addEventListener('load', () => {
184
+ const hello = provider === 'Vimeo' ? { method: 'addEventListener', value: 'play' } : { event: 'listening', id: 1, channel: 'widget' };
185
+ player!.contentWindow?.postMessage(JSON.stringify(hello), origin);
186
+ });
187
+ embedSlot.appendChild(player);
188
+ if (button) button.hidden = false;
189
+ sync();
190
+ };
191
+ let paused = reduce;
192
+ let visible = true;
193
+ let index = 0;
194
+ let timer: number | undefined;
195
+
196
+ const tick = () => {
197
+ slides[index].classList.remove('is-on');
198
+ index = (index + 1) % slides.length;
199
+ slides[index].classList.add('is-on');
200
+ };
201
+ const sync = () => {
202
+ const run = !paused && visible && !document.hidden;
203
+ if (video) {
204
+ if (run) void video.play().catch(() => {});
205
+ else video.pause();
206
+ }
207
+ if (player) command(run);
208
+ if (slides.length > 1) {
209
+ window.clearInterval(timer);
210
+ timer = run ? window.setInterval(tick, SLIDE_MS) : undefined;
211
+ }
212
+ if (button) {
213
+ button.setAttribute('aria-pressed', String(paused));
214
+ button.setAttribute('aria-label', paused ? 'Play background' : 'Pause background');
215
+ }
216
+ hero.toggleAttribute('data-paused', paused);
217
+ };
218
+ button?.addEventListener('click', () => { paused = !paused; sync(); });
219
+ document.addEventListener('visibilitychange', sync);
220
+ new IntersectionObserver(([e]) => { visible = e.isIntersecting; sync(); }).observe(hero);
221
+ if (embedSlot) {
222
+ // Warm the connection the moment it's allowed, so the video starts sooner.
223
+ const preconnect = () => {
224
+ const href = new URL(embedSlot.dataset.embedUrl!).origin;
225
+ if (document.querySelector(`link[rel="preconnect"][href="${href}"]`)) return;
226
+ const l = document.createElement('link');
227
+ l.rel = 'preconnect';
228
+ l.href = href;
229
+ document.head.appendChild(l);
230
+ };
231
+ if (hasConsent()) { preconnect(); loadPlayer(); }
232
+ onConsentChange((allowed) => { if (allowed) { preconnect(); loadPlayer(); } });
233
+ }
234
+ sync();
235
+ }
236
+ // Parallax: the background drifts more slowly than the page. Transform-based, so it works
237
+ // for an image, slides, a <video> or an embedded player alike. Off on touch devices
238
+ // (coarse pointers) and under reduced motion; only runs while the hero is on screen.
239
+ const fine = window.matchMedia('(pointer: fine)').matches;
240
+ for (const hero of document.querySelectorAll<HTMLElement>('.b-hero[data-parallax]')) {
241
+ const bg = hero.querySelector<HTMLElement>('.b-hero__bg');
242
+ if (!bg || reduce || !fine) continue;
243
+ hero.classList.add('is-parallax');
244
+ let ticking = false;
245
+ let onScreen = true;
246
+ const move = () => {
247
+ ticking = false;
248
+ const top = hero.getBoundingClientRect().top;
249
+ bg.style.transform = `translate3d(0, ${Math.round(Math.max(0, -top) * 0.35)}px, 0)`;
250
+ };
251
+ const queue = () => { if (onScreen && !ticking) { ticking = true; requestAnimationFrame(move); } };
252
+ new IntersectionObserver(([e]) => { onScreen = e.isIntersecting; if (onScreen) queue(); }).observe(hero);
253
+ window.addEventListener('scroll', queue, { passive: true });
254
+ move();
255
+ }
256
+ </script>
257
+
258
+ <style>
259
+ .b-hero {
260
+ display: grid;
261
+ gap: 2rem;
262
+ padding-block: 3rem;
263
+ }
264
+ @media (min-width: 48em) {
265
+ .b-hero[data-layout='split'] {
266
+ grid-template-columns: 1fr 1fr;
267
+ align-items: center;
268
+ }
269
+ }
270
+ .b-hero__text {
271
+ display: flex;
272
+ flex-direction: column;
273
+ gap: 1rem;
274
+ }
275
+ .b-hero[data-layout='centered'] .b-hero__text {
276
+ max-width: var(--max);
277
+ margin-inline: auto;
278
+ align-items: center;
279
+ text-align: center;
280
+ }
281
+ .b-hero__eyebrow {
282
+ margin: 0;
283
+ text-transform: uppercase;
284
+ letter-spacing: 0.12em;
285
+ font-size: 0.8125rem;
286
+ font-weight: 600;
287
+ color: var(--gold);
288
+ }
289
+ .b-hero__subtitle {
290
+ margin: 0;
291
+ font-size: 1.125rem;
292
+ line-height: 1.6;
293
+ color: var(--muted);
294
+ max-width: var(--max);
295
+ }
296
+ .b-hero__cta {
297
+ margin-top: 0.5rem;
298
+ }
299
+ /* The title as a picture (a wordmark): a width step on desktop, capped to the screen on
300
+ phones and to its column, never cropped; height follows the picture's own shape. */
301
+ .b-hero__title-image {
302
+ display: block;
303
+ width: min(var(--title-image-w, 32.5rem), 85vw);
304
+ max-width: 100%;
305
+ height: auto;
306
+ margin-inline: auto;
307
+ }
308
+ .b-hero__title-image[data-width='small'] { --title-image-w: 20rem; }
309
+ .b-hero__title-image[data-width='large'] { --title-image-w: 47.5rem; }
310
+ .b-hero[data-layout='split'] .b-hero__title-image { margin-inline: 0; }
311
+ /* A large wordmark may be wider than the text measure; the subtitle keeps its own. */
312
+ .b-hero[data-layout] .b-hero__text:has(.b-hero__title-image) { max-width: max(var(--max), 47.5rem); }
313
+ .b-hero__title-image[data-shadow] { filter: drop-shadow(var(--shadow-logo)); }
314
+
315
+ /* ── Mesh background: a soft, slowly drifting brand gradient behind the text.
316
+ Low opacity + blur keeps normal (dark) text perfectly readable. ── */
317
+ .b-hero[data-bg='mesh'] {
318
+ position: relative;
319
+ isolation: isolate;
320
+ overflow: hidden;
321
+ border-radius: var(--radius);
322
+ padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 4vw, 3rem);
323
+ }
324
+ .b-hero__mesh {
325
+ position: absolute;
326
+ inset: 0;
327
+ z-index: -1;
328
+ background: var(--bg);
329
+ }
330
+ .b-hero__mesh::before {
331
+ content: '';
332
+ position: absolute;
333
+ inset: -25%;
334
+ background:
335
+ radial-gradient(35% 45% at 20% 25%, var(--gold), transparent 70%),
336
+ radial-gradient(35% 45% at 80% 20%, var(--accent-2, var(--gold)), transparent 70%),
337
+ radial-gradient(40% 50% at 65% 85%, var(--gold-light), transparent 70%);
338
+ opacity: 0.35;
339
+ filter: blur(50px);
340
+ animation: b-hero-mesh 20s ease-in-out infinite alternate;
341
+ }
342
+ @keyframes b-hero-mesh {
343
+ from { transform: translate3d(-3%, -2%, 0) scale(1.05); }
344
+ to { transform: translate3d(3%, 4%, 0) scale(1.18); }
345
+ }
346
+ @media (prefers-reduced-motion: reduce) {
347
+ .b-hero__mesh::before { animation: none; }
348
+ }
349
+ .b-hero__media img {
350
+ display: block;
351
+ width: 100%;
352
+ height: auto;
353
+ border-radius: 8px;
354
+ }
355
+
356
+ /* ── Media layout: image / slideshow / video background with a legibility scrim ── */
357
+ .b-hero[data-layout='media'] {
358
+ position: relative;
359
+ min-height: min(68vh, 38rem);
360
+ display: grid;
361
+ place-items: center;
362
+ text-align: center;
363
+ padding: clamp(3rem, 8vw, 6rem) 1.5rem;
364
+ /* --hero-clear: the room a header logo hanging over this opener needs (Base). */
365
+ padding-top: max(clamp(3rem, 8vw, 6rem), var(--hero-clear, 0px));
366
+ border-radius: var(--radius);
367
+ overflow: hidden;
368
+ isolation: isolate;
369
+ }
370
+ /* A narrow band for a short, wide header strip: close to the strip's own shape, so it
371
+ isn't cropped to its middle and blown up. Less padding and a smaller title to fit. */
372
+ .b-hero[data-size='compact'] {
373
+ min-height: clamp(8rem, 18vw, 16rem);
374
+ padding-block: clamp(1.25rem, 3vw, 2.25rem);
375
+ padding-top: max(clamp(1.25rem, 3vw, 2.25rem), var(--hero-clear, 0px));
376
+ }
377
+ .b-hero[data-size='compact'] :global(h1) {
378
+ font-size: clamp(1.6rem, 3.4vw, 2.6rem);
379
+ }
380
+ /* Edge to edge across the screen, like a full-bleed banner. */
381
+ .b-hero[data-full-bleed='true'] {
382
+ width: 100vw;
383
+ margin-inline: calc(50% - 50vw);
384
+ border-radius: 0;
385
+ }
386
+ .b-hero[data-size='tall'] {
387
+ min-height: min(85vh, 52rem);
388
+ }
389
+ /* The full first screen below the sticky header, edge to edge — breaks out of the page
390
+ column. --header-h is the header's measured full height (SiteHeader); the fallback is
391
+ its usual height until that runs. */
392
+ .b-hero[data-size='screen'] {
393
+ width: 100vw;
394
+ margin-inline: calc(50% - 50vw);
395
+ min-height: calc(100svh - var(--header-h, 60px));
396
+ border-radius: 0;
397
+ }
398
+ @media (min-width: 64em) {
399
+ .b-hero[data-size='screen'] {
400
+ min-height: calc(100svh - var(--header-h, 64px));
401
+ }
402
+ }
403
+ .b-hero__bg {
404
+ position: absolute;
405
+ inset: 0;
406
+ z-index: -1;
407
+ background-color: var(--bg-section);
408
+ }
409
+ /* The picture (and each rotating slide) covers the band, framed by `focus`. */
410
+ .b-hero__img,
411
+ .b-hero__slide {
412
+ position: absolute;
413
+ inset: 0;
414
+ width: 100%;
415
+ height: 100%;
416
+ object-fit: cover;
417
+ object-position: var(--hero-focus, center);
418
+ display: block;
419
+ max-width: none;
420
+ }
421
+ /* Parallax: give the background room to drift (up to 35% of the hero) without uncovering
422
+ an edge. The room is split evenly above and below, so at rest the picture or video is
423
+ centred on the hero, not pushed down by the extra room. Any gap the drift opens at the
424
+ top stays above the screen. */
425
+ .b-hero.is-parallax .b-hero__bg {
426
+ inset: -17.5% 0 -17.5% 0;
427
+ will-change: transform;
428
+ }
429
+ .b-hero__bg video {
430
+ width: 100%;
431
+ height: 100%;
432
+ object-fit: cover;
433
+ object-position: var(--hero-focus, center);
434
+ }
435
+ /* An embedded background player, sized to COVER the hero like object-fit (16:9 kept,
436
+ overflow cropped). Never interactive; fades in once it has started. */
437
+ .b-hero__embed {
438
+ position: absolute;
439
+ inset: 0;
440
+ overflow: hidden;
441
+ pointer-events: none;
442
+ container-type: size;
443
+ opacity: 0;
444
+ transition: opacity 1.2s ease;
445
+ }
446
+ .b-hero__embed.is-on {
447
+ opacity: 1;
448
+ }
449
+ .b-hero__embed :global(iframe) {
450
+ position: absolute;
451
+ top: 50%;
452
+ left: 50%;
453
+ width: max(100cqw, 177.78cqh);
454
+ height: max(100cqh, 56.25cqw);
455
+ max-width: none; /* the global media reset caps iframes at 100%: cover must overflow */
456
+ transform: translate(-50%, -50%);
457
+ border: 0;
458
+ }
459
+ .b-hero__pause[hidden] {
460
+ display: none;
461
+ }
462
+ .b-hero__slide {
463
+ opacity: 0;
464
+ transition: opacity 1.6s ease-in-out;
465
+ }
466
+ .b-hero__slide.is-on {
467
+ opacity: 1;
468
+ }
469
+ @media (prefers-reduced-motion: reduce) {
470
+ .b-hero__slide { transition: none; }
471
+ }
472
+ .b-hero__scrim {
473
+ position: absolute;
474
+ inset: 0;
475
+ background: rgba(8, 10, 18, var(--hero-overlay, 0.45));
476
+ }
477
+ .b-hero[data-layout='media'] .b-hero__text {
478
+ max-width: var(--max);
479
+ align-items: center;
480
+ color: #fff;
481
+ }
482
+ .b-hero[data-layout='media'] .b-hero__subtitle {
483
+ color: rgba(255, 255, 255, 0.9);
484
+ margin-inline: auto;
485
+ }
486
+ .b-hero[data-layout='media'] .b-hero__eyebrow {
487
+ color: #fff;
488
+ opacity: 0.9;
489
+ }
490
+ .b-hero[data-layout='media'] :global(h1) {
491
+ color: #fff;
492
+ }
493
+
494
+ /* ── A picture shown whole (media.fit "contain"), e.g. a designed poster: never cropped,
495
+ edge to edge with `screen` or `fullBleed`, and as tall as the picture, not the screen.
496
+ The band takes the picture's shape (--hero-ratio, when the build read it; otherwise the
497
+ picture's own height as it loads). No scrim; the words sit below it, in the page's
498
+ colours, and keep clear of a header logo hanging over a short poster (--hero-clear). ── */
499
+ .b-hero[data-layout='media'][data-fit='contain'] {
500
+ display: flex;
501
+ flex-direction: column;
502
+ gap: 0;
503
+ min-height: 0;
504
+ padding: 0;
505
+ }
506
+ .b-hero[data-fit='contain'] .b-hero__bg {
507
+ position: relative;
508
+ inset: auto;
509
+ z-index: auto;
510
+ aspect-ratio: var(--hero-ratio, auto);
511
+ background-color: transparent;
512
+ }
513
+ .b-hero[data-fit='contain'] .b-hero__img,
514
+ .b-hero[data-fit='contain'] .b-hero__slide {
515
+ object-fit: contain;
516
+ }
517
+ .b-hero[data-fit='contain'] .b-hero__img,
518
+ .b-hero[data-fit='contain'] .b-hero__slide:first-of-type {
519
+ position: relative;
520
+ height: auto;
521
+ }
522
+ .b-hero[data-layout='media'][data-fit='contain'] .b-hero__text {
523
+ align-self: center;
524
+ padding: clamp(1.5rem, 4vw, 2.5rem) 1.5rem 0;
525
+ margin-top: max(0px, calc(var(--hero-clear, 0px) - 100vw / (var(--hero-ratio, 0.0001))));
526
+ color: var(--fg);
527
+ }
528
+ .b-hero[data-fit='contain'] .b-hero__text[data-words='none'] {
529
+ padding: 0;
530
+ margin: 0;
531
+ }
532
+ .b-hero[data-layout='media'][data-fit='contain'] .b-hero__subtitle {
533
+ color: var(--muted);
534
+ }
535
+ .b-hero[data-layout='media'][data-fit='contain'] .b-hero__eyebrow {
536
+ color: var(--gold);
537
+ opacity: 1;
538
+ }
539
+ .b-hero[data-layout='media'][data-fit='contain'] :global(h1) {
540
+ color: var(--fg);
541
+ }
542
+
543
+ /* A linked background: the whole picture opens the full video; the text and
544
+ its CTA stay clickable on top, and a visible cue carries the keyboard link. */
545
+ .b-hero__bglink {
546
+ position: absolute;
547
+ inset: 0;
548
+ z-index: 0;
549
+ cursor: pointer;
550
+ }
551
+ .b-hero[data-linked] .b-hero__text {
552
+ position: relative;
553
+ z-index: 1;
554
+ pointer-events: none;
555
+ }
556
+ .b-hero[data-linked] .b-hero__text :global(a),
557
+ .b-hero[data-linked] .b-hero__text :global(button) {
558
+ pointer-events: auto;
559
+ }
560
+ .b-hero__watch {
561
+ position: absolute;
562
+ left: clamp(0.75rem, 2vw, 1.25rem);
563
+ bottom: clamp(0.75rem, 2vw, 1.25rem);
564
+ z-index: 2;
565
+ display: inline-flex;
566
+ align-items: center;
567
+ gap: 0.5rem;
568
+ padding: 0.5rem 0.9rem;
569
+ border-radius: 999px;
570
+ border: 1px solid rgba(255, 255, 255, 0.55);
571
+ background: rgba(8, 10, 18, 0.45);
572
+ color: #fff;
573
+ font-size: 0.875rem;
574
+ font-weight: 600;
575
+ text-decoration: none;
576
+ }
577
+ .b-hero__watch:hover {
578
+ background: rgba(8, 10, 18, 0.65);
579
+ }
580
+ .b-hero__watch:focus-visible {
581
+ outline: 3px solid #fff;
582
+ outline-offset: 2px;
583
+ }
584
+ .b-hero__watch-icon {
585
+ width: 0;
586
+ height: 0;
587
+ border-block: 0.35rem solid transparent;
588
+ border-inline-start: 0.6rem solid currentColor;
589
+ }
590
+ /* Read by screen readers, not shown: the watch link's note, and a hidden title (titleHidden). */
591
+ .b-hero__sr,
592
+ .b-hero[data-title-hidden] :global(h1) {
593
+ position: absolute;
594
+ width: 1px;
595
+ height: 1px;
596
+ overflow: hidden;
597
+ clip-path: inset(50%);
598
+ white-space: nowrap;
599
+ }
600
+
601
+ /* Pause / play for moving backgrounds — small, quiet, always reachable. */
602
+ .b-hero__pause {
603
+ position: absolute;
604
+ z-index: 2;
605
+ right: clamp(0.75rem, 2vw, 1.25rem);
606
+ bottom: clamp(0.75rem, 2vw, 1.25rem);
607
+ width: 2.5rem;
608
+ height: 2.5rem;
609
+ display: grid;
610
+ place-items: center;
611
+ border-radius: 50%;
612
+ border: 1px solid rgba(255, 255, 255, 0.55);
613
+ background: rgba(8, 10, 18, 0.45);
614
+ color: #fff;
615
+ cursor: pointer;
616
+ }
617
+ .b-hero__pause:hover {
618
+ background: rgba(8, 10, 18, 0.65);
619
+ }
620
+ .b-hero__pause:focus-visible {
621
+ outline: 3px solid #fff;
622
+ outline-offset: 2px;
623
+ }
624
+ /* Two bars (pause) → a triangle (play) when paused. */
625
+ .b-hero__pause-icon {
626
+ width: 0.75rem;
627
+ height: 0.875rem;
628
+ border-inline: 0.25rem solid currentColor;
629
+ }
630
+ .b-hero[data-paused] .b-hero__pause-icon {
631
+ width: 0;
632
+ height: 0;
633
+ border-inline: 0;
634
+ border-block: 0.45rem solid transparent;
635
+ border-inline-start: 0.75rem solid currentColor;
636
+ margin-inline-start: 0.2rem;
637
+ }
638
+ </style>