/* 出版书籍栏目列表（zhiku.php?id=65，include/book-shelf.php）。
   Mouse + ≥768px: a shelf of covers; hovering or keyboard-focusing a book wipes its summary up over the cover.
   Touch at ≥768px: the same shelf, with the summary under the title. Below 768px: left portrait cover, right title. */
.book-shelf { --book-red: #a51e25; --book-ink: #23282f; --book-muted: #646a70; --book-line: #e8e5e2; --book-paper: #f7f6f3; --book-focus: #bf6e2e;
    --book-ease: cubic-bezier(.22, 1, .36, 1); box-sizing: border-box; padding: 4px 16px 8px; color: var(--book-ink); font-size: 14px; line-height: 1.8; }
/* style.css keeps .main at a fixed 1200px from 769px up, and .main_warp clips it; this panel follows the viewport instead. */
.main.book-shelf-main { width: min(1200px, calc(100% - 24px)); }
@media (max-width: 767px) { .main.book-shelf-main { width: 98%; } }
.book-shelf *, .book-shelf *::before, .book-shelf *::after { box-sizing: border-box; }
.book-shelf ::selection { background: var(--book-red); color: #fff; }
.book-shelf-list { margin: 0; padding: 0; list-style: none; }
.book-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--book-line); color: inherit; text-decoration: none; }
.book-shelf-list li:last-child .book-card { border-bottom: 0; }
.book-card:hover, .book-card:focus { color: inherit; text-decoration: none; }
.book-card:focus-visible { outline: 3px solid var(--book-focus); outline-offset: 4px; }

/* Cover frame: 3:4 on paper. The art box keeps 3:4 too, so a contained scan and the cropped poster line up the same way. */
.book-cover { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--book-paper); }
.book-cover-art { position: absolute; inset: 8%; overflow: hidden; }
/* Uploads are book-cover scans close to 3:4, so cover fills the art box (a square scan with a portrait book crops to just the book).
   Multiply lets each scan's white backdrop take on the paper tone instead of showing as a pale box. */
.book-cover-art img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; mix-blend-mode: multiply; }
/* Poster artwork (800×600): show only the printed cover (x 22–346, y 110–535 px), scaled to the art box width and centred vertically. */
.book-cover-poster .book-cover-art img { position: absolute; top: -24.6%; left: -6.77%; width: 246.2%; height: auto; object-fit: fill; }
.book-cover-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--book-muted); font-size: 12px; }

.book-caption { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.book-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; margin: 0; color: var(--book-ink); font-size: 16px; font-weight: 600; line-height: 1.6; text-wrap: balance; overflow-wrap: anywhere; transition: color .25s var(--book-ease); }
.book-summary { display: none; }
.book-more { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--book-red); font-size: 13px; font-weight: 600; line-height: 1.5; }
.book-shelf svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.book-card:active .book-title { color: var(--book-red); }

@media (min-width: 768px) {
    .book-shelf { padding: clamp(32px, 4vw, 48px) clamp(24px, 4.5vw, 56px) clamp(40px, 4.5vw, 56px); }
    .book-shelf-list { display: grid; gap: 48px 40px; }
    /* At most three books a row, so each cover stays large enough to carry its summary. */
    .book-shelf-list { grid-template-columns: repeat(auto-fill, minmax(max(220px, calc((100% - 80px) / 3)), 1fr)); }
    .book-card { position: relative; display: block; padding: 0; border: 0; }
    .book-caption { padding-top: 16px; }
    .book-title { -webkit-line-clamp: 2; }
    .book-more { margin-top: 6px; }
    /* Touch screens have no hover: keep a short summary in reading order under the title. */
    .book-summary { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; margin-top: 6px; color: var(--book-muted); font-size: 13px; line-height: 1.75; }
    .book-summary-more { display: none; }
}

@media (hover: hover) and (min-width: 768px) {
    .book-more { display: none; }
    .book-cover { transition: box-shadow .45s var(--book-ease); }
    /* The summary sits over the cover (same box: full width, 3:4, top of the card) and wipes up from the bottom edge. */
    .book-summary { position: absolute; top: 0; left: 0; z-index: 1; display: flex; flex-direction: column; gap: 16px; width: 100%; aspect-ratio: 3 / 4; margin: 0; padding: clamp(24px, 10%, 36px) clamp(20px, 9.5%, 32px) clamp(20px, 8%, 28px);
        background: rgb(35 40 47 / 97%); color: rgb(255 255 255 / 88%); font-size: 14px; line-height: 1.9; -webkit-line-clamp: none;
        clip-path: inset(100% 0 0 0); transition: clip-path .5s var(--book-ease); }
    .book-summary::before { content: ''; flex-shrink: 0; width: 28px; height: 2px; background: #d9474e; }
    /* No flex growth here: a stretched -webkit-box shows lines past its clamp. The link row is pushed down with margin-top: auto instead. */
    .book-summary-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 7;
        opacity: 0; transform: translateY(8px); transition: opacity .35s var(--book-ease), transform .45s var(--book-ease); }
    .book-summary-more { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; color: #fff; font-weight: 600; letter-spacing: .04em; opacity: 0; transition: opacity .35s var(--book-ease); }
    .book-summary-more svg { transition: transform .35s var(--book-ease); }
    .book-card:hover .book-cover, .book-card:focus-visible .book-cover { box-shadow: 0 4px 8px rgb(40 22 18 / 6%), 0 18px 36px rgb(40 22 18 / 14%); }
    .book-card:hover .book-summary, .book-card:focus-visible .book-summary { clip-path: inset(0 0 0 0); }
    .book-card:hover .book-summary-text, .book-card:focus-visible .book-summary-text { opacity: 1; transform: none; transition-delay: .12s; }
    .book-card:hover .book-summary-more, .book-card:focus-visible .book-summary-more { opacity: 1; transition-delay: .2s; }
    .book-card:hover .book-summary-more svg { transform: translateX(3px); }
    .book-card:hover .book-title, .book-card:focus-visible .book-title { color: var(--book-red); }
}
/* Full-width panel: 336px covers hold ten lines of summary; narrower columns keep the clamp above. */
@media (hover: hover) and (min-width: 1200px) {
    .book-summary-text { -webkit-line-clamp: 10; }
}

/* Reduced motion: no wipe or drift, the overlay simply appears. */
@media (prefers-reduced-motion: reduce) {
    .book-cover, .book-title { transition: none; }
}
@media (prefers-reduced-motion: reduce) and (hover: hover) and (min-width: 768px) {
    .book-summary, .book-summary-text, .book-summary-more, .book-summary-more svg { transition: none; }
    .book-summary { clip-path: none; opacity: 0; }
    .book-summary-text { transform: none; }
    .book-card:hover .book-summary, .book-card:focus-visible .book-summary { opacity: 1; }
    .book-card:hover .book-summary-more svg { transform: none; }
}
