/* ═══════════════════════════════════════════════════════════════
   News Site — style.css
   可替换此文件来更换整站样式
   ═══════════════════════════════════════════════════════════════ */

/* ── 变量 ─────────────────────────────────────────────────────── */
:root {
  --bg:          #f7f6f3;
  --surface:     #ffffff;
  --border:      #e4e2db;
  --text:        #1a1a18;
  --text-muted:  #6b6963;
  --accent:      #c0392b;
  --accent-soft: #fdf0ef;
  --link:        #1a1a18;
  --link-hover:  #c0392b;
  --radius:      4px;
  --font-sans:   "Helvetica Neue", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  --font-mono:   "JetBrains Mono", "Fira Code", monospace;
  --max-width:   740px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
img { max-width: 100%; height: auto; display: block; }

/* ── 布局 ─────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main.container {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}
.site-title:hover { color: var(--accent); }
.header-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── 首页文章列表 ─────────────────────────────────────────────── */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}
.post-card:hover {
  border-color: var(--accent);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.post-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.post-category {
  font-size: 0.7rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.post-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.6rem;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }

/* 首页简介：二级标题无序列表 */
.post-summary {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0;
}
.post-summary li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-left: 1em;
  position: relative;
  width: 100%;
}
.post-summary li::before {
  content: "·";
  position: absolute;
  left: 0.2em;
  color: var(--accent);
}

/* ── 分页 ─────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}
.page-btn {
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.disabled {
  color: var(--border);
  cursor: default;
  pointer-events: none;
}
.page-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── 详情页文章正文 ───────────────────────────────────────────── */
.post-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
}

/* 正文排版 */
.post-body h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--accent);
}
.post-body h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  padding-left: 0.6rem;
  border-left: 3px solid var(--accent);
}
.post-body h3 {
  font-size: 0.98rem;
  font-weight: 600;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
}
.post-body h4, .post-body h5 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
}
.post-body p {
  margin-bottom: 0.75rem;
  font-size: 0.93rem;
}
.post-body ul, .post-body ol {
  padding-left: 1.4em;
  margin-bottom: 0.75rem;
}
.post-body li {
  margin-bottom: 0.3rem;
  font-size: 0.93rem;
}
.post-body strong { font-weight: 600; }
.post-body em { font-style: italic; }
.post-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post-body blockquote {
  border-left: 3px solid var(--border);
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 1rem 0;
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}
.post-body pre {
  background: var(--text);
  color: var(--bg);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
}
.post-body pre code { background: none; padding: 0; color: inherit; }
.post-body img {
  margin: 1rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1rem 0;
}
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  text-align: left;
}
.post-body th { background: var(--bg); font-weight: 600; }

/* ── 返回链接 ─────────────────────────────────────────────────── */
.back-link {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}
.back-link a { color: var(--text-muted); }
.back-link a:hover { color: var(--accent); }

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

/* ── 搜索栏 ──────────────────────────────────────────────────── */
.search-bar {
  margin-bottom: 1rem;
  padding-top: 0.25rem;
}
.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.cat-select {
  flex: 0 0 auto;
  height: 2.2rem;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b6963'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 1.8rem;
}
.cat-select:focus {
  outline: none;
  border-color: var(--accent);
}
.search-input {
  flex: 1;
  height: 2.2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  transition: border-color 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-input::placeholder { color: var(--text-muted); }
.search-btn {
  flex: 0 0 auto;
  height: 2.2rem;
  padding: 0 1.1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.search-btn:hover { opacity: 0.85; }
.search-clear {
  flex: 0 0 auto;
  height: 2.2rem;
  line-height: 2.2rem;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.search-clear:hover { border-color: var(--accent); color: var(--accent); }

.search-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.post-excerpt {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* FTS 高亮 */
.post-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.6;
}
.post-snippet mark {
  background: #fff3b0;
  color: var(--text);
  border-radius: 2px;
  padding: 0 0.15em;
}

/* ── 空状态 ──────────────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 0;
  font-size: 0.9rem;
}

/* ── 响应式 ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .post-body { padding: 1.25rem 1rem; }
  .post-card { padding: 1rem 1rem; }
  .post-body h1 { font-size: 1.2rem; }
}
