/* 书封、书目卡片、详情抽屉：首页「04 典籍出处」和古籍书架（shelf.html）共用
   书封：有实拍封面的直接用图，其余用 CSS 画线装书——流派底色、双线边框、浅色题签竖排书名、
   右侧线装订口、流派纹样（八字的地支盘、紫微的十二宫、奇门的九宫……），尺寸用容器单位，大小封面同一套写法 */

:root {
  --tex-cloth: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.1 -.6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E");
}

/* —— 书封 —— */
.cv { --c: #2f4b57; --ln: rgb(236 232 220 / .5); position: relative; display: block; width: 100%; aspect-ratio: .74;
  container-type: inline-size; overflow: hidden; border-radius: 2px 4px 4px 2px; color: var(--ln);
  background:
    var(--tex-cloth) 0 0 / 160px,
    radial-gradient(130% 90% at 28% 18%, rgb(255 255 255 / .08), transparent 62%),
    radial-gradient(closest-side, transparent 70%, rgb(0 0 0 / .22) 135%),
    linear-gradient(90deg, transparent 84%, rgb(0 0 0 / .16) 100%),
    color-mix(in oklab, var(--c) 78%, #1b1e1f);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .05), inset -1px 0 0 rgb(0 0 0 / .2); }
/* 双线边框：外线是边框，内线用负 outline-offset 画在里面；右边让出装订口 */
.cv-frame { position: absolute; inset: 6% 17% 6% 7%; border: 1px solid var(--ln); outline: 1px solid rgb(236 232 220 / .3); outline-offset: -2.6cqw; }
/* 线装：装订口一条竖线，四道缝线横跨书脊边 */
.cv-bind { position: absolute; top: 0; bottom: 0; right: 0; width: 11%; border-left: 1px solid rgb(0 0 0 / .22); box-shadow: inset 1px 0 0 rgb(255 255 255 / .06);
  background:
    linear-gradient(var(--ln) 0 0) 0 13% / 100% 1px, linear-gradient(var(--ln) 0 0) 0 38% / 100% 1px,
    linear-gradient(var(--ln) 0 0) 0 62% / 100% 1px, linear-gradient(var(--ln) 0 0) 0 87% / 100% 1px,
    rgb(0 0 0 / .1);
  background-repeat: no-repeat; }
/* 流派纹样：淡线，压在边框里下半部 */
.cv-motif { position: absolute; left: 16%; right: 24%; bottom: 9%; width: auto; aspect-ratio: 1; fill: none; stroke: currentColor; stroke-width: 1.2; opacity: .4; }
.cv-motif * { vector-effect: non-scaling-stroke; }
/* 题签：浅色纸条，书名竖排；太长的书名分成两列 */
.cv-head { position: absolute; top: 11%; left: 21%; display: flex; align-items: flex-start; gap: 3.4cqw; }
.cv-label { display: flex; flex-direction: column; align-items: center; gap: 2.4cqw;
  padding: 3.6cqw 2.8cqw; background: #e6e3d8; color: #24292a; box-shadow: inset 0 0 0 1px rgb(36 41 42 / .5), inset 0 0 0 3px #e6e3d8, inset 0 0 0 4px rgb(36 41 42 / .25), 0 1px 2px rgb(0 0 0 / .18); }
.cv-label b { font: 500 var(--fs, 12cqw)/1.08 var(--f-serif); writing-mode: vertical-rl; letter-spacing: .06em; white-space: nowrap; }
.cv-label i { width: 6.2cqw; height: 6.2cqw; display: grid; place-items: center; border: 1px solid var(--c-zhusha); color: var(--c-zhusha);
  font: normal 500 3.4cqw/1 var(--f-serif); writing-mode: vertical-rl; letter-spacing: 0; }
.cv-by { margin-top: 1cqw; font: 4.6cqw/1.2 var(--f-serif); writing-mode: vertical-rl; letter-spacing: .14em; white-space: nowrap; color: rgb(236 232 220 / .72); }
/* 西方的书：书脊在左、横排书名 */
.cv.is-west .cv-frame { inset: 6% 7% 6% 17%; }
.cv.is-west .cv-bind { right: auto; left: 0; border-left: 0; border-right: 1px solid rgb(0 0 0 / .22);
  background: repeating-linear-gradient(transparent 0 17%, rgb(236 232 220 / .3) 17% calc(17% + 1px), transparent 0 calc(17% + 3px)), rgb(0 0 0 / .1); }
.cv-en { position: absolute; top: 14%; left: 17%; right: 7%; text-align: center; color: rgb(240 236 226 / .9); }
.cv-en b { display: block; font: 400 10cqw/1.1 var(--f-num); letter-spacing: .01em; }
.cv-en small { display: block; margin-top: 2.6cqw; font: 3.8cqw/1.3 var(--f-num); letter-spacing: .16em; text-transform: uppercase; opacity: .75; }
.cv.is-west .cv-motif { left: 26%; right: 14%; bottom: 10%; }
/* 实拍封面：图片自带书的轮廓，只加投影 */
.cv-img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }

/* —— 书目卡片：封面立在底线上，下面是书名、朝代 · 作者、（可选）流派和简介 —— */
.bk a { display: block; }
/* 封面区：统一高度，书都立在底线上 */
.bk-cover { position: relative; display: flex; align-items: flex-end; justify-content: flex-start; aspect-ratio: .74; }   /* 封面贴左，和下面的书名对齐 */
.bk-cover::after { content: ''; position: absolute; left: 8%; right: 8%; bottom: -6px; height: 12px; border-radius: 50%; background: radial-gradient(closest-side, rgb(30 40 42 / .2), transparent); }
.bk-cover > * { position: relative; z-index: 1; transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), filter .45s var(--ease-out); }
.bk-cover .cv { width: 100%; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .05), inset -1px 0 0 rgb(0 0 0 / .2), 0 2px 3px rgb(30 40 42 / .14), 0 12px 24px rgb(30 40 42 / .14); }
.bk-cover .cv-img { filter: drop-shadow(0 2px 3px rgb(30 40 42 / .14)) drop-shadow(0 12px 20px rgb(30 40 42 / .16)); }
.bk a:hover .bk-cover > *, .bk a:focus-visible .bk-cover > * { transform: translateY(-8px) rotate(-1deg); }
.bk a:focus-visible { outline: 0; }
.bk a:focus-visible .bk-t { text-decoration: underline; text-underline-offset: 4px; }
.bk-t { display: block; margin-top: 20px; font: 500 17px/1.45 var(--f-serif); color: var(--c-ink); transition: color .2s; }
.bk-t small { margin-left: 6px; font: italic 13px var(--f-num); color: var(--c-ink-3); }
.bk a:hover .bk-t { color: var(--c-daiqing); }
.bk-m { display: block; margin-top: 2px; font-size: 13px; color: var(--c-ink-3); }
.bk-d { display: -webkit-box; margin-top: 8px; font-size: 13px; line-height: 1.75; color: var(--c-ink-2); -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bk-s { display: inline-block; margin-top: 10px; padding: 1px 8px; border: 1px solid color-mix(in oklab, var(--c) 24%, transparent); border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--c) 9%, transparent); font-size: 12px; line-height: 1.6; letter-spacing: .06em; color: color-mix(in oklab, var(--c) 82%, var(--c-ink)); }


