:root {
  --site-loader-duration: 800ms;
}

.site-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background: #fbfcfd;
  color: #0d1526;
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", system-ui, sans-serif;
  visibility: visible;
  touch-action: none;
  overscroll-behavior: none;
  animation: local-hack-loader-curtain var(--site-loader-duration) cubic-bezier(.76, 0, .24, 1) both;
}

.site-loader + [data-motion] {
  animation: local-hack-loader-site var(--site-loader-duration) cubic-bezier(.4, 0, .2, 1) both;
}

html[data-site-loader-seen="true"] .site-loader {
  display: none;
}

html[data-site-loader-seen="true"] .site-loader + [data-motion] {
  animation: none;
}

.site-loader__content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: local-hack-loader-content var(--site-loader-duration) cubic-bezier(.4, 0, .2, 1) both;
}

.site-loader__lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3.15vw, 40px);
}

.site-loader__mark,
.site-loader__wordmark {
  display: block;
  width: auto;
  mask-image: linear-gradient(to right, #000 0 49%, transparent 51.5% 100%);
  mask-size: 200% 100%;
  mask-position: 100% 0;
  mask-repeat: no-repeat;
  -webkit-mask-image: linear-gradient(to right, #000 0 49%, transparent 51.5% 100%);
  -webkit-mask-size: 200% 100%;
  -webkit-mask-position: 100% 0;
  -webkit-mask-repeat: no-repeat;
}

.site-loader__mark {
  height: clamp(74px, 9.1vw, 116px);
  animation: local-hack-loader-logo var(--site-loader-duration) cubic-bezier(.35, 0, .2, 1) both;
}

.site-loader__wordmark {
  height: clamp(52px, 6.25vw, 80px);
  animation: local-hack-loader-wordmark var(--site-loader-duration) cubic-bezier(.35, 0, .2, 1) both;
}

.site-loader__meta,
.site-loader__progress {
  position: absolute;
  bottom: max(28px, 6.5vh);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  animation: local-hack-loader-meta var(--site-loader-duration) ease-out both;
}

.site-loader__meta {
  left: clamp(24px, 8vw, 104px);
  color: #94a3b8;
  font-size: clamp(9px, .94vw, 12px);
  letter-spacing: .3em;
}

.site-loader__progress {
  right: clamp(24px, 8vw, 104px);
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: #0d1526;
}

.site-loader__progress-value {
  min-width: 3ch;
  font-size: clamp(30px, 3.15vw, 40px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.site-loader__progress-unit {
  color: #94a3b8;
  font-size: clamp(12px, 1.2vw, 15px);
}

@keyframes local-hack-loader-logo {
  0%,
  6% {
    mask-position: 100% 0;
    -webkit-mask-position: 100% 0;
  }
  36%,
  100% {
    mask-position: 0 0;
    -webkit-mask-position: 0 0;
  }
}

@keyframes local-hack-loader-wordmark {
  0%,
  13% {
    mask-position: 100% 0;
    -webkit-mask-position: 100% 0;
  }
  48%,
  100% {
    mask-position: 0 0;
    -webkit-mask-position: 0 0;
  }
}

@keyframes local-hack-loader-meta {
  0%,
  10% {
    opacity: 0;
  }
  24%,
  72% {
    opacity: 1;
  }
  84%,
  100% {
    opacity: 0;
  }
}

@keyframes local-hack-loader-content {
  0%,
  72% {
    opacity: 1;
    transform: translateY(0);
  }
  84%,
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes local-hack-loader-curtain {
  0%,
  78% {
    visibility: visible;
    transform: translateY(0);
  }
  99% {
    visibility: visible;
    transform: translateY(-101%);
  }
  100% {
    visibility: hidden;
    transform: translateY(-101%);
  }
}

@keyframes local-hack-loader-site {
  0%,
  80% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .site-loader__lockup {
    gap: 14px;
    padding: 0 20px;
  }

  .site-loader__mark {
    height: 68px;
  }

  .site-loader__wordmark {
    height: 46px;
    max-width: calc(100vw - 130px);
    object-fit: contain;
  }

  .site-loader__meta,
  .site-loader__progress {
    bottom: max(24px, 5.5vh);
  }
}

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

  .site-loader + [data-motion] {
    animation: none;
  }
}
