.shelf { display: grid; gap: var(--space-5) var(--grid-gap); margin-top: var(--space-6); }
.shelf-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.book {
  --s-text: var(--color-cover-text); --s-muted: var(--pig-soft); --s-focus: var(--color-cover-focus); --s-thread-line: var(--color-cover-text);
  --pad: var(--space-5);
  position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0; padding: var(--pad); overflow: hidden;
  color: var(--s-text); background: var(--pig-deep); border-radius: var(--radius-xl);
  outline: 1px solid var(--color-cover-edge); outline-offset: -1px;
}
.book-art {
  position: relative; container-type: size; flex: 1 0 var(--art-h, 8rem); min-height: var(--art-h, 8rem);
  margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) var(--space-4); overflow: hidden; pointer-events: none;
  background: radial-gradient(120% 120% at 100% 0%, color-mix(in oklab, var(--pig-glow) 22%, transparent) 0%, transparent 70%);
}
.art { display: block; position: absolute; overflow: visible; }
.art-ray { stroke: color-mix(in oklab, var(--pig-soft) 70%, var(--pig-deep)); }
.art-map { stroke: var(--color-cover-sanskrit); }
.art-hub { fill: var(--pig-deep); stroke: var(--color-cover-text); }
.art-thread { stroke: var(--color-cover-thread-line); }
.art-radial { --d: min(85cqw, 175cqh); bottom: 0; right: calc(var(--d) * -0.3); width: var(--d); height: var(--d); }
.art-rows { top: var(--pad); left: var(--pad); width: calc(100% - 2 * var(--pad)); height: min(100cqh - var(--pad), 4.75rem); }
.book h3 { font: inherit; }
.book h3 a { display: block; text-decoration: none; }
.book h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.book h3 a:focus-visible { outline: none; }
.book:has(h3 a:focus-visible) { outline: 2px solid var(--color-cover-focus); outline-offset: -6px; }
.book-sa { display: block; margin-bottom: var(--space-1); font: 400 var(--text-sa-sm)/1.35 var(--font-read); color: var(--color-cover-sanskrit); overflow-wrap: normal; }
.book-sa-long { font-size: 1.125rem; }
.book-sa[lang="mr"] { font-family: var(--font-read-mr); }
.book-name { display: block; min-width: 0; font: 600 var(--text-xl)/1.15 var(--font-ui); letter-spacing: -0.025em; overflow-wrap: break-word; text-wrap: balance; }
.book-blurb { margin-top: var(--space-2); font-size: var(--text-sm); line-height: 1.5; color: var(--s-muted); text-wrap: pretty; }
.book-key { margin-top: var(--space-3); max-width: 28rem; font-size: var(--text-xs); line-height: 1.45; color: var(--s-muted); text-wrap: pretty; }
.book-key i { display: inline-block; width: 0.875rem; height: 2px; margin-right: 0.375rem; vertical-align: middle; background: var(--color-cover-sanskrit); border-radius: 2px; }
.book-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-4); margin-top: var(--space-3); }
.book-count { font-size: var(--text-sm); color: var(--s-muted); }
.book-start { position: relative; z-index: 1; font-size: var(--text-sm); font-weight: 600; }
.book-start a { display: inline-flex; align-items: center; min-height: 2.25rem; }
.book-big { --pad: var(--space-6); --art-h: 14rem; }
.book-big .art-radial { --d: min(118cqh, 112cqw); bottom: auto; top: calc(var(--d) * -0.16); right: calc(var(--d) * -0.2); }
.book-big .book-name { font-size: clamp(1.875rem, 1.3rem + 1.6vw, 2.5rem); letter-spacing: -0.035em; }
.book-big .book-blurb { max-width: 30rem; font-size: var(--text-md); }
.book-stack { display: grid; grid-auto-rows: 1fr; gap: var(--space-4); }
.book-slim { --pad: var(--space-4); display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: var(--space-1) var(--space-4); padding-inline: 1.25rem; }
.book-slim .book-name { font-size: var(--text-lg); }
.book-slim .book-art { container-type: normal; flex: none; width: 7.5rem; height: 1.25rem; min-height: 0; margin: var(--space-2) 0 0; overflow: visible; background: none; }
.book-slim .art { position: static; width: 100%; height: 100%; }
@media (hover: hover) {
  .book h3 a:hover .book-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: var(--underline-offset); }
  .book:has(h3 a:hover) { box-shadow: var(--shadow-lift); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .book { transition: translate var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
  .book:has(h3 a:hover) { translate: 0 -3px; }
}
@media (min-width: 72rem) {
  .shelf-bento { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .shelf-bento .book-big { grid-column: 1 / span 6; grid-row: span 2; }
  .shelf-bento .book-m { grid-column: span 3; }
  .shelf-bento .book-w { grid-column: span 4; --art-h: 6.25rem; }
  .shelf-bento .book-stack { grid-column: span 4; }
  .shelf-bento .book-slim { grid-template-columns: minmax(0, 1fr) auto; }
  .shelf-bento .book-slim .book-art { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin: 0; }
}
@media (min-width: 40rem) and (max-width: 71.99rem) {
  .shelf-bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .shelf-bento .book-big {
    grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); grid-template-rows: 1fr repeat(4, auto);
    column-gap: var(--grid-gap); min-height: 22rem;
  }
  .shelf-bento .book-big > h3 { grid-area: 2 / 1; }
  .shelf-bento .book-big > .book-blurb { grid-area: 3 / 1; }
  .shelf-bento .book-big > .book-key { grid-area: 4 / 1; }
  .shelf-bento .book-big > .book-foot { grid-area: 5 / 1; }
  .shelf-bento .book-big .book-art { grid-area: 1 / 2 / 6 / 3; margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) calc(-1 * var(--pad)) 0; min-height: 0; }
  .shelf-bento .book-big .art-radial { --d: min(125cqh, 125cqw); bottom: auto; top: calc(var(--d) * -0.12); right: calc(var(--d) * -0.22); }
  .shelf-bento .book-m, .shelf-bento .book-w { grid-column: span 3; }
  .shelf-bento .book-stack { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: auto; }
}
@media (max-width: 39.99rem) {
  .book { --pad: 1.25rem; }
  .book-big { --art-h: 11rem; }
  .book-slim { grid-template-columns: minmax(0, 1fr) auto; }
  .book-slim .book-art { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin: 0; width: 6.5rem; }
}
@media (pointer: coarse) {
  .book h3 a { min-height: var(--target); }
  .book-start a { min-height: var(--target); }
}
.chapters { margin-top: var(--space-6); border-top: 1px solid var(--s-border-control); }
.chapter { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2) var(--grid-gap); padding-block: var(--space-4); border-bottom: 1px solid var(--s-border); }
.chapter-name { font: 400 var(--text-2xl)/1.2 var(--font-read); text-decoration: none; }
.chapter-sa { display: inline-block; max-width: 100%; vertical-align: baseline; margin-left: var(--space-2); font-size: var(--text-sa-sm); color: var(--s-muted); }
.chapter-place { margin-top: var(--space-1); color: var(--s-muted); }
.chapter-count { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--s-muted); }
.chapter-context { grid-column: 1 / -1; max-width: 46rem; font: 400 var(--text-md)/1.6 var(--font-read); text-wrap: pretty; }
.strip { display: block; width: 100%; height: 0.875rem; }
.strip rect { fill: var(--s-text); }
.strip .strip-base { fill: var(--s-border-control); }
.prose { max-width: 42rem; margin-top: var(--space-4); font: 400 var(--text-lg)/1.6 var(--font-read); text-wrap: pretty; }
.prose + .prose { margin-top: var(--space-3); }
@media (min-width: 56rem) {
  .chapter { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .chapter-strip { padding-top: 0.6rem; }
}
@media (hover: hover) {
  .chapter-name:hover { text-decoration: underline; text-decoration-color: var(--s-thread-line); text-decoration-thickness: 2px; text-underline-offset: var(--underline-offset); }
}
@media (pointer: coarse) {
  .chapter-name { display: inline-flex; align-items: center; min-height: var(--target); }
}
.book ::selection { background: var(--color-cover-selection); color: var(--color-cover-text); }
@media (forced-colors: active) {
  .book { border: 1px solid CanvasText; }
  .book-art { forced-color-adjust: none; background: var(--s-bg); }
  .book-key i { background: Highlight; }
  .book:has(h3 a:focus-visible) { outline-color: Highlight; }
}
.book.has-paint {
  container-type: inline-size; background: linear-gradient(var(--ptop), var(--pfloor) 72%);
  --s-muted: oklch(87% 0.03 85);
}
.has-paint > .book-art {
  z-index: -1; min-height: 0; overflow: visible; background: none;
  flex: 1 0 min(var(--show) * 1.5 * (100cqw + 2 * var(--pad)), var(--art-max, 100rem));
}
.book-paint {
  position: absolute; left: 0; bottom: calc(-1 * (1 - var(--base)) * 150cqw); display: block; width: 100%; max-width: none; height: auto;
  -webkit-mask-image: linear-gradient(transparent, #000 9%, #000 84%, transparent); mask-image: linear-gradient(transparent, #000 9%, #000 84%, transparent);
}
.book-slim.has-paint {
  container-type: normal; grid-template-columns: 38% minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-content: stretch; gap: var(--space-1) 0;
  min-height: 5.75rem; padding: 0; background: var(--pside);
}
.book-slim.has-paint > h3 { grid-area: 1 / 2; align-self: end; padding: var(--space-3) var(--space-4) 0 var(--space-3); }
.book-slim.has-paint > .book-count { grid-area: 2 / 2; align-self: start; padding: 0 var(--space-4) var(--space-3) var(--space-3); }
.book-slim.has-paint .book-art { grid-area: 1 / 1 / 3 / 2; position: relative; z-index: -1; align-self: stretch; width: auto; height: auto; margin: 0; overflow: hidden; }
.book-slim .book-paint {
  inset: 0; bottom: auto; width: 100%; height: 100%; object-fit: cover; object-position: calc(var(--fx) * 100%) calc(var(--fy) * 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 50%, transparent); mask-image: linear-gradient(90deg, #000 50%, transparent);
}
@media (min-width: 40rem) and (max-width: 71.99rem) {
  .shelf-bento .book-big.has-paint { display: flex; min-height: 0; --art-max: 22rem; }
  .shelf-bento .book-big.has-paint .book-art { margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) var(--space-4); }
}
@media (forced-colors: active) {
  .has-paint > .book-art { overflow: hidden; }
  .book-paint { -webkit-mask-image: none; mask-image: none; }
}
