/* ============================================
   What Framework — Design System
   Convex-inspired: warm darks + cream sections
   ============================================ */

/* --- Theme Variables --- */
:root,
[data-theme="dark"] {
  --bg-deep: #111110;
  --bg: #1a1a18;
  --bg-raised: #222220;
  --bg-surface: #2a2a28;
  --bg-cream: #f5f0e8;
  --bg-cream-raised: #ffffff;
  --bg-cream-surface: #ebe5db;
  --text: #f0efe8;
  --text-secondary: #9d9d93;
  --text-muted: #6b6b63;
  --text-on-cream: #1a1a18;
  --text-on-cream-secondary: #5c5c52;
  --border: #2e2e2a;
  --border-light: #252522;
  --border-cream: #d9d3c7;
  --accent: #3ecf8e;
  --accent-hover: #34b87d;
  --accent-dim: rgba(62, 207, 142, 0.12);
  --accent-orange: #ee5d34;
  --accent-orange-dim: rgba(238, 93, 52, 0.12);
  --code-bg: #1a1a18;
  --code-border: #2e2e2a;
  --success: #3ecf8e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #60a5fa;
  --nav-bg: rgba(17, 17, 16, 0.92);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-deep: #f5f0e8;
  --bg: #ebe5db;
  --bg-raised: #ffffff;
  --bg-surface: #f5f0e8;
  --bg-cream: #f5f0e8;
  --bg-cream-raised: #ffffff;
  --bg-cream-surface: #ebe5db;
  --text: #1a1a18;
  --text-secondary: #5c5c52;
  --text-muted: #9d9d93;
  --text-on-cream: #1a1a18;
  --text-on-cream-secondary: #5c5c52;
  --border: #d9d3c7;
  --border-light: #e5dfd5;
  --border-cream: #d9d3c7;
  --accent: #2ba86e;
  --accent-hover: #249b62;
  --accent-dim: rgba(43, 168, 110, 0.1);
  --accent-orange: #d94e2b;
  --accent-orange-dim: rgba(217, 78, 43, 0.1);
  --code-bg: #1a1a18;
  --code-border: #2e2e2a;
  --success: #2ba86e;
  --warning: #d97706;
  --error: #dc2626;
  --info: #2563eb;
  --nav-bg: rgba(245, 240, 232, 0.92);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg-deep);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Base Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
}

/* --- Syntax Highlighting (always dark code blocks) --- */
.keyword { color: #c084fc; }
.string { color: #34d399; }
.comment { color: #6b6b63; }
.function { color: #60a5fa; }
.number { color: #fbbf24; }
.tag { color: #f87171; }
.attr { color: #a78bfa; }
.component { color: #22d3ee; }
.punctuation { color: #9d9d93; }
.operator { color: #c084fc; }

/* --- Theme Toggle Button --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-surface);
}

.theme-toggle svg { width: 18px; height: 18px; }

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* --- Pill Badge --- */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-raised);
}

.pill-cream {
  border-color: var(--border-cream);
  color: var(--text-on-cream-secondary);
  background: var(--bg-cream-raised);
}

/* --- Copy Button --- */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

*:hover > .copy-btn,
.copy-btn:focus { opacity: 1; }

.copy-btn svg { width: 16px; height: 16px; }

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
