/* ============================================
   Blog - Clean Modern Style
   ============================================ */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-light: #999;
  --border: #e8e8e8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --tag-bg: #f1f5f9;
  --tag-text: #475569;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
  --max-width: 720px;
  --header-height: 64px;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

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

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.site-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* ---- Main Layout ---- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

main { padding: 40px 0 80px; }

/* ---- Hero Section (Home) ---- */
.hero {
  text-align: center;
  padding: 60px 0 48px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.hero p {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* ---- Tag Filter ---- */
.tag-filter {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tag-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.2s;
  user-select: none;
}

.tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- Post Card Grid ---- */
.post-list { display: grid; grid-template-columns: 1fr; gap: 20px; }

.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.post-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-light);
}

.post-card-date { font-variant-numeric: tabular-nums; }

.post-card-source {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.source-blog { background: #ecfdf5; color: #059669; }
.source-obsidian { background: #fef3c7; color: #d97706; }

.post-card h2 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--accent); }

.post-card-excerpt {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.post-tag {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 12px;
  font-weight: 500;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ---- Article Detail Page ---- */
.article-header {
  margin-bottom: 40px;
}

.article-header h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.3;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-light);
  font-size: 14px;
}

.article-meta .tag {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 12px;
  font-weight: 500;
}

/* ---- Article Content (Markdown rendered) ---- */
.article-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.article-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 40px 0 16px;
  letter-spacing: -0.3px;
  padding-top: 8px;
}

.article-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.article-content h4 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }

.article-content p { margin-bottom: 1.3em; }

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content strong { font-weight: 600; color: var(--text); }

.article-content ul,
.article-content ol {
  margin-bottom: 1.3em;
  padding-left: 24px;
}

.article-content li { margin-bottom: 6px; }

.article-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  padding: 12px 20px;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.article-content blockquote p { margin-bottom: 0; }

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #e11d48;
}

.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.6;
}

.article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

.article-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 24px 0;
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.article-content th {
  background: #f8fafc;
  font-weight: 600;
}

/* ---- Reading Progress Bar ---- */
.reading-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: 101;
  transition: width 0.1s linear;
}

/* ---- Article Navigation ---- */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.article-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s;
  max-width: 45%;
}

.article-nav a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.article-nav .nav-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.article-nav .nav-title {
  font-weight: 600;
  font-size: 14px;
}

/* ---- Back to Home ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  font-weight: 500;
}
.back-link:hover { color: var(--accent); }

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-light);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ---- Callout blocks (Obsidian-style) ---- */
.callout {
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.7;
}
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.callout-content p { margin-bottom: 8px; }
.callout-content p:last-child { margin-bottom: 0; }

.callout-info { background: #eff6ff; border-left: 3px solid #3b82f6; }
.callout-tip { background: #ecfdf5; border-left: 3px solid #22c55e; }
.callout-warning { background: #fffbeb; border-left: 3px solid #f59e0b; }
.callout-danger { background: #fef2f2; border-left: 3px solid #ef4444; }
.callout-note { background: #f1f5f9; border-left: 3px solid #64748b; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .hero h1 { font-size: 26px; }
  .post-card { padding: 20px; }
  .post-card h2 { font-size: 17px; }
  .article-header h1 { font-size: 24px; }
  .article-content h2 { font-size: 20px; }
  .container { padding: 0 16px; }
  .header-inner { padding: 0 16px; }
  .nav-links { gap: 16px; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; }
}

/* ---- Loading skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- TOC (Table of Contents) ---- */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}

.toc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin-bottom: 6px; }
.toc a {
  color: var(--text-secondary);
  font-size: 14px;
  display: block;
  padding: 2px 0;
  border-left: 2px solid transparent;
  padding-left: 10px;
  transition: all 0.2s;
}
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.toc .toc-h3 { padding-left: 22px; font-size: 13px; }
