/* OPALL redesign sample — 档案文献方向 · 双主题
   纸面/书房 · 宋体标题 · 等宽编目 · 单一强调色 */

:root {
  --paper: #faf8f3;
  --paper-deep: #f3f0e8;
  --ink: #1c1a17;
  --ink-soft: #57524a;
  --ink-faint: #8d867a;
  --rule: #ddd7c9;
  --rule-strong: #1c1a17;
  --accent: #1e5741;
  --accent-soft: #3d7a5f;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --paper: #141311;
  --paper-deep: #1c1a17;
  --ink: #ece7db;
  --ink-soft: #a89f90;
  --ink-faint: #6f675a;
  --rule: #2c2924;
  --rule-strong: #d8d2c4;
  --accent: #8fc3a6;
  --accent-soft: #6da689;
}

:root[data-theme="dark"] .doc-content p { color: #c9c2b3; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  transition: background-color .3s ease, color .3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 32px; }

/* ---------- 主题切换 ---------- */
.theme-toggle {
  position: fixed; top: 20px; right: 24px; z-index: 10;
  background: none; border: none; cursor: pointer;
  color: var(--ink-faint); font-size: 15px; line-height: 1;
  padding: 8px; transition: color .2s, transform .5s;
}
.theme-toggle:hover { color: var(--ink); transform: rotate(180deg); }

/* ---------- 顶部导航（内页） ---------- */
.top-nav {
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.top-nav .wrap {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 18px; padding-bottom: 18px; padding-right: 64px;
}
.top-nav .brand { font-family: var(--mono); letter-spacing: .22em; color: var(--ink); font-size: 13px; }
.top-nav nav { display: flex; gap: 28px; flex-wrap: wrap; }
.top-nav nav a { color: var(--ink-soft); }
.top-nav nav a[aria-current] { color: var(--ink); border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.top-nav nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- meta 行 ---------- */
.meta { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--ink-faint); }
.meta b { color: var(--accent); font-weight: 500; }

/* ---------- 门（极简首页） ---------- */
.cover {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0;
}
.gate-mark {
  font-family: var(--serif);
  font-size: 21px; font-weight: 600;
  letter-spacing: .52em; text-indent: .52em; /* 视觉居中补偿 */
  color: var(--ink);
}
.gate-rule {
  width: 1px; height: 56px; margin: 40px 0 48px;
  background: var(--rule-strong); opacity: .35;
}
.gate-doors {
  display: flex; gap: 12px;
}
.gate-doors a {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 20px 22px;
  color: var(--ink-faint);
}
.gate-doors a:hover { text-decoration: none; color: var(--ink); }
.gate-doors svg { display: block; transition: color .25s ease; }
.gate-label {
  font-size: 13px; letter-spacing: .3em; text-indent: .3em;
  color: var(--ink-soft);
  opacity: 0; transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
  text-align: center;
}
.gate-label .en {
  display: block; font-family: var(--mono); font-size: 9px;
  letter-spacing: .22em; text-indent: .22em; color: var(--ink-faint);
  margin-top: 4px;
}
.gate-doors a:hover .gate-label,
.gate-doors a:focus-visible .gate-label { opacity: 1; transform: translateY(0); }
.gate-foot {
  position: fixed; bottom: 36px; left: 0; right: 0;
  text-align: center;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em;
  color: var(--ink-faint); opacity: .7;
}
.gate-signals {
  position: fixed; bottom: 34px; right: 32px;
  font-size: 12px; letter-spacing: .2em;
  color: var(--ink-faint); opacity: .75;
}
.gate-signals span { font-family: var(--mono); font-size: 9px; letter-spacing: .22em; margin-left: 6px; }
.gate-signals:hover { color: var(--ink); text-decoration: none; opacity: 1; }

/* ---------- 期刊刊头（索引页） ---------- */
.masthead { padding: 72px 0 56px; border-bottom: 2px solid var(--rule-strong); }
.masthead h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 60px);
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.1;
}
.masthead .tagline {
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--ink-soft);
  margin-top: 18px;
  font-weight: 400;
}
.masthead .meta { margin-top: 24px; }
.masthead .statement {
  margin-top: 32px; max-width: 40em;
  color: var(--ink-soft); font-size: 15px;
  padding-left: 16px; border-left: 2px solid var(--accent-soft);
}

