/* =========================================== */
/* SPLASH GLOBAL (LAUNCH SCREEN)               */
/* =========================================== */

/* ===== Variables del splash ===== */
:root {
  --splash-bg-base: #000;
  --splash-bg-radial: radial-gradient(circle at 50% 40%, #1a1a1a 0%, #000 70%);
  --splash-text: #ffffff;
  --splash-glow-soft: rgba(255, 255, 255, 0.15);
  --splash-logo-drop: rgba(255, 255, 255, 0.25);
  --splash-progress-bg: rgba(255, 255, 255, 0.12);
  --splash-progress-glow: rgba(255, 255, 255, 0.4);
  --splash-progress-fill: linear-gradient(90deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 1) 50%,
      rgba(255, 255, 255, 0.4) 100%);
}

html.light {
  --splash-bg-base: #ffffff;
  --splash-bg-radial: radial-gradient(circle at 50% 40%, #f0ece6 0%, #ffffff 70%);
  --splash-text: #8B4513;
  --splash-glow-soft: rgba(139, 69, 19, 0.15);
  --splash-logo-drop: rgba(139, 69, 19, 0.25);
  --splash-progress-bg: rgba(0, 0, 0, 0.1);
  --splash-progress-glow: rgba(139, 69, 19, 0.4);
  --splash-progress-fill: linear-gradient(90deg,
      rgba(139, 69, 19, 0.4) 0%,
      rgba(139, 69, 19, 1) 50%,
      rgba(139, 69, 19, 0.4) 100%);
}

/* ===== Bloqueo de scroll durante el splash ===== */
html.loading-active,
body.loading-active {
  overflow: hidden;
  height: 100vh;
  margin: 0;
  pointer-events: none;
  background: var(--splash-bg-base);
}

/* ===== Overlay principal ===== */
#loading-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--splash-bg-base);
  background-image: var(--splash-bg-radial);
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--splash-text);
  text-align: center;
  opacity: 1;
  transition: opacity 0.6s ease;
  box-sizing: border-box;
  pointer-events: all;
  overflow: hidden;
  padding-bottom: 10vh;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ===== Grupo central ===== */
.logo-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  animation: splashFadeUp 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes splashFadeUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Logo ===== */
.logo-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  max-width: 80%;
  aspect-ratio: 1 / 1;
}

.logo-wrapper::before {
  content: '';
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--splash-glow-soft) 0%, transparent 60%);
  animation: splashGlow 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes splashGlow {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.95);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.08);
  }
}

.logo-image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 24px;
  filter: drop-shadow(0 0 12px var(--splash-logo-drop));
  animation: splashLogoIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes splashLogoIn {
  from {
    opacity: 0;
    transform: scale(0.85);
    filter: drop-shadow(0 0 0 transparent) blur(8px);
  }

  to {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 12px var(--splash-logo-drop)) blur(0);
  }
}

/* ===== Nombre de la app ===== */
.app-name {
  margin-top: 32px;
  font-size: 2.2em;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--splash-text);
  text-transform: uppercase;
  opacity: 0;
  animation: splashNameIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

@keyframes splashNameIn {
  from {
    opacity: 0;
    transform: translateY(12px);
    letter-spacing: 14px;
  }

  to {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: 6px;
  }
}

/* ===== Barra de progreso minimalista ===== */
.splash-progress {
  margin-top: 42px;
  width: 160px;
  max-width: 60%;
  height: 2px;
  background: var(--splash-progress-bg);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  animation: splashFadeIn 0.8s ease 1s both;
}

.splash-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--splash-progress-fill);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--splash-progress-glow);
  animation: splashProgress 6s cubic-bezier(0.4, 0, 0.2, 1) 1s forwards;
}

@keyframes splashProgress {
  from {
    width: 0%;
  }

  to {
    width: 100%;
  }
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ===== Footer del splash (solo ID) ===== */
.splash-footer {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: splashFadeIn 0.6s ease 1.2s both;
  pointer-events: none;
  padding: 0 16px;
  box-sizing: border-box;
}

.splash-footer-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--splash-text);
  background: var(--splash-progress-bg);
  padding: 8px 14px;
  border-radius: 6px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.25s ease,
    box-shadow 0.25s ease;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
}

@media (hover: hover) and (pointer: fine) {
  .splash-footer-id:hover {
    transform: scale(1.08);
    background: var(--splash-glow-soft);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.18),
      0 0 0 1px var(--splash-glow-soft);
  }
}

.splash-footer-id:active {
  transform: scale(0.98);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .logo-wrapper {
    width: 240px;
  }

  .app-name {
    font-size: 1.7em;
    margin-top: 26px;
    letter-spacing: 4px;
    animation-delay: 0.4s;
  }

  @keyframes splashNameIn {
    from {
      opacity: 0;
      transform: translateY(10px);
      letter-spacing: 10px;
    }

    to {
      opacity: 1;
      transform: translateY(0);
      letter-spacing: 4px;
    }
  }

  .splash-progress {
    margin-top: 32px;
    width: 130px;
  }

  #loading-overlay {
    padding-bottom: 8vh; /* sube el bloque ~80px en móvil */
    box-sizing: border-box;
  }

  .splash-footer {
    bottom: 18px;
  }

  .splash-footer-id {
    font-size: 11px;
    padding: 6px 10px;
  }
}