/* iBlog · MUJI 风格样式
 * 设计原则(见 MUJI.md):
 *   - 「这样就好」:克制,不追求惊艳
 *   - 暖石墨 #3c3c43 替代纯黑,纸白 #fffdfa 替代纯白
 *   - MUJI 红 #7f0019 只做点缀(悬停、细线),绝不做主角
 *   - 圆角两极化:2px 或完全圆角,无中间值
 *   - 版面如一张纸:暖灰背景托起中央纸面
 */

:root {
  --bg: #f6f3ee;          /* 页面底色:暖灰 */
  --paper: #fffdfa;       /* 纸面 */
  --text: #3c3c43;        /* 暖石墨 */
  --heading: #2f2f35;     /* 标题墨色 */
  --muted: #6d6b66;       /* 次要文字 */
  --line: #e6e0d6;        /* 主分割线 */
  --soft-line: #efe9df;   /* 弱分割线 */
  --accent: #7f0019;      /* MUJI 红,仅点缀 */
  --code-bg: #f3eee6;
  --selection: #e9e0d2;
  --monospace: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.85;
}

::selection { background: var(--selection); }

/* 纸面:暖灰背景中央的一张纸,两侧一道细边 */
.sheet {
  max-width: 880px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 3.5rem 4rem;
  background: var(--paper);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.wrap { max-width: 100%; margin: 0; padding: 0; }

/* 链接:默认安静,正文里的链接带一道若隐若现的红线,悬停才显色 */

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

.post-content a {
  border-bottom: 1px solid rgba(127, 0, 25, 0.22);
}
.post-content a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- 页眉 / 页脚 ---- */

.site-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}
.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 1.4rem;
  padding-bottom: 1.2rem;
}
.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.02em;
}
.site-nav a { margin-left: 1.2rem; color: var(--muted); font-size: 0.9rem; }
.site-nav a:hover { color: var(--accent); }

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--soft-line);
  color: var(--muted);
  font-size: 0.82rem;
}
.site-footer .wrap { padding-top: 1.4rem; padding-bottom: 1.4rem; text-align: center; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.gongan-icon {
  height: 0.9em;
  width: auto;
  vertical-align: -0.1em;
  margin-right: 0.25em;
}

/* ---- 文章列表(首页/分类页):静态目录感 ---- */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem;
}
/* 列表项不帶下线,只靠呼吸感排列 */
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.7rem 0;
}
.post-list time {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.post-list a { color: var(--heading); }
.post-list a:hover { color: var(--accent); }
.post-list .category {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* ---- 分类树 / 子分类 ---- */

.category-tree ul, .subcategory-list {
  list-style: none;
  padding-left: 1.2rem;
}
.category-tree > ul { padding-left: 0; }
/* 行距与文章列表同一节奏 */
.category-tree li, .subcategory-list li { padding: 0.7rem 0; }
.category-tree a, .subcategory-list a { color: var(--heading); }
.category-tree a:hover, .subcategory-list a:hover { color: var(--accent); }
.count { color: var(--muted); font-size: 0.82rem; margin-left: 0.3rem; }

/* ---- 面包屑 ---- */

.breadcrumb {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ---- 文章页 ---- */

.page-title {
  color: var(--heading);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 2rem;
}

.post-header h1 {
  color: var(--heading);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.5rem;
}
.post-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 2.2rem;
}

/* 分类标签:MUJI 式全圆角,可点击 */
.tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.7em;
  margin-right: 0.3em;
  font-size: 0.78em;
  color: var(--muted);
}
a.tag:hover {
  color: var(--accent);
  border-color: rgba(127, 0, 25, 0.4);
}

/* 首页"全部文章"入口 */
.more-link { font-size: 0.85rem; margin: 1rem 0 2.5rem; }
.more-link a { color: var(--muted); }

/* ---- 正文排版 ---- */

.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
  color: var(--heading);
  line-height: 1.35;
  margin: 2.4rem 0 0.8rem;
}
/* 以空代线:标题不帶下划线,用留白分隔 */
.post-content h1 { font-size: 1.6rem; margin-top: 3rem; }
.post-content h2 { font-size: 1.35rem; margin-top: 3rem; }
.post-content h3 { font-size: 1.15rem; }
.post-content h4 { font-size: 1rem; }

.post-content p { margin: 0 0 1.25rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin: 0 0 1.25rem; }
.post-content li { margin-bottom: 0.35rem; }

.post-content strong { color: var(--heading); font-weight: 650; }
.post-content em { color: #5f5a53; }

.post-content img, .post-content video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto;
  border-radius: 2px;
}

/* 引用:不要底色块,一道左边线 + 灰字即可 */
.post-content blockquote {
  margin: 0 0 1.25rem;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid #d9d0c0;
  color: var(--muted);
}
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content code {
  font-family: var(--monospace);
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--heading);
  padding: 0.12em 0.4em;
  border-radius: 2px;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.7;
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}
.post-content pre code {
  background: none;
  padding: 0;
}
/* 让 pygments 的高亮块透出 pre 的暖底色,而不是自带冷灰底 */
.post-content pre .highlight { background: transparent; }

/* 三线表:只留横线,无竖线、无斑马纹、无色块 */
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.25rem;
  font-size: 0.94rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.post-content th, .post-content td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  vertical-align: top;
}
.post-content thead th {
  color: var(--heading);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.post-content tbody td {
  border-top: 1px solid var(--soft-line);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.post-content kbd {
  padding: 0.12rem 0.45rem;
  background: #f5f5f5;
  border: 1px solid var(--line);
  border-bottom-color: #d9d9d9;
  border-radius: 2px;
  font-family: var(--monospace);
  font-size: 0.85em;
}

.post-content mark { background: #efe6cf; padding: 0.08em 0.2em; }

/* mermaid 图居中 */
.post-content .mermaid {
  display: flex;
  justify-content: center;
  margin: 1.5em 0;
}

/* ---- 上一篇 / 下一篇 ---- */

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--soft-line);
  font-size: 0.88rem;
}
.post-nav a { color: var(--muted); }
.post-nav a:hover { color: var(--accent); }
.post-nav .next { margin-left: auto; text-align: right; }

/* ---- 首页简介 ---- */

.home-intro { color: var(--muted); margin-bottom: 2rem; }

/* ---- 小节标题(最近文章/分类/子分类) ---- */

section h2 {
  color: var(--heading);
  font-size: 1.15rem;
  margin: 2.2rem 0 1rem;
}

/* ---- 移动端 ---- */

@media only screen and (max-width: 900px) {
  html { font-size: 15px; }
  .sheet {
    min-height: auto;
    padding: 0 1.4rem 3rem;
    border-left: 0;
    border-right: 0;
  }
}
