.books-page { background: #101522; color: #edf0fa; }
.books-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); align-items: center; gap: clamp(1rem, 4vw, 4rem); padding: clamp(2rem, 6vw, 5rem) 0; border-bottom: 1px solid #584e44; }
.books-intro h1 { max-width: 18ch; font-size: clamp(2.35rem, 6vw, 5rem); line-height: .98; }
.books-intro p { margin-block: 1rem; color: #d6dbea; }
.reader-art { display: block; width: 100%; height: auto; max-width: 420px; justify-self: end; border-radius: .6rem; }
.books-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(17rem, 1fr); align-items: start; gap: clamp(1rem, 4vw, 3rem); margin-top: 2rem; }
.books-layout section { margin-bottom: 1.85rem; }
.books-layout h2 { color: #f4d290; margin-bottom: .8rem; }
.book-card, .book-form { background: #1a2133; border: 1px solid #635645; border-radius: .8rem; padding: 1rem; }
.book-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .8rem; align-items: start; overflow-wrap: anywhere; }
.book-cover { display: grid; place-items: center; width: 64px; aspect-ratio: 2 / 3; background: #322a2d; color: #f4d290; font-size: .75rem; text-align: center; border-radius: .25rem; }
.book-cover img { width: 100%; height: 100%; object-fit: contain; }
.book-card h3 { font-size: 1.05rem; }
.book-card p { margin: .2rem 0 .5rem; }
.book-form input, .book-form select { display: block; width: 100%; color: #fff; background: #101522; border: 1px solid #706454; border-radius: .35rem; padding: .6rem; margin: .25rem 0 .85rem; }
.book-form .button { cursor: pointer; }
.books-footer { display: flex; flex-wrap: wrap; gap: 1rem; padding-block: 1rem 2rem; }
@media (max-width: 770px) { .books-layout { grid-template-columns: 1fr; } }
.books-grid {
  display: grid;
  gap: .85rem;
  min-width: 0;
}
.book-shelf-tile, .books-grid:empty::before {
  min-width: 0;
  box-sizing: border-box;
  padding: .8rem .8rem 0;
  background: #171b26;
  border: 1px solid #635645;
  border-bottom: .65rem solid #72513b;
  border-radius: .65rem;
}
.book-shelf-tile {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 7rem), 1fr));
}
.books-grid:empty::before { content: "Loading books…"; padding-bottom: .8rem; }
.book-shelf-tile > p { grid-column: 1 / -1; margin: 0 0 .8rem; }
.book-spine {
  --leather: #602f24;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: stretch;
  gap: .3rem;
  min-width: 0;
  min-height: 16rem;
  padding: 1.45rem .55rem;
  background:
    linear-gradient(90deg, #0008, transparent 17%, #fff1 52%, #0005),
    repeating-linear-gradient(117deg, #fff1 0 1px, transparent 1px 4px),
    var(--leather);
  color: #fff0c7;
  border: 1px solid #a98853;
  border-radius: .45rem .4rem .12rem .12rem;
  box-shadow: inset 0 0 0 3px #21130c80, inset 0 0 0 4px #deb77466, 2px 1px 3px #0006;
  font: 700 1rem/1.18 Georgia, serif;
  text-shadow: 0 1px 2px #000;
  cursor: pointer;
}
.book-spine[data-leather="1"] { --leather: #48273e; }
.book-spine[data-leather="2"] { --leather: #264c40; }
.book-spine[data-leather="3"] { --leather: #304462; }
.book-spine[data-leather="4"] { --leather: #704819; }
.book-spine[data-leather="5"] { --leather: #6b282e; }
.book-spine::before, .book-spine::after {
  content: "";
  position: absolute;
  inset-inline: .25rem;
  height: .38rem;
  border-block: 1px solid #d8ac65;
  background: #21130c65;
  pointer-events: none;
}
.book-spine::before { top: .45rem; }
.book-spine::after { bottom: .45rem; }
.book-spine span, .book-spine small {
  writing-mode: vertical-rl;
  justify-self: center;
  text-align: center;
  overflow-wrap: anywhere;
}
.book-spine small { font-size: .82rem; font-weight: 400; color: #f5daa4; }
.book-spine.book-spine-long {
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: .8rem;
}
.book-spine-long span, .book-spine-long small {
  writing-mode: horizontal-tb;
  max-width: 100%;
}
.book-overview {
  grid-column: 1 / -1;
  white-space: pre-line;
}
.book-overview h4 { margin-block: .25rem; }
.book-spine:hover, .book-spine:focus-visible { outline: 2px solid #7efaff; outline-offset: -2px; }
.book-details {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  box-sizing: border-box;
  margin: auto;
  padding: 3.5rem 1rem 1rem;
  background: #181f30;
  color: #edf0fa;
  border: 0;
  border-radius: 1rem;
}
.book-details::backdrop { background: rgb(5 9 19 / 88%); }
.book-details-close {
  position: absolute;
  right: .75rem;
  top: .5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #264577;
  color: #fff;
  border: 1px solid #c3ccdb;
  font-size: 1.5rem;
  cursor: pointer;
}
.book-details .book-card { grid-template-columns: minmax(4rem, 40%) minmax(0, 1fr); }
.book-details .book-cover { width: 100%; }
html:has(.book-details[open]) { overflow: hidden; }

.book-shelf-slot {
  display: grid;
  min-width: 0;
  padding-inline: .175rem;

}

@media (max-width: 600px) {
  .books-intro { grid-template-columns: 1fr; }
  .reader-art { justify-self: start; }
}
