/* Page hero (spec p.7, p.40). --ss-hero-progress (0 to 1) is set by hero.js while scrolling past. */

.ss-hero {
    --ss-hero-progress: 0;
    --ss-hero-scrim: var(--ss-emerald-shadow);

    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 86vh;
    min-height: 86svh;
    overflow: hidden;
    background: var(--ss-emerald-gradient);
}

/* The scrim: darkest at the foot, where the wording sits. */
.ss-hero.has-photo::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--ss-hero-scrim) 22%, transparent) 0%,
            transparent 20%,
            color-mix(in srgb, var(--ss-hero-scrim) 8%, transparent) 42%,
            color-mix(in srgb, var(--ss-hero-scrim) 62%, transparent) 70%,
            color-mix(in srgb, var(--ss-hero-scrim) 90%, transparent) 100%
        ),
        radial-gradient(120% 70% at 10% 92%, color-mix(in srgb, var(--ss-hero-scrim) 50%, transparent), transparent 62%);
}

/* Darkens up to 60% as the page scrolls past. */
.ss-hero.has-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--ss-hero-scrim);
    opacity: calc(var(--ss-hero-progress) * 0.6);
}

/* Drifts at 30% of scroll speed and grows to 105%. */
.ss-hero__media {
    position: absolute;
    inset: 0;
    z-index: -2;
    transform: translate3d(0, calc(var(--ss-hero-progress) * 30%), 0) scale(calc(1 + var(--ss-hero-progress) * 0.05));
    transform-origin: 50% 0;
}

.ss-hero__photo {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: 50% 40%;
    animation: ss-hero-settle 2.6s var(--ss-ease) both;
}

/* Fades and lifts 56px as the page scrolls past. */
.ss-hero__inner {
    padding-top: 132px;
    padding-bottom: calc(var(--ss-sheet-radius) + 64px);
    opacity: clamp(0, calc(1.3 - var(--ss-hero-progress) * 2.2), 1);
    transform: translate3d(0, calc(var(--ss-hero-progress) * -56px), 0);
}

.ss-hero__copy {
    animation: ss-hero-rise 1.1s 0.2s var(--ss-ease) both;
}

.ss-hero.has-photo .ss-hero__copy > * {
    text-shadow:
        0 1px 1px color-mix(in srgb, var(--ss-hero-scrim) 30%, transparent),
        0 0 24px color-mix(in srgb, var(--ss-hero-scrim) 32%, transparent);
}

.ss-hero__title {
    margin-top: var(--ss-space-3);
}

.ss-hero__line {
    max-width: 36em;
    margin-top: var(--ss-space-3);
    color: color-mix(in srgb, var(--ss-cream) 92%, transparent);
}

.ss-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: var(--ss-space-4);
}

/* Glass chip naming the photograph. */
.ss-hero__chip {
    position: absolute;
    top: calc(var(--ss-bar-offset) + var(--ss-space-3));
    right: max(var(--ss-gutter), (100% - var(--ss-container)) / 2);
    max-width: min(320px, 100% - 2 * var(--ss-gutter));
    padding: 8px 18px;
    border: 1px solid color-mix(in srgb, var(--ss-gold-highlight) 55%, transparent);
    border-radius: var(--ss-radius-pill);
    background: color-mix(in srgb, var(--ss-emerald-shadow) 35%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--ss-cream);
    font-size: 0.8125rem;
    line-height: 1.4;
    text-align: center;
}

/* Opening images: a glass chip counts the photographs, names the one shown and holds Pause images. */
.ss-hero__slides {
    position: absolute;
    right: max(var(--ss-gutter), (100% - var(--ss-container)) / 2);
    bottom: calc(var(--ss-sheet-radius) + 64px);
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100% - 2 * var(--ss-gutter));
    margin: 0;
    padding: 4px 4px 4px 16px;
    border: 1px solid color-mix(in srgb, var(--ss-gold-highlight) 55%, transparent);
    border-radius: var(--ss-radius-pill);
    background: color-mix(in srgb, var(--ss-emerald-shadow) 35%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--ss-cream);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.ss-hero__slides-count {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ss-hero__slides-caption {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-hero__slides-pause {
    min-height: 32px;
    padding: 4px 14px;
    border: 0;
    border-radius: var(--ss-radius-pill);
    background: color-mix(in srgb, var(--ss-cream) 10%, transparent);
    color: inherit;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--ss-duration-hover) var(--ss-ease);
}

.ss-hero__slides-pause:hover {
    background: color-mix(in srgb, var(--ss-cream) 22%, transparent);
}

.ss-hero__slides-pause[aria-pressed="true"] {
    background: var(--ss-gold-highlight);
    color: var(--ss-ink);
}

/* Compact variant: an emerald title band, no photograph, at its content height on every screen. */
.ss-hero.ss-hero--compact {
    min-height: 0;
}

.ss-hero--compact .ss-hero__inner {
    padding-top: 180px;
    padding-bottom: calc(var(--ss-sheet-radius) + 72px);
}

@keyframes ss-hero-settle {
    from {
        transform: scale(1.06);
    }

    to {
        transform: none;
    }
}

@keyframes ss-hero-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ss-hero__media,
    .ss-hero__inner {
        opacity: 1;
        transform: none;
    }

    .ss-hero.has-photo::after {
        opacity: 0;
    }
}

@media (max-width: 767px) {
    .ss-hero {
        min-height: 88vh;
        min-height: 88svh;
    }

    .ss-hero.has-photo::before {
        background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--ss-hero-scrim) 24%, transparent) 0%,
            color-mix(in srgb, var(--ss-hero-scrim) 30%, transparent) 30%,
            color-mix(in srgb, var(--ss-hero-scrim) 62%, transparent) 62%,
            color-mix(in srgb, var(--ss-hero-scrim) 88%, transparent) 100%
        );
    }

    .ss-hero__inner {
        padding-top: 104px;
        padding-bottom: calc(var(--ss-sheet-radius) + 40px);
    }

    .ss-hero__chip {
        top: calc(var(--ss-bar-offset) + var(--ss-space-2));
        right: 50%;
        transform: translateX(50%);
    }

    .ss-hero__slides {
        top: calc(var(--ss-bar-offset) + var(--ss-space-2));
        right: 50%;
        bottom: auto;
        width: max-content;
        border-radius: 22px;
        transform: translateX(50%);
    }

    .ss-hero__slides-caption {
        white-space: normal;
    }

    .ss-hero--compact .ss-hero__inner {
        padding-top: 128px;
        padding-bottom: calc(var(--ss-sheet-radius) + 48px);
    }
}
