/* Original cover-inspired spine illustrations, with real jacket images on opening. */
.bookshelf-page {
  --shelf-wood: #b68a63;
  --shelf-edge: #8f6748;
  --shelf-shadow: rgba(68, 48, 30, 0.16);
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 0 72px;
}
.bookshelf-page *, .bookshelf-page *::before, .bookshelf-page *::after { box-sizing: border-box; }
.bookshelf-page :is(h1, h2, p, ul, li) { max-width: none; }
.bookshelf-intro { margin-bottom: 48px; }
.bookshelf-eyebrow, .shelf-number { margin: 0 0 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.bookshelf-eyebrow { color: var(--primary-color); }
.bookshelf-intro h1 { margin: 0 0 18px; font-size: clamp(40px, 5vw, 60px); }
.shelf-pyramid { display: flex; flex-direction: column; align-items: center; gap: 38px; }
.book-shelf { width: 100%; min-width: 0; }
.book-shelf--reading { width: 55%; }
.book-shelf--1 { width: 64%; }
.book-shelf--2 { width: 73%; }
.book-shelf--3 { width: 82%; }
.book-shelf--4 { width: 91%; }
.shelf-caption { text-align: center; padding: 0 8px; margin-bottom: 22px; }
.shelf-number { margin-bottom: 8px; opacity: 0.65; font-size: 9px; }
.shelf-number span { padding: 0 6px; }
.shelf-caption h2 { margin: 0 0 9px; font-size: 27px; }
.shelf-description { max-width: 540px !important; margin: 0 auto; line-height: 1.6; font-size: 13px; }
.bookshelf-page .shelf-books {
  --cover-height: 256px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  list-style: none;
  padding: 0 18px;
  margin: 0;
  position: relative;
}
.shelf-books::before { content: ''; position: absolute; top: var(--cover-height); left: 0; right: 0; height: 12px; background: linear-gradient(to bottom, #c6a27f 0, var(--shelf-wood) 4px, var(--shelf-wood) 8px, var(--shelf-edge) 100%); border-radius: 2px; box-shadow: 0 10px 14px -7px var(--shelf-shadow); }
/* A steady, warm string along the shelf edge during December. */
.bookshelf-page--holiday .shelf-books::after {
  content: '';
  position: absolute;
  top: calc(var(--cover-height) + 2px);
  left: 0;
  right: 0;
  height: 34px;
  background: url('../decorations/bookshelf-lights.svg') repeat-x left top / 100px 34px;
  pointer-events: none;
}
.bookshelf-page--holiday .book-label { padding-top: 40px; }
.bookshelf-page .shelf-book { flex: 0 1 var(--spine-width); min-width: 26px; padding: 0; margin: 0; transition: flex-basis 420ms ease; }
.bookshelf-page .shelf-book:has(.book-drawer[open]) { flex-basis: 164px; }
.book-toggle { display: block; position: relative; height: var(--cover-height); list-style: none; cursor: pointer; perspective: 900px; -webkit-tap-highlight-color: transparent; }
.book-toggle::-webkit-details-marker { display: none; }
.book-toggle:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 6px; border-radius: 3px; }
.book-spine {
  position: absolute;
  inset: auto 0 0;
  height: var(--spine-height);
  background-color: var(--spine-paper);
  color: var(--spine-ink);
  border-radius: 2px 3px 0 0;
  box-shadow: inset 1px 0 rgba(255, 255, 255, 0.4), inset -1px 0 rgba(0, 0, 0, 0.25), 1px 0 2px rgba(0, 0, 0, 0.2);
  transform-origin: right bottom;
  transition: transform 420ms ease, opacity 250ms ease;
}
.spine-hard { border-radius: 3px 4px 0 0; border-inline: 2px solid rgba(0, 0, 0, 0.13); }
.spine-cloth {
  border-radius: 3px 4px 0 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.035) 2px 3px), repeating-linear-gradient(90deg, transparent 0 1px, rgba(255, 255, 255, 0.07) 1px 2px);
}
.spine-copy {
  position: absolute;
  top: max(14px, calc(var(--band-top) + 7px));
  bottom: max(30px, calc(var(--band-bottom) + 7px));
  left: 4px;
  right: 4px;
  display: flex;
  writing-mode: vertical-rl;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.spine-title, .spine-author { writing-mode: vertical-rl; text-orientation: mixed; }
.spine-title { flex-shrink: 0; font: 500 var(--spine-size)/1.08 'Playfair Display', serif; letter-spacing: 0.015em; }
.spine-sans .spine-title { font-family: 'Lato', sans-serif; font-weight: 700; letter-spacing: 0.035em; }
.spine-line { display: block; white-space: nowrap; }
.spine-author { flex-shrink: 0; font: 8px/1.1 'Lato', sans-serif; letter-spacing: 0.045em; white-space: nowrap; }
.spine-label-accent { padding: 5px 2px; background: var(--spine-accent); color: #fff4db; }
.spine-label-paper { padding: 5px 2px; background: #efe6cf; color: #3d3327; }
.spine-band { position: absolute; left: 0; right: 0; background: var(--spine-accent); }
.spine-band-top { top: 0; height: var(--band-top); }
.spine-band-bottom { bottom: 0; height: var(--band-bottom); }
.spine-mark { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font: 700 6px/1 'Lato', sans-serif; letter-spacing: 0.06em; color: var(--spine-ink); }
.spine-rules::before, .spine-frame::before { content: ''; position: absolute; inset: 6px 3px 5px; border-block: 1px solid currentColor; opacity: 0.4; }
.spine-frame::before { border: 1px solid currentColor; inset: 7px 3px 6px; }
.spine-floral::before { content: ''; position: absolute; inset: 9px 3px; background: radial-gradient(ellipse at center, var(--spine-accent) 0 2px, transparent 3px) 0 0 / 12px 22px; opacity: 0.3; }
.spine-light { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 12%, rgba(255, 255, 255, 0.19) 28%, transparent 52%, rgba(0, 0, 0, 0.08) 85%, rgba(0, 0, 0, 0.22)); }
.spine-paper .spine-light { background: linear-gradient(90deg, transparent 15%, rgba(255, 255, 255, 0.25) 17%, transparent 21%, transparent 78%, rgba(0, 0, 0, 0.1) 81%, transparent 85%), linear-gradient(90deg, rgba(0, 0, 0, 0.12), transparent 12%, rgba(255, 255, 255, 0.12) 32%, transparent 62%, rgba(0, 0, 0, 0.2)); }
.book-drawer[open] .book-spine { transform: translateY(-12px) rotateY(-90deg); opacity: 0; pointer-events: none; }
.book-toggle .book-cover { position: absolute; inset: 0; transform: rotateY(85deg); transform-origin: left center; opacity: 0; visibility: hidden; transition: transform 420ms ease, opacity 250ms ease, visibility 420ms; }
.book-drawer[open] .book-cover { transform: translateY(-12px) rotateY(0); opacity: 1; visibility: visible; }
.book-drawer[open] .book-toggle { z-index: 1; }
@media (hover: hover) {
  .book-drawer:not([open]) .book-toggle:hover .book-spine { transform: translateY(-5px); }
}
.book-cover { position: relative; display: flex; align-items: flex-end; justify-content: center; height: var(--cover-height); color: #fff6e4; }
.book-cover img { position: relative; width: auto; max-width: 100%; height: auto; max-height: 100%; margin: 0; object-fit: contain; object-position: bottom; border-radius: 1px 3px 2px 1px; box-shadow: 2px 1px 5px rgba(0, 0, 0, 0.2); }
.book-cover img[hidden] { display: none; }
.cover-fallback { position: absolute; inset: auto 0 0; height: 85%; padding: 14px 8px; background: var(--spine-paper); color: var(--spine-ink); border-radius: 2px; font: 12px/1.4 'Playfair Display', serif; text-align: center; overflow-wrap: anywhere; }
.book-cover:has(img:not([hidden])) .cover-fallback { visibility: hidden; }
.book-link { display: inline-block; margin-top: 8px; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.book-label { padding-top: 24px; text-align: left; }
.book-title { display: block; font: 12px/1.5 'Lato', sans-serif; overflow-wrap: anywhere; }
.book-author { display: block; margin-top: 5px; font-size: 10px; line-height: 1.45; }
.cover-credit { margin: 46px 0 0; text-align: center; font-size: 11px; }
.cover-credit a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 1000px) {
  .book-shelf--reading { width: 72%; }
  .book-shelf--1 { width: 78%; }
  .book-shelf--2 { width: 84%; }
  .book-shelf--3 { width: 90%; }
  .book-shelf--4 { width: 95%; }
  .bookshelf-page .shelf-books { gap: 2px; padding-inline: 10px; }
}
@media (max-width: 700px) {
  .bookshelf-page { padding-top: 32px; padding-bottom: 50px; }
  .bookshelf-intro { margin-bottom: 42px; }
  .bookshelf-intro h1 { font-size: 42px; }
  .shelf-pyramid { gap: 34px; }
  .book-shelf { width: 100%; }
  .shelf-caption { text-align: left; padding: 0; margin-bottom: 20px; }
  .shelf-caption h2 { font-size: 25px; }
  .shelf-description { margin: 0; }
  .bookshelf-page .shelf-books { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 8px; padding: 0 0 16px; border-bottom: 8px solid var(--shelf-wood); }
  .shelf-books::before { display: none; }
  .book-toggle { width: min(100%, var(--spine-width)); margin-inline: auto; }
  .bookshelf-page .shelf-book:has(.book-drawer[open]) { grid-column: span 2; }
  .book-drawer[open] .book-toggle { width: 100%; }
  .book-label { padding-top: 12px; }
  .bookshelf-page--holiday .book-label { padding-top: 12px; }
  .bookshelf-page--holiday .shelf-books { margin-bottom: 18px; }
  .bookshelf-page--holiday .shelf-books::after { top: auto; bottom: -25px; }
  .book-title { font-size: 14px; }
  .book-author { font-size: 11px; }
}
@media (prefers-color-scheme: dark) {
  .bookshelf-page { --shelf-wood: #70523c; --shelf-edge: #4e3728; --shelf-shadow: rgba(0, 0, 0, 0.5); }
  .shelf-books::before { background: linear-gradient(to bottom, #967353, var(--shelf-wood) 4px, var(--shelf-edge)); }
}
@media (prefers-reduced-motion: reduce) {
  .bookshelf-page .shelf-book, .book-spine, .book-toggle .book-cover { transition: none; }
}
