/* ==========================================================================
   Category page: the hub of a category with sub-categories
   (banner, round sub-category photos, a shelf of products per sub-category)
   ========================================================================== */

/* ---- Title + lead ---- */
.cat-head__title { font: var(--fw-black) var(--fs-4xl) / var(--lh-tight) var(--font-family); }
.cat-head__lead { max-width: 60ch; margin-top: var(--space-3); color: var(--color-text-muted); font-size: var(--fs-md); text-wrap: pretty; }

/* ---- Banner: an edge-to-edge photo with a title card that lines up with the page content ---- */
.cv3-hero { position: relative; background: var(--color-sand-soft); }
.cv3-hero .media { --ratio: 21 / 7; }
.cv-hero__inner { position: absolute; inset: 0; display: flex; align-items: flex-end; padding-bottom: var(--space-10); }
.cv3-hero__card {
  max-width: 460px;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--color-veil);
  backdrop-filter: blur(10px);
}
.cv3-hero__card .breadcrumb ol { padding-block: 0 var(--space-3); }
.cv3-hero__card .cat-head__lead { font-size: var(--fs-base); }

/* ---- Sub-categories: round photos you can drag through, on a sand box under the banner ---- */
.cv-sections__box { padding: var(--space-10) var(--space-8); border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: var(--color-sand-soft); }
.subcats { --rail-cols: 9; --rail-gap: var(--space-5); padding-bottom: var(--space-2); }
.subcat { display: grid; justify-items: center; gap: var(--space-3); text-align: center; font-size: var(--fs-nav); font-weight: var(--fw-semibold); }
/* The ring is a border with a gap inside it, so the rail's overflow can't clip it the way it clips an outline */
.subcat .media {
  --media-radius: var(--radius-pill);
  width: 100%;
  padding: 3px;
  border: 2px solid transparent;
  background: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.subcat img { border-radius: var(--radius-pill); }
.subcat:hover .media { border-color: var(--color-line-strong); }
.subcat[aria-current] .media { border-color: var(--color-brown); }
.subcat small { display: block; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--color-text-subtle); }

/* ---- Shelves: one row of products per sub-category; they follow each other closer than homepage sections ---- */
.cv-shelves { --space-section: var(--space-10); padding-bottom: var(--space-section); }
.cv4-shelf .rail { --rail-cols: 4; }
.cv4-promo { margin-top: var(--space-section); }
.cv4-promo .grid-promo { grid-template-columns: 1fr 1.4fr; height: 360px; }   /* outside a grid row nothing else sets its height */

/* Last slot of a shelf: "see all" card, the same height as the product photos */
.shelf-more {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-2);
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
  background: var(--color-sand-soft);
  text-align: center;
  color: var(--color-text-muted);
  transition: background var(--duration-fast) var(--ease-out);
}
.shelf-more:hover { background: var(--color-sand); }
.shelf-more__title { font-size: var(--fs-lg); font-weight: var(--fw-black); color: var(--color-text); }
.shelf-more__arrow { display: grid; place-items: center; width: 44px; height: 44px; margin-top: var(--space-3); border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-text); }

/* ---- Tablets ---- */
@media (max-width: 1024px) {
  .cv3-hero .media { --ratio: 16 / 7; }
  .cv-hero__inner { padding-bottom: var(--space-8); }
  .cv3-hero__card { padding: var(--space-6); }
  .cv-sections__box { padding: var(--space-8) var(--space-6); }
  .subcats { --rail-cols: 6.4; }
  .cv4-shelf .rail { --rail-cols: 3.3; }
  .cv4-promo .grid-promo { height: 300px; }
}

/* ---- Phones: the title card sits under the photo instead of on it ---- */
@media (max-width: 640px) {
  .cv3-hero .media { --ratio: 4 / 3; }
  .cv-hero__inner { position: static; padding: 0; }
  .cv3-hero__card { max-width: none; padding: var(--space-6) 0 var(--space-4); border-radius: 0; background: none; backdrop-filter: none; }
  .cv-sections { width: 100%; }   /* the sand box runs edge to edge */
  .cv-sections__box { padding: var(--space-6) var(--container-gutter); border-radius: 0; }
  .subcats { --rail-cols: 3.6; --rail-gap: var(--space-3); }
  .cv4-shelf .rail { --rail-cols: 1.8; }
  .cv4-promo .grid-promo { grid-template-columns: 1fr; height: auto; }
  .cv4-promo .grid-promo .media { aspect-ratio: 16 / 9; height: auto; order: -1; }
}

/* ==========================================================================
   Category listing: toolbar (price ranges, count, sort), the product grid, show more
   ========================================================================== */

/* ---- Toolbar: filters on the start side, count + sort on the end; sticks under the top of the screen ---- */
.toolbar {
  position: sticky;
  top: var(--sticky-top, 0px);
  z-index: calc(var(--z-overlay) - 1);   /* under the header's mega menus */
  margin-top: var(--space-8);
  background: var(--color-surface);   /* the page's colour, so the sticky bar hides what scrolls under it */
  border-block: 1px solid var(--color-line);
}
.toolbar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-block: var(--space-3); }
.toolbar__group { display: flex; align-items: center; gap: var(--space-2); }
.toolbar__count { margin-inline-end: var(--space-3); font-size: var(--fs-sm); color: var(--color-text-subtle); }
.toolbar__label { display: inline-flex; align-items: center; gap: var(--space-2); margin-inline-end: var(--space-2); font-size: var(--fs-sm); font-weight: var(--fw-bold); }

/* The options are links (each one is a URL), drawn like radio buttons */
.option__radio { flex-shrink: 0; width: 18px; height: 18px; border: 2px solid var(--color-line-strong); border-radius: var(--radius-pill); }
.option[aria-current] { font-weight: var(--fw-bold); }
.option[aria-current] .option__radio { border: 5px solid var(--color-brown); }

/* ---- Grid ---- */
.listing { padding-block: var(--space-8) var(--space-section); }
.listing__empty { display: grid; justify-items: center; gap: var(--space-4); padding-block: var(--space-10); color: var(--color-text-muted); }

/* ---- Show more: how far you are + the button ---- */
.load-more { display: grid; justify-items: center; gap: var(--space-4); margin-top: var(--space-10); font-size: var(--fs-sm); color: var(--color-text-subtle); }
.load-more progress {
  width: 240px;
  height: 3px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-line);
  appearance: none;
}
.load-more progress::-webkit-progress-bar { border-radius: var(--radius-pill); background: var(--color-line); }
.load-more progress::-webkit-progress-value { border-radius: var(--radius-pill); background: var(--color-brown); }
.load-more progress::-moz-progress-bar { border-radius: var(--radius-pill); background: var(--color-brown); }
.load-more .btn { margin-top: var(--space-2); }
.load-more .btn[aria-busy] { opacity: .6; pointer-events: none; }

@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Phones: two cards a row, the promo across both; the toolbar wraps ---- */
@media (max-width: 640px) {
  .toolbar__inner { flex-wrap: wrap; row-gap: var(--space-2); }
  .toolbar__label { display: none; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-8) var(--space-3); }
  .product-grid .grid-promo { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .product-grid .grid-promo .media { aspect-ratio: 16 / 9; height: auto; order: -1; }
}
