/* ============================================================
   山间小站 —— 简洁风格：无色块装饰，细边框 + 留白 + 单色系
   ============================================================ */

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

:root {
  --ink: #2b2b2b;
  --ink-soft: #6b6b6b;
  --line: #d8d8d8;
  --paper: rgba(255, 255, 255, 0.93);
  --maxw: 760px;
  font-size: 16px;
}

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  line-height: 1.75;
  background: #f4f2ee;
}

/* ---------- 背景轮播 ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.6s ease;
  z-index: 0;
}
.bg-layer.show { opacity: 1; }
.bg-veil {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  z-index: 1;
  pointer-events: none;
}

/* ---------- 布局 ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 250px;
  padding: 28px 20px 20px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.main {
  position: relative;
  z-index: 10;
  margin-left: 250px;
  padding: 40px 24px 60px;
  display: flex;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: var(--maxw);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 40px 44px 36px;
}

/* ---------- 侧栏 / 目录树 ---------- */
.site-name a {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink);
  text-decoration: none;
}
.site-sub {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 4px 0 22px;
  letter-spacing: 1px;
}

.tree { flex: 1; font-size: 0.92rem; }

.tree-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  color: var(--ink);
  font-weight: 600;
  padding: 7px 2px;
  cursor: pointer;
  text-align: left;
}
.tree-cat .arrow {
  display: inline-block;
  width: 1em;
  color: var(--ink-soft);
  transition: transform 0.15s;
  font-size: 0.75em;
}
.tree-cat.open .arrow { transform: rotate(90deg); }

.tree-children {
  display: none;
  margin: 0 0 6px 10px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.tree-children.open { display: block; }

.tree-item {
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding: 4px 2px;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-item .branch { color: var(--line); flex: none; }
.tree-item:hover { color: var(--ink); }
.tree-item.active {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.sidebar-foot {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* ---------- 文章排版 ---------- */
.article-head h1 {
  font-size: 1.5rem;
  line-height: 1.4;
  letter-spacing: 0.5px;
}
.article-meta {
  margin: 10px 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.article-body h3 {
  margin: 26px 0 10px;
  font-size: 1.08rem;
}
.article-body p { margin: 10px 0; }
.article-body ul { margin: 10px 0 10px 1.4em; }
.article-body blockquote {
  margin: 16px 0;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--ink-soft);
  color: var(--ink-soft);
}
.article-body code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
}
.article-body pre {
  margin: 14px 0;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.045);
  border: 1px solid var(--line);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
}
.article-body pre code { background: none; padding: 0; }
.article-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 0.88rem;
}
.article-body th, .article-body td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}

/* 首页文章列表 */
.home-head { font-size: 1.15rem; letter-spacing: 1px; margin-bottom: 6px; }
.home-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.home-item {
  display: block;
  padding: 14px 2px;
  border-bottom: 1px dashed var(--line);
  text-decoration: none;
  color: var(--ink);
}
.home-item:hover .home-title { text-decoration: underline; text-underline-offset: 4px; }
.home-title { font-weight: 600; font-size: 1rem; }
.home-item-meta { font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }

/* ---------- 留言区 ---------- */
.comments { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.comments h2 { font-size: 1.02rem; margin-bottom: 14px; letter-spacing: 1px; }

.comment {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.9rem;
}
.comment-head { color: var(--ink-soft); font-size: 0.78rem; margin-bottom: 2px; }
.comment-head b { color: var(--ink); font-weight: 600; }

.comment-form { margin-top: 16px; }
.comment-form input,
.comment-form textarea {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  margin-bottom: 8px;
}
.comment-form input { max-width: 220px; }
.comment-form textarea { resize: vertical; min-height: 72px; }
.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--ink-soft); }

.comment-form button {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 22px;
  border: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.comment-form button:hover { background: rgba(0, 0, 0, 0.05); }
.comment-form button:disabled { opacity: 0.5; cursor: default; }

.comment-notice {
  font-size: 0.84rem;
  color: var(--ink-soft);
  padding: 10px 12px;
  border: 1px dashed var(--line);
}
.comment-empty { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- 顶部栏（仅移动端） ---------- */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  padding: 0 14px;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.menu-btn {
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: none;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--ink);
}
.topbar-title { font-weight: 700; letter-spacing: 2px; }

.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 25;
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .topbar { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 270px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.show { display: block; }
  .main { margin-left: 0; padding-top: 68px; }
  .card { padding: 26px 20px 30px; border: none; }
}
