/* ============================================================
   户外知识 · 移动优先样式
   单列布局（≤680px）· 深色模式跟随系统 · 底部 Tab · 安全区适配
   ============================================================ */

:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #edf1e9;
  --text: #16201a;
  --text-2: #5c6a5e;
  --border: #e1e7db;
  --accent: #1c7a4d;
  --accent-press: #155f3b;
  --accent-soft: #e3f1e9;
  --co-tip-bg: #e7f3ec;    --co-tip-fg: #176b45;    --co-tip-bd: #b7dcc7;
  --co-info-bg: #e9f1fb;   --co-info-fg: #1f5da6;   --co-info-bd: #bcd6f2;
  --co-warn-bg: #fbf1de;   --co-warn-fg: #96600a;   --co-warn-bd: #eed9ac;
  --co-danger-bg: #fbe9e7; --co-danger-fg: #a8382b; --co-danger-bd: #f0c4bd;
  --shadow: 0 1px 2px rgba(16, 32, 20, .05), 0 4px 14px rgba(16, 32, 20, .05);
  --tabbar-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111512;
    --surface: #191e1a;
    --surface-2: #20271f;
    --text: #e6ebe5;
    --text-2: #96a498;
    --border: #2b322c;
    --accent: #46a975;
    --accent-press: #5cbc87;
    --accent-soft: #1b2f23;
    --co-tip-bg: #182b20;    --co-tip-fg: #6cc294;    --co-tip-bd: #274a36;
    --co-info-bg: #16273a;   --co-info-fg: #7db4ea;   --co-info-bd: #24405c;
    --co-warn-bg: #2e2716;   --co-warn-fg: #dfb25f;   --co-warn-bd: #4d4122;
    --co-danger-bg: #331d1a; --co-danger-fg: #e58d82; --co-danger-bd: #55302a;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "PingFang SC", "MiSans",
        "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

a { color: var(--accent); text-decoration: none; }
a:active { opacity: .75; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
strong { font-weight: 650; }
code {
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2); border-radius: 5px; padding: 2px 6px;
}

.container { max-width: 680px; margin: 0 auto; padding: 0 16px; }

