/*
  Home hero: a silent looping video under an overlay, with the content on top.
  The poster sits behind the video and shows until it plays, or instead of it with reduced motion.
*/

/*
  The hero stays pinned while the next section slides up over it.
  --hero-top is set in hero.js, so a hero taller than the screen can still scroll to its bottom first.
*/
.hero {
  position: sticky;
  top: var(--hero-top, 0px);
  z-index: 1;
  display: flex;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  background: var(--color-dark);
  color: var(--color-light);
}

.hero__poster,
.hero__video,
.hero__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__poster img,
.hero__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__video {
  opacity: 0;
}

/* Darker behind the text so it stays readable on the video's bright shots. */
.hero__overlay {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--color-dark) 60%, transparent) 30%,
    color-mix(in srgb, var(--color-dark) 30%, transparent) 85%
  );
}

.hero__content {
  position: relative;
}

/* 128px at the 1512px Figma frame. Below about 605px the two lines wrap into four. */
.hero__heading {
  margin: 0;
  font-size: clamp(min(16vw, 3.75rem), 8.466vw, 10rem);
  font-weight: var(--weight-heading);
  line-height: 1.1;
}

/* Each word rises out of its own mask. The padding keeps descenders from being clipped. */
.hero__word {
  display: inline-block;
  padding-bottom: 0.18em;
  margin-bottom: -0.18em;
  overflow: hidden;
  vertical-align: top;
}

.hero__word > span {
  display: block;
}

.hero__text {
  max-width: 21em;
  margin: 35px 0;
  font-size: clamp(1.0625rem, 0.96rem + 0.4vw, 1.25rem);
  line-height: 1.5;
}

@media (max-width: 767.98px) {
  .hero {
    height: auto;
    min-height: 100vh;
  }

  /* The text runs the full width here, so a left-to-right fade wouldn't help. */
  .hero__overlay {
    background: color-mix(in srgb, var(--color-dark) 60%, transparent);
  }

  .hero__content {
    padding-block: 150px;
  }
}

/* Starting state for the entrance in hero.js, which removes .js if Motion can't load. */
@media (prefers-reduced-motion: no-preference) {
  .js .hero__word > span {
    transform: translateY(110%);
  }

  .js .hero__text,
  .js .hero .btn {
    opacity: 0;
  }

  .js .hero__poster,
  .js .hero__video {
    transform: scale(1.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__video {
    display: none;
  }
}
