/* Reading list is self-contained so it can be removed without restyling the portfolio. */
body:has(.reading-list) {
  background-color: #d3e8c7;
  background-repeat: no-repeat;
  background-size: 100% var(--portfolio-gradient-height, 100%);
}
.reading-list { --reading-ink: #985000; --reading-accent: #f4cb28; margin-top: 46px; }
.reading-list .section-heading { border-color: #c8a22440; }
#books-heading { color: #000000; paint-order: stroke fill; text-shadow: 0 1px 0 #ffffff80; }
.reading-count { color: var(--reading-ink); font-size: .875rem; }
.book-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 38px 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.book { min-width: 0; --book-title: var(--case-red); }
.book:nth-child(6n + 2) { --book-title: var(--case-blue); }
.book:nth-child(6n + 3) { --book-title: var(--case-green); }
.book:nth-child(6n + 4) { --book-title: var(--case-violet); }
.book:nth-child(6n + 5) { --book-title: #8e570c; }
.book:nth-child(6n) { --book-title: #1c6a72; }
.book-link { display: block; height: 100%; }
.book-link:hover { text-decoration: none; }
.book-link:focus-visible { outline-color: var(--case-blue); outline-offset: 8px; }
.book-cover { --book-cover-height: 168px; display: flex; align-items: flex-end; justify-content: center; height: var(--book-cover-height); margin-bottom: 16px; }
.book-card {
  width: min(70%, calc(var(--book-cover-height) * var(--cover-ratio)));
  aspect-ratio: var(--cover-ratio);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px #27352d24, 0 6px 12px #27352d20;
  transition: transform .2s ease, box-shadow .2s ease;
}
.book-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  border-radius: inherit;
}
.book :is(h2, h3) { color: var(--book-title); font: 650 .9375rem/1.4 var(--sans); letter-spacing: 0; overflow-wrap: break-word; }
.book-author { margin-top: 5px; color: #61555a; font-size: .875rem; line-height: 1.45; overflow-wrap: break-word; }
.book :is(h2, h3, .book-author) { text-align: center; text-wrap: balance; padding-inline: 4px; }
/* The dedicated page opens directly onto the gallery. */
body.bookshelf-page { background-size: 100% 100%; }
.bookshelf-masthead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 28px 0; }
.bookshelf-masthead .identity { font: 700 2rem/1.15 var(--serif); letter-spacing: -.025em; }
.bookshelf-masthead nav a, .bookshelf-page footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; font-size: .875rem; }
.bookshelf-page .reading-list { margin-top: 0; }
.bookshelf-page .section-heading { padding-top: 26px; margin-bottom: 32px; }
.bookshelf-page #books-heading { font-size: 2.4rem; line-height: 1.2; }
.bookshelf-page .reading-count { color: var(--muted); }
.bookshelf-page footer { justify-content: space-between; }
@media (max-width: 1050px) {
  .book-grid { gap: 34px 22px; }
  .book-cover { --book-cover-height: 143.5px; }
}
@media (max-width: 760px) {
  .reading-list { margin-top: 34px; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 22px; }
  .book-cover { --book-cover-height: 154px; }
}
@media (max-width: 540px) {
  .book-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: 30px 20px; }
  .book-cover { --book-cover-height: 147px; }
}
@media (max-width: 360px) {
  .book-grid { gap: 28px 16px; }
  .book-cover { --book-cover-height: 126px; }
}
@media (hover: hover) and (pointer: fine) {
  .book-link:hover .book-card, .book-link:focus-visible .book-card { transform: translateY(-3px); box-shadow: 0 2px 3px #27352d24, 0 10px 18px #27352d26; }
  .book-link:hover :is(h2, h3) { text-decoration: underline; text-underline-offset: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-card { transform: none !important; }
}