/* ---------- 阅读进度条 ---------- */
#progressbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
#progressbar > i {
  display: block; height: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.tb-inner { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.tb-text { min-width: 0; }
.tb-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
.tb-sub { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.back {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 24px; line-height: 1;
  color: var(--text);
}
.back:active { background: var(--surface-2); }

/* ---------- 搜索 ---------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px; margin: 14px 0 6px;
}
.search-box svg { flex: none; width: 17px; height: 17px; color: var(--text-2); }
.search-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  font: inherit; font-size: 15px; color: var(--text);
}
.search-box input::placeholder { color: var(--text-2); }

/* ---------- 区块标题 ---------- */
.sec-title {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px; font-weight: 650; color: var(--text-2);
  letter-spacing: .04em; margin: 22px 0 10px;
}
.sec-title .sec-more { font-size: 12px; font-weight: 500; color: var(--accent); }

/* ---------- 分类卡片 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.cat-card:active { transform: scale(.97); }
.cat-ico { font-size: 26px; line-height: 1.2; }
.cat-name { font-size: 15px; font-weight: 650; }
.cat-desc {
  font-size: 12px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-count { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 2px; }

/* ---------- 文章卡片 ---------- */
.art-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  color: var(--text); box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.art-card:active { transform: scale(.98); }
.art-card-title { font-size: 15.5px; font-weight: 650; line-height: 1.45; }
.art-card-sum {
  font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.art-card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-2); margin-top: 10px;
}
.fav-dot { color: #e8a33d; }

/* ---------- 标签 ---------- */
.chip {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 3px 10px; line-height: 1.5;
}
.chip-link { margin-bottom: 10px; }

/* ---------- 文章页 ---------- */
.article { padding-top: 18px; }
.article h1 { font-size: 24px; line-height: 1.35; margin: 0 0 12px; font-weight: 750; }
.art-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 16px;
}
.fav-btn {
  margin-left: auto; font-size: 12.5px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 6px 14px; min-height: 32px;
}
.fav-btn.on { color: #8a6414; background: #f7e8c8; }
@media (prefers-color-scheme: dark) {
  .fav-btn.on { color: #e8c06a; background: #3a2f16; }
  .fav-dot { color: #e8c06a; }
}
.art-summary {
  font-size: 14.5px; color: var(--text-2); line-height: 1.8;
  border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin: 0 0 20px;
}

/* 目录 */
.toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 16px; margin-bottom: 20px; font-size: 14px;
}
.toc summary {
  cursor: pointer; font-weight: 650; font-size: 13px; color: var(--text-2);
  list-style: none; outline: 0;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: " ▾"; }
.toc[open] summary::after { content: " ▴"; }
.toc ol { margin: 8px 0 4px; padding-left: 20px; }
.toc li { margin: 6px 0; line-height: 1.5; }
.toc a { color: var(--text-2); }

/* 正文块 */
.article h2 {
  font-size: 19px; line-height: 1.4; font-weight: 700;
  margin: 30px 0 12px; scroll-margin-top: 72px;
}
.article h3 { font-size: 16.5px; font-weight: 700; margin: 22px 0 10px; scroll-margin-top: 72px; }
.article p { margin: 0 0 14px; }
.article hr { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }

.bl-list { margin: 0 0 14px; padding-left: 22px; }
.bl-list li { margin: 7px 0; padding-left: 2px; }
.bl-list li::marker { color: var(--accent); }

.bl-steps { margin: 0 0 14px; padding-left: 0; list-style: none; counter-reset: step; }
.bl-steps li {
  position: relative; padding-left: 34px; margin: 12px 0; counter-increment: step;
}
.bl-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}

blockquote {
  margin: 0 0 14px; padding: 10px 16px;
  border-left: 3px solid var(--border); background: var(--surface);
  border-radius: 0 12px 12px 0; color: var(--text-2); font-size: 14.5px;
}
blockquote cite { display: block; margin-top: 8px; font-size: 12.5px; font-style: normal; }

/* 提示框 */
.callout {
  border: 1px solid; border-radius: 12px;
  padding: 12px 14px; margin: 0 0 16px; font-size: 14.5px;
}
.co-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.co-tag { font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.co-title { font-size: 13.5px; font-weight: 650; }
.co-body { line-height: 1.7; }
.co-tip    { background: var(--co-tip-bg);    border-color: var(--co-tip-bd); }
.co-tip .co-tag, .co-tip .co-title { color: var(--co-tip-fg); }
.co-info   { background: var(--co-info-bg);   border-color: var(--co-info-bd); }
.co-info .co-tag, .co-info .co-title { color: var(--co-info-fg); }
.co-warn   { background: var(--co-warn-bg);   border-color: var(--co-warn-bd); }
.co-warn .co-tag, .co-warn .co-title { color: var(--co-warn-fg); }
.co-danger { background: var(--co-danger-bg); border-color: var(--co-danger-bd); }
.co-danger .co-tag, .co-danger .co-title { color: var(--co-danger-fg); }

/* 可交互清单 */
.checklist {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; margin: 0 0 18px;
}
.cl-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.cl-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-top: 1px dashed var(--border);
  font-size: 14.5px; line-height: 1.55; cursor: pointer;
}
.cl-item input[type="checkbox"] {
  flex: none; width: 20px; height: 20px; margin: 2px 0 0;
  accent-color: var(--accent); cursor: pointer;
}
.cl-item.done .cl-text { text-decoration: line-through; color: var(--text-2); }
.cl-progress { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 10px; }

/* 表格 */
.tbl-wrap {
  overflow-x: auto; margin: 0 0 16px;
  border: 1px solid var(--border); border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; }
th { background: var(--surface-2); font-weight: 650; font-size: 12.5px; }
td { border-top: 1px solid var(--border); }
tr td:first-child { font-weight: 600; }

/* 上一篇 / 下一篇 */
.pn { display: flex; gap: 10px; margin: 34px 0 8px; }
.pn-item {
  flex: 1; min-width: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  color: var(--text);
}
.pn-item:active { transform: scale(.98); }
.pn-dir { display: block; font-size: 11.5px; color: var(--text-2); }
.pn-title {
  display: block; font-size: 13.5px; font-weight: 600; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pn-item.next { text-align: right; }

/* 页脚 */
.site-footer {
  margin-top: 36px; padding: 18px 0 6px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2); line-height: 1.8; text-align: center;
}

/* 空状态 */
.empty-box {
  text-align: center; color: var(--text-2); font-size: 13.5px;
  padding: 40px 20px; line-height: 1.8;
}

/* ---------- 底部 Tab ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a {
  flex: 1; min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--text-2);
}
#tabbar a svg { width: 22px; height: 22px; }
#tabbar a.active { color: var(--accent); font-weight: 650; }

/* ---------- 桌面端微调 ---------- */
@media (min-width: 720px) {
  body { font-size: 16.5px; }
  .article h1 { font-size: 27px; }
}

/* 减弱动效 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
