:root {
  --ink: #1c1a17;
  --ink-soft: #5a544c;
  --paper: #fbf9f4;
  --line: #ddd6c9;
  --seal: #8c2f1f;
  --measure: 40rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif CJK SC", "Songti SC", "Source Han Serif SC", Georgia, serif;
  font-size: 17px;
  line-height: 1.85;
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- 头部 ---------- */
header { padding: 4.5rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.mark {
  margin: 0 0 2.2rem;
  font-size: .8rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft);
}
h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 5.4vw, 2.6rem);
  line-height: 1.28;
  letter-spacing: .01em;
  font-weight: 600;
}
.lede { margin: 0; color: var(--ink-soft); font-size: 1.02rem; }
.lede em { font-style: normal; color: var(--seal); }

.cta { margin: 1.6rem 0 0; }
.cta a {
  display: inline-block; padding: .5rem 1.1rem;
  border: 1px solid var(--seal); border-radius: 999px;
  color: var(--seal); font-size: .92rem; letter-spacing: .03em;
  transition: background .15s, color .15s;
}
.cta a:hover { background: var(--seal); color: #fff; }

/* ---------- 正文 ---------- */
main { padding: 3rem 0 0; }
section { margin: 0 0 3.4rem; }
h2 {
  margin: 0 0 1.1rem;
  font-size: 1.12rem;
  letter-spacing: .06em;
  font-weight: 600;
}
h2::before { content: ""; display: inline-block; width: 1.6rem; height: 2px; background: var(--seal); margin-right: .7rem; vertical-align: .28em; }
p { margin: 0 0 1.05rem; }
a { color: var(--seal); text-decoration: none; border-bottom: 1px solid rgba(140, 47, 31, .35); }
a:hover { border-bottom-color: var(--seal); }

/* ---------- 成品图 ---------- */
figure { margin: 0 0 2.2rem; }
figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(28, 26, 23, .06);
}
figcaption { margin-top: .7rem; font-size: .88rem; color: var(--ink-soft); line-height: 1.7; }
figcaption b { color: var(--ink); font-weight: 600; }

/* ---------- 清单 ---------- */
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { margin: 0 0 1.05rem; padding-left: 1.1rem; border-left: 2px solid var(--line); }
ul.plain li b { font-weight: 600; }
ul.plain li span { color: var(--ink-soft); }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 1rem; padding: 2.2rem 0 4rem;
  border-top: 1px solid var(--line);
  font-size: .84rem; color: var(--ink-soft); line-height: 1.8;
}
footer p { margin: 0 0 .5rem; }

@media (max-width: 34rem) {
  body { font-size: 16px; }
  header { padding-top: 3rem; }
}

/* ---------- 逐页浏览（view.html） ---------- */
body.viewer { background: #efeade; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem clamp(.8rem, 4vw, 2rem);
  background: rgba(251, 249, 244, .93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.bar-mark {
  font-size: .82rem; letter-spacing: .16em; color: var(--seal);
  border: 0; white-space: nowrap;
}
.tabs { display: flex; gap: .15rem; }
.tabs a {
  font-size: .86rem; padding: .28rem .72rem; border: 1px solid transparent;
  border-radius: 999px; color: var(--ink-soft); border-bottom: 0;
}
.tabs a:hover { color: var(--ink); }
.tabs a.is-on { background: #fff; border-color: var(--line); color: var(--ink); }

.stage-wrap {
  display: none; position: relative;
  max-width: 46rem; margin: 0 auto; padding: .8rem clamp(.6rem, 3vw, 1.2rem) 2.4rem;
}
body.js .stage-wrap { display: block; }
body.js .all-pages { display: none; }

.docname {
  margin: .3rem 0 .9rem; text-align: center;
  font-size: .8rem; letter-spacing: .2em; color: var(--ink-soft);
}

.stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 50vh;
}
.viewer-img {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: 76vh;
  border: 1px solid var(--line); background: #fff;
  box-shadow: 0 10px 30px rgba(60, 45, 25, .17);
}
.viewer-img.in-right { animation: pg-in-r .17s ease-out; }
.viewer-img.in-left { animation: pg-in-l .17s ease-out; }
@keyframes pg-in-r { from { opacity: .3; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@keyframes pg-in-l { from { opacity: .3; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.controls {
  display: flex; align-items: center; justify-content: center; gap: 1.1rem; margin-top: 1rem;
}
.controls button {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.controls button:hover { border-color: var(--seal); color: var(--seal); }
#indicator {
  min-width: 4.2rem; text-align: center;
  font-size: .88rem; letter-spacing: .08em; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.hit { position: absolute; top: 0; bottom: 0; width: 20%; cursor: pointer; }
.hit-prev { left: 0; }
.hit-next { right: 0; }
.hit:hover { background: linear-gradient(to right, rgba(140, 47, 31, .045), transparent); }
.hit-next:hover { background: linear-gradient(to left, rgba(140, 47, 31, .045), transparent); }

.hint { margin: 1.1rem 0 0; text-align: center; font-size: .76rem; color: var(--ink-soft); }
.hint code { font-size: .72rem; }

/* 无 JS 时的兜底：三份文档按顺序铺开，直接可读 */
.all-pages { max-width: 46rem; margin: 0 auto; padding: 1rem clamp(.6rem, 3vw, 1.2rem) 3rem; }
.all-pages h2 { margin: 2rem 0 1rem; font-size: 1rem; letter-spacing: .08em; }
.all-pages .page-img {
  display: block; width: 100%; height: auto;
  margin: 0 0 1rem; border: 1px solid var(--line); background: #fff;
}

@media (max-width: 34rem) {
  .hit { width: 28%; }
  .hint { display: none; }
  .viewer-img { max-height: 72vh; }
}
@media (prefers-reduced-motion: reduce) {
  .viewer-img.in-right, .viewer-img.in-left { animation: none; }
}

