.hero {
    --hero-interval: 7s;
    --hero-fade: 1.2s;
    --hero-inset: clamp(0.75rem, 0.5rem + 0.8vw, 1.25rem);
    --hero-axis: calc(var(--frame) + max(var(--page-gutter), (100% - var(--page-max)) / 2));
    --hero-text-bottom: clamp(4.5rem, 12svh, 8.5rem);
    display: flex;
    flex-direction: column;
    gap: var(--stack-m);
    min-height: 100svh;
    padding-bottom: var(--stack-m);
    background-color: var(--bg);
}

.hero-card {
    position: relative;
    display: grid;
    flex: 1;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: max(34rem, 72svh);
    overflow: hidden;
    touch-action: pan-y;
    isolation: isolate;
}

.hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(6, 33, 63, 0.5), rgba(6, 33, 63, 0) 28%),
        linear-gradient(0deg, rgba(6, 33, 63, 0.88), rgba(6, 33, 63, 0.64) 36%, rgba(6, 33, 63, 0.5) 54%, rgba(6, 33, 63, 0.2) 72%, rgba(6, 33, 63, 0) 86%);
}

.hero-slides {
    position: absolute;
    inset: 0;
    z-index: -2;
}

.hero-slide {
    position: absolute;
    inset: 0;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition:
        opacity var(--hero-fade) var(--ease-in-out),
        visibility 0s linear var(--hero-fade);
}

.hero-slide.is-active,
.hero-slide.is-next,
.hero-slide.is-leaving {
    display: block;
}

.hero-slide.is-active {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--hero-fade) var(--ease-in-out);
}

.hero-slide.is-leaving {
    visibility: visible;
}

@starting-style {
    .hero-slide.is-active {
        opacity: 0;
    }
}

.hero-slide .cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 45%;
    transform: scale(1.06);
}

.hero-slide.is-active .cover-image,
.hero-slide.is-leaving .cover-image {
    animation: hero-drift calc(var(--hero-interval) + var(--hero-fade) * 2) cubic-bezier(0.33, 0, 0.67, 1) both;
}

.hero[data-paused] .cover-image,
.hero[data-suspended] .cover-image {
    animation-play-state: paused;
}

@keyframes hero-drift {
    from {
        transform: scale(1.08);
    }

    to {
        transform: scale(1);
    }
}

.hero-content {
    display: grid;
    align-self: end;
    justify-items: start;
    gap: var(--stack-m);
    padding: var(--header-space) var(--frame) var(--hero-text-bottom);
}

.hero-title {
    max-width: 14ch;
    font-size: clamp(2.75rem, 1.3rem + 5vw, 6.5rem);
    font-weight: var(--weight-heavy);
    letter-spacing: -0.05em;
    line-height: 0.96;
    text-wrap: balance;
    text-shadow: 0 0.04em 0.4em rgba(6, 33, 63, 0.35);
}

.hero-lead {
    max-width: 30rem;
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
    font-weight: var(--weight-medium);
    line-height: 1.5;
    text-wrap: pretty;
    text-shadow: 0 0.05em 0.6em rgba(6, 33, 63, 0.4);
}

.hero-action {
    gap: 0.875rem;
    max-width: 100%;
    min-height: 3.75rem;
    padding: 0.375rem 0.375rem 0.375rem 0.5rem;
    border-color: var(--color-paper);
    color: var(--color-ink);
    background-color: var(--color-paper);
}

.hero-action.is-plain {
    min-height: 3.375rem;
    padding-left: 1.5rem;
    font-size: 1rem;
    font-weight: var(--weight-bold);
}

.hero-action-date {
    display: grid;
    flex: none;
    place-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    color: var(--color-paper);
    background-color: var(--color-ink);
    line-height: 1;
    text-align: center;
}

.hero-action-day {
    font-size: 1.125rem;
    font-weight: var(--weight-heavy);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.hero-action-month {
    margin-top: 0.15rem;
    font-size: 0.6875rem;
    font-weight: var(--weight-bold);
}

.hero-action-text {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
    padding-right: 0.5rem;
    text-align: left;
}

.hero-action-label {
    color: var(--color-slate);
    font-size: var(--text-micro);
    font-weight: var(--weight-semibold);
    transition: color var(--duration-fast) ease;
}

.hero-action-title {
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: var(--weight-bold);
    text-overflow: ellipsis;
}

.hero-action .pill-icon {
    width: 2.625rem;
    height: 2.625rem;
    color: var(--color-paper);
    background-color: var(--color-ink);
}

.hero-chapters {
    --focus: var(--color-blue);
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 0.25rem;
    max-width: calc(100% - 2 * var(--hero-axis));
    margin: 0 var(--hero-axis) var(--hero-inset);
    padding: 0.3125rem;
    border-radius: var(--radius-pill);
    color: var(--color-ink);
    background-color: var(--color-paper);
}

.hero-chapters[hidden] {
    display: none;
}

.hero-toggle {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.625rem;
    height: 2.625rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--color-paper);
    background-color: var(--color-ink);
    transition: background-color var(--duration-fast) ease;
}

.hero-toggle .icon {
    grid-area: 1 / 1;
    width: 1rem;
    height: 1rem;
}

.hero-toggle .icon + .icon,
.hero[data-paused] .hero-toggle .icon:first-child {
    display: none;
}

.hero[data-paused] .hero-toggle .icon + .icon {
    display: block;
}

