/* ==========================================================================
   English With Raj - Cursive Preloader Styles
   ========================================================================== */

html.loader-active,
body.loader-active {
  overflow: hidden !important;
}

#cursive-preloader {
  --bg-dark: #030304;
  --text-muted: #555555;
  --gold-light: #fce0ad;
  --gold: #b89047;
  --gold-dark: #8c6a2e;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #0a0907 0%, var(--bg-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 999999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  pointer-events: all;
  font-family: "Outfit", sans-serif;
}

#cursive-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Canvas Particle Background */
#cursive-preloader #particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Ambient radial gold glow */
#cursive-preloader .glow-overlay {
  position: absolute;
  width: 85vw;
  height: 85vw;
  max-width: 600px;
  max-height: 600px;
  background: radial-gradient(circle,
      rgba(184, 144, 71, 0.07) 0%,
      transparent 70%);
  z-index: 2;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: glow-pulse 7s infinite ease-in-out;
}

@keyframes glow-pulse {
  0%,
  100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(0.95);
  }

  50% {
    opacity: 1.2;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

#cursive-preloader .loader-container {
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 20px;
}

/* Responsive SVG Style */
#cursive-preloader .cursive-svg {
  width: 100%;
  max-width: 750px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0px 8px 24px rgba(184, 144, 71, 0.15));
  animation: svg-pulse 4.5s infinite ease-in-out;
}

@keyframes svg-pulse {
  0% {
    transform: scale(0.98);
    opacity: 1;
  }

  50% {
    transform: scale(1.01);
    opacity: 1;
  }

  80% {
    transform: scale(1.01);
    opacity: 1;
  }

  90%,
  100% {
    transform: scale(0.98);
    opacity: 0;
  }
}

#cursive-preloader .svg-text {
  font-family: "Great Vibes", cursive;
  font-size: 80px;
  font-weight: 400;
  text-anchor: middle;
  dominant-baseline: middle;
  transition: font-size 0.3s ease;
}

@media (max-width: 576px) {
  #cursive-preloader .svg-text {
    font-size: 100px;
  }
}

/* Drawing Animations - Unified 4.5s Loop */
#cursive-preloader .white-stroke {
  fill: transparent;
  stroke: #ffffff;
  stroke-width: 1.5px;
  stroke-dasharray: 650;
  stroke-dashoffset: 650;
  animation: draw-part1 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

#cursive-preloader .gold-stroke {
  fill: transparent;
  stroke: #e5c060;
  stroke-width: 1.5px;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw-part2 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Keyframes for Part 1 (English With) */
@keyframes draw-part1 {
  0% {
    stroke-dashoffset: 650;
    stroke: rgba(255, 255, 255, 0.85);
  }

  35% {
    stroke-dashoffset: 0;
    stroke: rgba(255, 255, 255, 0.85);
  }

  55%,
  80% {
    stroke-dashoffset: 0;
    stroke: rgba(255, 255, 255, 0);
  }

  90%,
  100% {
    stroke-dashoffset: 650;
    stroke: rgba(255, 255, 255, 0);
  }
}

/* Keyframes for Part 2 (Raj) */
@keyframes draw-part2 {
  0%,
  8% {
    stroke-dashoffset: 200;
    stroke: rgba(229, 192, 96, 0);
  }

  9% {
    stroke: rgba(229, 192, 96, 0.9);
  }

  45% {
    stroke-dashoffset: 0;
    stroke: rgba(229, 192, 96, 0.9);
  }

  55%,
  80% {
    stroke-dashoffset: 0;
    stroke: rgba(229, 192, 96, 0);
  }

  90%,
  100% {
    stroke-dashoffset: 200;
    stroke: rgba(229, 192, 96, 0);
  }
}

/* Fill styles for final solid text */
#cursive-preloader .white-fill {
  fill: #ffffff;
  stroke: transparent;
}

#cursive-preloader .gold-fill {
  fill: url(#goldGradient);
  stroke: transparent;
}

/* Mask Rectangle Animation for Left-to-Right Gradual Fill */
#cursive-preloader .mask-rect {
  transform: translateX(0px);
  animation: reveal-fill 4.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes reveal-fill {
  0%,
  12% {
    transform: translateX(0px);
  }

  55%,
  80% {
    transform: translateX(1000px);
  }

  90%,
  100% {
    transform: translateX(0px);
  }
}

/* Minimalist Progress Loader Underneath */
#cursive-preloader .progress-bar-container {
  width: 160px;
  height: 2px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-top: 15px;
  animation: bar-glow 4.5s infinite ease-in-out;
}

#cursive-preloader .progress-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e5c060 0%, #b89047 100%);
  position: absolute;
  left: -100%;
  animation: sync-progress 4.5s infinite cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes sync-progress {
  0%,
  12% {
    left: -100%;
  }

  55%,
  80% {
    left: 0;
    opacity: 1;
  }

  90%,
  100% {
    left: 100%;
    opacity: 0;
  }
}

@keyframes bar-glow {
  0%,
  100% {
    opacity: 0.1;
  }

  15%,
  80% {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  #cursive-preloader .progress-bar-container {
    width: 120px;
  }
}
