/* Library: bookshelf integrated into the site theme */

.library-toolbar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 2.2rem;
}

.library-toolbar button {
  font: inherit;
  font-size: 0.68em;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 7px 16px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.library-toolbar button[aria-pressed="true"] {
  color: var(--bg-primary);
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.library-toolbar button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.library-count {
  text-align: center;
  font-size: 0.7em;
  color: var(--text-secondary);
  margin: -1rem 0 2rem;
}

.shelf {
  margin: 0 0 3.2rem;
}

.shelf-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 1.3rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-color);
}

.shelf-head h2 {
  margin: 0;
  font-size: 1.1em;
  font-weight: normal;
}

.shelf-count {
  margin-left: auto;
  font-size: 0.64em;
  color: var(--text-secondary);
}

.shelf.featured .shelf-head {
  border-bottom-color: var(--accent-primary);
}

.shelf.featured .shelf-head h2 {
  color: var(--accent-primary);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 28px 20px;
}

.book {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.36s ease, transform 0.36s ease;
}

.book.in {
  opacity: 1;
  transform: none;
}

.book-frame {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.55);
  transition: transform 0.4s cubic-bezier(0.25, 0.6, 0.3, 1), box-shadow 0.4s ease;
}

.book:hover .book-frame,
.book:focus-visible .book-frame {
  transform: translateY(-6px);
  box-shadow: 0 18px 34px -14px rgba(0, 0, 0, 0.6);
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-ph {
  display: flex;
  align-items: flex-end;
  padding: 14px;
  color: #fff;
  font-weight: 600;
  font-size: 0.78em;
  line-height: 1.3;
  background: linear-gradient(160deg, var(--c2), var(--c1));
  height: 100%;
}

.book-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 8px 2px 0;
  font-size: 0.72em;
  font-weight: 500;
  line-height: 1.35;
}

.book-author {
  margin: 2px 2px 0;
  font-size: 0.62em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.book-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.36s ease, transform 0.36s ease;
}

.book-row.in {
  opacity: 1;
  transform: none;
}

.book-row .book-thumb {
  width: 42px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  background-color: var(--bg-secondary);
}

.book-row .book-thumb.ph {
  background: linear-gradient(160deg, var(--c2), var(--c1));
}

.book-row .row-title {
  font-size: 0.82em;
  font-weight: 500;
  min-width: 0;
}

.book-row .row-author {
  font-size: 0.72em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.library-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 4rem 0;
}

@media (max-width: 700px) {
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 24px 16px;
  }
}

@media (min-width: 1100px) {
  .book-list.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book,
  .book-row {
    opacity: 1 !important;
    transform: none !important;
  }
}
