/* =========================================================================
   Catalog listing: /shop, /c/{slug}, /m/{slug}, /search
   Density rises here. See VISUAL_DENSITY in DESIGN.md.
   ========================================================================= */

@layer components {

.shop-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-6);
  padding-bottom: var(--s-6);
}
@media (min-width: 1024px) { .shop-head { padding-top: var(--s-7); padding-bottom: var(--s-7); } }

.shop-title { font-size: var(--fs-h1); max-width: 22ch; }

.shop-search { display: flex; gap: var(--s-3); max-width: 560px; margin-top: var(--s-2); }

/* ----------------------------------------------------------------- layout */

.shop-layout {
  display: grid;
  gap: var(--s-6);
  padding-bottom: var(--s-9);
  align-items: start;
}
@media (min-width: 1024px) {
  .shop-layout { grid-template-columns: 244px minmax(0, 1fr); gap: var(--s-8); }
}

/* ---------------------------------------------------------------- filters */

.filters {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(340px, 100vw);
  z-index: calc(var(--z-drawer) + 1);
  background: var(--bg);
  border-inline-end: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--d-ui) var(--ease-io);
}
.filters[data-open="true"] { transform: none; }

@media (min-width: 1024px) {
  .filters {
    position: sticky;
    top: calc(var(--header-h) + var(--s-5));
    inset-inline: auto;
    width: auto;
    max-height: calc(100dvh - var(--header-h) - var(--s-8));
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: none;
    border: 0;
    background: none;
    z-index: 1;
    scrollbar-width: thin;
  }
}

.filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  min-height: var(--header-h);
  flex: none;
}
.filters-head h2 { font-size: var(--fs-h3); }

.filters-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}
@media (min-width: 1024px) { .filters-body { padding: 0; overflow: visible; } }

.fgroup { display: flex; flex-direction: column; gap: var(--s-3); }
.fgroup + .fgroup { border-top: 1px solid var(--line); padding-top: var(--s-5); }

.fgroup-title {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
}

.flist { display: flex; flex-direction: column; }

.fitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 7px 0;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  transition: color var(--d-micro) var(--ease);
}
.fitem span { font-size: 11px; color: var(--text-faint); }
.fitem:hover { color: var(--text); }
.fitem.is-on { color: var(--accent-text); font-weight: 500; }
.fitem.is-on span { color: var(--accent-text); }

/* .fchips and .fchip live in catalog.css: the product page uses them too. */

.frange { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.frange .input { min-height: 42px; }

.fclear { font-size: var(--fs-sm); align-self: flex-start; }

/* ---------------------------------------------------------------- results */

.results { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.results-count { font-size: var(--fs-sm); color: var(--text-dim); }
.results-count span { margin-left: var(--s-3); }

.results-tools { display: flex; align-items: center; gap: var(--s-3); }
.sort-field { min-width: 170px; }
.select-sm { min-height: 38px; padding: 7px 34px 7px 12px; font-size: var(--fs-sm); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; }

.active-filters { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.afchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  font-size: var(--fs-micro);
  transition: border-color var(--d-micro) var(--ease);
}
.afchip:hover { border-color: var(--danger); }
.afchip svg { opacity: 0.6; }

/* Loading skeletons, used while a filter request is in flight. */
.pgrid[data-busy="true"] { opacity: 0.45; pointer-events: none; transition: opacity var(--d-ui) var(--ease); }

}
