/**
 * SOLTYP PRELOADER - CSS COMPLETO
 * Sistema multi-fase de preloader con animaciones AAA
 */

/* ===========================================
   VARIABLES CSS
   =========================================== */
:root {
  --soltyp-orange: #E67E22;
  --soltyp-cyan: #00BCD4;
  --soltyp-dark-bg: #1a1a1a;
  
  /* Timings de animación */
  --preloader-duration: 5000ms;
  --fade-duration: 500ms;
}

/* ===========================================
   CONTENEDOR PRINCIPAL
   =========================================== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a 0%, #2C3E50 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity var(--fade-duration) ease;
}

#preloader.loaded {
  pointer-events: none;
}

/* ===========================================
   PARTICLES CANVAS (FASE 1)
   =========================================== */
#particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

/* ===========================================
   POWER ICON CONTAINER (FASES 2-3)
   =========================================== */
#power-icon-container {
  position: absolute;
  width: 120px;
  height: 120px;
  z-index: 3;
  opacity: 0;
  will-change: transform, opacity;
}

#power-icon {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px var(--soltyp-orange))
          drop-shadow(0 0 40px var(--soltyp-cyan));
}

/* Anillos de expansión */
.expansion-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid var(--soltyp-orange);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}

/* ===========================================
   LOGO TEXT (FASE 4)
   =========================================== */
#logo-container {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 4;
  opacity: 0;
}

#logo-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.logo-letter {
  display: inline-block;
  color: #fff;
  opacity: 0;
  transform: scale(0.5) rotate(180deg);
  text-shadow: 
    0 0 20px var(--soltyp-orange),
    0 0 40px var(--soltyp-cyan);
  will-change: transform, opacity;
}

.logo-letter.power-o {
  color: var(--soltyp-orange);
  font-weight: 800;
}

/* ===========================================
   TAGLINE (FASE 4)
   =========================================== */
#tagline {
  position: absolute;
  bottom: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soltyp-cyan);
  opacity: 0;
  z-index: 5;
  white-space: nowrap;
}

/* ===========================================
   GRID DE PUNTOS REACTIVO (FASE 3)
   =========================================== */
#reactive-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  grid-template-rows: repeat(13, 1fr);
  gap: 0;
  z-index: 2;
  pointer-events: none;
}

.grid-dot {
  width: 4px;
  height: 4px;
  background: var(--soltyp-cyan);
  border-radius: 50%;
  opacity: 0.3;
  justify-self: center;
  align-self: center;
  will-change: transform, opacity;
}

/* ===========================================
   SKIP BUTTON (ACCESIBILIDAD)
   =========================================== */
#skip-preloader {
  position: absolute;
  bottom: 30px;
  right: 30px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

#skip-preloader:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: var(--soltyp-orange);
}

#skip-preloader.visible {
  opacity: 1;
}

/* ===========================================
   LOADING PERCENTAGE (OPCIONAL)
   =========================================== */
#loading-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Space Grotesk', monospace;
  font-size: 72px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.1);
  z-index: 1;
  letter-spacing: -0.05em;
  opacity: 0;
  pointer-events: none;
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */
@media (max-width: 768px) {
  #power-icon-container {
    width: 90px;
    height: 90px;
  }
  
  #logo-text {
    font-size: 36px;
  }
  
  #tagline {
    font-size: 11px;
    bottom: 35%;
  }
  
  #reactive-grid {
    width: 300px;
    height: 300px;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
  }
  
  #skip-preloader {
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  #power-icon-container {
    width: 80px;
    height: 80px;
  }
  
  #logo-text {
    font-size: 28px;
    gap: 2px;
  }
  
  #tagline {
    font-size: 10px;
  }
}

/* ===========================================
   ACCESIBILIDAD: REDUCED MOTION
   =========================================== */
@media (prefers-reduced-motion: reduce) {
  #preloader * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  #particles-canvas {
    display: none;
  }
  
  #reactive-grid {
    display: none;
  }
  
  #logo-container {
    opacity: 1 !important;
  }
  
  .logo-letter {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ===========================================
   GPU ACCELERATION
   =========================================== */
#preloader,
#particles-canvas,
#power-icon-container,
#logo-container,
.expansion-ring,
.logo-letter,
.grid-dot {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===========================================
   FALLBACK ESTÁTICO
   =========================================== */
.no-js #preloader,
.preloader-error #preloader {
  background: var(--soltyp-dark-bg);
}

.no-js #particles-canvas,
.preloader-error #particles-canvas {
  display: none;
}

.no-js #logo-container,
.preloader-error #logo-container {
  opacity: 1 !important;
}

.no-js .logo-letter,
.preloader-error .logo-letter {
  opacity: 1 !important;
  transform: none !important;
}
