/* ============================================================
   Tela de carregamento.
   CSS bloqueante no head: pinta antes de o app carregar.
   ============================================================ */

#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(ellipse 78% 58% at 50% 34%, #1a3d57 0%, #0a1a27 72%);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: opacity 0.55s ease, visibility 0.55s;
}

#splash.saindo {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------------- nome em relevo com reflexo ---------------- */
.splash-cena {
  perspective: 1000px;
  perspective-origin: 50% 42%;
  text-align: center;
  padding: 20px;
}

.splash-nome {
  position: relative;
  display: inline-block;
  transform-style: preserve-3d;
  animation: flutuar 5s ease-in-out infinite;
}

.splash-frente {
  font-size: clamp(34px, 8.2vw, 78px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1;
  white-space: nowrap;
  background: linear-gradient(168deg, #ffffff 0%, #bfe2f3 38%, #4f9dc4 68%, #e4f5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5));
}

/* mesma coisa espelhada, apagando para baixo: o piso */
.splash-reflexo {
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  transform: scaleY(-1);
  opacity: 0.13;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 38%);
  mask-image: linear-gradient(transparent, #000 38%);
  filter: blur(1.8px);
}

.splash-reflexo .splash-frente {
  filter: none;
}

@keyframes flutuar {
  0%, 100% { transform: rotateY(-10deg) rotateX(3deg) translateY(0); }
  50%      { transform: rotateY(10deg) rotateX(-2deg) translateY(-6px); }
}

/* ---------------- linha de especialidade ---------------- */
/* fica abaixo do reflexo, que tem uma linha de altura */
.splash-especialidade {
  margin: 66px 0 0;
  font-size: clamp(8px, 1.6vw, 11px);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  animation: acender 0.8s ease forwards;
  animation-delay: 0.5s;
}

@keyframes acender {
  from { opacity: 0; letter-spacing: 9px; }
  to   { opacity: 0.42; letter-spacing: 4px; }
}

/* ---------------- barra de progresso ---------------- */
.splash-progresso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: clamp(200px, 46vw, 320px);
  margin: 22px auto 0;
  opacity: 0;
  animation: acenderBarra 0.8s ease forwards;
  animation-delay: 0.85s;
}

@keyframes acenderBarra {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-progresso-trilho {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.splash-progresso-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 8%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2f7fa8 0%, #4fd1e8 55%, #ffffff 100%);
  box-shadow: 0 0 10px rgba(79, 209, 232, 0.55);
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* brilho que corre por cima do preenchimento */
.splash-progresso-brilho {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%
  );
  width: 45%;
  animation: correr 1.7s ease-in-out infinite;
}

@keyframes correr {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.splash-progresso-numero {
  min-width: 38px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  opacity: 0.55;
  text-align: right;
}

/* ---------------- erro ---------------- */
.splash-erro {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: #fff;
}

.splash-erro.on {
  display: grid;
}

.splash-erro div {
  max-width: 380px;
}

.splash-erro strong {
  display: block;
  font-size: 17px;
  margin-bottom: 10px;
}

.splash-erro p {
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.72;
}

.splash-erro code {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.splash-erro button {
  margin-top: 20px;
  background: #4fd1e8;
  color: #06202f;
  border: 0;
  border-radius: 10px;
  padding: 11px 24px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.splash-erro button:hover {
  filter: brightness(1.1);
}

@media (prefers-reduced-motion: reduce) {
  .splash-nome,
  .splash-especialidade,
  .splash-progresso {
    animation: none;
  }
  .splash-especialidade {
    opacity: 0.42;
    letter-spacing: 4px;
  }
  .splash-progresso {
    opacity: 1;
  }
  .splash-progresso-brilho {
    display: none;
  }
  .splash-progresso-fill {
    transition: none;
  }
  .splash-reflexo {
    display: none;
  }
}
