/* ============================================================
   books.css — Books App: cover grid with Amazon links
   macOS Desktop Website
   ============================================================ */

/* ── Window content ──────────────────────────────────────────── */
#window-books .window-content {
  overflow-y: auto;
  padding: 24px;
  background: var(--books-bg);
  height: 100%;
  box-sizing: border-box;
}

/* ── Book grid ───────────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px 20px;
}

/* ── Book card ───────────────────────────────────────────────── */
.books-card {
  position: relative;
  cursor: pointer;
}

/* Cover wrapper: natural proportions */
.books-cover-wrap {
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  margin-bottom: 8px;
  position: relative;
  background: var(--books-cover-bg);
}

.books-cover-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Hover overlay ───────────────────────────────────────────── */
.books-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 4px;
}

.books-card:hover .books-hover-overlay {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .books-hover-overlay {
    transition: none;
  }
}

/* "View on Amazon" button */
.books-amazon-btn {
  color: #fff;
  border: 1.5px solid #fff;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  cursor: pointer;
  min-height: 34px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.books-amazon-btn:hover {
  background: #fff;
  color: var(--text-heading);
}

.books-amazon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .books-amazon-btn {
    transition: none;
  }
}

/* ── Book metadata ───────────────────────────────────────────── */
.books-meta {
  padding: 0 2px;
}

.books-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.books-year {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ── Empty state ─────────────────────────────────────────────── */
.books-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 200px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ── macOS-style scrollbars ──────────────────────────────────── */
#window-books .window-content::-webkit-scrollbar {
  width: 8px;
}

#window-books .window-content::-webkit-scrollbar-track {
  background: transparent;
}

#window-books .window-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#window-books .window-content::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* ── Mobile: 2 columns on narrow screens ─────────────────────── */
@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 12px;
  }

  #window-books .window-content {
    padding: 16px;
  }
}
