/* ============================================================
   library-list.css · 图书馆列表页「书籍形式」（2026-11-16）
   先例：library-reader.css（图书馆专属页级样式）。
   令牌：全走 theme-vars.css 既有 --lib-* 族（立轴头同源，双主题自适应）
   与基础令牌，零新增零写死。
   结构：
     .lb-hero-line   统计行（印章 + 种数 + 视图切换）
     .lb-grid/.lb-book  书封网格（5:7 封 + 竖排题签 + 朝代朱印 + 在线角标）
     .lb-shelfview   书架视图（书脊 + 木架板 + 分架标签）
   ============================================================ */

/* ---------- 统计行 ---------- */
.lb-hero-line { display: flex; align-items: center; gap: 12px; padding: 16px 0 4px; }
.lb-hero-seal {
  width: 40px; height: 40px; flex: 0 0 auto;
  background: var(--lib-seal); color: var(--on-accent);
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 2px var(--lib-seal-border);
}
.lb-hero-txt { color: var(--ink-2); font-size: var(--fs-sm); }
.lb-hero-txt b { color: var(--lib-seal); font-family: var(--serif); font-size: var(--fs-lg); font-weight: 700; }
.lb-hero-dot { margin: 0 6px; color: var(--line); }
.lb-viewtoggle { margin-left: auto; display: flex; border: 1px solid var(--line); border-radius: var(--radius-full); overflow: hidden; }
.lb-viewtoggle button {
  border: none; background: var(--card-bg); color: var(--ink-2);
  font-size: var(--fs-xs2); padding: 5px 16px; cursor: pointer;
  font-family: inherit; transition: all var(--transition-fast);
}
.lb-viewtoggle button:hover { color: var(--accent); }
.lb-viewtoggle button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ---------- 书封网格 ---------- */
.lb-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px 20px; padding: 14px 0 10px; }
.lb-book { position: relative; display: block; min-width: 0; }

.lb-cover {
  position: relative; display: block;
  aspect-ratio: 5 / 7;
  background: linear-gradient(160deg, var(--lib-cover-1), var(--lib-cover-2) 55%, var(--lib-cover-3));
  border: 1px solid var(--lib-meta-line);
  border-radius: 3px 6px 6px 3px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
/* 双边框线（外粗内细的古籍封绘） */
.lb-cover-drawn::before {
  content: ""; position: absolute; inset: 7px;
  border: 1px solid var(--lib-meta-line);
  box-shadow: 0 0 0 1px var(--lib-meta-line) inset;
  pointer-events: none;
}
.lb-book:hover .lb-cover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.lb-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-cover.has-img::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 62%, var(--lib-cover-inner));
  pointer-events: none;
}

/* 题签：右侧竖排书名 */
.lb-titling {
  position: absolute; top: 14px; right: 16px;
  width: 44px; max-height: calc(100% - 48px);
  background: var(--lib-meta-bg);
  border: 1px solid var(--lib-meta-line);
  border-radius: 2px;
  padding: 10px 4px;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 17px; font-weight: 700; letter-spacing: 4px;
  color: var(--lib-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: var(--shadow);
}
.lb-titling small {
  font-size: var(--fs-xs2); font-weight: 400;
  color: var(--lib-ink-2); letter-spacing: 2px; margin-top: 8px;
}

/* 朝代朱印（左下） */
.lb-stamp {
  position: absolute; left: 14px; bottom: 14px;
  width: 34px; height: 34px;
  background: var(--lib-seal); color: var(--on-accent);
  font-family: var(--serif); font-size: var(--fs-xs2); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); line-height: 1.1; text-align: center;
  opacity: .92;
  box-shadow: var(--lib-seal-shadow);
}

/* 在线阅读角标（左上） */
.lb-badge-online {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent);
  font-size: var(--fs-xs2); padding: 1px 8px;
  border-radius: var(--radius-full);
}

/* 卡下信息条 */
.lb-meta { display: block; padding: 9px 2px 0; }
.lb-meta .t {
  display: block; font-size: var(--fs-md); font-weight: 600;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-meta .d {
  display: flex; gap: 8px; margin-top: 2px;
  font-size: var(--fs-xs2); color: var(--ink-3);
  white-space: nowrap; overflow: hidden;
}
.lb-meta .dot { color: var(--line); }

/* ---------- 书架视图 ---------- */
.lb-shelfview { padding: 14px 0 10px; }
.lb-shelfview[hidden] { display: none; }
.lb-shelf { position: relative; margin-bottom: 30px; }
.lb-shelf-row {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 0 14px; min-height: 158px;
  background: var(--lib-paper-2);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow-x: auto;
}
.lb-shelf-board {
  height: 12px;
  background: linear-gradient(180deg, var(--lib-spine-1), var(--lib-spine-2));
  border-radius: 0 0 3px 3px;
  box-shadow: var(--shadow-hover);
}
.lb-spine {
  position: relative; flex: 0 0 auto;
  width: 40px; height: 138px;
  background: linear-gradient(180deg, var(--lib-cover-1), var(--lib-cover-2));
  border: 1px solid var(--lib-meta-line);
  border-radius: 3px 3px 1px 1px;
  box-shadow: inset 3px 0 0 var(--lib-spine-line), inset -2px 0 0 var(--lib-spine-inner);
  transition: transform var(--transition-fast);
}
.lb-spine:nth-child(4n+2) { background: linear-gradient(180deg, var(--lib-cover-2), var(--lib-cover-3)); }
.lb-spine:nth-child(4n+3) { background: linear-gradient(180deg, var(--lib-paper-2), var(--lib-paper-1)); }
.lb-spine:nth-child(4n)   { background: linear-gradient(180deg, var(--lib-spine-2), var(--lib-cover-3)); }
.lb-spine:hover { transform: translateY(-8px); box-shadow: var(--shadow-lift); }
.lb-spine .st {
  position: absolute; inset: 10px 4px;
  writing-mode: vertical-rl;
  font-family: var(--serif); font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: 3px; color: var(--lib-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-spine .sd {
  position: absolute; bottom: 6px; left: 0; right: 0;
  text-align: center; font-size: var(--fs-xs2); color: var(--lib-ink-2);
}
.lb-spine.pdf::after {
  content: ""; position: absolute; top: 5px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: var(--radius-full);
  background: var(--lib-seal);
}
.lb-shelf-label { font-size: var(--fs-xs2); color: var(--ink-3); margin: 8px 4px 0; }
.lb-shelf-label b { color: var(--ink-2); font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) { .lb-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .lb-grid { grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }
  .lb-titling { width: 36px; font-size: 15px; }
}
