/* style.css - 网站全局样式 */
:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #334155;
  --radius: 8px;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
}

/* 导航栏 */
.site-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: relative;
}

.nav-logo {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
}

/* 导航链接居中 */
.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* 首页 */
.index-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.index-header {
  margin-bottom: 40px;
}

.index-header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.index-header p {
  color: var(--text-muted);
}

/* 文章列表 */
.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.article-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  line-height: 1.5;
}

.article-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.article-card h3 a:hover {
  color: var(--accent);
}

.article-card .meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.article-card .summary {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.75rem;
  text-decoration: none;
  transition: background 0.2s;
}

.tag:hover {
  background: var(--accent);
  color: white;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input[type="text"] {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text);
  font-size: 0.9rem;
  width: 240px;
}

.filter-bar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* 页脚 */
.site-footer {
  max-width: 1200px;
  margin: 60px auto 0;
  padding: 30px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 搜索页 */
.search-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
}

.search-box {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 30px;
}

.search-box:focus {
  outline: none;
  border-color: var(--accent);
}

.search-results .result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.search-results .result-item a {
  color: var(--accent);
  font-size: 1.05rem;
  text-decoration: none;
}

.search-results .result-item a:hover {
  text-decoration: underline;
}

.search-results .result-snippet {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* 标签页 */
.tags-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}

.tags-cloud .tag {
  font-size: 0.9rem;
  padding: 6px 14px;
}

.tags-cloud .tag .count {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 4px;
}

/* 响应式 */
@media (max-width: 768px) {
  .article-list {
    grid-template-columns: 1fr;
  }
  .nav-links a {
    margin-left: 14px;
    font-size: 0.8rem;
  }
}

/* ============ 白天模式 ============ */
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed;
  --border: #e2e8f0;
}
