/* ==========================================================================
   Books Catalogue page (books.html) — filters and the responsive book grid.
   Shares design tokens and the .book-card component from css/style.css;
   only catalogue-specific layout lives here.
   ========================================================================== */

.books-page {
  padding-top: calc(var(--nav-h) + 40px);
  padding-bottom: clamp(60px, 8vw, 100px);
  background: linear-gradient(180deg, var(--bg-soft-purple), var(--bg) 55%);
  min-height: 60vh;
}

.books-page__back {
  display: inline-flex; align-items: center; font-weight: 700; font-size: 0.92rem;
  color: var(--purple-dark); margin-bottom: 28px; transition: transform var(--dur-fast) var(--ease);
}
.books-page__back:hover { transform: translateX(-4px); color: var(--coral-dark); }

.books-page__intro { max-width: 720px; margin-bottom: 36px; }
.books-page__heading { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 14px; }
.books-page__desc { color: var(--text-muted); font-size: 1.05rem; max-width: 640px; }

/* ---- Toolbar: filters ---- */
.books-toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 24px;
}

.books-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.books-filters select {
  height: 46px; padding: 0 38px 0 16px; border-radius: var(--r-full); border: 1.5px solid var(--border);
  background-color: var(--bg);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%23665F7A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat; background-position: right 14px center;
  appearance: none; -webkit-appearance: none; font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--text);
  cursor: pointer; transition: border-color var(--dur-fast) var(--ease);
}
.books-filters select:hover, .books-filters select:focus { border-color: var(--purple); outline: none; }
.books-filters__clear {
  display: inline-flex; align-items: center; font-weight: 700; font-size: 0.88rem;
  color: var(--coral-dark); padding: 10px 8px; border-radius: var(--r-full); transition: color var(--dur-fast) var(--ease);
}
.books-filters__clear:hover { color: var(--coral); text-decoration: underline; }

.books-results-count { color: var(--text-muted); font-weight: 600; font-size: 0.9rem; margin-bottom: 18px; }

/* ---- Grid ---- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}
.books-grid .book-card { width: 100%; }

/* ---- Empty state ---- */
.books-empty {
  text-align: center; padding: 64px 20px; background: var(--surface); border: 1.5px dashed var(--border);
  border-radius: var(--r-lg); display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.books-empty__icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg-soft-purple); color: var(--purple-dark); margin-bottom: 8px;
}
.books-empty h3 { font-size: 1.3rem; }
.books-empty p { color: var(--text-muted); max-width: 380px; }
.books-empty .btn { margin-top: 12px; }

/* Elements toggled via the `hidden` DOM property also set their own
   `display`, which would otherwise beat the UA [hidden] rule. */
.books-grid[hidden], .books-empty[hidden] { display: none; }

@media (max-width: 720px) {
  .books-toolbar { flex-direction: column; align-items: stretch; }
  .books-filters { justify-content: flex-start; }
  .books-filters select { flex: 1 1 auto; }
}

@media (max-width: 600px) {
  .books-page { padding-top: calc(var(--nav-h) + 24px); }
  .books-grid { gap: 16px; }
}
