/**
 * Critical CSS - Loaded early for fastest first paint
 *
 * Contains only styles needed for above-the-fold initial render:
 * - Font-face declarations
 * - Body background and text color
 * - Loading spinner animation
 * - Root container reset
 */

/* Font-face for immediate text rendering */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/SpaceGrotesk-latin.woff2) format('woff2');
}

/* Root element styles */
:root {
  --color-bg-primary: #0b1220;
  --color-brand-500: #0d7dd1;
  color-scheme: dark;
}

/* Prevent FOUC */
html {
  -webkit-text-size-adjust: 100%;
  background-color: #0b1220;
}

/* Body base styles for immediate paint */
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: radial-gradient(circle at 20% 20%, rgba(15, 118, 178, 0.25), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(251, 191, 36, 0.2), transparent 25%),
    radial-gradient(circle at 60% 80%, rgba(16, 185, 129, 0.2), transparent 35%),
    #0b1220;
  color: #e2e8f0;
}

/* Root container fills viewport */
#root {
  min-height: 100vh;
}

/* Initial loading state - shown before React hydrates */
.initial-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 1rem;
}

.initial-loader__spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 4px solid #0d7dd1;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.initial-loader__text {
  color: #94a3b8;
  font-size: 0.875rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hide initial loader once React renders */
#root:not(:empty) + .initial-loader {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .initial-loader__spinner {
    animation: none;
  }
}
