/* ═══════════════════════════════════════════════════════════════
   loader.css — Pantalla de carga con MorphText
═══════════════════════════════════════════════════════════════ */

/* ─── OVERLAY ────────────────────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg, #070514);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  /* Fade-out cuando JS agrega .loader--hidden */
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ─── LOGO ───────────────────────────────────────────────────── */
.loader__logo {
  height: clamp(2.5rem, 6vw, 4.5rem);
  width: auto;
  object-fit: contain;
  animation: loaderLogoIn 0.8s ease both;
}
@keyframes loaderLogoIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── MORPH CONTAINER ────────────────────────────────────────── */
/*
  filter: url(#morph-threshold) aplicado aqui — igual que el componente React.
  El feColorMatrix + feComposite hace que los blurs solapados se "fusionen"
  creando el efecto morph entre palabras.
*/
.loader__morph-container {
  filter: url(#morph-threshold);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── WORD ROTATOR ───────────────────────────────────────────── */
.loader__word-rotator {
  position: relative;
  height: 1.2em;
  min-width: 14ch;
  font-size: clamp(2.5rem, 10vw, 7rem);
  font-weight: 700;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cada palabra — absoluta, centrada, empieza invisible */
.loader__word {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  white-space: nowrap;
  color: #fff;
  /* Gradiente de texto igual que la paleta del sitio */
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

  /*
    Port 1:1 de wordStyles del componente:
      animationDuration: totalDuration (9s para 3 palabras x 3s)
      animationDelay:    i * wordDuration (0s, 3s, 6s)
    Se asignan como inline style desde el HTML.
  */
  animation-name: morphWordRotate;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}

/* ─── KEYFRAME — port directo del componente ─────────────────── */
@keyframes morphWordRotate {
  0% {
    opacity: 0;
    filter: blur(20px);
    transform: translate(-50%, -50%) scale(0.8);
  }
  5% {
    opacity: 0.5;
    filter: blur(10px);
  }
  15%, 35% {
    opacity: 1;
    filter: blur(0px);
    transform: translate(-50%, -50%) scale(1);
  }
  45% {
    opacity: 0.5;
    filter: blur(10px);
  }
  50%, 100% {
    opacity: 0;
    filter: blur(20px);
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* ─── REDUCED MOTION ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .loader__word {
    animation: morphWordRotateSafe var(--morph-duration, 9s) step-start infinite both;
  }
  @keyframes morphWordRotateSafe {
    0%, 100% { opacity: 0; filter: none; transform: translate(-50%,-50%); }
    5%, 45%  { opacity: 1; filter: none; transform: translate(-50%,-50%); }
  }
}
