.hero {
  position: relative;
  display: grid;
  min-height: min(calc(100svh - var(--nav-height)), 60rem);
  overflow: hidden;
}

main > .hero {
  padding-block: 0;
}

.hero-media {
  position: absolute;
  inset: 0;
  isolation: isolate;
  touch-action: pan-y;
}

.hero-media::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  background:
    linear-gradient(to top, rgba(var(--bg), 0.95) 0%, rgba(var(--bg), 0.7) 30%, transparent 55%),
    linear-gradient(to left, rgba(var(--bg), 0.75) 0%, rgba(var(--bg), 0.35) 45%, transparent 75%);
  pointer-events: none;
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.hero-slide.is-leaving {
  z-index: 1;
  opacity: 1;
}

.hero-slide.is-active {
  z-index: 2;
  opacity: 1;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto auto auto;
  gap: var(--space-l);
  padding-block: 4rem var(--space-l);
}

.hero-heading {
  align-self: center;
  margin: 0;
  text-align: right;
}

.hero-title {
  display: block;
  max-width: min(20ch, 100%);
  margin-inline-start: auto;
  font-size: clamp(1.625rem, 0.9rem + 3.2vw, 4rem);
  line-height: 1.1;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(var(--bg), 0.45);
}

.hero-title-lead,
.hero-title-turn {
  display: block;
}

.hero-title-lead {
  color: rgb(var(--heading));
}

.hero-title-turn {
  margin-top: 0.15em;
  color: rgb(var(--accent-text));
}

.hero-persona {
  display: grid;
  min-height: 6.5rem;
}

.hero-persona > .hero-moment {
  grid-area: 1 / 1;
}

.hero-persona > .hero-moment[hidden] {
  display: block;
  visibility: hidden;
}

.hero-moment-time {
  margin: 0 0 var(--space-xs);
  text-shadow: 0 1px 8px rgba(var(--bg), 0.8);
  color: rgb(var(--accent-text));
  font-size: var(--text-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-moment-role {
  margin: 0;
  color: rgb(var(--heading));
  font-family: var(--font-accent);
  font-weight: 400;
  font-size: clamp(3.25rem, 2.75rem + 2vw, 4.5rem);
  line-height: 1;
}

.hero-moment-text {
  max-width: 32ch;
  margin: var(--space-xs) 0 0;
  color: rgb(var(--text));
  font-size: 0.9375rem;
}

.hero-timeline {
  display: flex;
  align-items: flex-start;
  gap: var(--space-m);
  border-top: 1px solid rgba(var(--heading), 0.2);
  position: relative;
}

.hero-timeline[hidden] {
  display: none;
}

.hero-progress {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgb(var(--accent));
  transform: scaleX(calc((var(--step, 0) + 1) / var(--count, 7)));
  transform-origin: left;
}

.hero-stops {
  position: relative;
  display: flex;
  flex: 1;
  gap: var(--space-m);
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

.hero-stops::-webkit-scrollbar {
  display: none;
}

.hero-stops li {
  flex: 1 0 auto;
}

.hero-stop {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 3.5rem;
  padding: var(--space-m) 0 0;
  border: 0;
  background: none;
  color: rgb(var(--muted));
  text-align: left;
  cursor: pointer;
}

.hero-stop[aria-pressed="true"] {
  color: rgb(var(--heading));
}

.hero-stop:hover {
  color: rgb(var(--heading));
}

.hero-stop-time {
  font-size: var(--text-label);
  letter-spacing: 0.08em;
}

.hero-stop-name {
  display: none;
  font-size: var(--text-label);
  white-space: nowrap;
}

.hero-stop-occasion .hero-stop-time {
  font-style: italic;
}

.hero-note {
  margin: 0;
  color: rgb(var(--muted));
  font-size: var(--text-label);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-slide {
    transform: scale(1.05);
  }

  .hero-slide.is-active,
  .hero-slide.is-leaving {
    transform: none;
    transition: transform 9000ms cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .hero-slide.is-active {
    transition:
      opacity 1600ms cubic-bezier(0.4, 0, 0.2, 1),
      transform 9000ms cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .is-running .hero-progress {
    animation: hero-fill 6000ms linear both;
  }

  .hero-moment:not([hidden]) {
    animation: hero-moment-in 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero-heading {
    animation: hero-enter 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
}

@keyframes hero-fill {
  from {
    transform: scaleX(calc(var(--step, 0) / var(--count, 7)));
  }
}

@keyframes hero-moment-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes hero-enter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

@media (max-width: 47.99em) {
  .hero-stops {
    justify-content: space-between;
    gap: var(--space-xs);
    overflow: visible;
  }

  .hero-stops li {
    flex: none;
  }

  .hero-stop-time {
    letter-spacing: 0;
  }

  .hero-stop-rest {
    display: none;
  }
}

@media (min-width: 48em) {
  .hero-stop-name {
    display: block;
  }
}

@media (min-width: 64em) {
  .hero-inner {
    padding-block: 5rem var(--space-l);
  }
}

@media (max-width: 39.99em) {
  .hero {
    min-height: 0;
  }

  .hero-media {
    position: relative;
    inset: auto;
    aspect-ratio: 6 / 7;
    overflow: hidden;
  }

  .hero-media::after {
    background: linear-gradient(to top, rgb(var(--bg)) 0%, rgba(var(--bg), 0.75) 18%, rgba(var(--bg), 0.3) 34%, transparent 46%);
  }

  .hero-slide {
    object-position: 22% center;
  }

  .hero-slide[data-moment="arrival"] {
    object-position: 8% center;
  }

  .hero-slide[data-moment="friends"],
  .hero-slide[data-moment="grandparents"] {
    object-position: 40% center;
  }

  .hero-inner {
    grid-template-rows: auto;
    gap: 0.75rem;
    margin-top: -9rem;
    padding-block: 0 var(--space-l);
  }

  .hero-heading {
    position: relative;
    z-index: 4;
    align-self: start;
    text-align: right;
  }

  .hero-title {
    max-width: 18ch;
    margin-inline-start: auto;
    font-size: clamp(1.625rem, 1rem + 2.6vw, 2rem);
    line-height: 1.15;
    text-wrap: balance;
    text-shadow: none;
  }

  .hero-title-turn {
    margin-top: 0.2em;
  }

  .hero-persona {
    min-height: 0;
  }
}
