/* ════════════════════════════════════════════════════════════════════
   shop-cards.css — bestseller cards + header basket/list icons for /publish

   Self-contained. Adapted VERBATIM from books/index.html's card + nav
   styling so the cards read identically on both pages. Uses the publish
   page's existing CSS custom properties (--bg-card, --border, --radius,
   --orange, --text, --text-secondary, --bg, --bg-elevated,
   --shadow-card-hover) with a fallback for --transition-duration (publish
   defines --transition, not --transition-duration).

   Paired with assets/shop-mini.js. No scrollbars; no external assets.
   ════════════════════════════════════════════════════════════════════ */

/* ── BOOK GRID ── (books/index.html .book-grid) */
#bestsellerGrid.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── BOOK CARD ── (books/index.html .book-card / .book-cover / .book-info) */
#bestsellerGrid .book-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition-duration, 0.3s), box-shadow var(--transition-duration, 0.3s);
  display: flex;
  flex-direction: column;
}
#bestsellerGrid .book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
#bestsellerGrid .book-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--bg-elevated);
  padding: 16px;
}
#bestsellerGrid .book-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
#bestsellerGrid .book-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}
#bestsellerGrid .book-author {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
#bestsellerGrid .book-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

/* ── BADGES ── (books/index.html .book-badges / .bestseller-badge) */
#bestsellerGrid .book-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  pointer-events: none;
}
#bestsellerGrid .book-badges > * { pointer-events: auto; }
#bestsellerGrid .bestseller-badge {
  background: #B8860B;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ── BUTTONS ── (books/index.html .book-btn / .basket-add / .has-qty / .btn-list) */
#bestsellerGrid .book-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.15s, filter 0.2s;
}
#bestsellerGrid .book-btn:hover { opacity: 0.88; transform: translateY(-1px); }
/* .basket-add = our own SKU = direct revenue, solid orange in every state. */
#bestsellerGrid .book-btn.basket-add {
  background: var(--orange);
  color: #000;
  border: 1px solid var(--orange);
}
#bestsellerGrid .book-btn.basket-add:hover { opacity: 1; filter: brightness(1.05); }
#bestsellerGrid .book-btn.has-qty {
  background: var(--orange);
  color: #000;
  border-color: var(--orange);
}
#bestsellerGrid .book-btn.has-qty:hover { opacity: 1; filter: brightness(1.05); }
#bestsellerGrid .qty-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #000;
  color: var(--orange);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  margin-right: 6px;
  vertical-align: -2px;
}
/* Add-to-list secondary button (books/index.html .btn-list) */
#bestsellerGrid .btn-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 500;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.15s, color 0.2s, border-color 0.2s, background 0.2s;
}
#bestsellerGrid .btn-list:hover { transform: translateY(-1px); border-color: var(--text); }
#bestsellerGrid .btn-list.in-list {
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  border-color: var(--orange);
  color: var(--orange);
}
#bestsellerGrid .btn-list.in-list::before { content: '✓ '; margin-right: 2px; }

/* ── HEADER ICON BUTTONS ── (books/index.html .nav-right .icon-btn / .count-badge)
   On /publish the basket + list icons are HIDDEN until the visitor adds a
   bestseller to the basket/list (shop-mini.js toggles .show when count > 0). */
.nav-right .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.3s;
}
.nav-right .icon-btn.show { display: flex; }
.nav-right .icon-btn:hover { border-color: var(--orange); }
.nav-right .icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.nav-right .count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--orange);
  color: #000;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.nav-right .basket-btn .count-badge { background: var(--text); color: var(--bg); }

/* ── TOAST ── (books/index.html .toast) */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── RESPONSIVE ── (matches books/index.html breakpoints) */
@media (max-width: 768px) and (orientation: portrait) {
  #bestsellerGrid.book-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }
}
@media (max-width: 480px) and (orientation: portrait) {
  #bestsellerGrid.book-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  #bestsellerGrid .book-cover { padding: 10px; }
  #bestsellerGrid .book-info { padding: 12px; }
  #bestsellerGrid .book-title { font-size: 0.9rem; }
}
