/* Content → Audiobooks (Porchlight 3.1o): search, filters, Cover Flow, Cover
 * Grid, Simple List and the book's details. */
#ab-search { flex: 1; min-width: 0; box-sizing: border-box; font: inherit; font-size: var(--t-md); color: var(--ink);
             background: var(--paper); border: 1px solid var(--silver-1); border-radius: 999px; padding: 10px 16px; min-height: 44px; }
#ab-search:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.ab-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); align-items: end; margin-bottom: 10px; }
.ab-filters[hidden] { display: none; }
.ab-filter { display: flex; flex-direction: column; gap: var(--s-1); font-size: var(--t-sm); color: var(--muted); }
.ab-filter select { font: inherit; font-size: var(--t-base); color: var(--ink); background: var(--paper);
                    border: 1px solid var(--silver-1); border-radius: 12px; padding: 8px 10px; min-height: 44px; min-width: 0; }
.ab-filter select:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.ab-check { grid-column: span 2; min-height: 44px; }
.ab-layouts { margin-bottom: var(--s-3); }

/* ---- Cover Flow: the centre book faces forward; neighbours turn away. */
.ab-flow { position: relative; height: 290px; perspective: 900px; overflow: hidden; touch-action: pan-y;
           border-radius: var(--radius); }
.ab-flow:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.ab-cover { position: absolute; left: 50%; top: 12px; width: 170px; margin-left: -85px; padding: 0; border: 0;
            background: none; cursor: pointer; transform-style: preserve-3d;
            transform: translateX(calc(var(--o) * 52px + var(--s) * 58px)) rotateY(calc(var(--s) * -52deg)) scale(calc(1 - var(--a) * .1));
            opacity: calc(1 - var(--a) * .18); transition: transform .3s ease, opacity .3s ease;
            will-change: transform, opacity; backface-visibility: hidden; }
.ab-cover.mid { transform: none; opacity: 1; }
.ab-cover.gone { opacity: 0; pointer-events: none; }
.ab-img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px;
          background: var(--silver-2); box-shadow: var(--shadow-sm); }
.ab-nav { display: flex; justify-content: space-between; gap: var(--s-2); margin: var(--s-2) 0; }
.ab-caption { text-align: center; }
.ab-caption h3 { margin: var(--s-2) 0 2px; font-size: var(--t-lg); font-weight: 600; }
.ab-author { margin: 0; color: var(--ink); }
.ab-facts, .ab-pos { margin: 4px 0 0; font-size: var(--t-sm); color: var(--muted); }

/* ---- Cover Grid */
.ab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--s-3); }
.ab-tile { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; text-align: left;
           color: var(--ink); font: inherit; font-size: var(--t-sm); cursor: pointer; }
.ab-tile-title { line-height: 1.25; }

/* ---- Simple List: large rows, no movement. */
.ab-list { display: flex; flex-direction: column; }
.ab-row { display: flex; align-items: center; gap: var(--s-3); min-height: 72px; padding: 8px 2px; border: 0;
          border-bottom: 1px solid var(--silver-1); background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.ab-thumb { width: 44px; flex: 0 0 44px; box-shadow: none; }
.ab-row-title { display: block; font-size: var(--t-md); font-weight: 600; }
.ab-tile:focus-visible, .ab-row:focus-visible, .ab-cover:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---- the book's details */
.ab-detail { display: grid; grid-template-columns: 120px 1fr; gap: var(--s-4); align-items: start; }
.ab-detail-cover { width: 120px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow-sm); }
.ab-detail .ab-author { margin-bottom: var(--s-3); font-size: var(--t-md); }
.ab-story { margin: var(--s-3) 0 0; font-weight: 600; color: var(--rose); font-size: var(--t-sm); }
.ab-avail { margin: var(--s-3) 0 0; font-size: var(--t-sm); color: var(--muted); }
.ab-avail.ready { color: var(--green); font-weight: 600; }

/* ---- the Playlist's Reading control */
.pl-reading { display: flex; flex-direction: column; gap: var(--s-2); border-top: 1px solid var(--silver-1); padding-top: var(--s-2); }
.pl-reading-book { display: flex; align-items: center; gap: var(--s-2); }
.pl-reading-book .ab-thumb { width: 36px; flex-basis: 36px; }

/* Reduced motion: no transforms, no animation. Cover Flow becomes a still row
 * of the book and one neighbour on each side. */
@media (prefers-reduced-motion: reduce) {
  .ab-flow { display: flex; align-items: center; justify-content: center; gap: var(--s-2); perspective: none; height: auto; padding: 12px 0; }
  .ab-cover { position: static; margin: 0; width: 80px; transform: none; transition: none; opacity: .75; }
  .ab-cover.mid { width: 160px; }
  .ab-cover[data-a="2"], .ab-cover[data-a="3"], .ab-cover.gone { display: none; }
}
@media (max-width: 380px) {
  .ab-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ab-check { grid-column: span 2; }
}
