:root {
  color-scheme: light;
  --paper: #f6f2ea;
  --ink: #28241f;
  --muted: #696057;
  --accent: #802d32;
  --edge: #e0d5c7;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 76% 7%, #fcf9f4 0, transparent 60%);
}

.library {
  width: min(100% - 64px, 1040px);
  margin-inline: auto;
  padding-block: clamp(54px, 10vh, 112px) 48px;
}

.library-header,
.library-title {
  display: flex;
  align-items: center;
}

.library-header {
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--edge);
}

.library-title {
  gap: 16px;
}

.library-title img {
  flex: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font: 700 clamp(36px, 5vw, 54px)/1.2 var(--serif);
  letter-spacing: 0.06em;
}

.book-count {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 144px), 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book {
  display: block;
  max-width: 188px;
  height: 100%;
  overflow: clip;
  border: 1px solid var(--edge);
  border-radius: 10px;
  color: inherit;
  background: #fffcf7;
  box-shadow: 0 12px 25px -20px #5c3b2259;
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.book:hover,
.book:focus-visible {
  border-color: #bca393;
  box-shadow: 0 16px 32px -18px #5c3b2259;
}

.book:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.book-art {
  display: grid;
  place-items: center;
  height: 186px;
  overflow: clip;
  isolation: isolate;
  position: relative;
  padding: 18px;
  background: radial-gradient(ellipse at 42% 30%, #f4e9da 0, #e6d3c3 100%);
}

.book-art::before,
.book-art::after {
  position: absolute;
  z-index: -1;
  content: "";
  width: 92%;
  aspect-ratio: 1;
  border: 1px solid #ad826435;
  border-radius: 50%;
  pointer-events: none;
}

.book-art::after {
  width: 116%;
}

.book-cover {
  display: block;
  width: min(100%, 100px);
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 2px 4px 4px 2px;
  box-shadow: 4px 11px 18px #3a231e47;
  transition: transform 180ms ease;
}

.book:hover .book-cover {
  transform: translateY(-3px);
}

.book-cover--blank {
  border-left: 6px solid #522326;
  background: #802d32 url("./book.svg") center / 34px no-repeat;
}

.book-info {
  padding: 12px 13px 14px;
  overflow-wrap: anywhere;
}

.book-info h2 {
  font: 700 16px/1.45 var(--serif);
}

.book-author,
.book-details {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 520px) {
  .library {
    width: calc(100% - 36px);
    padding-top: 32px;
  }

  .library-header {
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .shelf {
    gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book,
  .book-cover {
    transition: none;
  }

  .book:hover .book-cover {
    transform: none;
  }
}
