/* Catalogue and the home book shelf share only book-owned components. */
.books-page { background: var(--bg); --books-surface: var(--tibumo-skin); }
:root[data-theme="dark"] .books-page { --books-surface: rgba(249,246,241,.08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .books-page { --books-surface: rgba(249,246,241,.08); } }
.books-main { max-width: 1280px; margin: 0 auto; padding: 120px 32px 64px; }
.books-main h1, .books-family-head h2, .books-publisher h2 { font-family: var(--brand-font); font-size: 48px; font-weight: 400; line-height: 1.2; overflow-wrap: anywhere; }
.books-intro { max-width: 850px; margin-bottom: 28px; }
.books-lead { font-size: 21px; margin-top: 20px; }
.books-stats { margin-top: 16px; font-weight: 900; }
.books-note { color: var(--text-secondary); font-size: 15px; line-height: 1.5; }
.books-filters { display: flex; flex-wrap: wrap; gap: 20px; align-items: end; padding: 20px 0; }
.books-filters label { display: grid; gap: 8px; font-weight: 800; }
.books-filters select { min-height: 46px; max-width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 32px 8px 12px; font: inherit; }
.books-results { margin: 20px 0 10px; font-weight: 800; }
.books-family { margin-top: 40px; padding-top: 34px; }
.books-family::before { content: ''; display: block; height: 8px; margin-bottom: 30px; background: url('../img/brand/tibumo-color-bar.png') center / 100% 100% no-repeat; }
.books-family:nth-of-type(even)::before { transform: scaleX(-1); }
.books-family-head { margin-bottom: 24px; }
.books-family-head p { margin-top: 10px; }
.books-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); column-gap: 32px; row-gap: 40px; }
.books-card { min-width: 0; display: flex; flex-direction: column; align-items: start; }
.books-media { display: block; width: 100%; }
.books-cover { width: 100%; height: auto; object-fit: contain; border-radius: 0; }
.books-card .books-media { display: flex; justify-content: center; align-items: start; }
.books-card .books-cover { max-height: 325px; width: auto; max-width: 100%; }
.books-card h3 { font: 900 21px/1.35 var(--font); margin: 16px 0 12px; }
.books-badge { font-size: 15px; font-weight: 800; margin-top: 12px; color: var(--text-secondary); }
.books-badge--uncertain { text-decoration: underline; text-decoration-style: dotted; }
.books-button { margin-top: auto; display: inline-flex; min-height: 44px; align-items: center; justify-content: center; }
.books-button.resource-action { font-size: 17px; padding: 10px 16px; max-width: 100%; white-space: normal; text-align: center; }
.books-return { margin-bottom: 24px; font-weight: 800; }
.books-return a { text-decoration: underline; text-underline-offset: 4px; }
.books-detail-head { display: grid; grid-template-columns: minmax(240px,380px) minmax(0,1fr); gap: 64px; align-items: center; }
.books-detail-cover { max-width: 340px; margin: 0 auto; }
.books-detail-cover .books-cover { display: block; box-shadow: 4px 6px 12px rgba(26,26,26,.12); }
.books-detail-media { min-width: 0; }
.books-detail-cover figure + figure { margin-top: 24px; }
.books-detail-cover figcaption { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
.books-detail-cover figcaption a { text-decoration: underline; text-underline-offset: 4px; font-weight: 800; }
.books-cover-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.books-cover-tab.resource-action { white-space: normal; font-size: 15px; padding: 10px 12px; }
.books-cover-tab.resource-action[aria-pressed="true"] { box-shadow: 0 1px 3px rgba(26,26,26,.12), inset 0 -3px 0 var(--tibumo-purple); }
.books-detail-cover figure[hidden] + figure { margin-top: 0; }
.books-detail-intro { padding: 16px 0; }
.books-format { font-size: 16px; font-weight: 800; margin-top: 14px; color: var(--text-secondary); }
.books-kicker { margin-bottom: 12px; font-weight: 900; color: var(--text-secondary); }
.books-amazon-title { font-size: 21px; line-height: 1.4; margin: 18px 0 10px; }
.books-buy { margin-top: 26px; }
.books-buy .books-button { margin-top: 0; }
.books-buy .books-note { margin-top: 12px; }
.books-conflict, .books-adult-help { padding: 12px 0 12px 16px; border-left: 4px solid var(--tibumo-purple); margin: 16px 0; font-size: 17px; }
.books-editions { margin-top: 22px; }
.books-editions p { font-weight: 800; margin-bottom: 8px; }
.books-edition-options { display: flex; flex-wrap: wrap; gap: 12px; }
.books-edition-link { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border-radius: 6px; background: var(--books-surface); font-weight: 800; border-bottom: 3px solid transparent; }
.books-edition-link[aria-current="page"] { border-bottom-color: var(--tibumo-purple); font-weight: 900; }
.books-publisher { margin-top: 48px; padding-top: 28px; }
.books-publisher::before { content: ''; display: block; height: 8px; margin-bottom: 30px; background: url('../img/brand/tibumo-color-bar.png') center / 100% 100% no-repeat; }
.books-publisher h2 { margin-bottom: 12px; }
.books-source { margin-top: 40px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.books-source summary { cursor: pointer; padding: 22px 0; font-size: 22px; font-weight: 900; }
.books-source summary::marker { color: var(--tibumo-purple); }
.books-source-content { padding-bottom: 28px; }
.books-source-content h3 { margin: 22px 0 8px; font-size: 19px; }
.books-source .books-amazon-title { margin-top: 0; }
.books-source-text { max-width: 850px; margin-top: 20px; font-size: 18px; line-height: 1.7; }
.books-source-text p + p { margin-top: 16px; }
.books-module-title { font-size: 24px; margin: 26px 0 18px; }
.books-aplus-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.books-aplus-grid img { width: 100%; height: auto; background: white; }
.books-aplus-grid h4 { margin: 14px 0 8px; font-size: 19px; }
.books-home-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 24px; margin: 24px 0 28px; }
.books-home-card { min-width: 0; }
.books-home-card h3 { margin-top: 14px; font: 900 20px/1.3 var(--text-font, var(--font, "Nunito", sans-serif)); }
.books-home-card p { margin-top: 6px; }
.books-home-card .books-cover { width: 100%; }
.books-home .books-note { color: var(--muted); }
.books-main [hidden], .books-home [hidden] { display: none; }
/* Reserve the enhanced layout before first paint; without JS both covers remain readable. */
html[data-books-enhanced] .books-filters[hidden],
html[data-books-enhanced] .books-cover-controls[hidden] { display: flex; }
html[data-books-enhanced] [data-book-covers]:not([data-book-covers-ready]) [data-book-cover-side="back"] { display: none; }
html[data-lang="zh"] .books-main h1, html[data-lang="zh"] .books-family-head h2, html[data-lang="zh"] .books-publisher h2 { font-family: var(--cjk-font); font-weight: 800; }
@media (max-width: 1020px) {
  .books-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 28px; }
  .books-home-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .books-detail-head { gap: 30px; grid-template-columns: minmax(200px,290px) minmax(0,1fr); }
}
@media (max-width: 700px) {
  .books-main { padding: 100px 20px 40px; }
  .books-grid, .books-home-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 28px 18px; }
  .books-card h3 { font-size: 18px; }
  .books-button.resource-action { font-size: 16px; padding: 10px 12px; }
  .books-filters { align-items: stretch; gap: 14px; }
  .books-filters label { width: 100%; }
  .books-detail-head { grid-template-columns: 1fr; gap: 26px; }
  .books-detail-cover { width: 100%; }
  .books-detail-intro { padding: 0; }
  .books-aplus-grid { grid-template-columns: 1fr; gap: 30px; }
  .books-aplus-grid figure { max-width: 420px; margin: auto; }
  .books-lead { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .books-page { scroll-behavior: auto; } }
