/* ==========================================================================
   THE MICRO CREDIT VILLAGE - PRELOADER STYLES
   ========================================================================== */
.site-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, #0B3564 0%, #072242 55%, #031224 100%);
  overflow: hidden;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.65s ease,
              visibility 0.65s;
  will-change: opacity, transform, filter;
}

.site-preloader.preloader-dismissing {
  opacity: 0;
  transform: scale(1.035);
  filter: blur(5px);
  pointer-events: none;
}

.site-preloader.preloader-hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Ambient Glow & Constellation Grid */
.preloader-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.preloader-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
  animation: preloaderAuraPulse 4s ease-in-out infinite alternate;
}

.preloader-glow-1 {
  width: 320px;
  height: 320px;
  background: #0B8F4D;
  top: 30%;
  left: 35%;
}

.preloader-glow-2 {
  width: 280px;
  height: 280px;
  background: #D7AA42;
  bottom: 25%;
  right: 35%;
  animation-delay: -2s;
}

.preloader-glow-3 {
  width: 240px;
  height: 240px;
  background: #D71920;
  top: 55%;
  left: 45%;
  opacity: 0.16;
  animation-delay: -1s;
}

@keyframes preloaderAuraPulse {
  0% { transform: scale(0.9) translate(-10px, -10px); opacity: 0.22; }
  100% { transform: scale(1.15) translate(10px, 10px); opacity: 0.34; }
}

/* Geometric Network Matrix Grid */
.preloader-grid {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px, 64px 64px, 64px 64px;
  opacity: 0.45;
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 75%);
}

/* Content Container */
.preloader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  max-width: 440px;
  width: 90%;
  box-sizing: border-box;
}

/* Emblem Container with Multi-Ring Kinematics */
.preloader-emblem {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Orbit Ring 1: Outer Emerald Orbit with Satellite */
.orbit-ring-outer {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #0B8F4D;
  border-right-color: rgba(11, 143, 77, 0.25);
  animation: preloaderSpin 2.4s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  box-shadow: 0 0 16px rgba(11, 143, 77, 0.25);
}

.orbit-satellite {
  position: absolute;
  top: 3px;
  right: 12px;
  width: 9px;
  height: 9px;
  background: #25D366;
  border-radius: 50%;
  box-shadow: 0 0 10px #25D366, 0 0 20px #25D366;
}

/* Orbit Ring 2: Middle Savannah Gold Counter-Rotating Dashed Orbit */
.orbit-ring-middle {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(215, 170, 66, 0.7);
  animation: preloaderSpinReverse 4s linear infinite;
}

/* Orbit Ring 3: Inner Crimson/Blue Gradient Pulse Ring */
.orbit-ring-inner {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-bottom-color: #D71920;
  border-left-color: #0B4F9C;
  animation: preloaderSpin 1.8s ease-in-out infinite;
}

/* Core Brand Medallion */
.emblem-core {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 0 4px rgba(255, 255, 255, 0.15),
    0 0 25px rgba(215, 170, 66, 0.3);
  animation: preloaderCoreBreathe 2.4s ease-in-out infinite;
}

.preloader-logo {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block !important;
  object-fit: contain !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

@keyframes preloaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes preloaderSpinReverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes preloaderCoreBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 255, 255, 0.15), 0 0 25px rgba(215, 170, 66, 0.3); }
  50% { transform: scale(1.04); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.22), 0 0 35px rgba(215, 170, 66, 0.55); }
}

/* Typography */
.preloader-brand {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.18em !important;
  text-transform: uppercase !important;
  color: #FFFFFF !important;
  margin: 0 0 6px 0 !important;
  background: linear-gradient(135deg, #FFFFFF 30%, #E6EDF5 70%, #D7AA42 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.preloader-tagline {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  color: rgba(235, 243, 252, 0.85) !important;
  margin: 0 0 20px 0 !important;
  letter-spacing: 0.04em !important;
}

/* Kenyan Tricolor Progress Sweep */
.preloader-progress-wrap {
  width: 220px !important;
  height: 4px !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  position: relative !important;
  margin-bottom: 14px !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

.preloader-progress-fill {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  height: 100% !important;
  width: 100% !important;
  background: linear-gradient(90deg, #0B8F4D 0%, #D7AA42 35%, #0B4F9C 70%, #D71920 100%) !important;
  background-size: 200% 100% !important;
  border-radius: 999px !important;
  animation: preloaderProgressSweep 1.6s ease-in-out infinite, preloaderProgressFill 1.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes preloaderProgressSweep {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes preloaderProgressFill {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(-20%); }
  100% { transform: translateX(0%); }
}

/* Status Pill */
.preloader-status {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 5px 12px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border-radius: 999px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #EDF4FA !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
}

.preloader-status .pulse-dot {
  width: 6px !important;
  height: 6px !important;
  background-color: #25D366 !important;
  border-radius: 50% !important;
  box-shadow: 0 0 8px #25D366 !important;
  animation: pulseDot 1.4s ease-in-out infinite !important;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  .site-preloader {
    transition: opacity 0.2s ease !important;
  }
  .orbit-ring-outer,
  .orbit-ring-middle,
  .orbit-ring-inner,
  .emblem-core,
  .preloader-glow,
  .preloader-progress-fill,
  .pulse-dot {
    animation: none !important;
  }
}

/* Mobile responsive scaling */
@media (max-width: 480px) {
  .preloader-emblem {
    width: 120px;
    height: 120px;
    margin-bottom: 18px;
  }
  .emblem-core {
    width: 82px;
    height: 82px;
    padding: 10px;
  }
  .preloader-brand {
    font-size: 1rem !important;
    letter-spacing: 0.14em !important;
  }
  .preloader-tagline {
    font-size: 0.76rem !important;
  }
  .preloader-progress-wrap {
    width: 180px !important;
  }
}
