/* ---------------------------------------------------------------
   极简静态教程库
   纸色底 + 墨色字 + 一点绿。没有框架，没有外部字体。
----------------------------------------------------------------*/

:root {
  --paper: #faf9f6;
  --card: #ffffff;
  --ink: #1b1a17;
  --muted: #6f6b63;
  --line: #e6e2d9;
  --accent: #2f6b4f;
  --accent-soft: #eaf1ec;
  --radius: 12px;
  --max: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; border-radius: 8px; }

/* ---------------------------------------------------------------- 导航 */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 249, 246, 0.88);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 16px;
}

.nav-links { display: flex; gap: 22px; font-size: 14px; color: var(--muted); }
.nav-links a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- 通用 */

main { display: block; }

.lead { color: var(--muted); margin: 0; }

.sec {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 24px 40px;
}

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
}

.sec-head h2 { font-size: 19px; margin: 0; letter-spacing: 0.01em; }

.more { font-size: 14px; color: var(--muted); }
.more:hover { color: var(--accent); }

/* ---------------------------------------------------------------- 首页 */

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 64px 24px 48px;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.hero .lead { font-size: 17px; max-width: 46ch; }

.search {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  max-width: 560px;
}

.search input,
.search-input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus,
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search button {
  padding: 12px 22px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.search button:hover { background: #275b43; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: #c9d6ce;
  transform: translateY(-2px);
}

.card h2,
.card h3 {
  font-size: 17px;
  line-height: 1.4;
  margin: 0;
}

.card-ex {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-cat,
.rel-cat,
.row-cat {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 10px;
  align-self: flex-start;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: wrap;
}

.date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
}

a.tag:hover { color: var(--accent); border-color: #c9d6ce; }

.cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cat-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 120px;
}

.cat-pill strong { font-size: 15px; font-weight: 600; }
.cat-pill span { font-size: 12px; color: var(--muted); }
.cat-pill:hover { border-color: #c9d6ce; }

/* ---------------------------------------------------------------- 归档 */

.archive-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 24px 64px;
}

.archive-head { margin-bottom: 26px; }
.archive-head h1 { font-size: 32px; margin: 0 0 8px; letter-spacing: -0.01em; }

.search-input { width: 100%; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 26px;
}

.chip {
  font-size: 13px;
  font-family: inherit;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip em { font-style: normal; opacity: 0.6; margin-left: 2px; }
.chip:hover { border-color: #c9d6ce; color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on em { opacity: 0.75; }

.rows { display: flex; flex-direction: column; }

.row {
  display: flex;
  gap: 18px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}

.row:hover { background: #fdfcfa; }
.row:hover strong { color: var(--accent); }

.row-cat {
  flex: 0 0 auto;
  height: fit-content;
  margin-top: 3px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.row-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.row-main strong { font-size: 16.5px; font-weight: 600; line-height: 1.45; }
.row-ex { font-size: 14px; color: var(--muted); }
.row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

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

.doc-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 24px 20px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.toc-col {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.toc-box {
  border-left: 2px solid var(--line);
  padding-left: 16px;
}

.toc-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 10px;
  text-transform: uppercase;
}

.toc-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.toc-list .toc-list { padding-left: 12px; margin-top: 4px; }
.toc-list li { margin: 6px 0; line-height: 1.5; }
.toc-list a { color: var(--muted); }
.toc-list a:hover { color: var(--accent); }
.toc-empty { font-size: 13px; color: var(--muted); margin: 0; }

.back { font-size: 13.5px; color: var(--muted); }
.back:hover { color: var(--accent); }

.doc h1 {
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.3;
  margin: 12px 0 10px;
  letter-spacing: -0.01em;
}

.crumb { margin-bottom: 4px; }

.doc-ex { color: var(--muted); margin: 0 0 16px; font-size: 15.5px; }

.doc-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

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

.prose { font-size: 16px; line-height: 1.85; }

.prose > *:first-child { margin-top: 0; }

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  line-height: 1.4;
  margin: 2em 0 0.6em;
  letter-spacing: -0.005em;
}

.prose h2 {
  font-size: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.prose h3 { font-size: 18px; }
.prose h4 { font-size: 16px; color: var(--muted); }

.prose p { margin: 1em 0; }

.prose ul,
.prose ol { margin: 1em 0; padding-left: 1.4em; }
.prose li { margin: 0.4em 0; }
.prose li > ul,
.prose li > ol { margin: 0.3em 0; }

.prose strong { font-weight: 650; }

.prose a {
  color: var(--accent);
  border-bottom: 1px solid #cfe0d5;
}

.prose a:hover { border-bottom-color: var(--accent); }

.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
  background: #f1efe9;
  border-radius: 5px;
  padding: 2px 6px;
}

.prose pre {
  background: #1f1e1b;
  color: #eae7e0;
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
  margin: 1.4em 0;
}

.prose pre code { background: none; padding: 0; color: inherit; font-size: 13.5px; }

.prose img { display: block; margin: 1.4em 0; border: 1px solid var(--line); }

.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 14.5px;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
}

.prose th { background: #f3f1eb; font-weight: 600; }

/* ---------------------------------------------------------------- 相关 */

.rel-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px 24px 72px;
  border-top: 1px solid var(--line);
}

.rel-wrap h2 { font-size: 16px; margin: 0 0 16px; color: var(--muted); font-weight: 600; }

.rel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.rel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}

.rel:hover { border-color: #c9d6ce; }
.rel:hover strong { color: var(--accent); }
.rel strong { font-weight: 600; line-height: 1.45; }

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

.foot {
  border-top: 1px solid var(--line);
  padding: 28px 24px 40px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.foot p { margin: 0; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 860px) {
  .doc-wrap { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; }
  .toc-col { position: static; order: 2; }
  .toc-box { border-left: none; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .hero { padding: 44px 24px 32px; }
  .row { gap: 12px; }
}
