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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222536;
  --border: #2e3248;
  --accent: #6c63ff;
  --text: #e8eaf0;
  --muted: #8b90a8;
  --success: #4caf8d;
  --radius: 12px;
}

[data-theme="light"] {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface2: #f0f1f6;
  --border: #dde0ec;
  --accent: #6c63ff;
  --text: #1a1d27;
  --muted: #6b7080;
  --success: #2e9e72;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px 60px;
  transition: background 0.2s, color 0.2s;
  line-height: 1.7;
}

a { color: var(--accent); }

.sitenav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 860px;
  margin: 0 auto 40px;
  padding: 0 4px;
}

.sitenav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  text-decoration: none;
}

.sitenav-links { display: flex; gap: 24px; }

.sitenav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.sitenav-links a:hover, .sitenav-links a.active { color: var(--text); }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--text); }

.page-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.page-wrap h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.page-wrap h1 span { color: var(--accent); }

.page-wrap .subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 36px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.card p, .card li {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.card ul, .card ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

.sitefooter {
  text-align: center;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.sitefooter a { color: var(--muted); text-decoration: none; margin: 0 10px; }
.sitefooter a:hover { color: var(--accent); }

/* Blog */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s;
}

.blog-card:hover { border-color: var(--accent); }

.blog-card .tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.blog-card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.blog-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Article */
.article-wrap {
  max-width: 680px;
  margin: 0 auto;
}

.article-wrap h1 {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
}

.article-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 32px;
}

.article-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
}

.article-body p {
  color: var(--muted);
  margin-bottom: 16px;
  font-size: 0.97rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
}

.article-body th {
  background: var(--surface2);
  color: var(--text);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
}

.article-body td {
  padding: 9px 14px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.article-body tr:nth-child(even) td { background: var(--surface2); }

.cta-box {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin: 32px 0;
  text-align: center;
}

.cta-box p { color: var(--muted); margin-bottom: 14px; font-size: 0.95rem; }

.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}

.cta-btn:hover { opacity: 0.85; color: #fff; }

@media (max-width: 480px) {
  body { padding: 16px 12px 40px; }
  .page-wrap h1, .article-wrap h1 { font-size: 1.5rem; }
  .card { padding: 20px 16px; }
  .sitenav-links { gap: 14px; }
  .theme-toggle span:last-child { display: none; }
}
