#loader,
.brand-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #f6fbff 0%, #e5f4ff 55%, #fdfefe 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 420ms ease, visibility 420ms ease, background 420ms ease;
}

.brand-loader.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.brand-loader__backdrop {
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(circle at 28% 30%, rgba(82, 181, 247, 0.16), transparent 34%),
    radial-gradient(circle at 72% 64%, rgba(255, 208, 109, 0.14), transparent 28%);
  animation: brand-loader-backdrop 3.6s ease-in-out infinite alternate;
  will-change: opacity, transform;
}

.brand-loader__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 260px);
  aspect-ratio: 1;
}

.brand-loader__logo {
  width: min(34vw, 126px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 0 rgba(8, 144, 243, 0));
  animation: brand-loader-glow 2s ease-in-out infinite;
  transform-origin: 50% 50%;
  will-change: transform, filter;
}

.brand-loader__fill {
  fill: #0890f3;
  opacity: 0;
  transform-origin: center;
}

.brand-loader__outline,
.brand-loader__detail {
  fill: none;
  stroke: url("#brand-loader-stroke-gradient");
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.brand-loader__outline {
  stroke-width: 2.4;
  stroke-dasharray: 34 66;
  stroke-dashoffset: 100;
  animation: brand-loader-trace-outline 1.35s linear infinite;
}

.brand-loader__detail {
  stroke-width: 3.4;
  stroke-dasharray: 38 62;
  stroke-dashoffset: 100;
  animation: brand-loader-trace-detail 1.35s linear infinite;
}

.brand-loader__detail--delay {
  animation-delay: 0.16s;
}

/* When the window load event fires, JS adds this class:
   - stop the infinite loop
   - finish the stroke draw once
   - briefly reveal the fill before the overlay fades out */
.brand-loader.is-complete .brand-loader__outline {
  animation: brand-loader-complete-outline 420ms ease forwards;
}

.brand-loader.is-complete .brand-loader__logo {
  animation: brand-loader-glow 420ms ease forwards;
  transform: scale(1);
}

.brand-loader.is-complete .brand-loader__detail,
.brand-loader.is-complete .brand-loader__detail--delay {
  animation: brand-loader-complete-detail 420ms ease forwards;
}

.brand-loader.is-complete .brand-loader__fill {
  animation: brand-loader-fill-in 380ms ease forwards;
  animation-delay: 180ms;
}

@keyframes brand-loader-draw-outline {
  0% {
    stroke-dashoffset: 100;
  }

  70% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes brand-loader-draw-detail {
  0%,
  18% {
    stroke-dashoffset: 100;
  }

  74%,
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes brand-loader-trace-outline {
  from {
    stroke-dashoffset: 100;
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes brand-loader-trace-detail {
  from {
    stroke-dashoffset: 100;
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes brand-loader-complete-outline {
  from {
    stroke-dashoffset: var(--loader-outline-offset, 0);
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes brand-loader-complete-detail {
  from {
    stroke-dashoffset: var(--loader-detail-offset, 0);
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes brand-loader-fill-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes brand-loader-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(8, 144, 243, 0));
  }

  50% {
    filter: drop-shadow(0 0 18px rgba(8, 144, 243, 0.22));
  }
}

@keyframes brand-loader-backdrop {
  0% {
    opacity: 0.72;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-loader,
  .brand-loader * {
    animation: none !important;
    transition: none !important;
  }

  .brand-loader__outline,
  .brand-loader__detail {
    stroke-dashoffset: 0;
  }

  .brand-loader__fill {
    opacity: 1;
  }
}
