/* ==========================================================================
   parts.css — the "all parts" page (parts.html)
   --------------------------------------------------------------------------
   Layout only. The product cards reuse .grid / .card straight from store.css —
   nothing about a card is restyled here. This file adds the category sidebar
   and the two-column shell around that grid.
   ========================================================================== */

.parts {
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 7vw, 5rem);
}

.parts__head {
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}
.parts__head h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.1;
}
.parts__count {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* two columns on desktop: the category rail, then the grid */
.parts__layout {
  display: grid;
  grid-template-columns: minmax(190px, 230px) 1fr;
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
}

/* ------------------------------ the sidebar ----------------------------- */
.parts__side {
  position: sticky;
  top: calc(var(--header-h, 72px) + 1rem);
  /* a grid item defaults to min-width:auto, which lets the scrolling chip row
     below (on mobile) and the card grid force the tracks wider than the
     viewport. min-width:0 lets both tracks shrink and scroll/reflow instead. */
  min-width: 0;
}
.parts__main { min-width: 0; }
.parts__side h2 {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.parts__cats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.parts__cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: start;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.parts__cat:hover { background: var(--surface); }
.parts__cat:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.parts__cat.is-active {
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 600;
}

.parts__cat .count {
  flex: none;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.parts__cat.is-active .count { color: var(--brand-2); }

/* ------------------------------- the main ------------------------------- */
.parts__toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}
.parts__toolbar .search { flex: 1 1 auto; max-width: 26rem; }

.parts__empty { margin-top: 1.5rem; }

/* --------------------------- narrow screens ----------------------------- */
/* The rail becomes a horizontal strip of chips above the grid. */
@media (max-width: 760px) {
  .parts__layout { grid-template-columns: 1fr; gap: 1.25rem; }

  .parts__side { position: static; }

  .parts__cats {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .parts__cats::-webkit-scrollbar { display: none; }

  .parts__cat {
    width: auto;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    white-space: nowrap;
  }
  .parts__cat.is-active { border-color: var(--brand); }
  .parts__cat .count { display: none; }   /* no room on a chip */
}
