/* ── Book Search ── */
.book-search-container {
  position: relative;
  max-width: 500px;
  margin: 1.5rem auto 0;
}

.book-search-input {
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 2.2rem;
  font-size: 0.95rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  color: #333;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.book-search-input:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.book-search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.45;
}

.book-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #999;
  padding: 0 0.3rem;
  line-height: 1;
}

.book-search-clear:hover {
  color: #333;
}

.book-search-status {
  text-align: center;
  font-size: 0.85rem;
  color: #777;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ── Dark mode: search ── */
:root:not(.light) .book-search-input {
  background: #1a1a1a;
  border-color: #3a3a3a;
  color: #ddd;
}

:root:not(.light) .book-search-input:focus {
  border-color: #5a9ae1;
  box-shadow: 0 0 0 3px rgba(90, 154, 225, 0.15);
}

:root:not(.light) .book-search-clear {
  color: #666;
}

:root:not(.light) .book-search-clear:hover {
  color: #ccc;
}

:root:not(.light) .book-search-status {
  color: #888;
}

/* Book list layout - Grid format */
.books-catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2rem;
  margin: 2rem auto;
  max-width: 1200px;
  padding: 0 2rem;
}

.book-item {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.book-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-color: #0066cc;
}

.book-cover {
  margin-bottom: 1rem;
}

.book-cover a {
  display: block;
  text-decoration: none;
  border: none;
  outline: none;
  transition: none;
  transform: none;
}

.book-cover a:hover {
  transform: none;
  text-decoration: none;
  border: none;
  outline: none;
}

/* Hide link arrow (↗) on all book card links
   Needs high specificity to beat: a[href^="http"]:not([href*="..."])::after */
.books-catalogue .book-item a[href]::after,
.books-catalogue .book-item a::after {
  content: none !important;
  display: none !important;
}

.book-cover img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
  transition: opacity 0.2s;
}

.book-cover img:hover {
  opacity: 0.9;
}

.book-details h2 {
  margin-top: 0;
  font-size: 1.2rem;
  line-height: 1.4;
}

.book-details h2 a {
  text-decoration: none;
  color: inherit;
}

.book-details h2 a:hover {
  color: #0066cc;
}

.book-author {
  font-style: italic;
  color: #666;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.book-rating {
  font-weight: bold;
  color: #f39c12;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}

.book-tag {
  display: inline-block !important;
  font-size: 0.65rem !important;
  font-weight: 500 !important;
  font-variant: normal !important;
  letter-spacing: 0.03em !important;
  text-decoration: none !important;
  padding: 0.2rem 0.55rem !important;
  border-radius: 10px !important;
  border: 1px solid #e0d6c8 !important;
  background: linear-gradient(135deg, #faf8f5, #f3efe9) !important;
  color: #7a6e5d !important;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.book-tag:hover {
  background: linear-gradient(135deg, #f39c12, #e67e22) !important;
  color: #fff !important;
  border-color: #e67e22 !important;
}

.book-summary {
  margin-top: 1rem;
  line-height: 1.6;
  font-size: 0.9rem;
  color: #333;
  flex-grow: 1;
}

/* ── Book single-page hero (cover + metadata) ── */
.book-hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e0e0e0;
}

.book-hero-cover {
  flex-shrink: 0;
  width: 220px;
}

.book-hero-cover img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: block;
}

.book-hero-meta {
  flex: 1;
  min-width: 0;
}

.book-hero-title {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
  line-height: 1.3;
}

.book-hero-author {
  font-style: italic;
  color: #555;
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.book-hero-rating {
  color: #f39c12;
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
}

.book-hero-rating-num {
  font-size: 0.85rem;
  color: #888;
  margin-left: 0.3rem;
}

.book-hero-publisher {
  color: #777;
  font-size: 0.9rem;
  margin: 0 0 0.8rem;
}

.book-hero-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.book-format-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
  border: 1px solid #d0c8bb;
  background: linear-gradient(135deg, #faf8f5, #f0ebe3);
  color: #6b5f4f;
}

.book-hero-link {
  display: inline-block;
  font-size: 0.9rem;
  color: #555 !important;
  text-decoration: none !important;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.1rem;
}

.book-hero-link:hover {
  color: #333 !important;
  border-bottom-color: #888;
}

/* Hide external-link arrow on hero links */
.book-hero a[href]::after {
  content: none !important;
  display: none !important;
}

/* Constrain any inline images in book post content (markdown-rendered) */
.post-content .post p img {
  max-width: 350px;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Pagination styling */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding: 1rem;
}

.pagination a {
  text-decoration: none;
  color: #0066cc;
  font-size: 1.2rem;
}

.pagination a:hover {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  .books-catalogue {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
  }

  .book-item {
    padding: 1rem;
  }

  .book-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .book-hero-cover {
    width: 180px;
  }

  .book-hero-formats {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .books-catalogue {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .book-hero-cover {
    width: 160px;
  }
}

/* ── Dark mode overrides ── */
:root:not(.light) .book-hero {
  border-bottom-color: #3a3a3a;
}

:root:not(.light) .book-hero-author {
  color: #aaa;
}

:root:not(.light) .book-hero-rating-num {
  color: #999;
}

:root:not(.light) .book-hero-publisher {
  color: #999;
}

:root:not(.light) .book-format-badge {
  background: linear-gradient(135deg, #1e1c18, #2a2620);
  border-color: #4a4030;
  color: #c4b99a;
}

:root:not(.light) .book-hero-link {
  color: #aaa !important;
  border-bottom-color: #555;
}

:root:not(.light) .book-hero-link:hover {
  color: #ddd !important;
  border-bottom-color: #999;
}

:root:not(.light) .book-item {
  border-color: #3a3a3a;
}

:root:not(.light) .book-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: #5a9ae1;
}

:root:not(.light) .book-author {
  color: #aaa;
}

:root:not(.light) .book-details h2 a:hover {
  color: #5a9ae1;
}

:root:not(.light) .book-summary {
  color: #bbb;
}

:root:not(.light) .pagination a {
  color: #5a9ae1;
}

:root:not(.light) .book-tags {
  border-top-color: #333 !important;
}

:root:not(.light) .book-tag {
  background: linear-gradient(135deg, #1e1c18, #2a2620) !important;
  border-color: #4a4030 !important;
  color: #c4b99a !important;
}
