/* ============================================================
   QALAM PLATFORM - LUXURY CALLIGRAPHY PRELOADER STYLES
   Masterpiece Splash Screen with Fountain Pen Animation
   ============================================================ */

.qalam-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(110% 110% at 50% 30%, #062333 0%, #03141f 50%, #010a10 100%);
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  direction: rtl;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
  overflow: hidden;
}

.qalam-preloader.dismissed {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  pointer-events: none;
}

/* Multi-layered Ambient Light Auras */
.preloader-glow-primary {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.25) 0%, rgba(13, 148, 136, 0.08) 50%, transparent 70%);
  filter: blur(55px);
  pointer-events: none;
  animation: qalamAmbientBreathe 3.5s ease-in-out infinite alternate;
}

.preloader-glow-secondary {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.2) 0%, transparent 65%);
  filter: blur(35px);
  pointer-events: none;
}

@keyframes qalamAmbientBreathe {
  0% {
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0.7;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 1;
  }
}

/* Ambient Canvas for Floating Dust & Pen Sparks */
.preloader-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Center Content Container */
.preloader-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 560px;
  padding: 0 20px;
}

/* Logo Stage Container */
.logo-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 822 / 370;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.logo-stage-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 12px 35px rgba(0, 0, 0, 0.65));
}

/* Individual Drawing Paths - Completely hidden until pen starts drawing */
.draw-path {
  opacity: 0;
  fill-opacity: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s ease, fill-opacity 0.6s ease;
}

.draw-path.drawing {
  opacity: 1;
}

.draw-path.filled {
  opacity: 1;
  fill-opacity: 1;
}

/* The Calligraphy Fountain Pen Nib */
.fountain-pen {
  position: absolute;
  top: 0;
  left: 0;
  width: 62px;
  height: 62px;
  pointer-events: none;
  z-index: 30;
  transform-origin: 50% 100%;
  opacity: 0;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.75));
  will-change: transform, opacity;
  transition: opacity 0.25s ease;
}

/* Glowing Ink Sparkle at Nib Point */
.pen-tip-sparkle {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 14px;
  height: 14px;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 10%, #5eead4 50%, #14b8a6 80%, transparent 100%);
  box-shadow: 0 0 14px #2dd4bf, 0 0 28px #14b8a6, 0 0 45px rgba(45, 212, 191, 0.8);
  pointer-events: none;
  animation: qalamTipPulse 0.6s ease-in-out infinite alternate;
}

@keyframes qalamTipPulse {
  0% { transform: translate(-50%, 50%) scale(0.8); opacity: 0.85; }
  100% { transform: translate(-50%, 50%) scale(1.35); opacity: 1; }
}

/* Cinematic Shimmer Sweep Light Wave across Logo */
.logo-shimmer-sweep {
  position: absolute;
  inset: -10px -15px;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
  border-radius: 20px;
  opacity: 0;
}

.logo-shimmer-sweep.active {
  opacity: 1;
}

.logo-shimmer-sweep::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -120%;
  width: 70%;
  height: 220%;
  background: linear-gradient(
    115deg,
    transparent 15%,
    rgba(255, 255, 255, 0.08) 35%,
    rgba(45, 212, 191, 0.5) 48%,
    rgba(255, 255, 255, 0.95) 52%,
    rgba(45, 212, 191, 0.5) 56%,
    rgba(255, 255, 255, 0.08) 68%,
    transparent 85%
  );
  transform: rotate(25deg);
  animation: qalamShimmerSweep 1.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes qalamShimmerSweep {
  0% { left: -120%; }
  100% { left: 220%; }
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .logo-stage-wrap {
    max-width: 86vw;
    margin: 0;
  }
  .fountain-pen {
    width: 48px;
    height: 48px;
  }
}
