/*
Theme Name: 知微杂志
Description: 复刻 justnews 版式的轻量杂志主题（紫色导航 + 焦点大卡 + 卡片网格 + 侧栏）
Author: zhiwei
Version: 1.1
Requires PHP: 7.4
*/

:root {
  --accent: #6d3fc0;
  --accent-2: #8252d6;
  --accent-hover: #5a32a6;
  --text: #222;
  --text-2: #555;
  --text-3: #999;
  --border: #e8e8e8;
  --bg: #f4f6f9;
  --card: #fff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; height: auto; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* ---------- 头部（紫色导航条，对标 w10） ---------- */
.site-header {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(109, 63, 192, .25);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  gap: 28px;
}
.site-logo a {
  display: inline-block;
  background: #fff;
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 6px;
  letter-spacing: .5px;
  line-height: 1.2;
}
.main-nav ul { display: flex; gap: 2px; }
.main-nav a {
  display: block;
  padding: 8px 16px;
  font-size: 15px;
  color: rgba(255,255,255,.92);
  border-radius: 4px;
  font-weight: 500;
}
.main-nav a:hover { background: rgba(255,255,255,.16); color: #fff; }
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a {
  background: rgba(255,255,255,.2);
  color: #fff;
  font-weight: 700;
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  gap: 20px;
  margin: 20px auto;
  align-items: flex-start;
}
.content-area { flex: 1 1 auto; min-width: 0; }
.sidebar { flex: 0 0 300px; }

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* ---------- 焦点大卡（对标 w10 首屏大图位） ---------- */
.home-hero { margin-bottom: 20px; }
.hero-item {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  min-height: 300px;
  background:
    linear-gradient(115deg, rgba(109,63,192,.95) 0%, rgba(130,82,214,.75) 45%, rgba(38,32,64,.88) 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 12px, transparent 12px 24px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  transition: opacity .2s;
}
.hero-item:hover { opacity: .95; }
.hero-cat {
  position: absolute;
  top: 22px;
  left: 28px;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 13px;
  padding: 3px 12px;
  border-radius: 4px;
}
.hero-title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.hero-meta {
  display: flex;
  gap: 16px;
  color: rgba(255,255,255,.8);
  font-size: 13px;
}

/* ---------- 分类标签页（最新/中国画/留学考试/随笔） ---------- */
.cat-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.cat-tabs a {
  padding: 8px 16px;
  font-size: 15px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.cat-tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.cat-tabs a:hover { color: var(--accent); }

/* ---------- 卡片网格（对标 w10 首页 5 列卡片） ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.g-item {
  background: #fbfbfd;
  border: 1px solid #f0f0f4;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: box-shadow .2s, transform .2s;
}
.g-item:hover {
  box-shadow: 0 4px 14px rgba(109,63,192,.14);
  transform: translateY(-2px);
}
.g-item h2 {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.g-item h2 a:hover { color: var(--accent); }
.g-item .item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}
.g-item .views::before { content: "⊙ "; }

/* ---------- 列表流（归档页备用） ---------- */
.post-list .item {
  padding: 16px 0;
  border-bottom: 1px dashed var(--border);
}
.post-list .item:last-child { border-bottom: 0; }
.post-list h2 { margin: 0 0 8px; font-size: 17px; line-height: 1.5; font-weight: 600; }
.item-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-3); }
.cat-badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--accent);
  background: #f1ebfc;
  border-radius: 3px;
}
.cat-badge:hover { background: var(--accent); color: #fff; }

/* ---------- 侧栏 ---------- */
.widget { margin-bottom: 20px; }
.widget-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
  line-height: 1.4;
}
.widget ul li {
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.widget ul li:last-child { border-bottom: 0; }
.widget .rank-num {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 12px;
  color: #fff;
  background: #c0c4cc;
  border-radius: 3px;
  margin-right: 8px;
}
.widget li:nth-child(1) .rank-num { background: #f5455c; }
.widget li:nth-child(2) .rank-num { background: #ff8547; }
.widget li:nth-child(3) .rank-num { background: #ffb400; }
.widget a { color: var(--text-2); }
.widget a:hover { color: var(--accent); }
.widget .meta { font-size: 12px; color: var(--text-3); margin-left: 6px; }

/* ---------- 文章页 ---------- */
.breadcrumb { font-size: 13px; color: var(--text-3); padding: 14px 0; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--accent); }
.entry-title { font-size: 24px; font-weight: 700; line-height: 1.4; margin: 5px 0 15px; }
.entry-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-3);
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.entry-content { font-size: 16px; line-height: 1.9; word-break: break-word; }
.entry-content h2, .entry-content h3 { font-size: 19px; margin: 28px 0 14px; }
.entry-content h4 { font-size: 17px; margin: 22px 0 12px; }
.entry-content p { margin: 0 0 16px; }
.entry-content ul, .entry-content ol { padding-left: 22px; margin: 0 0 16px; }
.entry-content li { margin-bottom: 6px; }
.entry-content a { color: var(--accent); }
.entry-content a:hover { text-decoration: underline; }
.entry-content blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent);
  background: #f7f4fd;
  color: var(--text-2);
}
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

/* ---------- 分页 ---------- */
.pagination { text-align: center; padding: 20px 0; }
.pagination .nav-links a, .pagination .nav-links span {
  display: inline-block;
  min-width: 34px;
  padding: 6px 10px;
  margin: 0 3px;
  background: var(--card);
  border-radius: 4px;
  font-size: 14px;
}
.pagination .nav-links .current { background: var(--accent); color: #fff; }

/* ---------- 归档头 ---------- */
.archive-head { padding: 5px 0 15px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.archive-title { font-size: 20px; font-weight: 700; margin: 0 0 5px; }
.archive-desc { font-size: 13px; color: var(--text-3); }

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 25px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.site-footer a { color: var(--text-2); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .main-nav { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .main-nav ul { flex-wrap: nowrap; }
  .main-nav a { white-space: nowrap; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 20px; }
}
