/*
 * Category listing.
 */

/* Breadcrumb styles live in base.css -- the PDP needs them too and does not
   load this sheet. */


.m-listing__head { margin-bottom: 16px; }
.m-listing__intro {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-500);
  max-width: 76ch;
}
.m-listing__intro p { margin-bottom: 8px; }

/* ---------------------------------------------------------------------------
 * Shell: rail + results
 * ------------------------------------------------------------------------ */

/*
 * One column until the rail has room to sit beside the results.
 *
 * The rail + results split is stated in the container query below, not here.
 * Stating it unconditionally made .m-results demand three tracks alongside
 * the rail on a phone, so opening the filter drawer widened the document to
 * 401px inside a 320px viewport and squeezed the rail itself to 142px --
 * half of it off-screen.
 */
.m-listing {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.m-results { min-width: 0; }

.m-filters {
  background: var(--surface);
  border: 1px solid var(--border-200);
  border-radius: var(--r-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/*
 * Mobile: the rail is collapsed behind a trigger. 17 filter rows would
 * otherwise push every product below the fold.
 */
.m-listing__trigger {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--green-700);
  border-radius: var(--r-control);
  color: var(--green-700);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  padding: 13px;
  margin-bottom: 12px;
}

.m-filters { display: none; margin-bottom: 12px; }
.m-filters.is-open { display: flex; }

/*
 * Container queries rather than media queries, to stay consistent with the type
 * scale and the hero span. Above the breakpoint the rail is always open and the
 * trigger disappears; below it the rail is collapsed behind the trigger so
 * products, not 21 filter rows, are the first thing on the screen.
 */
@container (min-width: 768px) {
  .m-listing__trigger { display: none; }
  .m-listing { grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); }
  .m-results { grid-column: span 3; }
  .m-filters {
    display: flex;
    max-width: 260px;
    margin-bottom: 0;
  }
}

/* ---------------------------------------------------------------------------
 * Filter groups
 * ------------------------------------------------------------------------ */

.m-filter-group__label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.m-filter-group ul { list-style: none; margin: 0; padding: 0; }
.m-filter-group li + li { margin-top: 4px; }

.m-filter {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 0;
  font-size: 13.5px;
  color: var(--ink-700);
}
.m-filter:hover { color: var(--green-700); }

.m-filter__box {
  flex: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-500);
  border-radius: 3px;
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.m-filter.is-checked .m-filter__box {
  background: var(--green-700);
  border-color: var(--green-700);
}
.m-filter.is-checked .m-filter__box::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.m-filter__label { flex: 1; min-width: 0; }
.m-filter.is-checked .m-filter__label { font-weight: 600; color: var(--ink-900); }
.m-filter__count { font-size: 13px; color: var(--ink-400); flex: none; }

/* ---------------------------------------------------------------------------
 * Results header
 * ------------------------------------------------------------------------ */

.m-results__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.m-results__count { font-size: 13.5px; color: var(--ink-500); }
.m-results__count strong { color: var(--ink-900); }

/* ---------------------------------------------------------------------------
 * Pagination
 * ------------------------------------------------------------------------ */

.m-pagination,
.woocommerce-pagination ul,
nav.pagination ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 22px 0 0;
  padding: 0;
}

.page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1.5px solid var(--border-400);
  border-radius: var(--r-control);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-700);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.page-numbers:hover { border-color: var(--green-700); color: var(--green-700); }
.page-numbers.current {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
}
.page-numbers.dots { border-color: transparent; background: transparent; }

/* ---------------------------------------------------------------------------
 * Empty state
 * ------------------------------------------------------------------------ */

.m-empty {
  background: var(--surface);
  border: 1px solid var(--border-200);
  border-radius: var(--r-card);
  padding: 44px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.m-empty p { font-size: 14px; color: var(--ink-500); max-width: 46ch; }
