/* Media - Hero images, figures, and video containers */

.hero-figure {
    margin-inline: calc(-1 * var(--grid-gutter));
    width: calc(100% + 2 * var(--grid-gutter));
}

hgroup {
    display: block;
    width: clamp( 100%, 100vw - 4 * var(--grid-gutter),
    calc(2 * var(--grid-max-width) - 4 * var(--grid-gutter))
    );
    max-width: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

figure:has(.hero-image) {
    --hero-max-width: calc(2 * var(--grid-max-width));
    --feather-size: clamp(0px, (100vw - var(--hero-max-width)) * 0.5, 6rem);

    inline-size: min(100vw, var(--hero-max-width));
    max-inline-size: none;
    position: relative;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    overflow: clip;
    mask-image:
        linear-gradient(
            to bottom,
            black 0% 50%,
            rgb(0 0 0 / 0.96) 58%,
            rgb(0 0 0 / 0.82) 68%,
            rgb(0 0 0 / 0.5) 80%,
            rgb(0 0 0 / 0.15) 91%,
            transparent 100%
        ),
        linear-gradient(
            to right,
            transparent 0,
            rgb(0 0 0 / 0.15) calc(var(--feather-size) * 0.25),
            rgb(0 0 0 / 0.5) calc(var(--feather-size) * 0.5),
            rgb(0 0 0 / 0.85) calc(var(--feather-size) * 0.75),
            rgb(0 0 0 / 0.97) calc(var(--feather-size) * 0.9),
            black var(--feather-size),
            black calc(100% - var(--feather-size)),
            rgb(0 0 0 / 0.97) calc(100% - var(--feather-size) * 0.9),
            rgb(0 0 0 / 0.85) calc(100% - var(--feather-size) * 0.75),
            rgb(0 0 0 / 0.5) calc(100% - var(--feather-size) * 0.5),
            rgb(0 0 0 / 0.15) calc(100% - var(--feather-size) * 0.25),
            transparent 100%
        );
    mask-composite: intersect;
}

.hero-image {
    display: block;
    inline-size: 100%;
    max-inline-size: none;
    block-size: clamp(26rem, 52vw, 60vh);
    object-fit: cover;
    object-position: top;
}

/* {{HeaderImage … |#| Focus=center|bottom}} keeps a lower part of the image in view when the frame crops it. */
.hero-image[data-focus="center"] {
    object-position: center;
}

.hero-image[data-focus="bottom"] {
    object-position: bottom;
}

/* Optional paper shader shares the image's crop, fade and parallax; original stays underneath. */
.hero-paper-texture {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-paper-texture canvas {
    z-index: 0;
}

figure:has(.hero-image) + hgroup {
    position: relative;
    z-index: 1;
    margin-block-start: calc(-1 * clamp(3.5rem, 10vw, min(14vh, 7.5rem)));
}

figure:has(.hero-image) + hgroup > .eyebrow {
    margin-block-start: 0;
}

@supports ((animation-timeline: view()) and (animation-range: entry) and (animation-range: exit-crossing)) {
    @media (prefers-reduced-motion: no-preference) {
        figure:has(.hero-image) {
            view-timeline-name: --hero-scroll;
            view-timeline-axis: block;
        }

        .hero-image {
            animation: hero-image-parallax linear both;
            animation-timeline: --hero-scroll;
            animation-range: exit-crossing 0% exit-crossing 100%;
        }
    }
}

@keyframes hero-image-parallax {
    from {
        transform: translateY(0) scale(1.025);
    }
    to {
        transform: translateY(65%) scale(1.025);
    }
}

.subtitle {
    margin-block: 0.25rem 0;
    font-size: 1.15rem;
    color: var(--color-text-muted, #888);
}

.eyebrow {
    width: fit-content;
    margin-block: var(--space-m) 0;
    margin-inline: auto;
    padding: 0.28rem 0.72rem;
    font-family: var(--font-family-san-serif);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgb(28 29 35 / 0.82);
    background: rgb(242 243 247 / 0.72);
    border: 1px solid rgb(0 0 0 / 0.1);
    border-radius: 9999px;
    backdrop-filter: blur(0.7rem) saturate(120%);
}

.eyebrow + h1 {
    margin-block-start: var(--space-xs);
}

.youtube-embed {
	inline-size: 100%;
	margin-block: 1.5rem;
}

.youtube-embed__play,
.youtube-embed__frame {
	display: grid;
	inline-size: 100%;
	min-block-size: 200px;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: 0.75rem;
}

.youtube-embed__play {
	place-content: center;
	place-items: center;
	gap: 0.6rem;
	padding: clamp(1rem, 5vw, 3rem);
	overflow: hidden;
	background: #171717;
	color: #fff;
	text-align: center;
	text-decoration: none;
}

.youtube-embed__play:hover {
	background: #252525;
	color: #fff;
}

.youtube-embed__play:focus-visible {
	outline: 0.25rem solid var(--color-primary);
	outline-offset: 0.2rem;
}

.youtube-embed__play-icon {
	display: grid;
	place-items: center;
	inline-size: 4.25rem;
	block-size: 3rem;
	border-radius: 0.75rem;
	background: #f00;
}

.youtube-embed__play-icon::before {
	content: "";
	inline-size: 0;
	block-size: 0;
	margin-inline-start: 0.2rem;
	border-block: 0.65rem solid transparent;
	border-inline-start: 1rem solid #fff;
}

.youtube-embed__title {
	max-inline-size: 32rem;
	font-size: clamp(1rem, 3vw, 1.35rem);
	font-weight: 700;
	line-height: 1.2;
	text-wrap: balance;
}

.youtube-embed__provider {
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #ccc;
}

.youtube-embed__frame {
	background: #000;
}

.youtube-embed > figcaption {
	margin-block-start: 0.5rem;
	color: var(--color-text-muted, #777);
	font-size: var(--step--1);
}
