#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  color: #f2d798;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 650ms ease, visibility 650ms ease, transform 650ms ease;
}

#loader::before {
  content: "";
  position: absolute;
  width: min(58vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(212, 175, 55, 0.24), rgba(212, 175, 55, 0.08) 34%, transparent 66%);
  filter: blur(10px);
  animation: loaderGlow 1700ms ease-in-out infinite;
}

.loader-inner {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  opacity: 0;
  transform: scale(0.82);
  animation: loaderIntro 650ms ease forwards;
}

#loader img {
  width: clamp(84px, 22vw, 132px);
  aspect-ratio: 1;
  object-fit: contain;
  filter:
    drop-shadow(0 0 14px rgba(212, 175, 55, 0.42))
    drop-shadow(0 0 34px rgba(212, 175, 55, 0.2));
  animation: loaderLogoPulse 1500ms ease-in-out infinite;
}

#loader p {
  margin: 0;
  color: #f2d798;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.loader-dots::after {
  content: "";
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: loaderDots 1200ms steps(4, end) infinite;
}

.loader-bar {
  position: relative;
  width: min(180px, 52vw);
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.18);
}

.loader-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #d4af37, #f2d798, transparent);
  transform: translateX(-100%);
  animation: loaderBar 1200ms ease-in-out infinite;
}

#loader.loader-hide {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
}

@keyframes loaderIntro {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes loaderGlow {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes loaderLogoPulse {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.035) rotate(1.2deg);
  }
}

@keyframes loaderDots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

@keyframes loaderBar {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  #loader,
  #loader::before,
  .loader-inner,
  #loader img,
  .loader-dots::after,
  .loader-bar::before {
    animation: none;
  }

  .loader-inner {
    opacity: 1;
    transform: none;
  }
}
