/* ==========================================================================
   LOADING SCREEN — Kailasa Kaladhara
   Text-only reveal with gold particle canvas background.
   Letter-by-letter title animation + animated gold rule.
   Slides up after 4s to reveal the home page.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: #0D0818;
  display: none; /* hidden by default; JS enables it only on first load / reload */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  visibility: visible; /* override body visibility:hidden — screen must always show */

  /* The slide-up exit — triggered by JS adding .loading-exit */
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}

#loading-screen.loading-exit {
  transform: translateY(-100%);
}

/* --------------------------------------------------------------------------
   Breathing radial gradient — slow pulse from surface to bg
   -------------------------------------------------------------------------- */
#loading-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, #1C1535 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
  animation: bg-breathe 6s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Noise / grain texture overlay
   -------------------------------------------------------------------------- */
#loading-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   Particle canvas — fills the entire loading screen behind text
   -------------------------------------------------------------------------- */
.loading-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   Title — "Kailasa Kaladhara"
   Individual <span> letters are animated with staggered delays via JS
   -------------------------------------------------------------------------- */
.loading-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--weight-light);
  letter-spacing: 0.22em;
  color: var(--color-accent);
  text-align: center;
  text-transform: uppercase;
  line-height: 1;
  margin: 0;
  position: relative;
  z-index: 1;
}

.loading-title .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(12px);
  animation: char-reveal 0.5s ease forwards;
}

/* Space characters — no animation, just a gap */
.loading-title .char-space {
  display: inline-block;
  width: 0.35em;
}

/* --------------------------------------------------------------------------
   Gold rule — animates width 0 → 60px over 0.6s
   -------------------------------------------------------------------------- */
.loading-divider {
  height: 1px;
  width: 0;
  background: var(--color-accent);
  margin: var(--space-5) auto;
  position: relative;
  z-index: 1;
  animation: divider-expand 0.6s ease 1.4s forwards;
}

/* --------------------------------------------------------------------------
   Subtitle — "Cultural Organisation"
   -------------------------------------------------------------------------- */
.loading-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  color: var(--color-accent);
  text-align: center;
  text-transform: uppercase;
  margin: 0;
  opacity: 0;
  position: relative;
  z-index: 1;
  animation: fade-in-dim 0.8s ease 1.8s forwards;
}

/* --------------------------------------------------------------------------
   Keyframe animations
   -------------------------------------------------------------------------- */

/* Letter reveal — used by .char spans */
@keyframes char-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Gold rule width expansion */
@keyframes divider-expand {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 60px;
    opacity: 1;
  }
}

/* Generic slow fade-in */
@keyframes fade-in-slow {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Subtitle fade — lands at 0.7 to read as dimmed gold */
@keyframes fade-in-dim {
  from { opacity: 0; }
  to   { opacity: 0.7; }
}

/* Radial gradient breathe */
@keyframes bg-breathe {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.2); }
}

/* --------------------------------------------------------------------------
   Mobile adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .loading-title {
    font-size: var(--text-3xl);
    letter-spacing: 0.14em;
  }
}
