/* An ordinary white ledge, with a little weight and light. */
.bookshelf-section { margin-top: 40px; }
.bookshelf {
  --book-count: 6;
  --book-gap: 6px;
  --book-width: 74px;
  --book-height: 114px;
  --book-status-read-surface: #e9f2ec;
  --book-status-read-text: #326944;
  --book-status-reading-surface: #ededed;
  --book-status-reading-text: #6f7174;
  container-type: inline-size;
  position: relative;
  width: 100%;
  margin-top: 16px;
  padding: 28px 20px 24px;
  border: 1px solid rgb(224 224 224 / 28%);
  border-radius: 30px;
  background: linear-gradient(180deg, #f8f8f8, #fcfcfc 57%, #fff);
  box-shadow: inset 0 2px 6px rgb(46 48 54 / 3%), inset 0 8px 20px rgb(46 48 54 / 4%), 0 1px 3px rgb(255 255 255 / 90%);
  color: #2f3133;
  -webkit-tap-highlight-color: transparent;
}
.bookshelf-stage { position: relative; isolation: isolate; padding: 0 16px 38px; }
.bookshelf-scroll { position: relative; margin: -22px -16px -18px; padding: 22px 16px 18px; border-radius: 4px; }
.bookshelf-scroll:focus-visible { outline: 1px solid #96989b; outline-offset: 3px; }
.bookshelf-row { position: relative; display: grid; grid-template-columns: repeat(var(--book-count), var(--book-width)); align-items: end; gap: var(--book-gap); width: calc(var(--book-count) * var(--book-width) + (var(--book-count) - 1) * var(--book-gap)); height: 152px; margin-inline: auto; }
.bookshelf-book-entry { position: relative; width: var(--book-width); min-width: 0; height: var(--book-height); }
.bookshelf-book-entry::after { content: ""; position: absolute; z-index: -1; left: 2px; right: -5px; bottom: -3px; height: 6px; border-radius: 50%; background: rgb(35 36 38 / 17%); filter: blur(4px); opacity: .8; transition: opacity 150ms ease; pointer-events: none; }
.bookshelf-book {
  --book-lift: 0px;
  --book-lean: var(--book-rest);
  position: relative;
  display: block;
  appearance: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px 4px 3px 2px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transform: translateY(var(--book-lift)) rotate(var(--book-lean));
  transform-origin: 50% 100%;
  transition: transform 420ms cubic-bezier(.22, 1, .36, 1), scale 150ms ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.bookshelf-book::before { content: ""; position: absolute; left: 3px; right: -5px; top: 4px; bottom: -1px; border-radius: 1px 3px 3px 1px; background: linear-gradient(90deg, #b9b8b2, #f4f2e9 9%, #ddd9ce 91%, #b8b5ad); box-shadow: 0 1px 2px #00000014, 1px 3px 4px #00000013; transform: skewY(2deg); transform-origin: left center; }
.bookshelf-book::after { content: ""; position: absolute; right: -4px; top: 5px; bottom: 1px; width: 4px; border-radius: 0 2px 2px 0; background: repeating-linear-gradient(0deg, #d6d3c9 0 .5px, #f1eee5 .5px 1.5px); box-shadow: inset -1px 0 1px #ffffff90; pointer-events: none; }
.bookshelf-cover { position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; overflow: hidden; border-radius: 2px 3px 3px 2px; background: #ece9e1; outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; box-shadow: inset 0 1px 0 #ffffff60, inset -1px 0 0 #00000014, -1px 0 1px #00000010, 0 2px 3px #00000017; }
.bookshelf-cover::before { content: ""; position: absolute; z-index: 3; inset: 0; background: linear-gradient(90deg, #00000020, transparent 3%, #ffffff26 5%, #0000000c 8%, transparent 12%, transparent 88%, #ffffff18); pointer-events: none; }
.bookshelf-cover::after { content: ""; position: absolute; z-index: 4; inset: 0; background: radial-gradient(ellipse at var(--book-pointer-x, 50%) var(--book-pointer-y, 0%), #ffffff2b, transparent 70%); opacity: 0; transition: opacity 150ms ease; pointer-events: none; }
/* Uniform book sizes; covers crop proportionally beneath the binding and light. */
.bookshelf-cover img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.bookshelf-reading-mark { position: absolute; z-index: 5; top: -3px; right: 7px; width: 5px; height: 15px; background: linear-gradient(90deg, #77736b, #aaa599 45%, #878278); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); pointer-events: none; }
.bookshelf-book[data-selected="true"] { --book-lift: -18px; --book-lean: 0deg; }
.bookshelf-book[data-selected="true"] .bookshelf-cover::after { opacity: 1; }
.bookshelf-book-entry:has(.bookshelf-book[data-selected="true"])::after { opacity: .15; }
.bookshelf-book:focus-visible { outline: 2px solid #85888d; outline-offset: 5px; }
@media (hover: hover) and (pointer: fine) {
  .bookshelf-book:hover { --book-lift: -14px; --book-lean: -2deg; }
  .bookshelf-book[data-selected="true"]:hover { --book-lift: -21px; --book-lean: -1deg; }
  .bookshelf-book:hover .bookshelf-cover::after { opacity: 1; }
  .bookshelf-book-entry:has(.bookshelf-book:hover)::after { opacity: .15; }
}
.bookshelf-book:active { scale: .96; }
.bookshelf-ledge { position: absolute; z-index: -1; left: -4px; right: -4px; height: 43px; bottom: 9px; pointer-events: none; }
.bookshelf-ledge-top { position: absolute; inset: 0 0 15px; border-radius: 6px 6px 7px 7px; background: linear-gradient(#ececec, #f8f8f8 46%, #fff); clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%); }
.bookshelf-ledge-top::after { content: ""; position: absolute; left: 7%; right: 7%; top: 0; height: 6px; background: #43464a12; filter: blur(3px); }
.bookshelf-ledge-front { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; border-radius: 0 0 6px 6px; background: linear-gradient(#fff, #f8f8f8 38%, #e8e8e8); box-shadow: inset 0 1px 0 #ffffffec, 0 3px 5px rgb(46 48 54 / 7%), 0 11px 16px rgb(46 48 54 / 10%); }
.bookshelf-caption { margin: 25px 0 0; color: #969799; text-align: center; font-size: 11px; line-height: 16px; }
.bookshelf-details[hidden], .bookshelf-details-link[hidden], .bookshelf-status[hidden] { display: none; }
.bookshelf-details { overflow: hidden; }
.bookshelf-details-inner { margin: 24px 12px 0; padding: 20px 0 0; border-top: 1px solid #e8e8e8; }
.bookshelf-details-heading { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.bookshelf-details-heading h3 { margin: 0; font-family: inherit; font-size: 16px; line-height: 20px; font-weight: 500; letter-spacing: -.25px; }
.bookshelf-details-author { margin-top: 4px; color: #86888c; font-size: 12px; line-height: 16px; }
.bookshelf-status { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; padding: 3px 7px; border: 0; border-radius: 6px; font-size: 10px; line-height: 14px; }
.bookshelf-status::before { content: ""; flex-shrink: 0; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.bookshelf-status[data-book-status="read"] { background: var(--book-status-read-surface); color: var(--book-status-read-text); }
.bookshelf-status[data-book-status="read"]::before { width: 7px; height: 4px; margin: -2px 0 0; border: solid currentColor; border-width: 0 0 1px 1px; border-radius: 0; background: none; transform: rotate(-45deg); }
.bookshelf-status[data-book-status="reading"] { background: var(--book-status-reading-surface); color: var(--book-status-reading-text); }
.bookshelf-close { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; margin: -4px -6px 0 0; padding: 0; border: 1px solid #00000012; border-radius: 50%; background: linear-gradient(#fff, #eeeeef); color: #8a8c8f; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.bookshelf-details-description { max-width: 400px; margin-top: 16px; color: #6f7275; font-size: 13px; line-height: 20px; text-wrap: pretty; }
.bookshelf-details-link { display: inline-block; margin-top: 16px; font-size: 12px; line-height: 18px; white-space: nowrap; color: #7f8286; text-decoration-color: #b5b6b8; }
.bookshelf-close:focus-visible, .bookshelf-details-link:focus-visible { outline: 2px solid #85888d; outline-offset: 3px; }
@media (hover: hover) { .bookshelf-close:hover { background: #e9e9e9; color: #4b4d50; } }
@container (max-width: 504px) {
  .bookshelf-stage { padding-inline: 4px; }
  .bookshelf-scroll { overflow-x: auto; overflow-y: hidden; margin-inline: -16px; margin-bottom: -26px; padding-inline: 8px; overscroll-behavior-x: none; scroll-snap-type: none; scroll-padding: 16px; scrollbar-width: none; }
  .bookshelf-scroll::-webkit-scrollbar { display: none; }
  /* The finite grid owns the scroll width. Clip decorative transforms inside
     an 8 px gutter so WebKit cannot add them to the scrollable range. */
  .bookshelf-row { --book-gap: 16px; width: calc(var(--book-count) * var(--book-width) + (var(--book-count) - 1) * var(--book-gap) + 16px); height: 160px; padding: 0 8px 8px; margin-inline: 0; overflow: clip; }
  .bookshelf-ledge { left: -8px; right: -8px; }
  .bookshelf-caption { padding-inline: 4px; font-size: 10px; }
  .bookshelf-details-inner { margin-inline: 4px; }
}
@media (max-width: 480px) {
  .bookshelf-section { margin-top: 32px; }
  .bookshelf { padding: 22px 16px 22px; border-radius: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .bookshelf-book, .bookshelf-book-entry::after, .bookshelf-cover::after, .bookshelf-close { transition: none; }
  .bookshelf-book, .bookshelf-book:hover, .bookshelf-book[data-selected="true"], .bookshelf-book[data-selected="true"]:hover { --book-lift: 0px; --book-lean: var(--book-rest); }
}
