/* ============================================================
   ENCODEX — cinematic boot loader (v3)
   Circuit-routing wordmark + hairline under the mark on a flat void.
   Exit mirrors the hero film-title: opacity + blur + rise, 1.7s.
   ============================================================ */

#loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--bg, #05070b);
  /* Same duration/easing family as #ui .ui-hero film-title */
  transition: opacity 1.7s ease;
}

#loader.done {
  opacity: 0;
  pointer-events: none;
}

/* Soft edge falloff — same family as #ui .ui-scrim, static only */
#loader .boot-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(3, 4, 6, 0.55) 0%, rgba(3, 4, 6, 0) 18%),
    linear-gradient(to top, rgba(3, 4, 6, 0.4) 0%, rgba(3, 4, 6, 0) 22%);
}

#loader .boot-core {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px;
  /* Film-title exit — inverse of #ui .ui-hero > * reveal */
  transition:
    opacity 1.7s ease,
    transform 1.7s cubic-bezier(0.16, 0.6, 0.2, 1),
    filter 1.7s ease;
}

#loader.done .boot-core {
  opacity: 0;
  transform: translateY(-16px);
  filter: blur(9px);
}

#loader .boot-mark {
  line-height: 0;
}

#loader .boot-mark .enx-logo {
  width: min(280px, 64vw);
  height: auto;
  display: block;
  overflow: visible;
}

/* ---------- circuit-routing wordmark (stroke → fill) ---------- */
#loader .enx-logo .enx-fill path {
  fill: var(--txt, #edf1f5);
}

#loader .enx-logo[data-state="route"] .enx-fill path {
  fill: var(--txt, #edf1f5);
  fill-opacity: 0;
  stroke: var(--hi, #ffffff);
  stroke-width: 0.7;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation:
    boot-route-draw 0.75s cubic-bezier(0.65, 0, 0.35, 1) forwards,
    boot-route-fill 0.4s ease forwards;
  animation-delay: calc(var(--i) * 0.12s), calc(0.75s + var(--i) * 0.12s);
}

@keyframes boot-route-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes boot-route-fill {
  to {
    fill-opacity: 1;
    stroke-opacity: 0;
  }
}

/* ---------- hairline progress (no HUD status / %) ---------- */
#loader .boot-bar {
  position: relative;
  width: min(120px, 28vw);
  height: 1px;
  background: var(--line, #1b212b);
  overflow: hidden;
}

#loader .boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--hi, #ffffff);
}

#loader .boot-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  #loader .boot-core { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  #loader .enx-logo[data-state="route"] .enx-fill path {
    animation: none !important;
    fill-opacity: 1;
    stroke-opacity: 0;
    stroke-dashoffset: 0;
  }
  #loader .boot-core,
  #loader {
    transition: opacity 0.4s ease !important;
  }
  #loader.done .boot-core {
    transform: none;
    filter: none;
  }
}
