.reading-shelf {
  margin-block: 3rem;
}

.reading-shelf__header {
  margin-block-end: 1.25rem;
}

.reading-shelf__title {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.15;
}

.reading-shelf__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.25rem;
}

.reading-shelf__book {
  min-width: 0;
}

.reading-shelf__link {
  color: inherit;
  display: block;
  height: 100%;
  text-decoration: none;
}

.reading-shelf__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.35rem;
}

.reading-shelf__cover-wrap {
  aspect-ratio: 2 / 3;
  border-radius: 0.75rem;
  margin-block-end: 0.85rem;
  overflow: hidden;
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.reading-shelf__cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reading-shelf__cover--placeholder {
  align-items: center;
  display: flex;
  font-size: 4rem;
  font-weight: 700;
  justify-content: center;
  opacity: 0.35;
}

.reading-shelf__body > * {
  margin: 0;
}

.reading-shelf__body > * + * {
  margin-block-start: 0.25rem;
}

.reading-shelf__book-title {
  font-size: 1rem;
  line-height: 1.25;
}

.reading-shelf__subtitle,
.reading-shelf__authors,
.reading-shelf__meta {
  font-size: 0.9rem;
  line-height: 1.35;
}

.reading-shelf__subtitle,
.reading-shelf__meta {
  opacity: 0.72;
}

.reading-shelf__authors {
  opacity: 0.85;
}

@media (hover: hover) {
  .reading-shelf__link:hover .reading-shelf__book-title {
    text-decoration: underline;
    text-underline-offset: 0.14em;
  }

  .reading-shelf__link:hover .reading-shelf__cover {
    transform: scale(1.025);
  }

  .reading-shelf__cover {
    transition: transform 160ms ease-out;
  }
}

/* ─── Bookshelf page ─── */

.bookshelf-page {
  margin-top: 1rem;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid #e0e0e0;
}

.filter-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #555;
  padding: 0.5rem 0;
  margin-right: 1.75rem;
  margin-bottom: -1px;
  line-height: 1;
  transition: color 80ms;
}

.filter-tab:hover {
  color: #000;
}

.filter-tab.is-active {
  color: #000;
  border-bottom-color: #000;
}

.filter-count {
  font-size: 0.7rem;
  color: #aaa;
  margin-left: 0.3rem;
  letter-spacing: 0;
  text-transform: none;
}

.filter-tab.is-active .filter-count {
  color: #666;
}

/* Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 2rem 0.875rem;
  align-items: start;
}

@media (max-width: 380px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 0.625rem;
  }
}

/* Book card */
.book-card {
  cursor: pointer;
}

.book-card__cover-wrap {
  aspect-ratio: 2 / 3;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f0f0f0;
  margin-bottom: 0.6rem;
  transition: opacity 120ms;
}

.book-card__cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease-out;
}

@media (hover: hover) {
  .book-card:hover .book-card__cover {
    transform: scale(1.04);
  }
  .book-card:hover .book-card__cover-wrap {
    opacity: 0.92;
  }
}

.book-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  height: 100%;
  /* gradient set inline per book */
}

.book-card__title {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  color: #000;
  margin: 0 0 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card__author {
  font-size: 0.72rem;
  color: #888;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Site nav */
.site-nav {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.35rem;
}

.site-nav a {
  font-size: 0.82rem;
  color: #555;
  border-bottom: none;
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: #0311fe;
}

/* ─── Book overlay ─── */

.bk-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.bk-overlay[hidden] { display: none; }

.bk-overlay__panel {
  position: relative;
  background: #fff;
  border-radius: 0.625rem;
  max-width: 30rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.bk-overlay__close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #999;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 0.25rem;
  outline: none;
}

.bk-overlay__close:hover { color: #000; }
.bk-overlay__close:focus-visible { outline: 2px solid #0311fe; outline-offset: 2px; }

.bk-overlay__body {
  display: flex;
  gap: 1.5rem;
}

.bk-overlay__cover-col {
  flex: 0 0 10rem;
}

.bk-overlay__cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.bk-overlay__cover--ph {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.bk-overlay__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bk-overlay__title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  padding-right: 1.5rem;
}

.bk-overlay__subtitle {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.4;
  margin: 0;
}

.bk-overlay__authors {
  font-size: 0.9rem;
  font-weight: 500;
  color: #000;
  margin: 0.2rem 0 0;
}

.bk-overlay__meta {
  font-size: 0.8rem;
  color: #999;
  margin: 0;
}

.bk-overlay__description {
  font-size: 0.875rem;
  color: #333;
  line-height: 1.65;
  margin: 0.5rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

.bk-overlay__description:empty,
.bk-overlay__description--loading {
  color: #bbb;
  font-style: italic;
}

.bk-overlay__link {
  display: inline-block;
  margin-top: 0.875rem;
  font-size: 0.875rem;
  color: #0311fe;
  text-decoration: none;
  border-bottom: 1px dotted #0311fe;
}

.bk-overlay__link:hover {
  border-bottom-style: solid;
}

@media (max-width: 520px) {
  .bk-overlay__panel { padding: 1.25rem; }
  .bk-overlay__body { flex-direction: column; }
  .bk-overlay__cover-col { flex: none; max-width: 8rem; }
}
