/* Listing pages: /shop, /collections/<slug> and (later) the search results.
 *
 * The card keeps the front page's `.product-card` look (raised white card,
 * hairline border, 4:3 stage for the photograph) so a product reads the same
 * wherever it is met. Tokens only. Two columns at phone width, four from
 * 64rem; `min-width: 0` on the cells so a long unbroken name wraps inside its
 * card instead of widening the page. */

.listing-head {
  margin-bottom: var(--space-lg);
}

.listing-head__lede {
  margin: 0 0 var(--space-xs);
  color: var(--ink-2);
}

/* The collection page's breadcrumb is the shared `.breadcrumb`
 * (components/listing/Breadcrumb, styled in global.css). */

/* ---- Filter and sort ----------------------------------------------------- */

.listing-filters {
  margin: 0 0 var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-3);
}

.listing-filters > summary {
  padding: var(--space-sm) var(--space-md);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.listing-filters__groups {
  display: grid;
  gap: var(--space-md) var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  padding: 0 var(--space-md) var(--space-md);
}

.listing-filters__title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-3);
}

.listing-filters ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* A pill the size of a thumb: 2.75rem tall is the tap target floor. */
.listing-filters ul a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-md);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-sm);
}

.listing-filters ul a:hover {
  border-color: var(--ink);
}

.listing-filters ul a[aria-current="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.listing-filters__clear {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin: 0 0 var(--space-sm) var(--space-md);
  color: var(--accent-deep);
}

/* ---- Grid ---------------------------------------------------------------- */

.listing-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.listing-grid__item {
  min-width: 0;
}

@media (min-width: 40rem) {
  .listing-grid {
    gap: var(--space-lg);
  }
}

@media (min-width: 64rem) {
  .listing-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---- Card ---------------------------------------------------------------- */

.listing-card {
  display: grid;
  gap: var(--space-xs);
  height: 100%;
  align-content: start;
  padding: var(--space-sm);
  border-radius: var(--radius-lg);
  background: var(--paper-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.listing-card:hover,
.listing-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  color: inherit;
}

.listing-card__art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--paper-2);
}

.listing-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The stand-in for a product with no photograph: its name, set large, so it
   reads as a label and not as a failed image. */
.listing-card__placeholder {
  padding: var(--space-sm);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.listing-card__badge {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-xs);
  font-weight: 600;
}

.listing-card__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.listing-card__summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--ink-3);
}

.listing-card__price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.listing-card__rating {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* ---- Empty and paging ---------------------------------------------------- */

.listing-empty {
  padding: var(--space-xl) 0;
}

.listing-empty a {
  color: var(--accent-deep);
}

.listing-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.listing-pages ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

.listing-pages a,
.listing-pages__current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 var(--space-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--ink);
  text-decoration: none;
}

.listing-pages__current {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---- Search page --------------------------------------------------------- */

/* The box and its button on one row, the box taking what is left; at phone
   width that row is the full measure minus the button. 16px text, so iOS
   does not zoom the page when the box is focused. */
.search-form {
  margin: 0 0 var(--space-lg);
}

.search-form__label {
  display: block;
  margin-bottom: var(--space-2xs);
  font-weight: 600;
}

.search-form__row {
  display: flex;
  gap: var(--space-xs);
  max-width: 36rem;
}

.search-form__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--paper-3);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-base);
}

.search-form__input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* The result count is the page's second heading, read at body size: it
   labels the grid below it rather than competing with "Search". */
.search-count {
  margin: 0 0 var(--space-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* An echoed query can be 80 characters with no space in them. */
.listing-empty p {
  overflow-wrap: anywhere;
}

.search-ways {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  list-style: none;
  margin: var(--space-sm) 0 0;
  padding: 0;
}

.search-ways a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-md);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--ink);
  text-decoration: none;
}

.search-ways a:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---- More in <collection> -------------------------------------------------
 * The strip under a product page (components/listing/MoreInCollection). */

.more-in {
  margin-top: var(--space-xl);
}

.more-in h2 {
  margin: 0 0 var(--space-md);
}

.more-in__all {
  margin: var(--space-md) 0 0;
}