/* ---------- 目录区块 ---------- */
.toc-section { padding: 56px 0 8px; }
.toc-section + .toc-section { border-top: 1px solid var(--rule); margin-top: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.section-head h2 {
  font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .02em;
}
.section-head .meta a { color: var(--ink-faint); }
.section-head .meta a:hover { color: var(--accent); }

.entry {
  display: grid;
  grid-template-columns: 96px 1fr 88px;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.entry:first-of-type { border-top: none; }
.entry .no { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--ink-faint); }
.entry h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.4; }
.entry h3 a { color: var(--ink); }
.entry h3 a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.entry .desc { margin-top: 8px; font-size: 14.5px; color: var(--ink-soft); max-width: 44em; }
.entry .desc b { font-weight: 600; color: var(--ink); }
.status { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-align: right; white-space: nowrap; }
.status.pub { color: var(--accent); }
.status.pub::before { content: "●"; font-size: 8px; vertical-align: 2px; margin-right: 6px; }
.status.prep { color: var(--ink-faint); }

.entry.dim { padding: 14px 0; }
.entry.dim h3 { font-size: 15.5px; font-family: var(--sans); font-weight: 500; color: var(--ink-soft); }
.entry.dim .desc { display: inline; margin: 0 0 0 12px; font-size: 13.5px; color: var(--ink-faint); }

/* 方法与证据 · 三栏 */
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--rule); }
.method-grid a {
  padding: 26px 24px 26px 0; border-right: 1px solid var(--rule);
  color: var(--ink); display: block;
}
.method-grid a:nth-child(3n) { border-right: none; }
.method-grid a + a { padding-left: 24px; }
.method-grid a:hover { text-decoration: none; background: var(--paper-deep); }
.method-grid .t { font-family: var(--serif); font-size: 17px; font-weight: 600; display: block; }
.method-grid .t::after { content: " →"; color: var(--accent); font-family: var(--sans); }
.method-grid .d { font-size: 13px; color: var(--ink-soft); margin-top: 6px; display: block; line-height: 1.7; }

/* ---------- 页脚 ---------- */
.footer { margin-top: 96px; border-top: 2px solid var(--rule-strong); }
.footer .wrap {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding-top: 28px; padding-bottom: 56px;
}
.footer p { font-size: 13px; color: var(--ink-faint); }

/* ---------- 档案页 ---------- */
.dossier-head { padding: 64px 0 48px; border-bottom: 2px solid var(--rule-strong); }
.dossier-head .meta { margin-bottom: 24px; }
.dossier-head h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.25; letter-spacing: .02em;
}
.dossier-head .sub {
  font-family: var(--serif); font-size: 20px; color: var(--ink-soft); margin-top: 14px;
}
.dossier-head .lead {
  margin-top: 28px; max-width: 42em; color: var(--ink-soft); font-size: 15.5px;
  padding-left: 16px; border-left: 2px solid var(--accent-soft);
}

.dossier-body { display: grid; grid-template-columns: 200px 1fr; gap: 64px; padding-top: 56px; }

.doc-toc { position: sticky; top: 32px; align-self: start; }
.doc-toc .label { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--ink-faint); margin-bottom: 16px; }
.doc-toc ol { list-style: none; }
.doc-toc li { margin-bottom: 10px; }
.doc-toc a { font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 10px; line-height: 1.5; }
.doc-toc a .n { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); flex-shrink: 0; padding-top: 2px; }
.doc-toc a:hover { color: var(--accent); text-decoration: none; }

