.hero-rotator {
    position: relative;
    grid-column: 8 / -1;
    height: clamp(24rem, 52vh, 31rem);
    overflow: hidden;
    border-radius: var(--radius-surface);
    background: var(--color-text);
    isolation: isolate;
}

.hero-rotator__media,
.hero-rotator__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-rotator__image {
    object-fit: cover;
    opacity: 0;
    transition: opacity 550ms var(--motion-ease);
}

.hero-rotator__image.is-active {
    opacity: 1;
}

.hero-rotator::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        to top,
        rgb(17 17 17 / 0.78) 0%,
        rgb(17 17 17 / 0.48) 28%,
        rgb(17 17 17 / 0.14) 58%,
        transparent 82%
    );
    pointer-events: none;
}

.hero-rotator__beats {
    position: absolute;
    inset-inline: clamp(1.5rem, 3vw, 2.5rem);
    inset-block-end: clamp(1.75rem, 4vw, 3rem);
    z-index: 2;
    min-height: 4.5rem;
    display: flex;
    align-items: flex-end;
}

.hero-rotator__beat {
    position: absolute;
    inset-inline-start: 0;
    inset-block-end: 0;
    max-width: 12ch;
    border-inline-start: 0.2rem solid var(--color-brand);
    padding-inline-start: var(--space-4);
    color: var(--color-surface);
    font-size: clamp(1.55rem, 2.25vw, 2.15rem);
    font-weight: 650;
    line-height: 1.05;
    letter-spacing: -0.025em;
    opacity: 0;
    transform: translateY(0.45rem);
    transition:
        opacity 320ms var(--motion-ease),
        transform 320ms var(--motion-ease);
}

.hero-rotator__beat.is-active {
    opacity: 1;
    transform: translateY(0);
}

.hero-rotator__control {
    position: absolute;
    inset-block-start: var(--space-4);
    inset-inline-end: var(--space-4);
    z-index: 3;
    min-height: 2rem;
    border: 1px solid rgb(255 255 255 / 0.28);
    border-radius: var(--radius-control);
    background: rgb(17 17 17 / 0.34);
    color: rgb(255 255 255 / 0.82);
    padding: 0.32rem 0.62rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.hero-rotator__control:hover,
.hero-rotator__control:focus-visible {
    background: rgb(17 17 17 / 0.62);
    color: var(--color-surface);
}

.no-js .hero-rotator__control {
    display: none;
}

@media (max-width: 60rem) {
    .hero-rotator {
        grid-column: 8 / -1;
        height: 22rem;
    }

    .hero-rotator__beat {
        font-size: clamp(1.4rem, 3vw, 1.9rem);
    }
}

@media (max-width: 40rem) {
    .hero-rotator {
        grid-column: 1;
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
    }

    .hero-rotator__beats {
        inset-inline: var(--space-5);
        inset-block-end: var(--space-5);
        min-height: 4rem;
    }

    .hero-rotator__beat {
        max-width: 13ch;
        font-size: clamp(1.5rem, 7.2vw, 2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-rotator__image,
    .hero-rotator__beat {
        transition: none;
    }
}

@media print {
    .hero-rotator {
        display: none !important;
    }
}
