/* 书架：卡片网格 */

.library {
  padding: var(--sp-7) var(--sp-6) var(--sp-8);
}

.library-head {
  display: flex;
  align-items: flex-start;
  margin-bottom: var(--sp-6);
  max-width: 1100px;
  margin-inline: auto;
}

.library-heading {
  width: 100%;
}

.library-title-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
}

.library-head h1 {
  margin: 0;
  flex: none;
  font-size: 20px;
  letter-spacing: .04em;
}

.library-tagline {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.library-features {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.library-features span {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: .03em;
}

.library-search {
  position: relative;
  display: block;
  max-width: 28rem;
  margin-top: var(--sp-4);
}

.library-search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.5;
  stroke-linecap: round;
  pointer-events: none;
}

.library-search input {
  width: 100%;
  height: 38px;
  padding: 0 var(--sp-3) 0 35px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.library-search input::placeholder {
  color: var(--text-faint);
}

.library-grid {
  max-width: 1100px;
  margin-inline: auto;
  border-radius: var(--radius-lg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--sp-6) var(--sp-5);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}

.card-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.card:hover .card-cover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.card-cover .placeholder {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  color: var(--text-faint);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-author {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-progress {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.card-progress-fill {
  height: 100%;
  background: var(--accent);
}

.card-progress-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card-progress-value {
  flex: none;
  color: var(--text-faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-dim);
}
.empty-title { font-size: 15px; margin: 0 0 var(--sp-2); color: var(--text); }
.empty-hint { margin: 0; font-size: 12px; }
.empty-hint a { color: var(--accent); }
.is-loading { color: var(--text-faint); font-size: 12px; text-align: center; padding: var(--sp-8); }

.library-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: var(--sp-7);
}

.pagination-button {
  height: 34px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.pagination-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-button:disabled {
  color: var(--text-faint);
  cursor: default;
}

.pagination-status {
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1023px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .library { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
  .library-title-row { flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); }
  .library-tagline { font-size: 12px; }
  .library-features { margin-top: var(--sp-2); }
  .library-search { max-width: none; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5) var(--sp-4); }
  .library-pagination { gap: var(--sp-2); }
  .pagination-button { padding: 0 var(--sp-3); }
}
