/*
 * Adapted from "Loader by dexter-st" (https://uiverse.io/dexter-st/wicked-elephant-4).
 * Copyright - 2026 dexter-st
 * MIT License
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to
 * do so, subject to the following conditions:
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

.site-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: #08090c;
  color: #fff;
  opacity: 1;
  isolation: isolate;
  /* If the controller script fails to load, never leave the page covered. */
  animation: suo-loader-failsafe .01s 7s forwards;
}

.has-js .site-loader { display: flex; }

.site-loader.is-leaving {
  opacity: 0;
  pointer-events: none;
  transition: opacity .36s ease;
}

.site-loader-word {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  width: max-content;
  max-width: calc(100vw - 48px);
  font-family: "Inter", "Alimama FangYuan", sans-serif;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -.035em;
  white-space: nowrap;
  user-select: none;
}

.site-loader-word > span:not(.site-loader-scan) {
  display: inline-block;
  position: relative;
  z-index: 2;
  opacity: 0;
  animation: suo-loader-letter 4s infinite linear;
}

.site-loader-word > .site-loader-space { width: .35em; }
.site-loader-word > span:nth-child(1) { animation-delay: .1s; }
.site-loader-word > span:nth-child(2) { animation-delay: .205s; }
.site-loader-word > span:nth-child(3) { animation-delay: .31s; }
.site-loader-word > span:nth-child(4) { animation-delay: .415s; }
.site-loader-word > span:nth-child(5) { animation-delay: .521s; }
.site-loader-word > span:nth-child(6) { animation-delay: .626s; }
.site-loader-word > span:nth-child(7) { animation-delay: .731s; }
.site-loader-word > span:nth-child(8) { animation-delay: .837s; }
.site-loader-word > span:nth-child(9) { animation-delay: .942s; }
.site-loader-word > span:nth-child(10) { animation-delay: 1.047s; }

.site-loader-scan {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-color: transparent;
  -webkit-mask: repeating-linear-gradient(90deg, transparent 0, transparent 6px, black 7px, black 8px);
  mask: repeating-linear-gradient(90deg, transparent 0, transparent 6px, black 7px, black 8px);
}

.site-loader-scan::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 50% 50%, #91e7ff 0%, transparent 50%),
    radial-gradient(circle at 45% 45%, #2f6bff 0%, transparent 45%),
    radial-gradient(circle at 55% 55%, #27d6ee 0%, transparent 45%),
    radial-gradient(circle at 45% 55%, #70bdff 0%, transparent 45%),
    radial-gradient(circle at 55% 45%, #2860e8 0%, transparent 45%);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 0%, transparent 10%, black 25%);
  mask: radial-gradient(circle at 50% 50%, transparent 0%, transparent 10%, black 25%);
  animation: suo-loader-scan 2s infinite alternate, suo-loader-glow 4s infinite;
  animation-timing-function: cubic-bezier(.6, .8, .5, 1);
}

@keyframes suo-loader-scan {
  0% { transform: translateX(-55%); }
  100% { transform: translateX(55%); }
}

@keyframes suo-loader-glow {
  0%, 100% { opacity: 0; }
  15% { opacity: 1; }
  65% { opacity: 0; }
}

@keyframes suo-loader-letter {
  0% { opacity: 0; }
  5% { opacity: 1; text-shadow: 0 0 4px #fff; transform: scale(1.1) translateY(-2px); }
  20% { opacity: .2; }
  100% { opacity: 0; }
}

@keyframes suo-loader-failsafe {
  to { visibility: hidden; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-loader-word > span:not(.site-loader-scan) {
    animation: none;
    opacity: 1;
  }
  .site-loader-scan::after { animation: none; opacity: .45; }
  .site-loader.is-leaving { transition-duration: .12s; }
}
