/* Opening animation */
.site-page {
  background: var(--color-bg);
}

body.intro-playing {
  overflow: hidden;
  background: var(--color-surface);
}

.intro-playing .site-page {
  clip-path: circle(0 at 50vw 50svh);
}

.intro-playing .site-header {
  opacity: 0;
}

.intro {
  --pill-height: clamp(3.75rem, 6.7vw, 5.75rem);
  --pill-width: clamp(20rem, 36vw, 31.25rem);
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.intro[hidden],
.intro__prompt[hidden] {
  display: none;
}

.intro__pill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: var(--pill-height);
  height: var(--pill-height);
  padding-inline: calc(var(--pill-height) * .2);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text);
}

.intro__pill::after {
  content: "";
  flex: 0 0 calc(var(--pill-height) * .58);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-accent);
}

.intro__prompt {
  flex: 1;
  padding-left: calc(var(--pill-height) * .12);
  font-size: clamp(1.25rem, 2.745vw, 2.25rem);
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.intro__caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  background: var(--color-accent);
  vertical-align: -.14em;
  animation: intro-blink 640ms step-end infinite;
}

@keyframes intro-blink {
  50% { opacity: 0; }
}

.hero__word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-block: .08em .2em;
  margin-block: -.08em -.2em;
}

.hero__word > span {
  display: block;
  padding-bottom: .2em;
  margin-bottom: -.2em;
  transition: transform .8s cubic-bezier(.22, 1, .36, 1), opacity .8s ease;
}

.hero__word:nth-of-type(2) > span {
  transition-delay: .15s;
}

.hero__word:nth-of-type(3) > span {
  transition-delay: .3s;
}

.hero__title.is-preparing:not(.is-visible) .hero__word > span {
  transition: none;
  transform: translateY(110%);
  opacity: 0;
}

.hero__title.is-visible .hero__word > span {
  transform: translateY(0);
  opacity: 1;
}

.hero__lead {
  transition: transform 1.4s cubic-bezier(.22, 1, .36, 1) .8s, opacity 1.4s ease .8s;
}

.hero__title.is-preparing:not(.is-visible) ~ .hero__lead {
  transition: none;
  transform: translateX(2rem);
  opacity: 0;
}

.hero__title.is-visible ~ .hero__lead {
  transform: translateX(0);
  opacity: 1;
}

.hero__title.has-intro-color .hero__word > span {
  color: transparent;
  background: linear-gradient(90deg, var(--color-text) 0% 25%, var(--color-accent) 50%, var(--color-text) 75% 100%);
  background-size: 400% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  animation: intro-type-colors 4s linear infinite;
}

@keyframes intro-type-colors {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  .intro-playing .site-page { clip-path: none; }
  .intro-playing .site-header { opacity: 1; }
  .hero__word > span, .hero__lead { transition: none; }
  .hero__title.has-intro-color .hero__word > span {
    animation: none;
    background: none;
    color: var(--color-text);
  }
}
