/* ==========================================================================
   首頁（index.html）：卷首水墨圖＋全文檢索框＋兩組書架＋頁尾
   版式：唯一「講究」的元素是業主提供的卷首圖；其餘沿用閱讀介面書單頁的語彙
   （楷體群組標題、細線分隔的書目、文言計數），零卡片、零陰影、無自動動效。
   工具列與 token 與閱讀／檢索頁相同。
   ========================================================================== */

body.home { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- 工具列（與 search.css 相同語彙） ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: .25rem;
  padding: 0 .5rem 0 .75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: center;
  min-width: 0; margin-right: .5rem;
  font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem; letter-spacing: .08em;
  color: var(--head); text-decoration: none; white-space: nowrap;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }

/* ---------- 主欄 ---------- */
.home-main { flex: 1; width: 100%; max-width: 60rem; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }

/* ---------- 卷首：水墨圖（600×400 原尺寸置中）＋檢索框 ---------- */
.hero { display: flex; flex-direction: column; align-items: center; }
.hero-art { width: 100%; max-width: 600px; margin: 0; }
.hero-img { width: 100%; height: auto; aspect-ratio: 3 / 2; mix-blend-mode: multiply; }   /* 圖為白底，multiply 讓白底融入紙色 */
:root[data-theme="dark"] .hero-art { background: #f5f4f0; padding: .75rem; border-radius: 2px; }   /* 暗黑主題：放在一張淺色紙片上 */

.search-form { display: flex; gap: .5rem; width: 100%; max-width: 40rem; margin: .75rem auto 0; }
.search-input { flex: 1; min-width: 0; min-height: 44px; font-size: 1.05rem; padding: 0 .9em; font-family: var(--font-serif); }
.search-submit { min-height: 44px; padding: 0 1.1em; flex: none; }
.search-submit .icon { width: 1.1em; height: 1.1em; }

/* ---------- 書架：群組標題＋書目（與 reader.css 群組書單頁一致，一書一次才裝飾） ---------- */
.shelves { display: grid; gap: 3rem; margin-top: 3rem; font-family: var(--font-serif); }
.shelves[aria-busy="true"] { min-height: 12rem; }
/* 群組標題：楷體、磁青字，不加框不加底（業主 2026-09-22：直排題簽→橫式色帶→嫌色塊太重，定案純文字）。
   reader.css 的 .group-title 同款，改這裡要一起改。 */
.shelf-title {
  margin: 0 0 .9rem;
  color: var(--head);
  font-family: var(--font-kai); font-size: 1.5rem; font-weight: 400; letter-spacing: .2em; line-height: 1.3;
}

/* 專書：書名、作者、科頁統計 */
.book-list { list-style: none; border-top: 1px solid var(--rule); }
.book-item { border-bottom: 1px solid var(--rule); }
.book-link { display: block; padding: 1.1rem .25rem; text-decoration: none; color: inherit; }
.book-link:hover .book-title, .book-link:focus-visible .book-title { color: var(--primary); }
.book-title { font-size: 1.25rem; font-weight: 600; letter-spacing: .04em; color: var(--head); line-height: 1.4; transition: color var(--ease); }
.book-authors { margin-top: .35rem; color: var(--muted); font-size: .9rem; line-height: 1.6; overflow-wrap: anywhere; }

/* 期刊輯錄：每種只有數篇，改兩欄緊湊列表（只列刊名；「凡N篇」已於 2026-09-22 依業主要求拿掉） */
.journal-list { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.5rem; border-top: 1px solid var(--rule); }
.journal-item { border-bottom: 1px solid var(--rule); }
.journal-link { display: block; padding: .8rem .25rem; text-decoration: none; color: inherit; }
.journal-link:hover .journal-title, .journal-link:focus-visible .journal-title { color: var(--primary); }
.journal-title { font-size: 1.05rem; font-weight: 500; letter-spacing: .03em; color: var(--head); line-height: 1.5; transition: color var(--ease); }

/* 載入失敗、無 JS */
.home-note { color: var(--muted); line-height: 1.8; }
.home-note a { color: var(--primary); }

/* ---------- 頁尾 ---------- */
.home-foot {
  width: 100%; max-width: 60rem; margin: 0 auto; padding: 1.5rem 1.5rem 2.5rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .75rem 1.5rem;
  color: var(--muted); font-size: .85rem;
}
.foot-links { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; list-style: none; }
.foot-link { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.foot-link:hover, .foot-link:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: .2em; }
.foot-link .icon-sm { width: .9em; height: .9em; vertical-align: -.1em; }
.foot-updated { font-variant-numeric: tabular-nums; }

/* ---------- 響應式 ---------- */
@media (max-width: 767px) {
  .brand { font-size: .95rem; letter-spacing: .04em; }
  .home-main { padding: 1rem 1rem 2rem; }
  .shelves { gap: 2.25rem; margin-top: 2.25rem; }
  .shelf-title { font-size: 1.2rem; letter-spacing: .12em; }   /* 13 字的群組名在 360px 也要一行放得下 */
  .journal-list { grid-template-columns: 1fr; }
  .home-foot { padding: 1.25rem 1rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .book-title, .journal-title { transition: none; }
}
