/* The shared stylesheet hides the entire document until every web font has
 * loaded. Allow the homepage poster and intro to paint immediately. */
html {
  opacity: 1 !important;
  visibility: visible !important;
}

.mv {
  overflow: hidden;
}

.mv-poster,
.mv .mv-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.mv-poster {
  z-index: 1;
}

.mv .mv-video {
  z-index: 2;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mv .mv-video.is-ready {
  visibility: visible;
  opacity: 1;
}

.toploading {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #fff;
  z-index: 1100;
  pointer-events: none;
  animation: hero-intro-overlay 3.3s linear forwards;
  will-change: opacity;
}

.toploading__logo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  height: 112px;
  overflow: hidden;
  background-color: #fff;
  transform: translate(-50%, -50%);
  animation: hero-intro-logo 3.3s linear forwards;
}

.toploading__logo svg {
  position: absolute;
  top: 0;
  left: 50%;
  width: 384px;
  height: auto;
  transform: translateX(-50%);
}

.toploading::before,
.toploading::after {
  position: absolute;
  z-index: 1;
  animation: hero-intro-line 3.3s linear forwards;
}

.toploading.is-finished {
  display: none;
  animation: none;
}

/* Keep the header painted throughout the intro so its decorative edge is not
 * rediscovered as a late LCP candidate when the animation finishes. */
.top .header {
  z-index: 1002;
  font-family: Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

/* Retract the lines by width only to preserve the original motion. */
@keyframes hero-intro-line {
  0% {
    width: 0;
  }
  16% {
    width: 50%;
  }
  61% {
    width: 50%;
  }
  77%,
  100% {
    width: 0;
  }
}

/* Keep the logo full width while the parent overlay fades. */
@keyframes hero-intro-logo {
  0%,
  30% {
    width: 0;
    visibility: visible;
    opacity: 1;
  }
  46%,
  100% {
    width: 480px;
    visibility: visible;
    opacity: 1;
  }
}

@keyframes hero-intro-overlay {
  0%,
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 767px) {
  .toploading__logo {
    animation-name: hero-intro-logo-mobile;
  }

  .toploading__logo svg {
    width: 48vw;
  }

  @keyframes hero-intro-logo-mobile {
    0%,
    30% {
      width: 0;
    }
    46%,
    100% {
      width: 60vw;
      visibility: visible;
      opacity: 1;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .toploading {
    display: none;
    animation: none;
  }

  .mv .mv-video {
    animation: none;
    transition: none;
  }
}
