/* ==========================================
   小清的空间 - 极简冷静风格
   参考 dayulab.com 的克制美学
   ========================================== */

/* ----- 配色变量 ----- */
:root {
  --bg: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #4a6fa5;          /* 蓝灰色调，冷静克制 */
  --accent-hover: #3b5998;
  --border: #eeeeee;
  --card-bg: #fafafa;
  --card-hover: #f5f5f5;
  --tag-bg: #f0f2f5;
  --tag-text: #666;
  --max-width: 720px;
}

/* 深色模式 */
[data-theme="dark"] {
  --bg: #1a1d23;
  --text: #d4d4d8;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6b9bd2;
  --accent-hover: #88b4e0;
  --border: #2d3139;
  --card-bg: #22262d;
  --card-hover: #282d35;
  --tag-bg: #2d3139;
  --tag-text: #a1a1aa;
}

/* ----- 全局重置 ----- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.nav-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.8rem;
}

.nav-links a {
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  transition: background 0.2s;
}
.theme-toggle:hover { background: var(--card-bg); }

/* ----- 页面容器 ----- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.2rem;
}

/* ===== 首页 Hero ===== */
.hero {
  text-align: center;
  padding: 4rem 0 2.5rem;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.hero .subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero .subtitle span {
  margin: 0 0.4rem;
}

/* ===== 功能卡片（首页三个入口） ===== */
.feature-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-top: 1rem;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  transition: background 0.2s, transform 0.15s;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.feature-card:hover {
  background: var(--card-hover);
  transform: translateY(-1px);
}

.feature-card .icon {
  font-size: 2.2rem;
  margin-bottom: 0.8rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.feature-card .arrow {
  color: var(--accent);
  font-size: 0.88rem;
}

/* ===== 文章列表页 ===== */
.page-header {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.page-header .subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* 文章条目 */
.article-item {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}

.article-item:last-child {
  border-bottom: none;
}

.article-item h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.article-item h2 a {
  color: var(--text);
  text-decoration: none;
}
.article-item h2 a:hover {
  color: var(--accent);
}

.article-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.article-meta .source-tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  padding: 0.05rem 0.5rem;
  border-radius: 4px;
}

.article-meta .dot {
  color: var(--border);
}

.article-excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.6rem;
}

.read-more {
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
}
.read-more:hover { text-decoration: underline; }

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2rem 0 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.pagination a {
  color: var(--accent);
  text-decoration: none;
}

.pagination span {
  color: var(--text-muted);
}

/* ===== 文章详情页 ===== */
.article-header {
  text-align: center;
  padding: 2rem 0 1rem;
}

.article-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.article-header .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Markdown 渲染后的正文样式 */
.article-body {
  padding: 1rem 0 3rem;
}

.article-body h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.8rem;
  font-weight: 600;
}

.article-body h3 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

.article-body p {
  margin-bottom: 1.1rem;
  line-height: 1.85;
}

.article-body ul,
.article-body ol {
  margin: 0.8rem 0 1.1rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.3rem;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-body code {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.12rem 0.35rem;
  font-size: 0.88em;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

.article-body pre {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.88rem;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
}

.article-body img {
  max-width: 100%;
  border-radius: 4px;
}

/* 返回链接 */
.back-link {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--accent); }

/* ===== 关于页 ===== */
.about-section {
  padding: 1rem 0;
}

.about-section h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.8rem;
}

.about-section p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.85;
}

.about-section ul {
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.about-section ul li {
  margin-bottom: 0.4rem;
}

/* ===== 工具页 ===== */
.tools-section {
  padding: 1rem 0;
}

.tool-item {
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 0;
}

.tool-item:last-child {
  border-bottom: none;
}

.tool-item h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.tool-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===== 页脚 ===== */
footer {
  text-align: center;
  padding: 2rem 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 2;
}

footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

footer .footer-links a {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

footer .footer-links a:hover {
  color: var(--accent);
}

/* ===== 回到顶部 ===== */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  z-index: 99;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
#back-to-top:hover {
  background: var(--card-bg);
  transform: translateY(-2px);
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .feature-cards {
    grid-template-columns: 1fr;  /* 手机端卡片竖向排列 */
  }
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.85rem; }
  .nav-logo { font-size: 0.9rem; }
  .page-header h1 { font-size: 1.4rem; }
  .article-item h2 { font-size: 1.1rem; }
  .pagination { gap: 0.8rem; font-size: 0.82rem; }
}
