/* A reading nook for the existing book collection. Shared shell lives in reading-room.css. */
.books-landscape { transition: opacity 220ms ease-out; }
.books-landscape img { filter: brightness(.95); }
.books-page .reading-shell { padding-bottom: 120px; }
.books-page h1 { text-wrap: pretty; }
.books-intro { margin-bottom: 32px; transition: opacity 220ms ease-out; }
.books-intro p { margin: 24px 0 0; font-size: 1rem; line-height: 1.8; }
.book-filter-sidebar { max-height: calc(100svh - var(--header-height) - 96px); background: rgba(5, 12, 23, .96); }
.book-filter-menu > summary { display: none; }
.book-filter-title { margin: 0 0 18px; color: var(--cream); font: 700 1rem/1.4 var(--font-display); }
.filter-pills { display: flex; flex-direction: column; }
.filter-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    color: var(--muted);
    background: transparent;
    font-size: var(--font-size-ui);
    line-height: 1.6;
    text-align: left;
    transition: color 180ms ease-out;
}
.filter-pill:hover, .filter-pill[aria-pressed="true"] { color: var(--gold); }
.filter-pill[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 5px; }
.pill-count { font-size: var(--font-size-ui); font-variant-numeric: tabular-nums; text-decoration: none; }
.books-back { display: flex; align-items: center; gap: 10px; width: fit-content; min-height: 44px; margin-top: 14px; color: var(--muted); font-size: var(--font-size-ui); text-decoration: none; }
.books-back:hover { color: var(--gold); }
.books-page :is(.books-back, .random-pick-icon, .floating-book-dock, .book-filter-menu > summary) svg { display: block; width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.5; }
.book-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 0; border-block: 1px solid var(--line); }
.book-count { margin: 0; color: var(--muted); font-size: var(--font-size-ui); font-variant-numeric: tabular-nums; }
.book-empty { margin: 36px 0; color: var(--muted); font-size: .9rem; }
.book-grid { min-width: 0; }
.book-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    row-gap: 10px;
    position: relative;
    padding: 32px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin: 0;
    transition: opacity 220ms ease-out;
}
.book-card.book-card--hidden { display: none; }
.book-card h3 { grid-column: 1 / -1; grid-row: 1; margin: 0; color: var(--cream); font: 600 1.2rem/1.55 var(--font-body); letter-spacing: -.02em; overflow-wrap: break-word; }
.book-author { grid-column: 1; grid-row: 2; align-self: baseline; margin: 0; color: var(--muted); font-size: var(--font-size-ui); line-height: 1.7; letter-spacing: .025em; overflow-wrap: break-word; }
.book-tag { grid-column: 2; grid-row: 2; align-self: baseline; color: var(--teal); font-size: var(--font-size-ui); line-height: 1.7; }
.book-review { grid-column: 1 / -1; grid-row: 3; margin: 8px 0 0; color: var(--cream-soft); font-size: 1.0381rem; line-height: 1.85; overflow-wrap: break-word; }
/* Keep surrounding recommendations readable while the selected pick is in view. */
.book-grid--focus .book-card:not(.book-card--spotlight) { opacity: var(--reading-context-opacity); }
.book-grid--focus .book-card:not(.book-card--spotlight):focus-within { opacity: 1; }
.books-page:has(.book-grid--focus) .books-intro { opacity: var(--reading-context-opacity); }
.books-page:has(.book-grid--focus) .books-landscape { opacity: .22; }
/* Shared corner markers and keyboard-focus treatment live in reading-room.css. */
.floating-book-dock {
    --dock-center: calc(95vw - min(400px, 32vw));
    position: fixed;
    left: var(--dock-center);
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: max-content;
    /* Keep enlarged controls and their focus rings inside the viewport,
       while retaining the reading-pane center at ordinary text sizes. */
    max-width: min(calc(100vw - 32px), calc(200vw - var(--dock-center) - var(--dock-center) - 32px));
    padding: 6px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
    transform: translateX(-50%);
}
.dock-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; min-height: 44px; padding: 8px 14px; border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--cream); font-size: var(--font-size-ui); font-weight: 600; overflow-wrap: anywhere; }
.dock-btn--shuffle { color: var(--gold); border-color: var(--line); }
.dock-btn--top { flex-shrink: 0; white-space: nowrap; }
.dock-btn:hover { color: var(--gold); border-color: var(--gold); }
.dock-btn:disabled { opacity: .55; cursor: default; }
@media (max-width: 1100px) {
    .floating-book-dock { --dock-center: 63.5vw; }
}
@media (max-width: 760px) {
    html { scroll-padding-top: calc(var(--header-height) + 80px); }
    .books-landscape img { object-position: center 68%; }
    .books-intro { margin-bottom: 28px; }
    .books-intro p { margin-top: 20px; }
    .book-filter-sidebar { position: sticky; top: var(--header-height); left: auto; z-index: 30; width: auto; max-height: none; overflow: visible; padding: 0; margin: 0 calc(-1 * var(--pane-inset)) 24px; background: var(--panel); }
    .book-filter-menu[open] { max-height: calc(100svh - var(--header-height) - 8px); overflow-y: auto; }
    .book-filter-menu > summary { position: sticky; top: 0; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px var(--pane-inset); background: var(--panel); color: var(--cream); font-size: var(--font-size-ui); font-weight: 600; cursor: pointer; list-style: none; }
    .book-filter-menu > summary::-webkit-details-marker { display: none; }
    .current-filter-label { margin-left: auto; color: var(--gold); font-size: var(--font-size-ui); font-weight: 400; }
    .books-page .book-filter-menu > summary svg { width: 16px; height: 16px; }
    .book-filter-menu[open] > summary svg { transform: rotate(180deg); }
    .book-filter-title { display: none; }
    .filter-pills { padding: 0 var(--pane-inset); }
    .filter-pill { min-height: 44px; }
    .books-back { margin: 10px var(--pane-inset) 14px; }
    .book-controls { gap: 12px; }
    .book-card { padding: 28px 0; column-gap: 12px; }
    .book-card h3 { font-size: 1.1rem; }
    .book-review { font-size: 1rem; line-height: 1.8; }
    .floating-book-dock { --dock-center: 50vw; }
}
@media (max-width: 380px) {
    .books-page .random-pick-btn { padding-inline: 10px; gap: 7px; }
    .book-controls { gap: 8px; }
    .dock-btn { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .filter-pill, .books-landscape, .books-intro, .book-card { transition: none; }
    .rolling .random-pick-icon { animation: none; }
}
