/* ==================== Tag Bar ==================== */
.book-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 1rem 0;
}

.tag-link {
  text-decoration: none;
  color: #666;
  font-size: 0.9rem;
  padding: 2px 8px;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.tag-link:hover {
  color: #333;
}

.tag-link.active {
  color: #333;
  font-weight: 700;
}

.tag-sep {
  color: #ddd;
  font-size: 0.8rem;
  user-select: none;
}

/* ==================== Book Grid ==================== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

/* ==================== Book Card ==================== */
.book-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: 8px;
  overflow: hidden;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ==================== Cover Image ==================== */
.book-card-cover {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 8px;
  background-color: #f0f0f0;
}

.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.book-card:hover .book-card-cover img {
  transform: scale(1.03);
}

/* ==================== Book Title ==================== */
.book-card-title {
  margin: 10px 0 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==================== Responsive ==================== */

/* Tablet: 3 columns */
@media (max-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* Mobile: 2 columns */
@media (max-width: 768px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .book-card-title {
    font-size: 0.8rem;
  }
}

/* ==================== Book Index Tags ==================== */
.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1rem 0;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0;
  transition: all 0.2s ease;
}

.tag:hover {
  text-decoration: none;
  opacity: 0.8;
}

/* ==================== Book Preface ==================== */
.book-preface {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.book-preface h2 {
  font-size: 1.25rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.book-preface p {
  line-height: 1.8;
  color: var(--body-font-color);
}
