/* Boot splash + boot-failure recovery UI.
   Loaded as an EXTERNAL stylesheet (from index.html <head>) so the strict production CSP
   (style-src 'self' ...) actually applies it. The equivalent inline <style> in index.html was
   CSP-blocked on hexmetrics.app, which left #hx-splash unstyled (position:static) — so whenever
   React was slow to mount, the splash collapsed to the word "HexMetrics" in the top-left corner
   with nothing else. Keeping these rules in a self-hosted file fixes that without weakening CSP.
   Backgrounds match the app loader exactly (dark #181A1B / light #FAFAFA) for a seamless hand-off. */

html { background: #181A1B; }
html[data-theme="light"] { background: #FAFAFA; }

#hx-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: #181A1B; transition: opacity .4s ease;
}
html[data-theme="light"] #hx-splash { background: #FAFAFA; }
#hx-splash.hx-out { opacity: 0; pointer-events: none; }
#hx-splash .hx-hexes { display: flex; gap: 8px; }
#hx-splash .hx-hexes i {
  width: 20px; height: 20px; display: block;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  background: #6b3f1f; animation: hxWave 1.4s ease-in-out infinite;
}
/* Per-hexagon stagger lives here (not in an inline style="--d:.." attr, which strict CSP blocks). */
#hx-splash .hx-hexes i:nth-child(1) { animation-delay: 0s; }
#hx-splash .hx-hexes i:nth-child(2) { animation-delay: .12s; }
#hx-splash .hx-hexes i:nth-child(3) { animation-delay: .24s; }
#hx-splash .hx-hexes i:nth-child(4) { animation-delay: .36s; }
#hx-splash .hx-hexes i:nth-child(5) { animation-delay: .48s; }
html[data-theme="light"] #hx-splash .hx-hexes i { background: #9a5a2c; animation-name: hxWaveLight; }
@keyframes hxWave { 0%, 100% { background: #6b3f1f; transform: translateY(0); } 45% { background: #c98237; transform: translateY(-6px); } }
@keyframes hxWaveLight { 0%, 100% { background: #9a5a2c; transform: translateY(0); } 45% { background: #e6a24c; transform: translateY(-6px); } }
#hx-splash .hx-word {
  font-family: 'Archivo', system-ui, sans-serif; font-weight: 800; letter-spacing: .3em;
  font-size: 13px; text-transform: uppercase; color: #8a8a8a;
}
@media (prefers-reduced-motion: reduce) { #hx-splash .hx-hexes i { animation: none; background: #c98237; } }

/* Boot-failure recovery: shown by /theme-init.js when #root never populates (entry bundle failed
   to load/parse, or a module threw before React mounted — none of which the in-app ErrorBoundary
   can catch). Replaces the spinner with a real message + a way out. All styling lives here (classes
   only) so nothing relies on CSP-blocked inline styles. */
#hx-splash.hx-failed .hx-hexes,
#hx-splash.hx-failed .hx-word { display: none; }
.hx-recover {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: 380px; padding: 0 24px; text-align: center;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; color: #9a9a9a;
}
.hx-recover h1 { margin: 0; font-size: 20px; font-weight: 700; color: #d4d4d4; }
.hx-recover p { margin: 0; font-size: 14px; line-height: 1.5; }
html[data-theme="light"] .hx-recover { color: #666; }
html[data-theme="light"] .hx-recover h1 { color: #1a1a1a; }
.hx-recover .hx-btns { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.hx-recover button {
  padding: 10px 20px; font-size: 14px; font-weight: 700;
  border-radius: 8px; border: none; cursor: pointer; font-family: inherit;
}
.hx-recover .hx-primary { background: #FACC15; color: #111; }
.hx-recover .hx-secondary { background: transparent; color: inherit; border: 1px solid currentColor; }
.hx-recover button:disabled { opacity: .5; cursor: default; }
