/* ========================================================
   IGM COMPUTER - CYBER MATRIX PRELOADER STYLES
   Monochrome Cyber Matrix with Luminous Typing, Particles & Waves
   ======================================================== */

#site-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  background-color: #000000;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: opacity 0.75s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.75s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
}

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

/* Background Ambient Motion Layer */
.loader-ambient-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Dark Charcoal / Graphite Ambient Orbs */
.loader-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.loader-orb-1 {
  top: -12%;
  left: -8%;
  width: 65vw;
  height: 65vw;
  max-width: 900px;
  max-height: 900px;
  background: radial-gradient(circle, rgba(28, 28, 28, 0.7) 0%, rgba(22, 22, 22, 0.5) 50%, rgba(13, 13, 13, 0.1) 80%, transparent 100%);
  filter: blur(140px);
  animation: floatOrb1 18s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  will-change: transform, opacity;
}

.loader-orb-2 {
  bottom: -15%;
  right: -8%;
  width: 70vw;
  height: 70vw;
  max-width: 980px;
  max-height: 980px;
  background: radial-gradient(circle, rgba(24, 24, 24, 0.65) 0%, rgba(20, 20, 20, 0.45) 50%, rgba(10, 10, 10, 0.1) 80%, transparent 100%);
  filter: blur(150px);
  animation: floatOrb2 22s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  will-change: transform, opacity;
}

.loader-orb-3 {
  top: 20%;
  right: 12%;
  width: 45vw;
  height: 45vw;
  max-width: 650px;
  max-height: 650px;
  background: radial-gradient(circle, rgba(31, 31, 31, 0.5) 0%, rgba(20, 20, 20, 0.35) 50%, transparent 80%);
  filter: blur(125px);
  animation: floatOrb3 16s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  will-change: transform, opacity;
}

.loader-orb-4 {
  bottom: 20%;
  left: 15%;
  width: 40vw;
  height: 40vw;
  max-width: 600px;
  max-height: 600px;
  background: radial-gradient(circle, rgba(26, 26, 26, 0.45) 0%, rgba(17, 17, 17, 0.3) 50%, transparent 80%);
  filter: blur(130px);
  animation: floatOrb4 24s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  will-change: transform, opacity;
}

@keyframes floatOrb1 {
  0%, 100% { transform: translate3d(-8%, -12%, 0) scale(1); opacity: 0.4; }
  50% { transform: translate3d(14%, 10%, 0) scale(1.15); opacity: 0.6; }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate3d(12%, 14%, 0) scale(1.1); opacity: 0.35; }
  50% { transform: translate3d(-12%, -8%, 0) scale(0.95); opacity: 0.55; }
}

@keyframes floatOrb3 {
  0%, 100% { transform: translate3d(4%, -18%, 0) scale(0.9); opacity: 0.3; }
  50% { transform: translate3d(-10%, 8%, 0) scale(1.2); opacity: 0.5; }
}

@keyframes floatOrb4 {
  0%, 100% { transform: translate3d(-15%, 15%, 0) scale(1.05); opacity: 0.25; }
  50% { transform: translate3d(10%, -10%, 0) scale(1.15); opacity: 0.45; }
}

/* 3D Cyber Matrix Perspective Grid - Charcoal / Neutral Silver */
.cyber-grid-perspective {
  position: absolute;
  inset: -50% -20%;
  height: 200%;
  width: 140%;
  transform: perspective(650px) rotateX(60deg) translateY(0);
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 70px 70px;
  animation: gridScroll 16s linear infinite;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 15%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 15%, transparent 75%);
  opacity: 0.45;
  pointer-events: none;
}

@keyframes gridScroll {
  0% { background-position: 0 0; }
  100% { background-position: 0 70px; }
}



/* Ambient Canvases */
#soundwave-canvas,
#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Interactive Cursor Spotlight */
#mouse-glow {
  position: absolute;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 35%, rgba(255, 255, 255, 0.008) 60%, transparent 75%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: opacity 0.5s ease;
  will-change: left, top;
  opacity: 0;
}

/* Radial Vignette & Contrast Masks */
.loader-center-mask {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  pointer-events: none;
}

.loader-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.95) 100%);
  pointer-events: none;
}

/* Central Stage & Typography */
.loader-stage {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
}

.loader-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 2rem;
  border-radius: 1rem;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.85s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.85s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform, filter;
}

.loader-container.fade-out {
  opacity: 0;
  transform: scale(0.975);
  filter: blur(5px);
}

.loader-typed-text {
  font-size: clamp(2.25rem, 8vw, 6.5rem);
  font-weight: 200;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1;
  white-space: pre;
  filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.45));
}

/* Blinking Cursor */
.loader-cursor {
  display: inline-block;
  width: clamp(2px, 0.35vw, 4px);
  height: 0.85em;
  margin-left: clamp(0.35rem, 0.8vw, 0.75rem);
  background-color: #ffffff;
  border-radius: 9999px;
  vertical-align: middle;
  transform: translateY(-2px);
  animation: smoothBlink 0.9s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes smoothBlink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 16px 2px rgba(255, 255, 255, 0.9), 0 0 30px rgba(255, 255, 255, 0.4);
  }
  50% {
    opacity: 0.2;
    box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  #site-preloader *,
  #site-preloader *::before,
  #site-preloader *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .loader-orb,
  .cyber-grid-perspective {
    animation: none !important;
  }
}
