/* ============================================================
   COMPONENT: Product Card, Grid, Tabs, Show More
   Used on: homepage, listing pages, category pages, search
   ============================================================ */

@layer components {

/* Product section wrapper */
.product-section { margin: 0 auto 32px; }

/* Tab row */
.section-tabs {
  display: flex;
  align-items: flex-end;
  border-bottom: 0.8px solid var(--color-tab-border);
  margin-bottom: 0;
}
.tab-link {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 0;
  margin-right: 28px;
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-body);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab-link--active { border-bottom: 2px solid var(--color-dark); }
/* New Releases / Coming Soon are buttons (keyboard and screen readers); they look like the plain heading. */
button.tab-link { background: none; border-top: 0; border-left: 0; border-right: 0; border-radius: 0; }

/* Product grid — uses gap (matches original Swiper spaceBetween:20) */
.product-grid {
  display: flex;
  flex-wrap: wrap;
  padding: 24px 0 8px;
  margin: 0;
  gap: 24px 20px;
  list-style: none;
}
.product-item {
  width: calc((100% - 60px) / 4);
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0;
  background: #fff;
  cursor: pointer;
  min-width: 0;
  box-sizing: border-box;
}
.product-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

/* Card image — fluid with desktop ceiling */
/* Each cover sits in a light-grey square, the Books page's colour (book-list.css), set less deep than there so the
   homepage covers stay large (owner, 18 Nov 2026: option B). Phones and touch tablets: responsive.css. */
.product-figure {
  position: relative;
  background: rgb(242, 241, 239);
  width: 100%;
  max-width: 272px;
  height: auto;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.product-figure img {
  width: 100%;
  height: 100%;
  max-width: 272px;
  object-fit: contain;
  display: block;
}
/* The cover's own link to the book page (the title is the other). It fills the figure, so the
   cover sits exactly where it did when the whole card was one link. */
.product-cover-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 9% 16%;
}
/* The title link takes the rest of the card (it used to hold the figure too). */
.product-item > .product-link { height: auto; flex: 1 1 auto; }
/* Uniform photographic shadow — traces the transparent PNG silhouette of each
   cropped book cover. Two layers: tight contact + soft ambient. Limited to the
   cropped PNGs: on opaque square photos (homepage tiles, placeholder covers) it
   drew a square shadow at phone widths, where the figure does not clip. */
.product-figure img[src*="/cropped/"] {
  filter:
    drop-shadow(0 2px 4px rgba(20, 16, 12, 0.18))
    drop-shadow(0 10px 20px rgba(20, 16, 12, 0.12));
}

/* Card body */
.product-info {
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}
/* title and author in the Books page's grey */
.product-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #6b6b6b;
  font-family: var(--font-body);
  line-height: 18px;
  margin: 0 0 2px;
  /* Selawik glyphs are ~3% wider than the legacy Figtree-Light at the same px,
     which pushed long titles from 2 lines to 3 on homepage product cards.
     This tightening restores 2-line wrap without changing perceived weight. */
  letter-spacing: -0.01em;
}
.product-author { font: 400 13px/17px var(--font-body); color: #6b6b6b; }
.product-price { display: none; }

/* Hover overlay */
.product-figcaption {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.25s ease;
  background: rgba(255,255,255,0.82);
  /* A click beside the buttons reaches the cover link underneath. */
  pointer-events: none;
}
.product-figcaption > button { pointer-events: auto; }
.product-figure:hover .product-figcaption,
.product-figcaption:focus-within { opacity: 1; }
/* The same buttons on other pages' boxes (js/quick-view-v2.js, [data-qv-figure]): kept inside the box and
   shown on hover; touch layouts are up to the page that uses them. */
[data-qv-figure] { position: relative; }
[data-qv-figure]:hover .product-figcaption { opacity: 1; }

.add-to-cart-btn {
  display: block;
  width: 140px;
  text-align: center;
  background: #000;
  color: #fff;
  border: 0.8px solid #000;
  padding: 9px;
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.add-to-cart-btn:hover { background: #333; border-color: #333; }

.quick-view-btn {
  display: block;
  width: 140px;
  text-align: center;
  background: #fff;
  color: var(--color-secondary);
  border: 0.8px solid var(--color-border);
  padding: 9px;
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.quick-view-btn:hover { background: rgb(248,248,248); }

/* On Sale badge */
.badge-sale {
  position: absolute;
  top: 0; right: 0;
  background: rgb(133, 134, 135);
  color: #fff;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 700;
  padding: 3px 6px;
  z-index: 2;
  text-transform: capitalize;
}

/* View More / Show Less / Show All: outline pills with a chevron (owner, 21 Nov 2026: option 1 on computers,
   "same look for 'show less'"; phones: responsive.css) */
.show-more-prods {
  display: block;
  width: fit-content;
  margin: 0 auto 12px;
  border: 1px solid rgb(62, 62, 62);
  border-radius: 999px;
  color: rgb(62, 62, 62);
  font-size: 12px;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 1.6px;
  padding: 9px 26px;
  cursor: pointer;
  background: #fff;
}
.show-more-prods:hover { background: rgb(242, 241, 239); color: rgb(40, 40, 40); }
.show-more-prods::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
}
.show-less-prods::after { transform: translateY(1px) rotate(-135deg); }
.show-all-prods::after { transform: translateY(-1px) rotate(-45deg); }

/* View More brings the next books in, then Show Less and Show All (a link, same look) take its place,
   side by side; a row without hidden books shows Show All at once. */
a.show-more-prods { text-decoration: none; }
.show-more-prods[hidden] { display: none; }
.show-after { display: none; justify-content: center; gap: 12px; }
.product-section--open .show-after, .more-section--open .show-after { display: flex; }
/* without the script (js/product-grid.js marks the section): Show All shows, and View More, which needs it, does not */
.more-section:not(.more-section--js) .show-after { display: flex; }
.more-section:not(.more-section--js) button.show-more-prods:not(.show-less-prods) { display: none; }
.show-after .show-more-prods { margin: 0 0 12px; }

/* A row title opens the row's list page; it looks as it did. */
a.tab-link:hover { color: var(--color-dark); }

/* JS-hidden states */
.product-item--hidden      { display: none; }
.product-grid--tab-hidden  { display: none; }

}
