/* 《一道》站点样式：移动优先，阅读为主 */
:root {
  --bg: #faf8f4;
  --fg: #2d2a26;
  --muted: #6f685d;
  --accent: #7a5c3e;
  --card: #ffffff;
  --border: #e8e2d8;
  --q-bg: #f3eee6;
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 17px;
}
html[data-theme="dark"] {
  --bg: #1c1a17;
  --fg: #d8d2c8;
  --muted: #8a8378;
  --accent: #c9a87c;
  --card: #262320;
  --border: #3a362f;
  --q-bg: #2a2622;
}
html[data-fontsize="large"] { font-size: 20px; }
html[data-fontsize="xlarge"] { font-size: 23px; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #1c1a17; --fg: #d8d2c8; --card: #262320;
    --border: #3a362f; --q-bg: #2a2622; --accent: #c9a87c;
    --muted: #8a8378;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  line-height: 1.9;
}
main { max-width: 42rem; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.4; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; color: var(--accent); }
.muted { color: var(--muted); font-size: .9rem; }

/* 页眉页脚 */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1.2rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.site-name { font-size: 1.2rem; font-weight: 700; letter-spacing: .3em; color: var(--fg); }
.site-nav { display: flex; gap: .8rem; align-items: center; }
.site-nav a { color: var(--muted); font-size: .9rem; padding: .4rem .3rem; }
.site-nav button {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); cursor: pointer; padding: .4rem .7rem; font-size: .85rem;
  font-family: inherit;
}
.site-nav button:hover { color: var(--accent); border-color: var(--accent); }
.site-footer {
  border-top: 1px solid var(--border); margin-top: 2rem;
  padding: 1.2rem; text-align: center; color: var(--muted); font-size: .8rem;
}

/* 首页 */
.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.4rem; letter-spacing: .5em; margin-left: .5em; }
.subtitle { color: var(--accent); }
.intro { color: var(--muted); font-size: .9rem; }
.searchbox { display: flex; gap: .5rem; margin: 1.2rem 0; }
.searchbox input {
  flex: 1; padding: .6rem .9rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--card); color: var(--fg);
  font-family: inherit; font-size: .95rem;
}
.searchbox button {
  padding: .6rem 1.1rem; border: none; border-radius: 8px;
  background: var(--accent); color: var(--bg); cursor: pointer;
  font-family: inherit; font-size: .95rem;
}
#search-results { text-align: left; }
#search-results .hit-snippet { color: var(--muted); font-size: .85rem; }
/* 语义检索命中的原文片段 */
.article-list .passage {
  display: block; margin: .4rem 0 .2rem; padding: .5rem .75rem;
  background: var(--q-bg); border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0; color: var(--fg);
  font-size: .9rem; line-height: 1.75; text-align: justify;
}
/* 深链定位到的最相关段落，短暂高亮 */
.hl {
  background: var(--q-bg); box-shadow: 0 0 0 .35rem var(--q-bg);
  border-radius: 4px; animation: hl-fade 2.4s ease;
}
@keyframes hl-fade { 0% { background: var(--accent); } 30% { background: var(--q-bg); } }

/* 整理提炼（第二层，opt-in 按钮触发） */
#organize-area { margin: 0 0 1rem; }
#btn-organize {
  padding: .55rem 1rem; border: 1px solid var(--accent); border-radius: 8px;
  background: none; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: .9rem;
}
#btn-organize:hover { background: var(--accent); color: var(--bg); }
#btn-organize:disabled { opacity: .5; cursor: default; background: none; color: var(--accent); }
.organize-result {
  margin-top: .8rem; padding: .9rem 1.1rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px;
}
.organize-disclaimer { color: var(--muted); font-size: .8rem; margin: 0 0 .7rem; }
.organize-text { text-align: justify; line-height: 1.9; margin: 0 0 1rem; }
.organize-text:last-child { margin-bottom: 0; }
/* 引用标记：细小、浅色，不打断阅读；点击才弹确认框，避免误触跳走 */
.cite-mark {
  display: inline-block; border: none; background: none; cursor: pointer;
  color: var(--muted); opacity: .5; font-size: .55rem; vertical-align: super;
  padding: 0 .2rem; line-height: 1; font-family: inherit;
}
.cite-mark:hover { opacity: 1; color: var(--accent); }
.cite-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem;
}
.cite-dialog {
  background: var(--card); border-radius: 10px; padding: 1.2rem;
  max-width: 20rem; width: 100%; text-align: center;
}
.cite-dialog p { margin: 0 0 1rem; color: var(--fg); }
.cite-actions { display: flex; gap: .7rem; justify-content: center; }
.cite-actions button, .cite-actions a {
  padding: .5rem 1rem; border-radius: 8px; font-size: .9rem; cursor: pointer;
  font-family: inherit; display: inline-block;
}
.cite-cancel { border: 1px solid var(--border); background: none; color: var(--muted); }
.cite-go { border: none; background: var(--accent); color: var(--bg); }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 540px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
.cat-card {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: .7rem .9rem; color: var(--fg);
}
.cat-card:hover { border-color: var(--accent); text-decoration: none; }
.cat-card .count { color: var(--muted); font-size: .8rem; }

/* 文章列表 */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { border-bottom: 1px solid var(--border); }
.article-list a { display: block; padding: .65rem .2rem; color: var(--fg); }
.article-list a:hover { text-decoration: none; background: var(--card); }
.article-list .num { color: var(--muted); font-size: .8rem; margin-right: .6rem; }
.article-list .t { font-weight: 600; }
.article-list .s { display: block; color: var(--muted); font-size: .85rem; }

/* 文章页 */
.article-meta { color: var(--muted); font-size: .85rem; margin-bottom: -.5rem; }
.question {
  margin: 1.2rem 0; padding: .9rem 1.1rem; background: var(--q-bg);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
}
.question .q-label {
  float: left; font-weight: 700; color: var(--accent); margin-right: .6rem;
}
.question p { margin: .3rem 0; }
.answer p { margin: 1.1rem 0; text-align: justify; }
.article-cats { margin: 1.5rem 0; }
.chip {
  display: inline-block; border: 1px solid var(--border); border-radius: 999px;
  padding: .1rem .7rem; font-size: .85rem; margin-right: .4rem; color: var(--muted);
}
.chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; font-size: .9rem; }
.pager .next { margin-left: auto; text-align: right; }

/* 辑序、关于 */
.preface p, .prose p { text-align: justify; }
