/* ===== Gridzone 风格 ===== */
:root {
  --bg: #f5f5f5;
  --text: #444;
  --text-muted: #999;
  --accent: #24a5db;
  --accent-hover: #1a8abf;
  --card-bg: #fff;
  --border: #e5e5e5;
  --radius: 10px;
  --shadow: 0 0 10px rgba(0,0,0,0.05);
  --shadow-hover: 0 2px 20px rgba(0,0,0,0.1);
  --font: "Titillium","PingFang SC","Microsoft YaHei",Arial,sans-serif;
  --font-mono: Consolas,monospace;
  --header-bg: #e8e8e8;
  --nav-link: #666;
  --nav-hover: #333;
}

.dark {
  --bg: #1a1a2e;
  --text: #ccc;
  --text-muted: #888;
  --card-bg: #222240;
  --border: #333;
  --header-bg: #16162a;
  --nav-link: #aaa;
  --nav-hover: #fff;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

a { color: #333; text-decoration: none; }
a:hover { color: var(--accent); }
.dark a { color: #ccc; }
.dark a:hover { color: var(--accent); }

/* ===== 头部 ===== */
header {
  background: var(--header-bg);
  padding: 0;
  border-bottom: 1px solid #ddd;
}
.dark header { border-color: #333; }

nav {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px;
}
.logo {
  font-size: 22px; font-weight: 700; color: #333;
  text-decoration: none; letter-spacing: -1px;
}
.dark .logo { color: #fff; }
.nav-links { display: flex; gap: 0; height: 100%; }
.nav-links a {
  padding: 0 16px; height: 56px; line-height: 56px;
  color: var(--nav-link); font-size: 14px; font-weight: 600;
  text-decoration: none; text-transform: uppercase;
  transition: all .15s;
}
.nav-links a:hover { color: var(--nav-hover); background: rgba(0,0,0,0.04); }
.theme-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px 8px; color: var(--nav-link);
}

/* ===== 主体 ===== */
main {
  max-width: 1320px; margin: 0 auto;
  padding: 20px;
  display: flex; flex-direction: column;
}

/* ===== 两栏布局 ===== */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;
}

/* ===== Hero ===== */
.hero {
  text-align: center; padding: 30px 0 20px;
}
.hero h1 {
  font-size: 32px; font-weight: 700; color: #333;
  letter-spacing: -1px; margin-bottom: 8px;
}
.dark .hero h1 { color: #fff; }
.hero p { color: #999; font-size: 15px; }
.btn {
  display: inline-block; padding: 10px 28px;
  background: var(--accent); color: #fff;
  border-radius: 4px; font-size: 14px; font-weight: 600;
  text-decoration: none; margin-top: 16px; transition: .2s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }

/* ===== 卡片网格 (Masonry) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ===== 文章卡片 (Masonry Item) ===== */
.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all .2s;
}
.post-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-cover {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9; width: 100%;
  background-size: cover; background-position: center;
  background-color: #e0e0e0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-cover img {
  width: 100%; display: block;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* 悬浮时显示分类 */
.card-cover .cover-overlay {
  position: absolute; left: 0; right: 0; bottom: -60px;
  padding: 20px 20px 14px;
  background: transparent;
  transition: all .2s;
  pointer-events: none;
}
.post-card:hover .cover-overlay,
.post-card:focus-within .cover-overlay {
  bottom: 0;
}
.cover-overlay a {
  background: rgba(0,0,0,0.6); color: #bbb;
  font-size: 14px; padding: 3px 11px; border-radius: 10px;
  pointer-events: auto; display: inline-block;
}

.card-body { padding: 20px; }
.card-body h3 {
  font-size: 16px; font-weight: 600; color: #333;
  margin-bottom: 6px; line-height: 1.4;
}
.dark .card-body h3 { color: #ddd; }
.card-body h3:hover { color: var(--accent); }
.card-meta {
  font-size: 14px; color: #999; margin-bottom: 8px;
  display: flex; gap: 14px; flex-wrap: wrap;
}
.card-body p {
  font-size: 14px; color: #999; line-height: 1.5;
}
.card-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.card-tags span {
  font-size: 12px; color: #999;
  background: #f5f5f5; padding: 2px 8px; border-radius: 4px;
}
.dark .card-tags span { background: #2a2a40; color: #888; }

.sticky-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: var(--accent); color: #fff;
  font-size: 12px; padding: 3px 10px; border-radius: 4px;
  font-weight: 600;
}

/* ===== 侧边栏 (Gridzone widget style) ===== */
.sidebar { position: relative; z-index: 2; }
.sidebar-section {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 30px; margin-bottom: 20px;
  border-radius: var(--radius);
}
.sidebar-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  color: #999; margin-bottom: 16px; letter-spacing: 1px;
  padding-bottom: 10px; border-bottom: 2px solid #eee;
}
.dark .sidebar-title { border-color: #333; }
.sidebar-intro { font-size: 14px; color: #999; line-height: 1.6; }
.sidebar-posts { list-style: none; }
.sidebar-posts li {
  padding: 8px 0; border-bottom: 1px solid #eee;
  font-size: 14px;
}
.dark .sidebar-posts li { border-color: #333; }
.sidebar-posts li:last-child { border: none; padding-bottom: 0; }
.sidebar-posts a { color: #666; display: block; }
.sidebar-posts a:hover { color: var(--accent); }
.dark .sidebar-posts a { color: #aaa; }
.sidebar-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-tag {
  font-size: 12px; color: #999; background: #f5f5f5;
  padding: 4px 10px; border-radius: 4px; cursor: default;
}
.dark .sidebar-tag { background: #2a2a40; }

/* ===== 文章详情 ===== */
.article-header { margin-bottom: 20px; }
.article-header h1 {
  font-size: 32px; font-weight: 700; color: #333;
  line-height: 1.3; margin-bottom: 10px;
}
.dark .article-header h1 { color: #fff; }
.article-header .meta {
  font-size: 14px; color: #999; display: flex; gap: 16px;
}
.article-header .tags { display: flex; gap: 6px; margin-top: 10px; }
.article-header .tags span {
  font-size: 12px; background: #f5f5f5;
  color: #999; padding: 2px 10px; border-radius: 4px;
}

.prose { font-size: 16px; line-height: 1.7; color: var(--text); }
.prose h2 {
  font-size: 22px; font-weight: 600; margin: 30px 0 12px;
  color: #333;
}
.dark .prose h2 { color: #ddd; }
.prose h3 { font-size: 18px; font-weight: 600; margin: 24px 0 10px; }
.prose p { margin-bottom: 14px; }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose ul, .prose ol { margin: 0 0 14px 20px; }
.prose li { margin-bottom: 4px; }
.prose pre {
  background: #2d2d2d; color: #ccc;
  padding: 16px 20px; border-radius: 6px;
  overflow-x: auto; font-size: 14px; margin: 16px 0;
  font-family: var(--font-mono);
}
.prose code {
  font-family: var(--font-mono);
  background: #f0f0f0; padding: 2px 6px;
  border-radius: 3px; font-size: 0.9em;
}
.dark .prose code { background: #2a2a40; }
.prose pre code { background: none; padding: 0; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px; margin: 16px 0;
  color: #888; font-style: italic;
}
.prose img { max-width: 100%; border-radius: 6px; margin: 12px 0; }

.back-link {
  display: inline-block; margin-top: 30px;
  color: #999; font-size: 14px;
}
.back-link:hover { color: var(--accent); }

/* ===== 关于页 ===== */
.about-section { max-width: 700px; margin: 0 auto; text-align: center; }
.about-section h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.about-section p { font-size: 15px; color: #999; margin-bottom: 20px; line-height: 1.7; }
.about-section h2 { font-size: 18px; font-weight: 600; margin: 24px 0 12px; }
.about-section .tech-list {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
}
.about-section .tech-item {
  background: var(--card-bg); padding: 16px;
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center;
}
.about-section .tech-item strong { display: block; font-size: 14px; margin-bottom: 4px; }
.about-section .tech-item span { font-size: 13px; color: #999; }

/* ===== 页面标题 ===== */
.page-title {
  font-size: 28px; font-weight: 700; color: #333;
  margin-bottom: 4px;
}
.dark .page-title { color: #fff; }
.page-subtitle { color: #999; font-size: 14px; margin-bottom: 20px; }

/* ===== 搜索 ===== */
.search-input {
  width: 100%; padding: 12px 16px; font-size: 15px;
  border: 1px solid #ddd; border-radius: 6px;
  background: #fff; color: #333;
}
.dark .search-input { background: #222; border-color: #444; color: #ccc; }
.search-input:focus { outline: none; border-color: var(--accent); }
.search-results { margin-top: 16px; }
.search-item {
  display: block; padding: 14px 16px; margin-bottom: 6px;
  background: var(--card-bg); border-radius: 6px;
  box-shadow: var(--shadow); color: inherit;
}
.search-item:hover { box-shadow: var(--shadow-hover); }
.search-item h4 { font-size: 15px; margin-bottom: 4px; }
.search-item p { font-size: 13px; color: #999; }

/* ===== 分页 ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 30px; padding: 16px;
}
.page-btn {
  padding: 8px 20px; border-radius: 4px;
  background: var(--card-bg); color: #666;
  text-decoration: none; font-size: 14px;
  box-shadow: var(--shadow);
}
.page-btn:hover { color: var(--accent); }
.page-info { font-size: 14px; color: #999; }

/* ===== 页脚 ===== */
footer {
  background: var(--header-bg);
  text-align: center; padding: 30px 20px;
  color: #999; font-size: 13px;
  margin-top: auto; border-top: 1px solid #ddd;
}
.dark footer { border-color: #333; }
footer a { color: #666; }
footer a:hover { color: var(--accent); }

.empty-state { text-align: center; padding: 40px; color: #999; }
.empty-state .icon { font-size: 2rem; margin-bottom: 10px; display: block; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-with-sidebar { grid-template-columns: 1fr 300px; gap: 24px; }
}
@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { flex-wrap: wrap; height: auto; padding: 10px; gap: 8px; }
  .nav-links a { height: 40px; line-height: 40px; }
  .hero h1 { font-size: 24px; }
}