/* 详情抽屉：右侧滑出，手机上铺满 */
.sd { position: fixed; inset: 0 0 0 auto; width: min(480px, 100vw); height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--c-line);
  background: var(--tex-paper), var(--c-page); color: var(--c-ink); overflow-y: auto; overscroll-behavior: contain; }
.sd[open] { animation: sd-in .4s var(--ease-out); }
.sd::backdrop { background: rgb(30 36 37 / .34); animation: sd-fade .3s ease; }
@keyframes sd-in { from { transform: translateX(32px); opacity: 0; } }
@keyframes sd-fade { from { opacity: 0; } }
html:has(.sd[open]) { overflow: hidden; }
.sd-in { padding: 28px 40px 48px; }
.sd-close { position: sticky; top: 0; float: right; margin: -8px -16px 0 0; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--c-ink-2); }
.sd-close:hover { background: rgb(30 36 37 / .06); color: var(--c-ink); }
.sd-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.sd-cover { display: flex; justify-content: center; align-items: flex-end; height: 300px; margin: 24px 0 36px; }
.sd-cover .cv { width: 210px; box-shadow: 0 2px 4px rgb(30 40 42 / .16), 0 18px 36px rgb(30 40 42 / .18); }
.sd-cover .cv-img { max-height: 300px; filter: drop-shadow(0 2px 4px rgb(30 40 42 / .16)) drop-shadow(0 18px 30px rgb(30 40 42 / .2)); }
.sd-school { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: .12em; color: var(--c-ink-3); }
.sd-school i { width: 8px; height: 8px; border-radius: 1px; background: var(--c); }
.sd h2 { margin-top: 10px; font-size: 30px; line-height: 1.35; }
.sd-en { margin-top: 2px; font: italic 16px var(--f-num); color: var(--c-ink-2); }
.sd-meta { margin-top: 6px; font-size: 14px; color: var(--c-ink-2); }
.sd-sec { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--c-line); }
.sd-sec h3 { margin-bottom: 8px; font: 500 13px/1.4 var(--f-sans); letter-spacing: .14em; color: var(--c-ink-3); }
.sd-sec p { font-size: 15px; line-height: 1.9; }
.sd-use { position: relative; padding-left: 16px; }
.sd-use::before { content: ''; position: absolute; left: 0; top: .5em; bottom: .5em; width: 2px; background: var(--c-zhusha); }
.sd-more ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sd-more a { display: inline-block; padding: 4px 10px; border: 1px solid var(--c-line); border-radius: var(--r-sm); font: 14px/1.6 var(--f-serif); color: var(--c-ink-2); transition: border-color .2s, color .2s; }
.sd-more a:hover { border-color: var(--c-daiqing); color: var(--c-daiqing); }
.sd-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-5); margin-top: 36px; }

@media (max-width: 860px) {
  .bk-t { margin-top: 16px; font-size: 16px; }
  .sd-in { padding: 20px 24px 40px; }
  .sd-cover { height: 240px; margin: 16px 0 28px; }
  .sd-cover .cv { width: 170px; }
  .sd-cover .cv-img { max-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .bk-cover > * { transition: none; }
  .sd[open], .sd::backdrop { animation: none; }
}

/* —— 2026-11 书库上线后加的 —— */
/* 只有影印本的书：封面左上角一枚小签 */
.bk-scan { position: absolute; z-index: 2; left: 6px; top: 6px; padding: 1px 5px; border-radius: 1px; background: rgb(251 250 246 / .92); font: normal 11px/1.5 var(--f-sans); letter-spacing: .08em; color: var(--c-ink-2); }
/* 译著用中文书名的硬面书：书名可能很长，字小一号、可折行 */
.cv.is-zh .cv-en b { font: 500 9cqw/1.25 var(--f-serif); letter-spacing: .04em; }
.cv.is-zh.is-long .cv-en b { font-size: 7.4cqw; }
.cv.is-zh .cv-en small { letter-spacing: .06em; text-transform: none; }
/* 抽屉里的阅读入口 */
.sd-read { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-5); margin-top: 24px; }
.sd-cta { padding-top: 24px; border-top: 1px solid var(--c-line); }
