/* Author Layout */
.author-meta {
  margin-bottom: 1rem;
}

.author-link {
  font-size: 0.9rem;
  color: #888;
}

/* Sections */
.book-section {
  margin-top: 2rem;
}

.series-block {
  margin-bottom: 2rem;
}

.series-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.series-header h3 {
  margin: 0;
}

.book-section h2 {
  margin-bottom: 0.8rem;
}

/* Grid Layout */
.book-grid {
  display: grid;
  gap: 1.2rem;
  margin-top: 1rem;

  grid-template-columns: 1fr; /* default: mobile */
}

/* Tablet (iPad) */
@media (min-width: 600px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop */
@media (min-width: 992px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .book-comments {
    font-size: 0.95rem;
  }

  .book-link {
    font-size: 0.9rem;
  }
}

/* Book Card */
.book-card {
  padding: 0.8rem;
  border-radius: 14px;

  background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
  border: 1px solid rgba(255,255,255,0.06);

  display: flex;
  flex-direction: column;

  transition: transform 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
}

.book-section h2 {
  color: #222;
  margin-bottom: 0.5rem;
}

.book-rating {
  margin-top: auto; /* pushes to bottom */
  font-size: 0.9rem;
  color: #f5c518;
}

/* Stars */
.stars {
  letter-spacing: 2px;
}

/* Genre */
.genre {
  font-size: 0.85rem;
  color: #aaa;
}

.book-number {
  font-size: 0.75rem;
  color: #888;
  margin-right: 6px;
}

.book-comments {
  margin-top: 0.6rem;
  font-size: clamp(0.85rem, 0.9vw, 0.95rem);
  color: #bbb;
}

.book-comments summary {
  cursor: pointer;
  font-size: clamp(0.85rem, 0.9vw, 0.95rem);
  color: #aaa;
}

.book-comments-content {
  margin-top: 0.5rem;
  line-height: 1.5;
  color: #ddd;
}

.book-links {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.book-link {
  font-size: clamp(0.8rem, 0.85vw, 0.9rem);
  padding: 4px 10px;
  border-radius: 999px;

  background: rgba(255,255,255,0.08);
  color: #ddd;

  text-decoration: none;
  transition: all 0.15s ease;
}

.book-link:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.book-id {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  margin-right: 4px;
}

.book-link.goodreads:hover {
  background: #553b08;
  color: #ffd700;
}

.book-link.open-library:hover {
  background: #7a0000;
  color: #fff;
}

.book-link.wiki-id:hover {
  background: #0645ad;
  color: #fff;
}

.book-link.isbn-13:hover,
.book-link.isbn-10:hover {
  background: #444;
  color: #fff;
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;   /* standard book ratio */
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 0.6rem;
}

.book-cover {
  position: relative;
}

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

.book-cover.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-size: 0.8rem;
}

.book-title {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #f5f5f5;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-comments summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: #888;
  list-style: none;
}

.book-comments summary::-webkit-details-marker {
  display: none;
}

/* Custom indicator */
.book-comments summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 6px;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.book-comments[open] summary::before {
  transform: rotate(90deg);
}

/* Content */
.book-comments-content {
  margin-top: 0.4rem;
  line-height: 1.4;
  color: #bbb;
}

.book-cover.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  padding: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #ddd;

/*  background: linear-gradient(145deg, #3a3a3a, #1f1f1f); */
  background: linear-gradient(135deg, #3a3a3a, #1a1a1a);
  border-radius: 10px;

  aspect-ratio: 2 / 3;
}

.book-cover.fallback span {
  display: block;          /* 🔥 ensures rendering */
  width: 100%;
}
.book-cover.fallback span {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;

  word-break: break-word;   /* 🔥 important */
}

/*
.book-cover.fallback {
  border: 2px solid red;
}
*/

.book-cover.fallback::before {
  content: "📖";
  position: absolute;
  top: 8px;
  left: 8px;
  opacity: 0.3;
}
