/* Homepage hero: a background video behind the headline and Get Started, in a panel inset from the
   left and right edges by a little less than the page gutter, and a little from the bottom with rounded bottom corners (after design-refs/hero-vid.png).
   The video is decorative (aria-hidden, no text in it) and loaded by static/hero.js, which skips it with
   reduced motion or data saver. The poster is also the section background, so a missing or failed video
   still leaves the image. A dark overlay sits between the video and the text for contrast.
   Headline and button sit left-aligned on the gutter. It fills the first screen under the header at every size. */

:root {
    --hero-ink: #f5f1ea;             /* warm off-white headline */
    --hero-ink-soft: #d4d4d4;        /* small text */
    --hero-shade: rgba(0, 0, 0, 0.45);
    --hero-title-size: clamp(2rem, 1rem + 4.5vw, 3.75rem); /* 32px on phones, 60px from about 1000px */
    --hero-inset: 0.5rem;            /* space under the video panel: 8px on phones, 12px from 768px, 16px from 1024px */
    --hero-side: calc(var(--gutter) - 0.625rem); /* space on its left and right: 10px less than the page gutter (6px / 10px / 14px), so the video sits just outside the logo and header buttons */
    --hero-radius: 0.75rem;
}

@media (min-width: 768px) {
    :root {
        --hero-inset: 0.75rem;
    }
}

@media (min-width: 1024px) {
    :root {
        --hero-inset: 1rem;
    }
}

.hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: grid;
    align-items: center;
    width: calc(100% - 2 * var(--hero-side));
    margin: 0 var(--hero-side) var(--hero-inset);
    border-radius: 0 0 var(--hero-radius) var(--hero-radius);
    /* Fills the first screen under the header (and the homepage banner, --promo-banner-h) at every size, phones included. Space is reserved before the
       video loads, so nothing shifts. The bottom inset is taken off too, so the white space under the panel
       shows at the bottom of the first screen. */
    min-height: calc(100vh - var(--header-height, 4rem) - var(--promo-banner-h, 0px) - var(--hero-inset));
    min-height: calc(100svh - var(--header-height, 4rem) - var(--promo-banner-h, 0px) - var(--hero-inset));
    padding-block: clamp(4rem, 3rem + 4vw, 7rem);
    background: #1a1a1a url("../assets/hero-poster.jpg") center / cover no-repeat;
    color: var(--hero-ink);
}

.hero__video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Dark overlay: an even 45% black, plus extra shade on the left where the text sits and toward the bottom.
   The text area ends up at least 60% black over any frame, which keeps the headline and button readable. */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to right, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0) 85%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.35) 100%),
        var(--hero-shade);
    pointer-events: none;
}

/* Left-aligned and vertically centered. Below 1024px the text sits on the page gutter (16px / 20px from the
   screen edge), in line with the logo and the other sections; from 1024px just past it (40px). */
.hero__content {
    padding-inline: calc(var(--gutter) - var(--hero-side));
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
}

@media (min-width: 1024px) {
    .hero__content {
        padding-inline: calc(var(--gutter) + 1rem - var(--hero-side)); /* 16px past the logo line (40px from the edge), so the text clears the video's edge a little more */
    }
}

.hero__title {
    max-width: 17em; /* about 30 characters a line, so the three lines stay balanced */
    margin: 0;
    color: var(--hero-ink);
    /* Phones: capped so the headline stays on four lines (about 26px at 360px, 31px at 430px). From about 530px
       wide the cap is larger than --hero-title-size, so tablets and desktop are unchanged. */
    font-size: min(var(--hero-title-size), calc(8.25vw - 0.25rem));
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.hero__nowrap {
    white-space: nowrap;
}

/* ---------- Get Started, inverted for the dark video: white button, black label, black square ---------- */
.hero-cta {
    margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
}

/* Below 1024px: the same size as the header's grey Get Started (36px tall, 14px text, 112px wide on a 360px
   phone up to 152px on tablets). From 1024px: the header button's desktop size, 40px tall with 15px text.
   The click area is always 44px tall via ::after. */
.hero-cta__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: clamp(7rem, 30vw, 9.5rem);
    height: 2.25rem;
    padding: 0.25rem 0.25rem 0.25rem 0.75rem;
    border-radius: 0.5rem;
    background: #ffffff;
    color: #000000;
    font-family: "Geist", sans-serif;
    font-size: 0.875rem;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.hero-cta__btn::after {
    content: "";
    position: absolute;
    inset: calc((100% - 2.75rem) / 2) 0;
}

.hero-cta__icon {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.3125rem;
    background: #000000;
    color: #ffffff;
}

@media (min-width: 1024px) {
    .hero-cta__btn {
        gap: 1rem;
        min-width: 0;
        height: 2.5rem;
        padding-left: 1rem;
        font-size: 0.9375rem;
    }

    .hero-cta__icon {
        width: 2rem;
        height: 2rem;
    }
}

.hero-cta__icon svg {
    transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .hero-cta__btn:hover {
        background: #e8e8e8;
    }

    .hero-cta__btn:hover .hero-cta__icon svg {
        transform: translateX(2px);
    }
}

.hero-cta__btn:focus-visible {
    background: #e8e8e8;
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

/* ---------- Pause/play control: very small, in the video's bottom-right corner ----------
   24px visible circle with a 10px icon; ::after keeps the tap area at 44×44px. */
.hero__toggle {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hero__toggle::after {
    content: "";
    position: absolute;
    inset: -0.625rem;
}

.hero__toggle[hidden] {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .hero__toggle:hover {
        background: rgba(0, 0, 0, 0.6);
        color: #ffffff;
    }
}

.hero__toggle:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.hero__toggle-play,
.hero__toggle.is-paused .hero__toggle-pause {
    display: none;
}

.hero__toggle.is-paused .hero__toggle-play {
    display: block;
}

/* Touch screens: press feedback, since there's no hover. The button dips slightly and greys, the pause
   button darkens. Mouse and trackpad users never see these. */
@media (hover: none) {
    .hero-cta__btn {
        transition: background-color 0.2s ease, transform 0.1s ease-out;
    }

    .hero-cta__btn:active {
        background: #e8e8e8;
        transform: scale(0.97);
    }

    .hero__toggle:active {
        background: rgba(0, 0, 0, 0.6);
        color: #ffffff;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-cta__btn,
    .hero-cta__icon svg,
    .hero__toggle {
        transition: none;
    }
}
