/* ============================================================
   BOOK SPACE · 总览 Overview
   与主页同一设计语言：奶白粉彩底 · Didot 风大标题 · 衬线中文
   ============================================================ */

:root {
  --bg: #ece9e2;
  --paper: #f2efe8;
  --ink: #141414;
  --ink-muted: rgba(20, 20, 20, 0.52);
  --line: rgba(20, 20, 20, 0.14);
  --drawer-width: 432px;
  --index-width: 46px;
}

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

html, body {
  min-height: 100%;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
body { padding-bottom: 90px; }

/* ---------- 顶部角标（与主页一致） ---------- */
.corner {
  position: fixed;
  top: 40px;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 1.7;
  z-index: 30;
}
.corner-left { left: 48px; }
.corner-right { right: 48px; text-align: right; }
.corner .line2 { opacity: 0.75; }
.corner-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-muted);
  padding-bottom: 2px;
  transition: opacity 0.3s ease;
}
.corner-link:hover { opacity: 0.6; }

/* ---------- 搜索（与主页一致的下划线式） ---------- */
.search-box {
  position: fixed;
  top: 74px;
  right: 48px;
  z-index: 40;
}
.search-box input {
  width: 176px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-muted);
  padding: 6px 2px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-align: right;
  outline: none;
  border-radius: 0;
  transition: width 0.35s ease, border-color 0.3s ease;
  -webkit-appearance: none;
}
.search-box input:focus { width: 236px; border-color: var(--ink); }
.search-box input::placeholder {
  color: var(--ink-muted);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- 标题 ---------- */
.header {
  padding: 12vh 24px 0;
  text-align: center;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 16px;
}
.title {
  font-family: "Playfair Display", "Noto Serif SC", serif;
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.06em;
}
.subcount {
  margin-top: 14px;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.collection-intro {
  max-width: 560px;
  margin: 18px auto 0;
  font-family: "Noto Serif SC", serif;
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-muted);
}

/* ---------- 筛选状态条 ---------- */
.active-filters {
  display: none;
}
.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
}
.af-chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}
.af-chip button:hover { opacity: 1; }
.af-reset {
  background: none;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
}
.af-reset:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- 档案索引式筛选抽屉 ---------- */
.drawer-hot-zone {
  position: fixed;
  inset: 0 0 0 auto;
  width: 30px;
  z-index: 58;
}
.drawer-toggle {
  position: fixed;
  top: 82px;
  right: 0;
  z-index: 92;
  width: var(--index-width);
  min-height: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 8px;
  border-radius: 22px 0 0 22px;
  border: 1px solid var(--line);
  border-right: 0;
  background: rgba(242, 239, 232, 0.96);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: -5px 8px 22px rgba(38, 31, 22, 0.08);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.drawer-toggle:hover,
.drawer-toggle:focus-visible {
  background: #faf8f3;
  box-shadow: -8px 10px 28px rgba(38, 31, 22, 0.12);
  outline: none;
}
.drawer-toggle .material-symbols-outlined {
  font-size: 19px;
}
.dt-label { writing-mode: vertical-rl; }
.dt-count {
  min-width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.dt-count:empty { display: none; }

.drawer-index {
  position: fixed;
  z-index: 91;
  top: 202px;
  right: 0;
  bottom: 18px;
  width: var(--index-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 4px 0;
  border-left: 1px solid var(--line);
  background: rgba(242, 239, 232, 0.92);
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: opacity 0.24s ease, transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
body.drawer-open .drawer-index {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
.index-mark {
  width: 100%;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: 400 9px/1 "Inter", sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.index-mark:hover,
.index-mark:focus-visible,
.index-mark.active {
  color: var(--ink);
  font-weight: 500;
  outline: none;
}

.drawer {
  position: fixed;
  top: 0;
  right: var(--index-width);
  bottom: 0;
  width: min(var(--drawer-width), calc(100vw - var(--index-width)));
  z-index: 80;
  background: var(--paper);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  box-shadow: -16px 0 34px rgba(38, 31, 22, 0.11), -7px -8px 0 rgba(244, 241, 234, 0.82), -13px -14px 0 rgba(232, 228, 219, 0.65);
  transform: translateX(calc(100% + var(--index-width) + 18px));
  transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  outline: none;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-kicker {
  margin-bottom: 4px;
  color: var(--ink-muted);
  font-size: 8px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.drawer-head h3 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-clear {
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
}
.drawer-clear:hover { color: var(--ink); border-color: var(--ink); }
.drawer-close {
  background: none;
  border: none;
  font-size: 20px !important;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px 6px;
}
.drawer-close:hover { color: var(--ink); }
.drawer-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 46% 54%;
  border-bottom: 1px solid var(--line);
}
.drawer-column {
  min-width: 0;
  overflow-y: auto;
  padding: 23px 14px 30px;
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 20, 20, 0.18) transparent;
}
.drawer-column-l1 { border-right: 1px solid var(--line); }
.drawer-section-title {
  min-height: 28px;
  padding: 0 5px 12px;
  font-family: "Noto Serif SC", serif;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}
.drawer-section-hint {
  margin-left: 4px;
  font-family: "Inter", sans-serif;
  font-size: 9px;
  letter-spacing: 0;
  opacity: 0.7;
}
.drawer-tags {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dtag {
  width: 100%;
  min-height: 39px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 0;
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
  background: transparent;
  border-radius: 4px;
  padding: 8px 8px;
  font-family: "Noto Serif SC", serif;
  font-size: 12px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.drawer-column-l2 .dtag {
  grid-template-columns: 18px minmax(0, 1fr) auto;
}
.dtag > .material-symbols-outlined {
  font-size: 17px;
  color: var(--ink-muted);
}
.dtag sup {
  font-size: 10px;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  opacity: 0.55;
}
.dtag:hover,
.dtag:focus-visible {
  background: rgba(255, 255, 255, 0.48);
  outline: none;
}
.dtag.active {
  background: #e8e0d1;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(38, 31, 22, 0.08);
}
.dtag.active > .material-symbols-outlined { color: currentColor; }
.dtag-all,
.dtag-all.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}
.dtag-all > .material-symbols-outlined { color: currentColor; }
.dtag.muted { opacity: 0.35; pointer-events: none; }
.drawer-footer {
  min-height: 82px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 15px 20px;
}
.drawer-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.4;
}
.drawer-summary strong {
  color: var(--ink);
  font-family: "Noto Serif SC", serif;
  font-size: 13px;
  font-weight: 500;
}
.drawer-apply {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font: 500 12px/1 "Noto Serif SC", serif;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.drawer-apply .material-symbols-outlined { font-size: 17px; }
.drawer-apply:hover,
.drawer-apply:focus-visible { background: #2b2a27; outline: 2px solid rgba(20, 20, 20, 0.2); outline-offset: 2px; }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 20, 20, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}
.drawer-backdrop.show { pointer-events: none; }

@media (min-width: 1100px) {
  .header,
  .wall,
  .active-filters {
    transition: width 0.36s cubic-bezier(0.16, 1, 0.3, 1), margin 0.36s cubic-bezier(0.16, 1, 0.3, 1), padding 0.36s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.drawer-open .header,
  body.drawer-open .active-filters {
    width: calc(100% - var(--drawer-width) - var(--index-width));
  }
  body.drawer-open .wall {
    max-width: none;
    margin-right: calc(var(--drawer-width) + var(--index-width));
  }
  body.drawer-open .corner-right,
  body.drawer-open .search-box {
    right: calc(var(--drawer-width) + var(--index-width) + 34px);
  }
}

/* ---------- 封面墙（分组容器） ---------- */
.wall {
  margin: 40px auto 0;
  max-width: 1560px;
  padding: 0 clamp(24px, 4vw, 64px);
}
/* 单个分类区块 */
.cat-section {
  margin-bottom: 68px;
  scroll-margin-top: 176px;
}
.cat-head {
  font-family: "Playfair Display", "Noto Serif SC", serif;
  font-weight: 500;
  font-size: clamp(18px, 2vw, 26px);
  letter-spacing: 0.08em;
  margin: 0 0 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.cat-count {
  font-family: "Playfair Display", serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
/* 区块内的封面栅格 */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 44px 26px;
  align-items: end;
}
.batch-sentinel {
  grid-column: 1 / -1;
  height: 1px;
  pointer-events: none;
}
.tile {
  cursor: pointer;
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.tile-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 0.7;
  border-radius: 2px 5px 5px 2px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(20, 20, 20, 0.16), 0 2px 6px rgba(20, 20, 20, 0.1);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
  background: #fff;
}
/* 精装书脊折痕 */
.tile-cover::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0,0,0,0.2), rgba(0,0,0,0.02) 55%, rgba(255,255,255,0.28) 78%, rgba(0,0,0,0.08));
  pointer-events: none;
}
.tile:hover .tile-cover {
  transform: translateY(-8px);
  box-shadow: 0 24px 44px rgba(20, 20, 20, 0.24), 0 4px 10px rgba(20, 20, 20, 0.12);
}
.tile-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile-cover img:not([src]) { visibility: hidden; }
/* 设计款封面（无真实封面时回退） */
.tile-design {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12% 10% 10% 16%;
  text-align: left;
}
.tile-design .td-tag {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.72;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tile-design .td-title {
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
  font-size: clamp(13px, 1.2vw, 17px);
  line-height: 1.35;
  margin-top: 10%;
}
.tile-design .td-author {
  margin-top: auto;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  opacity: 0.8;
}
/* 图注 */
.tile-caption { margin-top: 12px; }
.tile-caption .tc-title {
  font-family: "Noto Serif SC", serif;
  font-weight: 500;
  font-size: 12.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-caption .tc-author {
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.empty-hint {
  display: none;
  text-align: center;
  margin-top: 80px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.empty-hint.show { display: block; }

/* ---------- 底部提示 ---------- */
.footer-hint {
  position: fixed;
  left: 0; right: 0; bottom: 22px;
  text-align: center;
  font-size: 9px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-muted);
  pointer-events: none;
  z-index: 20;
}

/* ---------- 详情浮层 ---------- */
.detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(236, 233, 226, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.detail.open { display: flex; }
.detail-panel {
  position: relative;
  display: flex;
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  width: min(860px, 90vw);
  padding: 40px clamp(28px, 4vw, 56px);
  animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.d-close {
  position: absolute;
  top: 0; right: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 26px;
  font-weight: 300;
  color: var(--ink-muted);
  transition: color 0.3s ease;
}
.d-close:hover { color: var(--ink); }
.d-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--ink-muted);
  transition: color 0.3s ease, transform 0.2s ease;
  padding: 12px;
}
.d-nav:hover { color: var(--ink); }
.d-prev { left: -54px; }
.d-next { right: -54px; }
.d-cover {
  flex: 0 0 clamp(180px, 24vw, 250px);
  aspect-ratio: 0.7;
  border-radius: 2px 6px 6px 2px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 26px 54px rgba(20, 20, 20, 0.28), 0 6px 14px rgba(20, 20, 20, 0.14);
  background: #fff;
}
.d-cover::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 12px;
  background: linear-gradient(90deg, rgba(0,0,0,0.22), rgba(0,0,0,0.02) 55%, rgba(255,255,255,0.3) 78%, rgba(0,0,0,0.08));
  pointer-events: none;
}
.d-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.d-cover .tile-design .td-title { font-size: 21px; }
.d-cover .tile-design .td-tag { font-size: 9px; }
.d-cover .tile-design .td-author { font-size: 10px; }
.d-info { flex: 1 1 auto; min-width: 0; }
.d-tag {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.d-title {
  font-family: "Noto Serif SC", "Playfair Display", serif;
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 600;
  line-height: 1.3;
}
.d-sub {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  margin: 4px 0 12px;
}
.d-meta {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.d-desc {
  font-size: 13px;
  line-height: 1.85;
  opacity: 0.82;
  max-width: 480px;
}
.d-idx {
  margin-top: 18px;
  font-family: "Playfair Display", serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .corner { top: 16px; font-size: 8px; }
  .corner-left { left: 16px; }
  .corner-right { right: 16px; }
  .search-box { top: 44px; right: 16px; }
  .search-box input { width: 132px; font-size: 12px; }
  .header { padding-top: 96px; }
  .title { font-size: clamp(32px, 10vw, 64px); }
  .cats { position: sticky; top: 96px; gap: 2px 14px; padding: 10px 4vw; }
  .chip { font-size: 10px; letter-spacing: 0.08em; }
  .wall { margin-top: 26px; padding: 0 18px; }
  .tiles {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 30px 16px;
  }
  .cat-section { margin-bottom: 44px; scroll-margin-top: 150px; }
  .tile-caption .tc-title { font-size: 11px; }
  .footer-hint { display: none; }
  .drawer-hot-zone,
  .drawer-index { display: none; }
  .drawer-toggle {
    top: 44%;
    right: 0;
    width: 42px;
    min-height: 100px;
  }
  body.drawer-open { overflow: hidden; }
  body.drawer-open .drawer-toggle {
    opacity: 0;
    pointer-events: none;
  }
  .drawer {
    right: 0;
    width: min(94vw, 430px);
    transform: translateX(104%);
    box-shadow: -12px 0 34px rgba(38, 31, 22, 0.16);
  }
  .drawer-head { min-height: 68px; padding: 13px 16px; }
  .drawer-body { grid-template-columns: 45% 55%; }
  .drawer-column { padding: 17px 8px 24px; }
  .drawer-section-title { padding-inline: 6px; font-size: 11px; }
  .dtag { min-height: 38px; padding-inline: 6px; font-size: 11px; gap: 5px; }
  .dtag > .material-symbols-outlined { font-size: 15px; }
  .drawer-footer { min-height: 74px; padding: 11px 12px; }
  .drawer-apply { padding-inline: 12px; }
  .drawer-backdrop.show { opacity: 1; pointer-events: auto; }
  .detail-panel {
    flex-direction: column;
    gap: 22px;
    width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
    padding: 44px 22px 28px;
    text-align: center;
  }
  .d-cover { flex: 0 0 auto; width: 46vw; }
  .d-desc { max-width: none; font-size: 12px; }
  .d-nav { top: auto; bottom: -6px; transform: none; }
  .d-prev { left: 18vw; }
  .d-next { right: 18vw; }
  .d-close { top: 8px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
