/* ==========================================================================
   WAYONAA EV - Premium Animated Preloader Stylesheet (preloader.css)
   Aesthetic: Electric Light Reveal (Luxury Automotive Style)
   ========================================================================== */

/* Prevent page scrolling and content flashing while preloader is active */
body.preloader-active {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
}

/* --- 1. Fullscreen Preloader Overlay --- */
.wayonaa-preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background-color: #FFFFFF;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: all;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, opacity;
}

/* Subtle luxury warm-light vignette (barely perceptible ambient warmth) */
.wayonaa-preloader::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 1) 0%, rgba(250, 250, 248, 0.95) 75%, rgba(244, 245, 246, 0.85) 100%);
  pointer-events: none;
  z-index: 1;
}

/* --- 2. Preloader Central Stage --- */
.preloader-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  padding: 1.5rem;
  will-change: transform, opacity;
}

/* --- 3. Logo Reveal Frame --- */
.preloader-logo-wrapper {
  position: relative;
  width: clamp(210px, 22vw, 270px);
  aspect-ratio: 300 / 80;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Base image styling */
.preloader-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Phase 1: Subtle ghost silhouette */
.preloader-logo-base {
  opacity: 0.05;
  filter: grayscale(1);
  transition: opacity 0.3s ease;
}

/* Phase 2: High-definition revealed logo (clipped from left to right) */
.preloader-logo-reveal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 100% 0 0);
  -webkit-clip-path: inset(0 100% 0 0);
  will-change: clip-path;
}

.preloader-logo-active {
  opacity: 1;
}

/* --- 4. Electric Light Beam (Moving Slit of Light) --- */
.preloader-light-beam {
  position: absolute;
  top: -14px;
  bottom: -14px;
  width: 2.5px;
  left: 0%;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    rgba(255, 91, 0, 0) 0%,
    rgba(255, 91, 0, 0.9) 20%,
    #FFFFFF 50%,
    rgba(255, 91, 0, 0.9) 80%,
    rgba(255, 91, 0, 0) 100%
  );
  box-shadow:
    0 0 10px rgba(255, 91, 0, 0.75),
    0 0 20px rgba(255, 91, 0, 0.35);
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  will-change: left, opacity;
  z-index: 5;
}

/* Restrained trailing electric aura behind the light beam */
.preloader-light-beam::after {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  right: 0;
  width: 24px;
  background: linear-gradient(
    270deg,
    rgba(255, 91, 0, 0.32) 0%,
    rgba(255, 120, 30, 0.08) 70%,
    rgba(255, 255, 255, 0) 100%
  );
  border-radius: 999px 0 0 999px;
  filter: blur(3px);
  pointer-events: none;
}

/* --- 5. Phase 3: Signature Line Beneath Logo --- */
.preloader-signature-line-track {
  position: relative;
  width: clamp(110px, 12vw, 150px);
  height: 2px;
  margin-top: clamp(20px, 2.5vh, 28px);
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader-signature-line {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 91, 0, 0) 0%,
    #FF5B00 25%,
    #FFA86B 50%,
    #FF5B00 75%,
    rgba(255, 91, 0, 0) 100%
  );
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: center center;
  box-shadow: 0 0 8px rgba(255, 91, 0, 0.45);
  will-change: transform, opacity;
}

/* Center light pulse when the line begins expanding */
.preloader-signature-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow:
    0 0 10px #FF5B00,
    0 0 20px #FF5B00;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* --- 6. Responsive Tuning --- */
@media (max-width: 767.98px) {
  .preloader-logo-wrapper {
    width: 190px;
  }
  .preloader-light-beam {
    top: -10px;
    bottom: -10px;
    width: 2px;
  }
  .preloader-signature-line-track {
    width: 100px;
    margin-top: 18px;
  }
}

/* --- 7. Reduced Motion Support --- */
@media (prefers-reduced-motion: reduce) {
  .preloader-light-beam,
  .preloader-signature-pulse {
    display: none !important;
  }
  .preloader-logo-reveal {
    clip-path: none !important;
    -webkit-clip-path: none !important;
  }
  .preloader-signature-line {
    transform: scaleX(1) !important;
  }
}
