/* ============================================
   AksVerse Loading Screen
   Uses the same theme variables as the rest of
   the site, so it matches dark/light mode.
   ============================================ */

#aksverse-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

/* Fade-out state, toggled by JS once the page is ready */
#aksverse-loader.aksverse-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---- Particle network background ---- */
.aksverse-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Everything else sits above the canvas */
#aksverse-loader > *:not(.aksverse-particles) {
  position: relative;
  z-index: 1;
}

/* ---- Hex mark ---- */
.aksverse-hex {
  width: 110px;
  height: 110px;
  margin-bottom: 28px;
  animation: aksverse-spin 3.2s linear infinite;
  transform-origin: center;
}

.hex-outer {
  fill: none;
  stroke: var(--primary-color);
  stroke-width: 2.5;
}

.hex-inner {
  fill: none;
  stroke: var(--tertiary-color);
  stroke-width: 1.5;
  opacity: 0.7;
}

.hex-core {
  fill: var(--primary-color);
  /* scale from the circle's own centre, not the SVG's top-left corner */
  transform-origin: 80px 80px;
  animation: aksverse-pulse 1.8s ease-in-out infinite;
}

.hex-dot {
  fill: var(--tertiary-color);
}

@keyframes aksverse-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes aksverse-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(0.85); }
}

/* ---- Reveal everything together ----
   The hex mark, text and dots all stay hidden until the `fonts-loaded`
   class is added by JS (once the real webfont has loaded), then fade
   in as ONE unit. This stops the logo showing first and the text
   popping in a moment later. */
.aksverse-hex,
.aksverse-title,
.aksverse-subtitle,
.aksverse-dots,
.aksverse-loading {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.fonts-loaded .aksverse-hex,
.fonts-loaded .aksverse-title,
.fonts-loaded .aksverse-subtitle,
.fonts-loaded .aksverse-dots,
.fonts-loaded .aksverse-loading {
  opacity: 1;
}

.aksverse-title {
  margin: 0;
  font-family: var(--mono-font);
  font-weight: 700;
  font-size: clamp(24px, 5vw, 42px);
  color: var(--text-on-bg);
  letter-spacing: 1px;
  text-align: center;
}

.aksverse-subtitle {
  margin: 10px 0 0;
  font-family: var(--mono-font);
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-on-surface);
  text-align: center;
}

/* ---- Loading dots ---- */
.aksverse-dots {
  display: flex;
  gap: 14px;
  margin-top: 46px;
}

.aksverse-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: aksverse-dot-pulse 1.2s ease-in-out infinite;
}

.aksverse-dots span:nth-child(1) { animation-delay: 0s; }
.aksverse-dots span:nth-child(2) { animation-delay: 0.15s; }
.aksverse-dots span:nth-child(3) { animation-delay: 0.3s; }
.aksverse-dots span:nth-child(4) { animation-delay: 0.45s; }

@keyframes aksverse-dot-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40%           { opacity: 1;    transform: scale(1); }
}

/* ---- "Loading..." label ---- */
.aksverse-loading {
  margin-top: 22px;
  font-family: var(--mono-font);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-on-surface);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .aksverse-hex,
  .hex-core,
  .aksverse-dots span {
    animation: none;
  }
}
