/* ================= 通用区块 ================= */
.wrap {
  width: min(1200px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
}

.section {
  position: relative;
  padding: clamp(96px, 13vw, 176px) 0;
}

.kicker {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; letter-spacing: .42em; color: var(--brass);
  margin-bottom: 36px;
}
.kicker::before { content: ""; width: 32px; height: 1px; background: currentColor; opacity: .7; }

.h2 {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .14em;
}

.body {
  max-width: 30em;
  margin-top: 28px;
  font-size: 16px; line-height: 2.1; letter-spacing: .06em;
  color: var(--ink-2);
  text-align: justify;
}

.demo-tag {
  flex: none;
  padding: 3px 8px 3px 10px;
  border-radius: var(--radius); background: rgba(166, 138, 91, .14);
  font-size: 11px; letter-spacing: .24em; color: var(--brass);
}

/* 配图：细框 + 小字题注，进入视口时自上而下展开 */
.figure { margin: 0; }
.figure-frame {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #e6ddcf;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.6s cubic-bezier(.65, .05, .25, 1);
}
.figure-frame img {
  position: absolute; inset: -6% 0; width: 100%; height: 112%;
  object-fit: cover;
  translate: 0 var(--shift, 0px); /* 视差位移单独走 translate，不吃下面 2.2s 的过渡，避免滚动时拖影 */
  transform: scale(1.08);
  transition: transform 2.2s var(--ease-out);
}
.figure.in .figure-frame { clip-path: inset(0 0 0 0); }
.figure.in .figure-frame img { transform: scale(1); }
.figure figcaption {
  margin-top: 16px;
  font-size: 12px; letter-spacing: .4em; color: var(--ink-3);
  opacity: 0; transition: opacity 1s var(--ease-out) .9s;
}
.figure.in figcaption { opacity: 1; }

/* 滚动进场 */
.rv { opacity: 0; transform: translateY(22px); transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out); }
.rv.in { opacity: 1; transform: none; }

/* ================= 壹 · 典籍 ================= */
.canon { background: var(--paper); }

.canon-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(48px, 8vw, 128px);
  align-items: center;
}
.canon-figure { justify-self: end; width: min(100%, 460px); }

.stat {
  display: flex; align-items: baseline; gap: 10px;
  margin: -8px 0 28px;
  line-height: 1;
}
.stat-num {
  font-family: var(--latin); font-weight: 500;
  font-size: clamp(88px, 10vw, 148px);
  letter-spacing: -.01em;
  font-variant-numeric: lining-nums tabular-nums;
}
.stat-unit { font-size: 18px; letter-spacing: .3em; color: var(--ink-2); }

