/* ═══════════════════════════════════════════════════════════════
   ACADEMIST — Textbook library
   ═══════════════════════════════════════════════════════════════ */

/* ── Search in the header ─────────────────────────────────────── */
.lib-search {
  display: flex; gap: 10px; margin-top: 26px;
  max-width: 620px; position: relative; z-index: 2;
}
.lib-search .input {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.24);
  color: #fff; font-size: .88rem;
}
.lib-search .input::placeholder { color: rgba(255,255,255,.6); }
.lib-search .input:focus {
  background: rgba(255,255,255,.18); border-color: var(--su);
  box-shadow: 0 0 0 3px rgba(250,204,21,.2);
}
.lib-quick {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin-top: 14px; position: relative; z-index: 2;
}
.lib-quick button {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.85); padding: 5px 12px; border-radius: 100px;
  font-size: .71rem; font-weight: 700; cursor: pointer; font-family: var(--font);
}
.lib-quick button:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ── Category strip ───────────────────────────────────────────── */
.cat-strip {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 22px 2px 6px; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.cat-strip::-webkit-scrollbar { height: 5px; }
.cat-strip::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.cat-card {
  flex: 0 0 auto; width: 152px; padding: 14px;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); cursor: pointer; text-align: left;
  font-family: var(--font); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.cat-card.on { border-color: var(--ac); background: var(--ac-soft); }
.cat-card .el { margin-bottom: 10px; }
.cat-card b { display: block; font-size: .8rem; font-weight: 800; line-height: 1.25; }
.cat-card span { font-size: .68rem; color: var(--muted); font-weight: 600; }

/* ── Results bar ──────────────────────────────────────────────── */
.lib-bar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 30px 0 22px;
}
.lib-controls { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* ── Book grid ────────────────────────────────────────────────── */
.book-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
}
@media (max-width: 520px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 13px; }
}

.book-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; text-align: left;
  font-family: var(--font); padding: 0;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); border-color: var(--line-2); }

.book-cover {
  aspect-ratio: 3 / 4; position: relative; overflow: hidden;
  background: var(--surface-2); display: flex;
  align-items: center; justify-content: center;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* When there is no cover art, the subject's element tile stands in. */
.cover-fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  padding: 16px; text-align: center; color: #fff;
}
.cover-fallback .cf-title {
  font-size: .72rem; font-weight: 700; line-height: 1.3;
  opacity: .95; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-fallback .el { background: rgba(255,255,255,.2) !important; backdrop-filter: blur(2px); }

.book-flags {
  position: absolute; top: 9px; left: 9px; right: 9px;
  display: flex; gap: 5px; flex-wrap: wrap; pointer-events: none;
}
.book-flags .badge { box-shadow: 0 1px 4px rgba(0,0,0,.14); }

.book-body { padding: 13px 14px 15px; flex: 1; display: flex; flex-direction: column; }
.book-body h3 {
  font-size: .84rem; font-weight: 800; line-height: 1.32; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-author { font-size: .72rem; color: var(--muted); margin: 0 0 9px; }
.book-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: .68rem; color: var(--muted); margin-bottom: 11px;
}
.book-meta .dot-sep { opacity: .4; }
.book-foot {
  margin-top: auto; display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
}
.book-price { font-size: 1rem; font-weight: 900; letter-spacing: -.02em; }
.book-price small { font-size: .64rem; font-weight: 700; color: var(--muted); display: block; margin-top: -2px; }
.book-price.free { color: var(--mg); }

.stars { color: var(--su); font-size: .72rem; letter-spacing: -1px; }
.stars em { font-style: normal; color: var(--line-2); }

/* ── Pager ────────────────────────────────────────────────────── */
.pager {
  display: flex; justify-content: center; align-items: center;
  gap: 6px; margin-top: 34px; flex-wrap: wrap;
}
.pager button {
  min-width: 38px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 9px; font-family: var(--font); font-size: .78rem;
  font-weight: 700; cursor: pointer; color: var(--ink-2);
}
.pager button:hover:not(:disabled) { border-color: var(--ac); color: var(--ac); }
.pager button.on { background: var(--ac); border-color: var(--ac); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Detail modal ─────────────────────────────────────────────── */
.detail-top { display: grid; grid-template-columns: 168px 1fr; gap: 22px; }
@media (max-width: 600px) { .detail-top { grid-template-columns: 1fr; } }
.detail-cover {
  aspect-ratio: 3/4; border-radius: var(--r); overflow: hidden;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }

.spec-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 12px; margin: 18px 0;
  padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.spec-list div span {
  display: block; font-size: .64rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
}
.spec-list div b { font-size: .82rem; font-weight: 700; }

.buy-box {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 17px; margin-top: 18px;
}
.buy-price {
  display: flex; align-items: baseline; gap: 9px; margin-bottom: 4px;
}
.buy-price strong { font-size: 1.9rem; font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.buy-price span { font-size: .82rem; color: var(--muted); font-weight: 600; }

.review-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.review-head b { font-size: .8rem; }

.step-card .el { margin-bottom: 15px; }
.step-card h3 { font-size: 1rem; font-weight: 800; margin: 0 0 7px; }
.step-card p { font-size: .84rem; color: var(--ink-2); margin: 0; line-height: 1.6; }
