/*
 * Pre-React critical boot CSS — first-paint skeleton + spinner + boot-failure overlay.
 *
 * Served as a STATIC public asset (verbatim, no Vite postcss / html-proxy) on purpose:
 * the dev html-proxy inline-<style> pipeline mis-parses CSS comments AND truncates large
 * inline styles, which 500'd `/`. As an external file this CSS is delivered as-is, so
 * comments and the @keyframes are safe here. Loaded via <link> in index.html <head>.
 */

/* First-paint background placeholder (flips with the theme bootstrap on <html>). */
#root:empty::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--color-background, #f8fafc);
}
html.dark #root:empty::before { background: #0a0a0a; }

/* Centered spinner (gated off by the reduce-motion class from the bootstrap script). */
#root:empty::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid #2F5FAA;
  border-top-color: transparent;
  border-radius: 50%;
  animation: navajo-pre-spinner 0.9s linear infinite;
}
html.reduce-motion #root:empty::after { animation: none; }
@keyframes navajo-pre-spinner { to { transform: rotate(360deg); } }

/* Pre-React boot-failure overlay (shown by the boot watchdog when the bundle fails to
   load / React hasn't mounted before the timeout; app-mounted always wins). */
#boot-error {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  color: #0f172a;
  background: var(--color-background, #f8fafc);
}
html.dark #boot-error { color: #f8fafc; background: #0a0a0a; }
html.boot-failed #root:empty::before,
html.boot-failed #root:empty::after { display: none; }
html.boot-failed #boot-error { display: flex; }
html.app-mounted #boot-error { display: none; }
#boot-error h1 { margin: 0; font-size: 18px; font-weight: 600; }
#boot-error p { margin: 0; font-size: 14px; opacity: 0.7; max-width: 320px; line-height: 1.5; }
#boot-error button {
  margin-top: 6px;
  padding: 10px 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: #2F5FAA;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
#boot-error button:hover { background: #2558A0; }