/* 检索演示 */
.demo {
  margin: clamp(80px, 10vw, 136px) auto 0;
  max-width: 920px;
  background: var(--raised);
  border: 1px solid var(--raised-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--raised-shadow), 0 30px 60px -44px rgba(60, 42, 24, .35);
  overflow: hidden;
}
.demo-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--raised-line);
  font-size: 17px; letter-spacing: .08em;
}
.demo-icon { flex: none; color: var(--ink-3); }
.demo-q { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-caret {
  flex: none; width: 1px; height: 1.2em; margin-left: -10px; margin-right: auto;
  background: var(--ink); animation: caret 1s steps(1) infinite;
}
.demo.done .demo-caret { opacity: 0; animation: none; }
@keyframes caret { 50% { opacity: 0; } }

/* 左正文、右旁注。.anim 由脚本加上才播动画，否则内容直接可见 */
.demo-answer {
  display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 44px;
  padding: 30px 32px 28px;
}
/* 追问贴底，和右栏底边对齐 */
.demo-main { display: flex; flex-direction: column; gap: 28px; }
.demo-follow { margin-top: auto; }
.demo-body p {
  font-size: 15.5px; line-height: 2.05; letter-spacing: .06em; color: var(--ink);
  text-align: justify;
}
.demo-body p + p { margin-top: 14px; }
.demo-body .demo-h { margin-top: 22px; font-weight: 600; letter-spacing: .1em; }
/* 还没出现的字先透明占位，版面不跳 */
.demo-ghost { color: transparent; }
.demo-cite.demo-ghost { visibility: hidden; }
.demo-stream-caret {
  display: inline-block; width: 1px; height: 1.1em; margin: 0 -1px 0 0; vertical-align: -.15em;
  background: var(--ink); animation: caret 1s steps(1) infinite;
}

/* 注码 */
.demo-cite {
  display: inline-block; min-width: 1.35em; margin: 0 .1em; padding: 0 .22em;
  font-size: 11px; font-weight: 600; line-height: 1.5;
  color: var(--cinnabar); text-align: center; vertical-align: super;
  border-radius: var(--radius); cursor: default;
  transition: background-color .25s var(--ease-out);
}
.demo-cite.on { background: rgba(158, 59, 46, .1); }
.demo-cite:focus-visible { outline-offset: 1px; }

.demo-notes li {
  padding: 2px 0 2px 14px;
  border-left: 1px solid var(--line);
  transition: border-color .3s var(--ease-out), opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
.demo-notes li + li { margin-top: 18px; }
.demo-notes li.on { border-left-color: var(--cinnabar); }
.note-head { font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.note-no { display: inline-block; min-width: 1.1em; margin-right: 4px; font-size: 12px; color: var(--cinnabar); text-align: center; }
.note-chapter { margin-left: 2px; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.note-text { margin-top: 6px; font-size: 12.5px; line-height: 1.8; letter-spacing: .04em; color: var(--ink-2); }
/* 白话讲解 */
.note-gloss {
  position: relative; margin-top: 8px; padding-left: 14px;
  font-size: 12.5px; line-height: 1.8; letter-spacing: .03em; color: var(--ink);
}
.note-gloss::before { content: ""; position: absolute; left: 0; top: .9em; width: 8px; height: 1px; background: var(--brass); }
.note-era { margin-top: 6px; font-size: 11px; letter-spacing: .2em; color: var(--ink-3); }

.demo-follow { transition: opacity .6s var(--ease-out); }
.demo-follow-label { margin-bottom: 6px; font-size: 12px; letter-spacing: .3em; color: var(--ink-3); }
.demo-follow-q {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 2px;
  border-top: 1px solid var(--raised-line);
  font-size: 14px; letter-spacing: .06em; color: var(--ink-2);
  transition: color .3s var(--ease-out), padding-left .3s var(--ease-out);
}
.demo-follow-q:last-child { border-bottom: 1px solid var(--raised-line); }
.demo-follow-q svg { flex: none; color: var(--ink-3); transition: color .3s var(--ease-out), transform .3s var(--ease-out); }
.demo-follow-q:hover { color: var(--ink); padding-left: 8px; }
.demo-follow-q:hover svg { color: var(--brass); transform: translateX(2px); }

.demo.anim .demo-notes li { opacity: 0; transform: translateY(8px); }
.demo.anim .demo-follow { opacity: 0; }
.demo.anim.answered .demo-notes li { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * .1s); }
.demo.anim.answered .demo-follow { opacity: 1; transition-delay: .3s; }

/* 书名滚动带 */
.shelf {
  margin-top: clamp(80px, 10vw, 128px);
  display: grid; gap: 18px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  overflow: hidden;
}
.shelf-row { display: flex; width: max-content; animation: shelf var(--dur, 160s) linear infinite; }
.shelf-row--rev { animation-direction: reverse; }
.shelf:hover .shelf-row { animation-play-state: paused; }
.shelf-row span {
  flex: none; padding: 0 22px;
  font-size: 19px; letter-spacing: .14em; color: var(--ink-3);
  transition: color .4s var(--ease-out);
}
.shelf-row span:hover { color: var(--ink); }
.shelf-row--rev span { font-size: 16px; color: rgba(31, 29, 26, .32); }
@keyframes shelf { to { transform: translateX(-50%); } }

/* ================= 贰 · 对谈 ================= */
.podcast {
  background: #ede6da;
}
.podcast::before { /* 与上一段之间一道极细分隔 */
  content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 72px;
  background: var(--line); transform: translateX(-50%);
}

.podcast-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(48px, 8vw, 128px);
  align-items: center;
}
.podcast-figure { width: min(100%, 460px); }

.player {
  margin-top: 44px;
  max-width: 520px;
  background: var(--raised);
  border: 1px solid var(--raised-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--raised-shadow), 0 30px 60px -44px rgba(60, 42, 24, .35);
  overflow: hidden;
}
.player-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--raised-line);
}
.player-title { font-size: 17px; font-weight: 600; letter-spacing: .1em; }
.player-hosts { margin-top: 6px; font-size: 13px; letter-spacing: .12em; color: var(--ink-3); }
.player-dot { margin: 0 8px; }
.host { color: var(--ink-2); margin-right: 4px; }
.host--a { color: #6f7f5f; }
.host--b { color: #8a6f45; }

.transcript {
  height: 212px; overflow: hidden; position: relative;
  padding: 8px 24px;
  -webkit-mask: linear-gradient(transparent, #000 18%, #000 78%, transparent);
          mask: linear-gradient(transparent, #000 18%, #000 78%, transparent);
}
.transcript li {
  display: grid; grid-template-columns: 3em 1fr; gap: 12px;
  padding: 10px 0;
  font-size: 14px; line-height: 1.9; letter-spacing: .06em;
  color: rgba(31, 29, 26, .3);
  cursor: pointer;
  transition: color .6s var(--ease-out), transform .8s var(--ease-out);
  transform: translateY(var(--scroll, 0px));
}
.transcript .who { font-size: 12px; letter-spacing: .16em; padding-top: .2em; }
.transcript li[data-who="a"] .who { color: rgba(111, 127, 95, .6); }
.transcript li[data-who="b"] .who { color: rgba(138, 111, 69, .6); }
.transcript li.past { color: rgba(31, 29, 26, .5); }
.transcript li.now { color: var(--ink); }
.transcript li.now .who { color: inherit; }
.transcript li.now[data-who="a"] .who { color: #6f7f5f; }
.transcript li.now[data-who="b"] .who { color: #8a6f45; }

.player-controls {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 24px 12px;
  border-top: 1px solid var(--raised-line);
}
.play {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  cursor: pointer; transition: transform .4s var(--ease-out), background-color .4s var(--ease-out);
}
.play:hover { transform: scale(1.05); }
.play .i-pause { display: none; }
.player.playing .play .i-play { display: none; }
.player.playing .play .i-pause { display: block; }

.wave { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; height: 28px; }
.wave i {
  flex: 1; height: 100%; border-radius: 1px;
  background: rgba(31, 29, 26, .18);
  transform: scaleY(var(--h, .3));
  transition: background-color .3s;
}
.wave i.on { background: var(--brass); }
.player.playing .wave i { animation: bar 1.1s ease-in-out infinite alternate; animation-delay: var(--dl, 0s); }
@keyframes bar { to { transform: scaleY(calc(var(--h, .3) * .45)); } }

.time { flex: none; font-family: var(--latin); font-size: 14px; letter-spacing: .06em; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; }
.time-total { color: var(--ink-3); }

.progress {
  position: relative; height: 14px; margin: 0 24px 14px; cursor: pointer;
}
.progress::before, .progress span {
  content: ""; position: absolute; left: 0; top: 6px; height: 1px; background: var(--line); right: 0;
}
.progress span { right: auto; width: 0; background: var(--ink); height: 1px; }

/* ================= 收尾 ================= */
.closing {
  background: #1f1d1a;
  color: #efe8dc;
  padding: clamp(112px, 14vw, 184px) 0 0;
}
.closing-inner { text-align: center; }
.kicker--light { justify-content: center; color: #b89d6c; }
.kicker--light::before { display: none; }
.closing-title {
  font-size: clamp(32px, 3.4vw, 50px); font-weight: 400; letter-spacing: .16em;
  margin-right: -.16em; line-height: 1.35;
}
.closing-link {
  position: relative;
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 60px; padding: 10px 0 12px .3em;
  font-size: 17px; letter-spacing: .3em; color: #efe8dc;
}
.closing-link::before, .closing-link::after { /* 常态一道淡线，悬停时铜线由左展开覆盖 */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
}
.closing-link::before { background: rgba(239, 232, 220, .3); }
.closing-link::after {
  background: #b89d6c; transform: scaleX(0); transform-origin: left;
  transition: transform .7s var(--ease-out);
}
.closing-link svg { transition: transform .5s var(--ease-out); }
.closing-link:hover::after, .closing-link:focus-visible::after { transform: scaleX(1); }
.closing-link:hover svg, .closing-link:focus-visible svg { transform: translateX(5px); }

.footer {
  display: flex; align-items: baseline; gap: 32px; flex-wrap: wrap;
  margin-top: clamp(112px, 14vw, 176px);
  padding: 28px 0 36px;
  border-top: 1px solid rgba(239, 232, 220, .14);
  font-size: 12px; letter-spacing: .14em; color: rgba(239, 232, 220, .5);
}
.footer-brand { font-size: 16px; font-weight: 600; letter-spacing: .3em; color: #efe8dc; }
.footer-copy { margin-left: auto; }

/* ================= 响应式 ================= */
@media (max-width: 860px) {
  .canon-grid, .podcast-grid { grid-template-columns: 1fr; gap: 56px; }
  .canon-figure, .podcast-figure { justify-self: stretch; width: 100%; max-width: 460px; }
  .podcast-text { order: -1; }
  .player { max-width: none; }
  .body { text-align: left; }
  /* 窄屏：旁注改到正文之下，像对话页的文末出处列表 */
  .demo-answer { grid-template-columns: 1fr; gap: 26px; }
  .demo-main { display: contents; }
  .demo-follow { order: 1; margin-top: 0; }
  .demo-notes { padding-top: 22px; border-top: 1px solid var(--raised-line); }
  .demo-body p { text-align: left; }
}
@media (max-width: 560px) {
  .kicker { margin-bottom: 28px; }
  .demo-bar { padding: 18px 18px; font-size: 15px; gap: 10px; }
  .demo-answer { padding: 20px 18px 18px; }
  .demo-body p { font-size: 15px; }
  .shelf-row span { font-size: 16px; padding: 0 14px; }
  .shelf-row--rev span { font-size: 14px; }
  .player-head, .player-controls { padding-left: 18px; padding-right: 18px; }
  .transcript { padding: 8px 18px; }
  .progress { margin: 0 18px 12px; }
  .player-controls { gap: 12px; }
  .wave { gap: 2px; }
  .time { font-size: 13px; }
  .footer { gap: 12px 24px; }
  .footer-copy { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  .figure-frame { clip-path: none; transition: none; }
  .figure-frame img { transform: none; transition: none; }
  .figure figcaption { opacity: 1; transition: none; }
  .shelf-row { animation: none; flex-wrap: wrap; width: auto; justify-content: center; }
  .shelf { -webkit-mask: none; mask: none; }
  .player.playing .wave i { animation: none; }
}

/* JS 没加载时，进场动画的初始隐藏态全部取消，内容直接可见 */
html:not(.js) .rv { opacity: 1; transform: none; }
html:not(.js) .figure-frame { clip-path: none; }
html:not(.js) .figure-frame img { transform: none; }
html:not(.js) .figure figcaption { opacity: 1; }
