@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

/* === 基础重置与变量 === */
:root {
  --bg: #f7f5f0;
  --bg-elevated: #ece9e0;
  --bg-hover: #e4e1d8;
  --border: #1a1a1a;
  --border-light: #a8a59a;
  --text: #1a1a1a;
  --text-dim: #555;
  --text-head: #000;
  --accent: #8b1a1a;
  --accent-hover: #b22222;
  --link: #8b1a1a;
  --link-hover: #b22222;
  --wiki-link: #1a3c6c;
  --warn: #8b6914;
  --radius: 0px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --font-body: 'Noto Sans SC', 'Source Han Sans SC', 'PingFang SC', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Noto Sans SC', monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

/* === 顶部报头 === */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 3px double var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 16px;
}
.menu-toggle {
  display: none;
  background: none; border: none; color: var(--text);
  font-size: 22px; cursor: pointer; padding: 4px 8px;
  font-family: sans-serif;
}
.menu-toggle:hover { background: var(--bg-hover); }
.site-title {
  font-size: 22px; font-weight: 700;
  color: var(--text-head); text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-body);
  letter-spacing: 1px;
}
.site-title:hover { color: var(--accent); }
.site-title small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: -4px;
}
.header-search {
  flex: 1; display: flex; justify-content: flex-end; position: relative;
  max-width: 300px; margin-left: auto;
}
#searchInput {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
}
#searchInput:focus { border-color: var(--border); }
.search-results {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: min(420px, 92vw);
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  display: none;
}
.search-results:has(*) { display: block; }
.search-item {
  display: block; padding: 10px 14px;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-body);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-hover); }
.search-item-title { font-weight: 700; color: var(--link); font-size: 15px; }
.search-item-snippet { font-size: 13px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.no-result { padding: 14px; color: var(--text-dim); font-size: 14px; text-align: center; }

/* === 布局 === */
.layout {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-light);
  position: fixed;
  top: var(--header-height); bottom: 0; left: 0;
  overflow-y: auto;
  padding: 20px 0;
}
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  max-width: 800px;
  padding: 32px 40px 80px;
}

/* === 侧边栏导航（报纸栏目感） === */
.nav-tree { padding: 0 14px; }
.nav-group { margin-bottom: 8px; }
.nav-group-title {
  display: flex; align-items: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 10px 6px;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-body);
}
.nav-group-title:hover { color: var(--text); }
.nav-group-title .arrow {
  display: inline-block; margin-right: 6px;
  font-size: 10px; transition: transform 0.2s;
  font-family: sans-serif;
}
.nav-group.collapsed .arrow { transform: rotate(-90deg); }
.nav-group.collapsed .nav-list { display: none; }
.nav-list { list-style: none; margin: 4px 0 10px; padding: 0 0 0 10px; }
.nav-list li { margin: 1px 0; }
.nav-list a {
  display: block; padding: 5px 10px;
  color: var(--text); text-decoration: none;
  font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-body);
}
.nav-list a:hover { background: var(--bg-hover); color: var(--link-hover); text-decoration: underline; }
.nav-list a.active { background: var(--bg-hover); color: var(--accent); font-weight: 700; }

/* === 面包屑 === */
.breadcrumbs {
  font-size: 13px; color: var(--text-dim);
  margin-bottom: 20px;
  font-family: var(--font-body);
}
.breadcrumbs a { color: var(--text-dim); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; color: var(--accent); }
.breadcrumbs span { margin: 0 6px; color: var(--border-light); }

/* === 文章排版（报纸风格） === */
article { color: var(--text); }
article h1 {
  font-size: 32px; font-weight: 700;
  color: var(--text-head); margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 3px double var(--border);
  font-family: var(--font-body);
  line-height: 1.3;
}
article h2 {
  font-size: 22px; font-weight: 700;
  color: var(--text-head); margin: 36px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-body);
  line-height: 1.35;
}
article h3 {
  font-size: 18px; font-weight: 700;
  color: var(--text-head); margin: 26px 0 10px;
  font-family: var(--font-body);
}
article h4 {
  font-size: 16px; font-weight: 700;
  color: var(--text-head); margin: 20px 0 8px;
  font-family: var(--font-body);
}
article p { margin: 0 0 14px; text-align: justify; }
article a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
article a:hover { color: var(--link-hover); }
article a.wiki-link { color: var(--wiki-link); }
article ul, article ol { margin: 0 0 14px; padding-left: 28px; }
article li { margin: 4px 0; }
article blockquote {
  margin: 16px 0; padding: 10px 18px;
  border-left: 4px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-style: italic;
}
article blockquote p:last-child { margin-bottom: 0; }
article hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 28px 0;
}

/* === 表格（线框表） === */
article table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0; font-size: 14px;
  border: 1px solid var(--border);
}
article th, article td {
  border: 1px solid var(--border-light);
  padding: 8px 12px; text-align: left;
}
article th {
  background: var(--bg-elevated);
  font-weight: 700; color: var(--text-head);
  border-bottom: 2px solid var(--border);
}
article tr:nth-child(even) { background: rgba(0,0,0,0.02); }

/* === 代码 === */
article code {
  background: var(--bg-elevated);
  padding: 2px 6px; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 14px;
  color: var(--accent);
  border: 1px solid var(--border-light);
}
article pre {
  background: var(--bg-elevated);
  padding: 14px 16px; border-radius: var(--radius);
  overflow-x: auto; margin: 16px 0;
  border: 1px solid var(--border-light);
}
article pre code { background: none; padding: 0; color: var(--text); border: none; }

/* === Frontmatter 信息条 === */
.meta-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 20px; font-size: 13px;
  font-family: var(--font-body);
}
.meta-tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  padding: 3px 10px;
  color: var(--text-dim);
}
.meta-tag .label { color: var(--accent); font-weight: 700; margin-right: 4px; }

/* === 页脚 === */
.page-footer {
  margin-top: 60px; padding-top: 24px;
  border-top: 1px solid var(--border-light);
  font-size: 13px; color: var(--text-dim);
  text-align: center; line-height: 1.8;
  font-family: var(--font-body);
}

/* === 移动端适配 === */
@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }
  .menu-toggle { display: block; }
  .sidebar {
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    z-index: 90;
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
    background: var(--bg);
    border-right: 1px solid var(--border-light);
  }
  .sidebar.open { transform: translateX(0); }
  .content {
    margin-left: 0;
    padding: 24px 20px 50px;
    max-width: 100%;
  }
  .site-title { font-size: 18px; }
  .site-title small { display: none; }
  .header-search { max-width: 160px; }
  article h1 { font-size: 26px; }
  article h2 { font-size: 20px; }
  article h3 { font-size: 17px; }
  article table { font-size: 13px; }
  article th, article td { padding: 6px 8px; }
}

/* === 滚动条美化 === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b8b4a8; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #9c988c; }

/* === 选中高亮 === */
::selection { background: rgba(139, 26, 26, 0.12); }
