/*
 * The VeriPlus loader: the mark assembling itself. The arcs turn in, the
 * check grows out of its vertex, and the plus pops last.
 *
 * Transform and opacity only. Dash-offset drawing rendered wedge-shaped
 * slivers in Chrome on the parent site, so it is not used.
 *
 * One stylesheet, two users: the preloader inside #root in index.html (shown
 * before the JavaScript arrives, replaced the moment React mounts), and the
 * <Loader /> component (src/components/Loader.tsx) that React shows while a
 * page's code loads. It is a plain file in public/ and linked from index.html
 * because the CSP allows no inline styles.
 */

.vp-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: vp-loader-in 0.3s ease both;
}

.vp-loader--screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #faf8f5;
}

.vp-loader--inline {
  min-height: 60vh;
}

.vp-loader__mark {
  width: 72px;
  height: 72px;
  overflow: visible;
}

.vp-loader__mark path {
  stroke: #f1560a;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: view-box;
}

.vp-loader__arc {
  transform-origin: 50px 50px;
  animation: vp-loader-arc 2.2s cubic-bezier(0.5, 0, 0.2, 1) infinite both;
}

.vp-loader__arc--b {
  animation-delay: 0.08s;
}

/* The check grows out of its vertex at (42, 80). */
.vp-loader__check {
  transform-origin: 42px 80px;
  animation: vp-loader-check 2.2s cubic-bezier(0.6, 0, 0.2, 1) infinite both;
}

.vp-loader__plus {
  transform-origin: 87px 12px;
  animation: vp-loader-plus 2.2s cubic-bezier(0.3, 1.6, 0.6, 1) infinite both;
}

.vp-loader__name {
  font-family: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a6478;
  animation: vp-loader-name 2.2s ease-in-out infinite;
}

@keyframes vp-loader-in {
  from {
    opacity: 0;
  }
}

@keyframes vp-loader-arc {
  0%,
  5% {
    transform: rotate(-90deg) scale(0.6);
    opacity: 0;
  }
  30%,
  80% {
    transform: none;
    opacity: 1;
  }
  95%,
  100% {
    transform: none;
    opacity: 0;
  }
}

@keyframes vp-loader-check {
  0%,
  18% {
    transform: scale(0);
    opacity: 1;
  }
  45%,
  80% {
    transform: scale(1);
    opacity: 1;
  }
  95%,
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes vp-loader-plus {
  0%,
  42% {
    transform: scale(0);
    opacity: 1;
  }
  55%,
  80% {
    transform: scale(1);
    opacity: 1;
  }
  95%,
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes vp-loader-name {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* No assembling for visitors who asked for less motion: the whole mark, breathing. */
@media (prefers-reduced-motion: reduce) {
  .vp-loader__arc,
  .vp-loader__check,
  .vp-loader__plus {
    animation: none;
    transform: none;
  }

  .vp-loader__mark {
    animation: vp-loader-name 2.2s ease-in-out infinite;
  }
}
