/* 对外阅读站 —— 书感排版，浅色为默认，深色跟随系统 */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --bg: #faf8f4; --surface: #ffffff; --surface-2: #f3efe7;
  --ink: #1c1b18; --ink-2: #56534c; --ink-3: #8b877d;
  --line: #e8e3d9; --line-2: #d6cfc0;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --r: 10px;
  --shadow: 0 1px 2px rgba(28,27,24,.04), 0 8px 24px -12px rgba(28,27,24,.18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312; --surface: #1b1b1a; --surface-2: #232320;
    --ink: #eceae4; --ink-2: #b3afa5; --ink-3: #837f75;
    --line: #2c2c29; --line-2: #3a3a35;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-icon {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 9px; font-size: 17px; line-height: 1;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--serif); font-size: 17px; letter-spacing: .04em; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 12px; }
.ver {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-2);
}
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; width: 15px; height: 15px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; }
.search input {
  width: 260px; padding: 7px 34px 7px 32px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.search kbd {
  position: absolute; right: 8px; font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px;
}

/* ---------- Hero ---------- */
.hero { max-width: 1180px; margin: 0 auto; padding: 56px 28px 28px; }
.hero h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 52px); line-height: 1.15; margin: 0 0 14px; letter-spacing: .02em; }
.lede { margin: 0; max-width: 640px; color: var(--ink-2); font-size: 16px; }
.stats { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 26px; font-size: 13px; color: var(--ink-3); }
.stats b { display: block; font-family: var(--serif); font-size: 24px; color: var(--ink); font-weight: 600; }

/* ---------- 分类 ---------- */
.chips {
  position: sticky; top: 63px; z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  /* 居中显示；放不下时退回左对齐（safe），保证最左边的标签还能滚回来 */
  justify-content: center;
  justify-content: safe center;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 5px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13px; transition: .16s;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .6; margin-left: 5px; font-size: 11px; }

/* ---------- 卡片 ---------- */
.grid {
  max-width: 1180px; margin: 0 auto; padding: 28px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 20px 20px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card-top { display: flex; align-items: baseline; gap: 10px; }
.card-seq { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.card h3 { font-family: var(--serif); font-size: 19px; margin: 0; line-height: 1.35; letter-spacing: .01em; }
.card .sum { color: var(--ink-2); font-size: 13.5px; line-height: 1.65; margin: 0; }
.card .excerpt { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--ink-2);
}
.badge-q { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.dots { display: inline-flex; gap: 2px; margin-left: 6px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.dot.on { background: var(--accent); }
.empty { text-align: center; padding: 80px 20px; color: var(--ink-3); }

/* ---------- 详情 ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-bg { position: absolute; inset: 0; background: rgba(20,18,14,.42); backdrop-filter: blur(3px); animation: fade .18s ease; }
.sheet-body {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(780px, 100%);
  background: var(--bg); overflow-y: auto; box-shadow: -24px 0 60px -20px rgba(0,0,0,.3);
  animation: slide .24s cubic-bezier(.2,.7,.3,1);
  padding: 0 0 80px;
}
@keyframes fade { from { opacity: 0 } }
@keyframes slide { from { transform: translateX(28px); opacity: .4 } }
.sheet-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 16px 44px 16px 32px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.sheet-head .k { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.sheet-head .close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font-size: 16px; line-height: 1; display: grid; place-items: center;
}
.sheet-head .close:hover { background: var(--surface-2); }
.article { padding: 30px 44px 0 32px; }
.article h1 { font-family: var(--serif); font-size: 32px; line-height: 1.3; margin: 0 0 12px; }
.article .sub { color: var(--ink-2); font-size: 15.5px; margin: 0 0 22px; }
.article h2 {
  font-family: var(--serif); font-size: 19px; margin: 34px 0 12px; padding-bottom: 7px;
  border-bottom: 1px solid var(--line); letter-spacing: .02em;
}
.article h3 { font-size: 15.5px; margin: 22px 0 8px; }
.article p { margin: 0 0 14px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; }
.article li { margin: 5px 0; }
.article strong { font-weight: 600; }
.article blockquote {
  margin: 0 0 16px; padding: 12px 18px; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 6px 6px 0; color: var(--ink-2);
}
.article blockquote p:last-child { margin-bottom: 0; }
.article .quote { margin: 0 0 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.article .quote p { margin: 0 0 6px; font-family: var(--serif); font-size: 16px; }
.article .quote cite { font-size: 12px; color: var(--ink-3); font-style: normal; }
.article figure { margin: 0 0 20px; }
.article figure img { width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.kv { margin: 0 0 18px; }
.links a {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0;
  padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 12.5px; color: var(--ink-2);
}
.links a:hover { border-color: var(--accent); color: var(--accent); }
.links span { display: inline-flex; align-items: center; margin: 0 6px 6px 0; padding: 4px 10px; border: 1px dashed var(--line-2); border-radius: 999px; font-size: 12.5px; color: var(--ink-3); }
.sheet-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); }
.sheet-nav button {
  flex: 1; padding: 10px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer;
}
.sheet-nav button:hover { border-color: var(--accent); color: var(--accent); }

.foot { text-align: center; padding: 40px 20px 60px; color: var(--ink-3); font-size: 12px; }

@media (max-width: 720px) {
  .top { padding: 10px 16px; gap: 10px; }
  .brand-text em { display: none; }
  .search input { width: 44px; padding-right: 10px; }
  .search input:focus { width: 170px; padding-right: 10px; }
  .search kbd { display: none; }
  .hero { padding: 34px 18px 20px; }
  .chips { top: 55px; padding: 10px 16px; }
  .grid { padding: 18px; grid-template-columns: 1fr; }
  .sheet-body { width: 100%; }
  .article { padding: 22px 20px 0; }
  .sheet-head { padding: 12px 20px; }
}
