/* The library: search hero, recently-added shelf, book grid, covers, and the
 * book detail page. */

.library-hero h1 { margin-bottom: 0.3em; }

.search-row input[type="search"] {
  width: 100%;
  font-size: 1.2rem;
  padding: 0.6rem 0.9rem;
}

.filter-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.6rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Recently added: a little shelf of covers. */
.recent-strip h2 { margin-bottom: 0.4em; }
.recent-shelf {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 1rem;
  border-bottom: 3px double var(--border);
}
.recent-book { flex: 0 0 auto; }

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0 0.6rem;
}
.results-meta p {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* Covers/List switch */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 0.8rem;
}
.view-toggle-option {
  padding: 0.2rem 0.8rem;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface);
}
.view-toggle-option + .view-toggle-option { border-left: 1px solid var(--border); }
.view-toggle-option:hover { color: var(--accent); }
.view-toggle-option.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* List view: compact scannable rows */
.book-list { list-style: none; padding: 0; margin: 0; }
.book-row {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--border);
}
.book-row-title { font-weight: 600; }
.book-row-author { color: var(--muted); }
.book-row-meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
}
.book-row-badges { margin-left: auto; display: inline-flex; gap: 0.35rem; }
.badge-loan { border-color: var(--accent); color: var(--accent); }

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.4rem 1.1rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}
.book-card-cover { position: relative; }
.book-card:hover .cover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }

.book-card-text { display: flex; flex-direction: column; gap: 0.1rem; }
.book-card-title { font-weight: 600; line-height: 1.25; }
.book-card-author { font-size: 0.9rem; color: var(--muted); }
.book-card-meta {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
}

/* Covers: real images and spine-styled placeholders share the same box. */
.cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
  background: var(--surface);
}

.cover-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12% 10%;
  /* --spine-hue set per-book from the title hash (warm band, 18–58). */
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0, rgba(0, 0, 0, 0) 8%),
    hsl(var(--spine-hue, 25), 38%, 32%);
  color: hsl(var(--spine-hue, 25), 45%, 88%);
}
.cover-placeholder[hidden] { display: none; }
.cover-placeholder-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover-placeholder-author { font-size: 0.7rem; opacity: 0.8; }

.cover-recent { width: 92px; }
.cover-large { max-width: 260px; }

/* Book detail page */
.book-page {
  display: grid;
  grid-template-columns: minmax(140px, 260px) 1fr;
  gap: 2rem;
  margin-top: 1rem;
}
@media (max-width: 640px) {
  .book-page { grid-template-columns: 1fr; }
  .book-page-cover { max-width: 200px; }
}

.book-page-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.book-page h1 { margin-top: 0; }
.book-byline { color: var(--muted); font-size: 1.1rem; margin-top: -0.4rem; }

.book-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1.2rem;
  font-size: 0.98rem;
  margin: 1.2rem 0;
}
.book-details dt { color: var(--muted); font-family: var(--sans); font-size: 0.82rem; align-self: baseline; padding-top: 0.2em; }
.book-details dd { margin: 0; }

.book-comments {
  border-left: 3px solid var(--gold);
  padding-left: 1rem;
  font-style: italic;
}

.note-list { list-style: none; padding: 0; }
.note-list li { margin-bottom: 0.6rem; }
.note-actions { font-size: 0.85rem; margin-left: 0.5rem; display: inline-flex; gap: 0.5rem; }
.note-actions form { display: inline; }

.loan-history ul { color: var(--muted); }
