/*
 * BPOBOX boot loader styles. Served at /boot-loader.css (Vite serves
 * `public/` verbatim — no bundling, no hash). Referenced from index.html
 * via `<link rel="stylesheet">` so it fetches in parallel with the HTML
 * parse. Module-chip CSS was removed when the chip row was retired;
 * re-add it if/when chips return.
 */
/* Self-hosted (SIL OFL) so the page needs no request to Google Fonts. One
   variable file covers weights 400 to 800, Latin characters only. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/PlusJakartaSans-latin.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}

:root {
  --bpx-accent: #0098f6;
  --bpx-accent2: #007ed1;
  --bpx-accent-soft: #e6f4fe;
}

/* Hide the loader entirely on refresh — see the inline `<script>` in
   `index.html` that sets this class when sessionStorage says the
   loader has already played this tab. */
.bpx-skip-loader .initial-loader {
  display: none !important;
}

.initial-loader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    70% 60% at 50% 40%,
    #ffffff 0%,
    #f9fafb 58%,
    #f3f4f6 100%
  );
  z-index: 99999;
  font-family:
    'Plus Jakarta Sans',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: #111827;
  overflow: hidden;
  animation: bpx-fadein 0.35s ease-out both;
  transition: opacity 0.45s ease-out;
}
/* Fade-out class — JS toggles this after min-display + app-ready. */
.initial-loader.is-leaving {
  opacity: 0;
  pointer-events: none;
}

/* Ambient grid drift — masked with radial fade so grid only shows
   in the centre area, not edge-to-edge. */
.initial-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    rgba(0, 152, 246, 0.05) 1px,
    transparent 1px
  );
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(
    110% 80% at 50% 44%,
    #000 30%,
    transparent 75%
  );
  mask-image: radial-gradient(110% 80% at 50% 44%, #000 30%, transparent 75%);
  animation: bpx-grid 11s linear infinite;
  pointer-events: none;
}
/* Two large soft orbs in opposite corners for depth. */
.initial-loader::after {
  content: '';
  position: absolute;
  top: -120px;
  left: -100px;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: rgba(0, 152, 246, 0.09);
  filter: blur(90px);
  pointer-events: none;
}
.initial-loader__orb {
  position: absolute;
  bottom: -160px;
  right: -120px;
  width: 680px;
  height: 680px;
  border-radius: 50%;
  background: rgba(0, 126, 209, 0.08);
  filter: blur(100px);
  pointer-events: none;
}

.initial-loader__col {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Emblem (122x122): breathing glow + spinning ring + central icon. */
.initial-loader__emblem {
  position: relative;
  width: 122px;
  height: 122px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}
.initial-loader__emblem-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 152, 246, 0.22), transparent 66%);
  transform: translate(-50%, -50%);
  filter: blur(6px);
  animation: bpx-breathe 4.5s ease-in-out infinite;
}
.initial-loader__emblem-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 122px;
  height: 122px;
  animation: bpx-ring 1.3s linear infinite;
}
.initial-loader__emblem-ico {
  position: relative;
  width: 62px;
  height: 62px;
  color: var(--bpx-accent);
}
.initial-loader__brand {
  width: 200px;
  height: auto;
  display: block;
}
.initial-loader__tagline {
  margin-top: 12px;
  font-weight: 500;
  font-size: 17px;
  color: #6b7280;
  letter-spacing: 0.2px;
}

.initial-loader__progress {
  width: 470px;
  max-width: calc(100vw - 48px);
  margin-top: 46px;
}
.initial-loader__progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.initial-loader__status {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 24px;
}
.initial-loader__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bpx-accent);
  box-shadow: 0 0 0 4px rgba(0, 152, 246, 0.16);
  flex: none;
  animation: bpx-blink 1.4s ease-in-out infinite;
}
.initial-loader__status-text {
  font-weight: 500;
  font-size: 15.5px;
  color: #374151;
}
.initial-loader__pct {
  font-weight: 700;
  font-size: 15px;
  color: var(--bpx-accent);
  font-variant-numeric: tabular-nums;
}
.initial-loader__bar {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: #e5e7eb;
  overflow: hidden;
}
.initial-loader__bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--bpx-accent), var(--bpx-accent2));
  box-shadow: 0 0 12px rgba(0, 152, 246, 0.55);
  transition: width 0.18s linear;
}

.initial-loader__veil {
  position: absolute;
  inset: 0;
  background: #f9fafb;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

@keyframes bpx-fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes bpx-ring {
  to {
    transform: rotate(360deg);
  }
}
@keyframes bpx-breathe {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.14);
    opacity: 0.8;
  }
}
@keyframes bpx-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
@keyframes bpx-grid {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 44px 44px;
  }
}
