/* === Base: Reset, Variables, Typography === */

:root {
  --bg-body: #f5f7fa;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --bg-nav-blur: rgba(255,255,255,0.82);
  --bg-footer: #f5f7fa;
  --bg-input: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #999;
  --accent: #4a6cf7;
  --accent-hover: #3b5de7;
  --accent-light: rgba(74,108,247,0.08);
  --accent-lighter: rgba(74,108,247,0.04);
  /* semantic palette */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --success-border: #a7f3d0;
  --danger: #e74c3c;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --danger-border: #fecaca;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --info-border: #bfdbfe;
  --border: #e8ecf1;
  --border-light: #f0f2f5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.08);
  --radius: 6px;
  --radius-lg: 10px;
  --max-width: 1100px;
  --sidebar-width: 320px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
  --line-height: 1.75;
  --gap: 24px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.18s;
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: var(--line-height);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

h1 { font-size: 1.75rem; margin-bottom: 16px; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; margin-bottom: 12px; letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; margin-bottom: 10px; }
h4 { font-size: 1.05rem; margin-bottom: 8px; }

p { margin-bottom: 12px; }

hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 12px 0;
  line-height: 1.45;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.82em;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin: 16px 0;
  background: var(--accent-lighter);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

ul, ol { padding-left: 24px; margin-bottom: 12px; }
li { margin-bottom: 4px; }

::selection { background: var(--accent); color: #fff; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Screen reader only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
