/*
 * HERO BLOCK
 *
 * Structure: .hero (outer band) > .hero__frame (the visual surface: photo,
 * brand fill, radius, clipping) > .hero__inner (container width) >
 * .hero__grid (centered or split).
 *
 * The frame exists so the "default" variant can be a rounded, shadowed card
 * inset in the page while the full-width variants paint edge to edge - both
 * from the same markup, and without any `width: 100vw` math. <main> is
 * full-bleed (components.css), so full width here simply means "do not
 * constrain the frame".
 */

.hero {
    position: relative;
    color: #fff;
    /* Vertical breathing room inside the frame. The .pad-compact /
       .pad-none appearance presets retune it by setting --pad-y. */
    --hero-pad-y: var(--pad-y, clamp(3rem, 5vw, 5.5rem));
}

.hero__frame {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding-block: var(--hero-pad-y);
}

/* ---- Surfaces -------------------------------------------------------- */

/* No background image: the frame becomes a solid brand panel. Uses the
   deepened fill token so white copy clears WCAG AA for any palette. */
.hero--solid .hero__frame {
    background: var(--color-primary-strong);
}

.hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*
 * Scrim: keeps white copy legible over any uploaded photo, however bright.
 * Centered heroes get a vertical gradient; split heroes get a horizontal
 * one that is heaviest behind the text column and clears toward the image.
 */
.hero__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgb(15 23 42 / 0.55),
        rgb(15 23 42 / 0.72)
    );
}

@media (min-width: 768px) {
    .hero-layout--split .hero__scrim {
        background: linear-gradient(
            to right,
            rgb(15 23 42 / 0.82) 0%,
            rgb(15 23 42 / 0.62) 55%,
            rgb(15 23 42 / 0.35) 100%
        );
    }
}

/* ---- Content --------------------------------------------------------- */

.hero__inner {
    position: relative;
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-md);
}

.hero__grid {
    display: grid;
    gap: var(--space-2xl);
    align-items: center;
}

.hero__title {
    font-size: var(--fs-display);
    font-weight: 700;
    color: #fff;
    text-wrap: balance;
}

.hero__subtitle {
    margin-top: var(--space-md);
    max-width: var(--measure-short);
    font-size: var(--fs-body-lg);
    line-height: var(--lh-relaxed);
    color: rgb(255 255 255 / 0.92);
    text-wrap: pretty;
}

.hero__cta {
    margin-top: var(--space-xl);
}

/* ---- Layout: centered ------------------------------------------------ */

.hero-layout--centered .hero__text {
    max-width: 52rem;
    margin-inline: auto;
    text-align: center;
}

.hero-layout--centered .hero__subtitle {
    margin-inline: auto;
}

/* ---- Layout: split --------------------------------------------------- */

@media (min-width: 768px) {
    .hero-layout--split .hero__grid {
        grid-template-columns: 1.05fr 0.95fr;
    }
}

.hero__media {
    position: relative;
    width: 100%;
    /* Reserved ratio: the image box is sized before the photo loads, so the
       hero never reflows, and every uploaded photo crops to the same shape
       instead of dictating the hero's height. */
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-overlay);
}

/* The picture tag wraps the img in a <picture>, which is inline by default
   and would break the height chain. */
.hero__media picture {
    display: block;
    width: 100%;
    height: 100%;
}

.hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Width / height variants ----------------------------------------- */

/* default: a contained, rounded banner card sitting on the page. */
.hero--default {
    padding-inline: var(--space-md);
}

.hero--default .hero__frame {
    max-width: var(--container-max);
    margin-inline: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-overlay);
}

/* The card's own edges already provide the gutter. */
.hero--default .hero__inner {
    padding-inline: clamp(var(--space-md), 4vw, var(--space-3xl));
}

/* full_width + fullscreen: the frame paints edge to edge. */
.hero--fullwidth .hero__frame,
.hero--fullscreen .hero__frame {
    border-radius: 0;
}

.hero--fullscreen .hero__frame {
    /* 100vh is the fallback for browsers without dvh. The second
       declaration subtracts the sticky header's measured height
       (--site-header-height, set in base.html) so the hero fills exactly
       the space below the header instead of pushing past the fold.
       min-height, not height, so long copy still grows the section. */
    min-height: 100vh;
    min-height: calc(100dvh - var(--site-header-height, 0px));
}
