/*
 * base.css — CSS variables, reset, typography, global styles
 * Carnac Prediction Tracker
 * Load order: 1 of 4 (base → cards → modal → layout)
 */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&family=Inter:wght@400;500;600&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Background layers */
  --bg:              #0d0d14;
  --surface:         #13131f;
  --surface-light:   #1e1e2e;
  --surface-hover:   #252538;

  /* Border */
  --border:          #2a2a3e;
  --border-bright:   #3a3a58;

  /* Brand colors */
  --color-cyan:      #00ffff;
  --color-pink:      #ff5078;
  --color-green:     #00ff80;
  --color-yellow:    #ffe600;
  --color-purple:    #bf80ff;

  /* Glow variants */
  --glow-cyan:       rgba(0, 255, 255, 0.25);
  --glow-pink:       rgba(255, 80, 120, 0.25);
  --glow-green:      rgba(0, 255, 128, 0.25);
  --glow-yellow:     rgba(255, 230, 0, 0.25);

  /* Text hierarchy */
  --text-primary:    #e8e8f0;
  --text-secondary:  #a0a0c0;
  --text-dim:        #5a5a7a;

  /* Typography */
  --font-display:    'Press Start 2P', monospace;
  --font-mono:       'Space Mono', monospace;
  --font-body:       'Inter', system-ui, sans-serif;

  /* Spacing scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Border radius scale */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-pill: 9999px;

  /* Transition speeds */
  --transition-fast: 0.12s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.35s ease;

  /* Z-index layers */
  --z-modal:    100;
  --z-header:   50;
  --z-scanline: 9999;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle dot-grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

#root {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: 1.3;
}

p, li, td {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--text-secondary);
}

code, pre {
  font-family: var(--font-mono);
  background: var(--surface-light);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.85em;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-cyan); }

/* ── Focus visible ─────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Selection ─────────────────────────────────────────────────────────────── */
::selection {
  background: rgba(0, 255, 255, 0.2);
  color: var(--text-primary);
}

/* ── Utility classes ────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.visually-hidden { composes: sr-only; }

/* ── Keyframe library ───────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 6px var(--glow-cyan); }
  50%       { box-shadow: 0 0 20px var(--glow-cyan), 0 0 40px rgba(0, 255, 255, 0.1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20%       { transform: translateX(-4px) rotate(-6deg) scale(1.12); }
  40%       { transform: translateX(4px)  rotate( 6deg) scale(1.15); }
  60%       { transform: translateX(-3px) rotate(-3deg) scale(1.1); }
  80%       { transform: translateX(3px)  rotate( 3deg) scale(1.05); }
}

@keyframes pop {
  0%   { transform: scale(0.8); opacity: 0; }
  70%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

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

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
