/* ==========================================================================
   Effect: loading
   Shown once per visit (fx-loading.js adds .is-loading to <html>). Page
   animations wait behind the cover and start when it fades out.
   ========================================================================== */
html.is-loading:not(.is-loaded) {
  overflow: hidden;
}

html.is-loading:not(.is-loaded) body * {
  animation-play-state: paused !important;
}

html.is-loading body::before,
html.is-loading body::after,
html.is-loading::before,
html.is-loading::after {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.8s var(--ease);
}

html.is-loading body::before {
  content: "";
  inset: 0;
  background: var(--color-white);
}

/* Logo, spinner and label stacked at the centre of the cover */
html.is-loading body::after {
  content: "";
  top: calc(50% - 44px);
  left: 50%;
  width: 140px;
  height: 40px;
  translate: -50% -50%;
  background: url("/assets/img/common/logo.webp") center / contain no-repeat;
  animation: fx-loader-logo 1s var(--ease) 0.15s both;
}

html.is-loading::before {
  content: "";
  z-index: 1001;
  top: calc(50% + 16px);
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 2px solid var(--color-line);
  border-top-color: var(--color-navy);
  border-radius: 50%;
  animation: fx-loader-spin 0.9s linear infinite;
}

html.is-loading::after {
  content: "Loading...";
  z-index: 1001;
  top: calc(50% + 52px);
  left: 50%;
  translate: -50% 0;
  color: var(--color-navy);
  font-size: 12px;
  letter-spacing: 0.2em;
  animation: fx-loader-blink 1.4s ease-in-out infinite;
}

html.is-loaded body::before,
html.is-loaded body::after,
html.is-loaded::before,
html.is-loaded::after {
  opacity: 0;
}

@keyframes fx-loader-logo {
  from {
    opacity: 0;
    translate: -50% calc(-50% + 8px);
  }
}

@keyframes fx-loader-spin {
  to {
    rotate: 1turn;
  }
}

@keyframes fx-loader-blink {
  50% {
    filter: opacity(0.3);
  }
}
