/* Painted timber and ornaments are cut from the approved Jiangnan watercolor.
   Live books remain DOM links; no demonstration covers are published. */
:root { color-scheme: light; --ink: #58432f; --paper: #f7f3e9; }
* { box-sizing: border-box; }
body { font-family: var(--site-font, 'Kaiti SC', 'STKaiti', 'KaiTi', serif); margin: 0; color: var(--ink); background: var(--paper); }
a { color: inherit; }
.library-shell { max-width: 1440px; margin: auto; padding: 0 28px; }
.site-heading { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-link { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; text-decoration: none; font-size: 17px; }
.portal-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.site-mark { display: flex; align-items: center; gap: 9px; font-size: 18px; letter-spacing: .08em; }
.small-seal { display: grid; place-items: center; width: 27px; height: 29px; color: #fff6e3; background: #a0523d; border-radius: 3px; font-size: 19px; }
.jiangnan-library { max-width: 1320px; margin: 4px auto 0; }
.bookcase { filter: drop-shadow(0 12px 12px #6d4d2420); }
.bookcase-crown { position: relative; aspect-ratio: 1536 / 278; background: url('../images/picturebooks/library/jiangnan-header.webp') center / 100% 100% no-repeat; }
.painted-sign { display: none; }
.bookcase-display { position: relative; }
.shelf-row { display: flex; align-items: flex-end; justify-content: flex-start; gap: 5%; aspect-ratio: 1536 / 216; padding: 0 16% 2.6% 13%; background: url('../images/picturebooks/library/jiangnan-shelf.webp') center / 100% 100% no-repeat; }
.bookcase-base { aspect-ratio: 1536 / 130; background: url('../images/picturebooks/library/jiangnan-base.webp') center / 100% 100% no-repeat; }
.shelf-book { flex: 0 0 16%; min-width: 0; margin: 0; position: relative; z-index: 1; }
.book-object { position: relative; display: block; aspect-ratio: 1.03; text-decoration: none; transform: perspective(900px) rotateY(-5deg) rotateZ(-1deg); transform-origin: bottom center; filter: drop-shadow(6px 4px 3px #47261066); transition: transform .22s, filter .22s; }
.shelf-book:nth-child(2) .book-object { transform: perspective(900px) rotateY(-5deg) rotateZ(1deg); }
.book-object:hover, .shelf-book:nth-child(2) .book-object:hover { transform: translateY(-7px) rotateZ(0); filter: drop-shadow(7px 8px 5px #47261066); }
.book-front { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: #fbf1d9; border: 1px solid #ab9166; border-radius: 2px 4px 2px 1px; box-shadow: inset 4px 0 3px #6a4a3b44, inset -3px 0 0 #fff8; }
.book-front::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg,#492c3020,transparent 5%,#fff2 7%,transparent 12%,transparent 97%,#6e48251a); box-shadow: inset 0 0 0 5px #ece3cc38; }
.book-spine { position: absolute; top: 2px; bottom: -1px; width: 9px; left: -7px; border: 1px solid #8e8c79; background: #a4b7b9; transform: skewY(-12deg); border-radius: 2px 0 0 2px; }
.book-spine span { display: none; }
.cover-heading { position: relative; padding: 7px 7px 5px; text-align: center; flex-shrink: 0; }
.cover-series { display: block; color: #837152; font-size: clamp(8px, .76vw, 11px); letter-spacing: .12em; }
.cover-heading h3 { margin: 4px 0 2px; font-size: clamp(17px, 1.9vw, 27px); line-height: 1.2; font-weight: 600; color: #244b65; white-space: nowrap; }
.cover-english { display: block; color: #6d6859; font-size: clamp(9px, .85vw, 12px); }
.story-image { display: block; width: 100%; min-height: 0; flex: 1; object-fit: contain; object-position: center; }
.cover-foot { display: flex; justify-content: space-between; gap: 4px; padding: 5px 9px; font-size: clamp(8px, .8vw, 11px); color: #73644c; }
.collection-note { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 16px 0 5px; font-size: 16px; color: #7a6b54; }
.library-count { color: #80523b; letter-spacing: .13em; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 12px; background: white; }
a:focus-visible { outline: 3px solid #244b65; outline-offset: 5px; }
@media (max-width: 700px) {
  .library-shell { padding: 0 8px; }
  .site-heading { min-height: 66px; padding: 0 8px; gap: 6px; }
  .portal-link { font-size: 14px; gap: 3px; }
  .site-mark { font-size: 14px; gap: 5px; letter-spacing: 0; }
  .small-seal { width: 23px; height: 25px; font-size: 17px; }
  .bookcase-crown { height: auto; aspect-ratio: 1536 / 278; }
  .painted-sign { display: block; position: absolute; width: 53%; height: auto; left: 23.5%; top: 8px; }
  .shelf-row { height: auto; aspect-ratio: 768 / 490; padding: 15px 16% 5%; background: url('../images/picturebooks/library/jiangnan-shelf-compact.webp') center / 100% 100% no-repeat; }
  .shelf-row:nth-child(even) { background-image: url('../images/picturebooks/library/jiangnan-shelf-compact-second.webp'); }
  .shelf-book { display: flex; justify-content: center; flex: 0 0 100%; }
  .book-object { width: 82%; max-width: none; aspect-ratio: 1.03; }
  .cover-series { font-size: 10px; }
  .cover-heading h3 { font-size: clamp(18px, 5.8vw, 29px); }
  .cover-english { font-size: 11px; }
  .cover-foot { font-size: 10px; }
  .bookcase-base { height: auto; aspect-ratio: 1536 / 130; }
  .collection-note { gap: 10px; margin: 14px 0 7px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .book-object { transition: none; } }

/* Original painted book covers, with responsive shelf pagination. */
.shelf-row[hidden], .shelf-pagination[hidden] { display: none; }
.book-front { background: transparent; border: 0; box-shadow: none; }
.book-front::after, .book-spine { display: none; }
.cover-art { width: 100%; height: 100%; object-fit: fill; }
.collection-note { margin-bottom: 16px; }
.shelf-pagination { display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 44px; margin: 0 0 12px; }
.shelf-pagination button { min-width: 76px; min-height: 44px; padding: 7px 14px; border: 1px solid #b4a18a; border-radius: 4px; color: var(--ink); background: #f7f0df; font: inherit; cursor: pointer; }
.shelf-pagination button:disabled { opacity: .4; cursor: default; }
@media (min-width:701px) and (max-width:999px) {
  .shelf-row { aspect-ratio: 1536 / 260; }
  .shelf-book { flex-basis: 21.25%; }
}
@media (max-width:700px) {
  .shelf-row { aspect-ratio: 768 / 280; padding: 0 16% 2.6% 13%; gap: 12%; }
  .shelf-book { flex-basis: 44%; }
  .book-object { width: 100%; }
}
@media (max-height:500px) {
  .site-heading { min-height: 44px; }
  .bookcase-crown { max-height: 75px; background-size: 100% auto; background-position: center 30%; }
  .bookcase-base { max-height: 38px; }
  .collection-note { margin: 8px 0; font-size: 13px; }
}
