/*
 * Home page hero (Magento_Theme/templates/html/sr-home-hero.phtml): full-width background video
 * under the header, filling the rest of the first screen. The poster is the section background,
 * so the hero looks finished before (or without) the video.
 */

.sr-hero {
    position: relative;
    z-index: 0;
    display: flex;
    align-items: flex-end;
    box-sizing: border-box;
    min-height: 520px;
    height: calc(100vh - 80px);
    height: calc(100svh - 80px);
    max-height: 960px;
    overflow: hidden;
    background: #1f2328 url('../images/hero/poster-1080.jpg') center / cover no-repeat;
    color: #ffffff;
}

/* Darkens the lower part so the text stays readable on snow and sand */
.sr-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0.1) 100%);
}

.sr-hero__video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.sr-hero.is-playing .sr-hero__video {
    opacity: 1;
}

.sr-hero__content {
    /* Headline size, shared with the bottom padding below */
    --sr-hero-title-size: clamp(4rem, 6vw, 7.2rem);
    box-sizing: border-box;
    width: 100%;
    /* 80px plus one headline line: the headline is two single lines, so the text and buttons sit one line higher
       and the headline keeps its place */
    padding: 0 max(48px, calc((100% - 1372px) / 2)) calc(80px + var(--sr-hero-title-size) * 1.05);
}

.sr-hero__eyebrow {
    margin: 0 0 16px;
    color: #f26a21;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1.4;
    text-transform: uppercase;
}

.sr-hero__title {
    margin: 0 0 20px;
    color: #ffffff;
    font-family: 'Barlow', sans-serif;
    font-size: var(--sr-hero-title-size);
    font-weight: 600;
    line-height: 1.05;
}

/* Second line of the headline: all lines stacked in one grid cell (so the headline keeps the height of the
   longest), the active one shown; it changes with the video's scenes (web/js/satrunner-hero.js) */
.sr-hero__places {
    display: grid;
}

/* Lines swap instantly; a new line shuffles in letter by letter (split-flap board, web/js/satrunner-hero.js) */
.sr-hero__place {
    grid-area: 1 / 1;
    white-space: nowrap; /* every line on one line; the longest, "Überall auf der Welt.", is 8.9em wide */
    opacity: 0;
}

.sr-hero__place.is-active {
    opacity: 1;
}

.sr-hero__word {
    display: inline-block;
    white-space: nowrap;
}

/* Fixed width per letter (set by the JS) keeps the line still while letters shuffle */
.sr-hero__char {
    display: inline-block;
    overflow: hidden;
    text-align: center;
    vertical-align: top;
}

.sr-hero__char.is-flipping {
    color: rgba(255, 255, 255, 0.7);
}

.sr-hero__text {
    max-width: 56ch;
    margin: 0 0 32px;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1.6rem, 1.3vw, 2rem);
    line-height: 1.6;
}

.sr-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* a.sr-hero__button and its states win over Luma's link colours */
.sr-hero a.sr-hero__button,
.sr-hero a.sr-hero__button:visited,
.sr-hero a.sr-hero__button:hover,
.sr-hero a.sr-hero__button:active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 48px;
    padding: 0 24px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sr-hero a.sr-hero__button--primary {
    background-color: #f26a21;
}

.sr-hero a.sr-hero__button--primary:hover {
    background-color: #d95b17;
}

.sr-hero a.sr-hero__button--secondary {
    border-color: rgba(255, 255, 255, 0.8);
    background-color: transparent;
}

.sr-hero a.sr-hero__button--secondary:hover {
    border-color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
}

.sr-hero a.sr-hero__button:focus-visible,
.sr-hero button.sr-hero__toggle:focus-visible {
    outline: 3px solid rgba(242, 106, 33, 0.6);
    outline-offset: 4px;
}

/* Pause / play, top right, out of the way of the text and the chat button */
.sr-hero button.sr-hero__toggle {
    position: absolute;
    top: 24px;
    right: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.35);
    box-shadow: none;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sr-hero button.sr-hero__toggle[hidden] {
    display: none;
}

.sr-hero button.sr-hero__toggle:hover,
.sr-hero button.sr-hero__toggle:focus,
.sr-hero button.sr-hero__toggle:active {
    border: 0;
    background-color: rgba(0, 0, 0, 0.55);
    color: #ffffff;
}

.sr-hero__toggle-icon {
    display: block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: url('../images/icons/pause.svg') center / 20px 20px no-repeat;
    mask: url('../images/icons/pause.svg') center / 20px 20px no-repeat;
}

.sr-hero__toggle.is-paused .sr-hero__toggle-icon {
    -webkit-mask-image: url('../images/icons/play.svg');
    mask-image: url('../images/icons/play.svg');
}

/* Tablet and Mobile: the header is a pill floating over the hero (satrunner-header.css), so the hero fills the
   whole screen from the top edge and the pause button sits under the pill */
@media (max-width: 1023px) {
    .sr-hero {
        height: 100vh;
        height: 100svh;
    }

    .sr-hero button.sr-hero__toggle {
        top: 92px;
    }
}

/* Mobile: lighter poster */
@media (max-width: 448px) {
    .sr-hero {
        min-height: 480px;
        background-image: url('../images/hero/poster-720.jpg');
    }
}

/* Mobile (448px and narrower) */
@media (max-width: 448px) {
    /* Bottom padding clears the fixed chat button (52px + 16px), plus one headline line as above. The headline
       shrinks so "Überall auf der Welt." (8.9em) still fits the width on one line. */
    .sr-hero__content {
        --sr-hero-title-size: min(4rem, calc((100vw - 32px) / 9));
        padding: 0 16px calc(88px + var(--sr-hero-title-size) * 1.05);
    }

    .sr-hero__actions {
        flex-direction: column;
    }

    .sr-hero a.sr-hero__button {
        width: 100%;
    }

    .sr-hero button.sr-hero__toggle {
        top: 84px;
        right: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sr-hero__video,
    .sr-hero a.sr-hero__button,
    .sr-hero button.sr-hero__toggle {
        transition: none;
    }
}