.hero-chapter-list {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hero-chapter {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: var(--target-size);
    min-height: var(--target-size);
    padding: 0 0.375rem;
    border: 0;
    color: var(--color-ink);
    background: transparent;
}

.hero-chapter-bar {
    position: relative;
    flex: none;
    width: 1.375rem;
    height: 4px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background-color: rgba(6, 33, 63, 0.16);
    transition:
        width var(--duration-medium) var(--ease-out),
        background-color var(--duration-fast) ease;
}

.hero-chapter[aria-current] .hero-chapter-bar {
    width: 2.75rem;
}

.hero-chapter-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: var(--color-blue);
    transform: scaleX(0);
    transform-origin: left center;
}

.hero-chapter.is-done .hero-chapter-bar::after {
    background-color: var(--color-ink);
    transform: none;
}

.hero-chapter[aria-current] .hero-chapter-bar::after {
    animation: hero-progress var(--hero-interval) linear both;
}

.hero[data-paused] .hero-chapter-bar::after,
.hero[data-suspended] .hero-chapter-bar::after {
    animation-play-state: paused;
}

@keyframes hero-progress {
    to {
        transform: none;
    }
}

.hero-chapter:not([aria-current]) .hero-chapter-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.hero-chapter[aria-current] .hero-chapter-label {
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    white-space: nowrap;
}

.hero-next {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: 2.625rem;
    height: 2.625rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--color-ink);
    background-color: transparent;
    transition: background-color var(--duration-fast) ease;
}

.hero-next .icon {
    width: 1rem;
    height: 1rem;
}

.hero-next .progress-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 2.5;
    transform: rotate(-90deg);
}

.progress-ring-track {
    stroke: rgba(6, 33, 63, 0.12);
}

.progress-ring-value {
    stroke: var(--color-blue);
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: hero-ring var(--hero-interval) linear both;
}

.hero[data-paused] .progress-ring-value,
.hero[data-suspended] .progress-ring-value {
    animation-play-state: paused;
}

@keyframes hero-ring {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-links {
    display: flex;
    align-items: center;
    gap: var(--stack-m);
    margin-inline: var(--hero-axis);
}

.hero-links-label {
    flex: none;
    color: var(--color-ink);
    font-family: var(--font-hand);
    font-size: 1.5rem;
    font-weight: var(--weight-semibold);
    line-height: 1;
}

.hero-links .chip-list {
    flex-wrap: nowrap;
    margin: -0.375rem;
    padding: 0.375rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.hero-links .chip-list::-webkit-scrollbar {
    display: none;
}

.hero-links .chip-list li {
    flex: none;
}

.hero-links .chip {
    --chip-bg: var(--color-mist);
    white-space: nowrap;
    box-shadow: none;
}

@media (hover: hover) {
    .hero-action:hover {
        border-color: var(--color-marker);
        background-color: var(--color-marker);
    }

    .hero-action:hover .hero-action-label {
        color: var(--color-ink);
    }

    .hero-toggle:hover {
        background-color: var(--color-blue);
    }

    .hero-next:hover {
        background-color: var(--color-mist);
    }

    .hero-chapter:hover .hero-chapter-bar {
        background-color: rgba(6, 33, 63, 0.32);
    }
}

@media (max-width: 47.99rem) {
    .hero-chapters {
        justify-self: stretch;
        max-width: none;
    }

    .hero-chapter-list,
    .hero-chapter,
    .hero-chapter-bar {
        flex: 1;
        min-width: 0;
    }

    .hero-chapter-list li {
        display: flex;
        flex: 1;
        min-width: 0;
        transition: flex-grow var(--duration-medium) var(--ease-out);
    }

    .hero-chapter-list li:has([aria-current]) {
        flex-grow: 2;
    }

    .hero-chapter[aria-current] .hero-chapter-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

}

@media (max-width: 79.99rem) {
    .hero-links-label {
        display: none;
    }

    .hero-links .chip {
        min-height: 2.5rem;
        padding: 0.375rem 0.875rem 0.375rem 0.75rem;
        font-size: 0.9375rem;
    }

    .hero-links .chip .icon {
        width: 1.125rem;
        height: 1.125rem;
    }
}

@media (min-width: 48rem) {
    .hero-chapters {
        justify-self: end;
    }
}

@media (min-width: 64rem) {
    .hero-chapters {
        position: absolute;
        right: var(--hero-axis);
        bottom: calc(var(--hero-text-bottom) + 0.1875rem);
        margin: 0;
    }

    .hero-card::before {
        background:
            linear-gradient(180deg, rgba(6, 33, 63, 0.5), rgba(6, 33, 63, 0) 28%),
            linear-gradient(90deg, rgba(6, 33, 63, 0.72), rgba(6, 33, 63, 0) 84%),
            linear-gradient(0deg, rgba(6, 33, 63, 0.86), rgba(6, 33, 63, 0.6) 36%, rgba(6, 33, 63, 0.42) 56%, rgba(6, 33, 63, 0.16) 72%, rgba(6, 33, 63, 0) 86%);
    }

    .hero-content {
        gap: var(--stack-m) var(--stack-l);
    }

    .hero-title {
        margin-bottom: var(--stack-s);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-slide .cover-image {
        transform: none;
    }

    .hero-slide.is-active .cover-image,
    .hero-slide.is-leaving .cover-image {
        animation: none !important;
    }

    .hero-chapter[aria-current] .hero-chapter-bar::after {
        animation: none !important;
        transform: none;
    }

    .progress-ring-value {
        animation: none !important;
        stroke-dashoffset: 1;
    }

    .hero-toggle {
        display: none;
    }

    .hero-chapters {
        padding-left: 0.875rem;
    }
}
