/* ============================================================
   统一前台样式 - 三种模式共用
   主题颜色由 site.js / PHP 从 themes/default/theme.json 注入
   ============================================================ */
:root {
  --primary: #3498db;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --text: #2c3e50;
  --muted: #7f8c8d;
  --border: #e5e7eb;
  --code-bg: #f6f8fa;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code { background: var(--code-bg); padding: .15em .4em; border-radius: 4px; font-size: .9em; font-family: Consolas, Monaco, monospace; }
pre { background: var(--code-bg); padding: 14px; border-radius: var(--radius); overflow: auto; }
pre code { background: none; padding: 0; }
blockquote { margin: 1em 0; padding: .4em 1em; border-left: 4px solid var(--primary); background: var(--bg-alt); color: var(--muted); }
table { border-collapse: collapse; width: 100%; margin: 1em 0; }
th, td { border: 1px solid var(--border); padding: .5em .8em; text-align: left; }
th { background: var(--bg-alt); }
hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-top: 14px; padding-bottom: 14px; }
.brand a { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.brand a:hover { text-decoration: none; }
.brand .tagline { font-size: .8rem; color: var(--muted); margin-left: 8px; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { padding: 6px 12px; border-radius: 8px; color: var(--text); font-size: .95rem; }
.site-nav a:hover { background: var(--bg-alt); text-decoration: none; }
.site-nav a.active { background: var(--primary); color: #fff; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 22px 0; color: var(--muted); font-size: .9rem; text-align: center; }
.site-footer a { color: var(--muted); }

/* Home list */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { border-bottom: 1px solid var(--border); padding: 26px 4px; }
.post-list li:last-child { border-bottom: none; }
.post-card h2 { margin: 0 0 8px; font-size: 1.4rem; }
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--primary); text-decoration: none; }
.post-meta { font-size: .85rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.post-meta .tag { background: var(--bg-alt); border: 1px solid var(--border); padding: 1px 8px; border-radius: 20px; color: var(--muted); }
.post-excerpt { color: var(--muted); margin: 0; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 30px 0; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.pagination a:hover { background: var(--bg-alt); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Article */
.article-header { padding: 34px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 26px; }
.article-header h1 { margin: 0 0 12px; font-size: 2rem; line-height: 1.35; }
.article-body { font-size: 1.02rem; }
.article-body h1, .article-body h2, .article-body h3 { line-height: 1.4; margin-top: 1.6em; }
.article-body p { margin: 1em 0; }

/* Giscus */
.giscus-wrap { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.giscus-title { font-size: 1.15rem; margin-bottom: 12px; }
.giscus-placeholder { background: var(--bg-alt); border: 1px dashed var(--border); color: var(--muted); padding: 18px; border-radius: var(--radius); font-size: .95rem; }

/* Misc */
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.spinner { text-align: center; color: var(--muted); padding: 40px 0; }
.back-link { display: inline-block; margin-bottom: 18px; font-size: .9rem; }

@media (max-width: 600px) {
  .article-header h1 { font-size: 1.55rem; }
  .post-card h2 { font-size: 1.2rem; }
}