.doc-content { max-width: 640px; min-width: 0; }
.doc-content section { padding-bottom: 48px; }
.doc-content section + section { border-top: 1px solid var(--rule); padding-top: 40px; }
.doc-content h2 {
  font-family: var(--serif); font-size: 23px; font-weight: 600; margin-bottom: 20px; line-height: 1.4;
}
.doc-content h2 .n {
  font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--accent);
  letter-spacing: .12em; display: block; margin-bottom: 10px;
}
.doc-content h2 .en {
  font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--ink-faint);
  letter-spacing: .08em; display: block; margin-top: 6px;
}
.doc-content p { margin-bottom: 16px; font-size: 15.5px; color: #2e2b26; max-width: 40em; }
.doc-content p:last-child { margin-bottom: 0; }

.ledger { list-style: none; }
.ledger li {
  padding: 12px 0 12px 28px; position: relative;
  font-size: 15px; border-bottom: 1px solid var(--rule);
}
.ledger li:last-child { border-bottom: none; }
.ledger.yes li::before { content: "证"; position: absolute; left: 0; top: 14px; font-family: var(--serif); font-size: 12px; color: var(--accent); border: 1px solid var(--accent-soft); width: 17px; height: 17px; line-height: 17px; text-align: center; }
.ledger.no li::before { content: "限"; position: absolute; left: 0; top: 14px; font-family: var(--serif); font-size: 12px; color: var(--ink-faint); border: 1px solid var(--ink-faint); width: 17px; height: 17px; line-height: 17px; text-align: center; }

.related-list { list-style: none; }
.related-list li { padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 14.5px; }
.related-list li:last-child { border-bottom: none; }
.related-list .meta { margin-left: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .wrap { padding: 0 20px; }
  .top-nav .wrap { padding-right: 56px; }
  .masthead { padding: 52px 0 40px; }
  .gate-doors { flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 340px; }
  .gate-doors a { padding: 18px; }
  .gate-doors a .gate-label { opacity: 1; transform: none; } /* 触屏无 hover，常显 */
  .gate-foot { padding: 0 24px 28px; letter-spacing: .1em; position: static; margin-top: 40px; }
  .gate-signals { position: static; margin-top: 8px; }
  .cover { padding: 48px 0; }
  .entry { grid-template-columns: 1fr; gap: 6px; padding: 22px 0; }
  .entry .no { order: -1; }
  .status { text-align: left; margin-top: 4px; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid a { border-right: none; border-bottom: 1px solid var(--rule); padding-left: 0 !important; }
  .method-grid a:last-child { border-bottom: none; }
  .dossier-body { grid-template-columns: 1fr; gap: 40px; }
  .doc-toc { position: static; border-bottom: 1px solid var(--rule); padding-bottom: 24px; }
  .doc-toc ol { display: flex; flex-wrap: wrap; gap: 6px 18px; }
  .doc-toc li { margin-bottom: 0; }
}

/* ---------- 台账标记扩展：宜/忌/问/查 ---------- */
.ledger.fit li::before { content: "宜"; position: absolute; left: 0; top: 14px; font-family: var(--serif); font-size: 12px; color: var(--accent); border: 1px solid var(--accent-soft); width: 17px; height: 17px; line-height: 17px; text-align: center; }
.ledger.avoid li::before { content: "忌"; position: absolute; left: 0; top: 14px; font-family: var(--serif); font-size: 12px; color: var(--ink-faint); border: 1px solid var(--ink-faint); width: 17px; height: 17px; line-height: 17px; text-align: center; }
.ledger.ask li::before { content: "问"; position: absolute; left: 0; top: 14px; font-family: var(--serif); font-size: 12px; color: var(--accent); border: 1px solid var(--accent-soft); width: 17px; height: 17px; line-height: 17px; text-align: center; }
.ledger.check li::before { content: "查"; position: absolute; left: 0; top: 14px; font-family: var(--serif); font-size: 12px; color: var(--accent); border: 1px solid var(--accent-soft); width: 17px; height: 17px; line-height: 17px; text-align: center; }

/* ---------- 流程步骤 ---------- */
.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  padding: 14px 0 14px 44px; position: relative;
  border-bottom: 1px solid var(--rule); font-size: 15px;
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: "0" counter(step);
  position: absolute; left: 0; top: 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--accent);
}
.steps li b { font-weight: 600; }

/* 草稿条目里的链接继承弱化色 */
.entry.dim h3 a { color: var(--ink-soft); }
.entry.dim h3 a:hover { color: var(--accent); }

/* 门上的按钮化链接（access 页复制提示） */
.copy-line {
  display: inline-block; margin-top: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .05em;
  color: var(--accent); border: 1px solid var(--accent-soft);
  padding: 10px 18px; background: none; cursor: pointer;
}
.copy-line:hover { background: var(--paper-deep); }
.copy-feedback { margin-top: 12px; font-size: 13px; color: var(--ink-faint); min-height: 1.5em; }
