.journey { position: relative; }

.hero--motion {
  --motion-title-size: clamp(3.25rem, 6.8cqi, 5.85rem);
  --copy-progress: 0;
  --mid-copy: 0;
  --arrival-copy: 0;
  --phase-shade: clamp(0, calc(var(--mid-copy) + var(--arrival-copy)), 1);
}

.hero--motion .hero__copy { max-inline-size: none; }

.hero--motion .hero__title {
  color: var(--ivory);
  font: 400 var(--motion-title-size) / .93 var(--serif);
  letter-spacing: -.025em;
}

.hero--motion .hero__description strong {
  color: var(--ivory);
  font-weight: 650;
  white-space: nowrap;
}

.motion-stage {
  position: absolute;
  z-index: -2;
  inset: 0;
  min-height: 0;
  overflow: hidden;
}

.motion-stage__poster, .motion-stage__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.motion-stage__poster {
  object-fit: cover;
  object-position: 67% center;
}

.motion-stage__canvas, .motion-cue { display: none; }

.hero__phase-copy { display: none; pointer-events: none; }

.hero__phase {
  grid-area: 1 / 1;
  align-self: center;
  opacity: var(--phase-opacity);
  transform: translateY(calc(.65rem * (1 - var(--phase-opacity))));
}

.hero__phase--mid { --phase-opacity: var(--mid-copy); }
.hero__phase--arrival { --phase-opacity: var(--arrival-copy); }

.hero__phase-title {
  color: var(--ivory);
  font: 400 clamp(3.2rem, 5.85cqi, 5.35rem) / .94 var(--serif);
  letter-spacing: -.022em;
  text-wrap: balance;
}

.hero__phase--mid .hero__phase-title {
  color: #eee2d2;
  font-size: clamp(2.8rem, 5.2cqi, 4.8rem);
  max-width: 14ch;
}

.hero__phase-title > span { display: block; }

.journey__marker {
  position: absolute;
  inset: 23svh auto auto 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.motion-bio {
  display: grid;
  align-items: center;
  min-height: 76svh;
  padding: clamp(3.4rem, 7.4vw, 8rem) var(--gutter);
  color-scheme: light;
  color: var(--ink);
  background: var(--paper);
}

.motion-bio__inner {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1fr);
  align-items: center;
  max-width: 78rem;
  width: 100%;
  margin-inline: auto;
  gap: clamp(2.2rem, 8.2vw, 9rem);
}

.motion-bio__portrait {
  width: 100%;
  max-height: 65svh;
  height: auto;
  aspect-ratio: 19 / 20;
  object-fit: cover;
  object-position: 50% 31%;
}

.motion-bio__copy h2 {
  font: 400 clamp(3.4rem, 7vw, 6rem) / .95 var(--serif);
  letter-spacing: -.025em;
}

.motion-bio__copy p {
  max-width: 40ch;
  margin-top: 1.1rem;
  color: #51483e;
  font-size: clamp(.95rem, 1.37vw, 1.1rem);
  line-height: 1.64;
  text-wrap: pretty;
}

.motion-bio__contact {
  display: inline-flex;
  align-items: center;
  gap: .62rem;
  min-height: 2.75rem;
  margin-top: 1rem;
  color: #663819;
  font-size: .91rem;
  font-weight: 650;
}

.motion-bio__contact:hover { color: var(--ink); }

@media (prefers-reduced-motion: no-preference) {
  .journey:has(.motion-stage.is-ready) { min-height: 210svh; }

  .hero--motion:has(.motion-stage.is-ready) {
    position: sticky;
    top: 0;
  }

  .motion-stage.is-ready .motion-stage__poster { visibility: hidden; }
  .motion-stage.is-ready .motion-stage__canvas { display: block; }
  .hero--motion:has(.motion-stage.is-ready) .static-cue { display: none; }

  .hero--motion:has(.motion-stage.is-ready) .motion-cue {
    display: inline-flex;
    opacity: calc(1 - var(--copy-progress));
  }

  .hero--motion.is-copy-hidden .motion-cue { pointer-events: none; }

  .hero--motion:has(.motion-stage.is-ready) .hero__phase-copy {
    display: grid;
    position: absolute;
    inset: 0 auto 0 0;
    padding: 0 var(--gutter);
    width: min(49vw, 43rem);
  }

  .hero--motion .hero__copy:focus-within + .hero__phase-copy { visibility: hidden; }

  @container (min-width: 44.001rem) {
    .hero--motion:has(.motion-stage.is-ready)::after {
      background:
        linear-gradient(90deg,
          rgb(9 14 22 / calc(.88 - .53 * var(--copy-progress) + .46 * var(--phase-shade))) 0%,
          rgb(9 14 22 / calc(.59 - .40 * var(--copy-progress) + .5 * var(--phase-shade))) 31%,
          rgb(9 14 22 / calc((.59 - .40 * var(--copy-progress)) * .444444 + .34 * var(--phase-shade))) 51%,
          transparent 67%),
        linear-gradient(180deg, rgb(9 14 22 / 72%) 0%, transparent 24%, transparent 70%, rgb(9 14 22 / 56%) 100%);
    }

    .hero--motion .hero__copy {
      opacity: calc(1 - var(--copy-progress));
      transform: translateY(calc(var(--copy-progress) * -.7rem));
    }

    .hero--motion.is-copy-hidden .hero__copy { pointer-events: none; }
    .hero--motion .hero__copy:focus-within { transform: none; }
  }

  @container (max-width: 44rem) {
    .hero--motion:has(.motion-stage.is-ready) .hero__phase-copy {
      grid-area: copy;
      inset: .15rem var(--mobile-gutter) auto;
      padding: 0;
      width: auto;
    }

    .hero--motion .hero__copy :is(.hero__title, .hero__description) {
      opacity: calc(1 - var(--copy-progress));
    }

    .hero--motion .hero__copy:focus-within :is(.hero__title, .hero__description) { opacity: 1; }

    .hero__phase-title { font-size: clamp(2.6rem, 12cqi, 4.5rem); }
    .hero__phase--mid .hero__phase-title { font-size: clamp(2.4rem, 11.5cqi, 4.2rem); }
  }

  .hero--motion .hero__copy:focus-within, .hero--motion .motion-cue:focus-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

@container (max-width: 44rem) {
  .hero--motion {
    --motion-title-size: clamp(2.35rem, 11.6cqi, 4.5rem);
    grid-template-rows: minmax(min(16.5rem, 46svh), 1fr) auto auto;
  }

  .motion-stage {
    grid-area: image;
    position: relative;
    mask-image: linear-gradient(black 76%, transparent 100%);
  }

  .motion-stage__poster { object-position: 76% 52%; }

  .motion-bio__inner { grid-template-columns: minmax(0, 1fr); }
  .motion-bio__portrait { max-height: none; }
}

@container (max-width: 22rem) {
  .hero--motion .hero__actions .button {
    gap: .45em;
    padding-inline: .45em;
  }
}
