/* ==========================================================================
   Loader inicial — o "n" da marca se desenha, o logo entra e o painel azul
   encolhe até virar a caixa do hero (.s-hero .h-bg).
   Só existe com JS: o <head> adiciona html.is-loading.
   ========================================================================== */

.n-loader {
  --nl-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nl-k: 1;            /* escala de tempo (revisita = mais rápido) */
  --nl-progress: 0;     /* 0 → 1, controlado pelo JS */
  /* caixa final (o JS mede a .h-bg do hero; estes são os valores padrão) */
  --nl-t: 1.6rem;
  --nl-r: 1.6rem;
  --nl-b: 1.6rem;
  --nl-l: 1.6rem;
  --nl-radius: 3.2rem;

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-family: 'Poppins', 'Inter', sans-serif;
  color: #fff;
  pointer-events: none;
}
html.is-loading .n-loader,
.n-loader.is-leaving { display: flex; }
html.is-loading .n-loader { pointer-events: auto; }

/* trava o scroll e segura as animações do site até o loader sair */
html.is-loading,
html.is-loading body { overflow: hidden; }
html.is-loading body > :not(.n-loader),
html.is-loading body > :not(.n-loader) * { animation-play-state: paused !important; }

/* ---------- painel ---------- */
.nl-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0073CE url("../img/bg-hero.svg") center / cover no-repeat;
  clip-path: inset(0 0 0 0 round 0);
}
.nl-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 60, 140, 0.35) 100%);
}
.nl-aurora { position: absolute; border-radius: 50%; filter: blur(8rem); }
.nl-aurora.a1 {
  top: -18rem;
  right: -10rem;
  width: 56rem;
  height: 56rem;
  background: #03E7E7;
  opacity: 0.35;
  animation: nl-orb 9s ease-in-out infinite alternate;
}
.nl-aurora.a2 {
  bottom: -22rem;
  left: -12rem;
  width: 50rem;
  height: 50rem;
  background: #0B6EB6;
  opacity: 0.6;
  animation: nl-orb 11s ease-in-out infinite alternate-reverse;
}
.nl-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 6.4rem 6.4rem;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 38% 42% at 50% 48%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 38% 42% at 50% 48%, #000 10%, transparent 70%);
  opacity: 0;
  animation: nl-fade 1.2s ease calc(0.1s * var(--nl-k)) forwards;
}

/* ---------- marca ---------- */
.nl-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nl-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nl-halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26rem;
  height: 26rem;
  margin: -16rem 0 0 -13rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(3, 231, 231, 0.45) 0%, rgba(3, 231, 231, 0) 65%);
  opacity: 0;
  animation: nl-halo 3.2s ease-in-out calc(0.9s * var(--nl-k)) infinite;
}
.nl-arch {
  position: relative;
  width: 10.4rem;
  height: auto;
  overflow: visible;
}
.nl-arch .stroke {
  fill: none;
  stroke: #fff;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation:
    nl-draw calc(1.15s * var(--nl-k)) var(--nl-ease) calc(0.15s * var(--nl-k)) forwards,
    nl-out-soft calc(0.5s * var(--nl-k)) ease calc(1.15s * var(--nl-k)) forwards;
}
.nl-arch .fill {
  fill: #fff;
  opacity: 0;
  animation: nl-fade calc(0.6s * var(--nl-k)) ease calc(0.95s * var(--nl-k)) forwards;
}
.nl-arch .shine-bar {
  fill: url(#nl-shine-grad);
  transform: translateX(-260px);
  animation: nl-shine 2.4s var(--nl-ease) calc(1.35s * var(--nl-k)) infinite;
}
.nl-word {
  width: 13.6rem;
  height: auto;
  margin-top: 2.8rem;
  clip-path: inset(0 100% 0 0);
  opacity: 0.6;
  animation: nl-wipe calc(0.9s * var(--nl-k)) var(--nl-ease) calc(1.05s * var(--nl-k)) forwards;
}

/* ---------- progresso ---------- */
.nl-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 4.4rem;
  opacity: 0;
  transform: translateY(0.8rem);
  animation: nl-rise calc(0.8s * var(--nl-k)) var(--nl-ease) calc(0.5s * var(--nl-k)) forwards;
}
.nl-bar {
  position: relative;
  width: 22rem;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.nl-bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFC800, #FFDC5C);
  box-shadow: 0 0 1.2rem rgba(255, 200, 0, 0.6);
  transform-origin: 0 50%;
  transform: scaleX(var(--nl-progress));
}
.nl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  width: 22rem;
  margin-top: 1.4rem;
}
.nl-tag {
  font-size: 1.2rem;
  white-space: nowrap;
  line-height: 1.6rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.72);
}
.nl-pct {
  font-size: 1.2rem;
  line-height: 1.6rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #fff;
  min-width: 3.6ch;
  text-align: right;
}

/* ---------- saída ---------- */
.n-loader.is-leaving .nl-content {
  animation: nl-leave 0.6s var(--nl-ease) forwards;
}
.n-loader.is-leaving .nl-bg {
  transition: clip-path 1s var(--nl-ease);
  clip-path: inset(var(--nl-t) var(--nl-r) var(--nl-b) var(--nl-l) round var(--nl-radius));
}
.n-loader.is-leaving {
  animation: nl-out 0.6s ease 0.5s forwards;
}
/* sem hero visível (ex.: recarregou no meio da página): só some */
.n-loader.is-leaving.no-morph .nl-bg { clip-path: inset(0 0 0 0 round 0); }
.n-loader.is-leaving.no-morph { animation-delay: 0.25s; }

/* ---------- keyframes ---------- */
@keyframes nl-orb { to { transform: translate(-6rem, 4rem) scale(1.15); } }
@keyframes nl-fade { to { opacity: 1; } }
@keyframes nl-out-soft { to { opacity: 0.25; } }
@keyframes nl-draw { to { stroke-dashoffset: 0; } }
@keyframes nl-wipe { to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes nl-rise { to { opacity: 1; transform: none; } }
@keyframes nl-shine {
  0% { transform: translateX(-260px); }
  55%, 100% { transform: translateX(760px); }
}
@keyframes nl-halo {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 0.7; transform: scale(1.06); }
}
@keyframes nl-leave {
  to { opacity: 0; transform: translateY(-2.4rem) scale(0.96); filter: blur(6px); }
}
@keyframes nl-out { to { opacity: 0; visibility: hidden; } }

/* ---------- responsivo ---------- */
@media (max-width: 991px) {
  .n-loader { --nl-t: 1.2rem; --nl-r: 1.2rem; --nl-b: 1.2rem; --nl-l: 1.2rem; --nl-radius: 2.4rem; }
}
@media (max-width: 991px) {
  .nl-aurora { filter: blur(5rem); }
}
@media (max-width: 560px) {
  .nl-arch { width: 8.8rem; }
  .nl-word { width: 11.6rem; margin-top: 2.4rem; }
  .nl-halo { width: 22rem; height: 22rem; margin: -14rem 0 0 -11rem; }
  .nl-meta { margin-top: 3.6rem; }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .n-loader *,
  .n-loader *::after { animation: none !important; transition: none !important; }
  .nl-grid,
  .nl-arch .fill,
  .nl-meta { opacity: 1; transform: none; }
  .nl-arch .stroke { opacity: 0; }
  .nl-word { clip-path: none; opacity: 1; }
  .nl-halo { opacity: 0.45; }
  .n-loader.is-leaving .nl-bg { clip-path: inset(0 0 0 0 round 0); }
  .n-loader.is-leaving { animation: nl-out 0.35s ease forwards !important; }
}
