/* The Shop's browsing UI (web/shop-browser.js): a filter sidebar beside the grid of
   garments. Shown on /shop and, the same, in the design tool's "Change product" dialog
   (design.html loads this file too; the dialog's own frame is in design.css). The cards
   themselves (.cat-card, .cat-thumb) are in site.css. */

.shop-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; }

.shop-filters { display: grid; align-content: start; gap: 18px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-right: 4px; }
.shop-filters-head { display: none; }
.shop-filters .cat-search input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 13px;
}
.shop-filters .cat-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shop-facets { display: grid; gap: 20px; }

.facet { display: grid; gap: 8px; }
.facet-title {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft);
}
.facet-list, .facet-sublist { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.facet-sublist { margin: 2px 0 4px 12px; padding-left: 8px; border-left: 2px solid var(--line-soft); }
.facet-link {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%;
  font: inherit; font-size: 14.5px; text-align: left; color: var(--ink-soft);
  background: transparent; border: 0; border-radius: var(--r-sm); padding: 6px 8px; cursor: pointer;
}
.facet-link:hover { background: var(--panel); color: var(--ink); }
.facet-link[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.facet-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.facet-count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 500; }

.facet-checks { display: grid; gap: 2px; }
.facet-checks--scroll { max-height: 236px; overflow: auto; padding-right: 4px; }
.facet-check {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px;
  font-size: 14.5px; color: var(--ink-soft); padding: 5px 8px; border-radius: var(--r-sm); cursor: pointer;
}
.facet-check:hover { background: var(--panel); color: var(--ink); }
.facet-check input { margin: 0; accent-color: var(--accent-fill); width: 16px; height: 16px; }

.shop-main { min-width: 0; }
.shop-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.shop-bar .cat-count { margin: 0 auto 0 0; font-weight: 600; color: var(--ink-soft); }
.shop-filters-open { display: none; }

.facet-check-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.facet-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.facet-note { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.shop-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.shop-sort select {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px;
}
.shop-sort select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.shop-active { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.shop-chip {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--accent-ink); background: var(--accent-soft); border: 1px solid transparent; border-radius: 999px;
  padding: 6px 10px 6px 12px; cursor: pointer;
}
.shop-chip:hover { border-color: var(--accent); }
.shop-chip-x { font-size: 15px; line-height: 1; }
.shop-clear { font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 6px; }
.shop-clear:hover { color: var(--ink); }

/* Swatches on a card: the supplier's own swatch image in a small round well. */
.shop-dots { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 2px; }
.shop-dot {
  position: relative; width: 18px; height: 18px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--panel-2, #E4E7EC); border: 1px solid var(--line);
}
.shop-dot-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-dot-btn { padding: 0; cursor: pointer; font: inherit; }
.shop-dot-btn:hover { border-color: var(--ink-soft); }
.shop-dot-btn[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent-fill); border-color: transparent; }
.shop-dot-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* The card is a box holding two links (the photo, and the title) and the swatch row
   between them, rather than one link round everything. */
.shop-main .cat-card { gap: 8px; }
.cat-card-img { display: block; border-radius: var(--r-md); text-decoration: none; }
.cat-card-link { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.cat-card-link:hover .cat-card-title { text-decoration: underline; }
.cat-card-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
.shop-dots-more { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.cat-badge--new { color: var(--accent-ink); border-style: solid; border-color: var(--accent); }

/* Pick mode (the design tool's dialog): the photo and the title are buttons that pick the
   garment rather than links, drawn exactly as the links are; "+N" opens the rest of the
   colors; the garment the design is on is marked. */
.cat-card-pick { font: inherit; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; width: 100%; }
.cat-card-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
.shop-dots-more-btn { background: none; border: 0; border-radius: var(--r-sm); padding: 1px 4px; cursor: pointer; font-family: inherit; }
.shop-dots-more-btn:hover { color: var(--ink); text-decoration: underline; }
.shop-dots-more-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cat-card--current { border-color: var(--accent-fill); box-shadow: 0 0 0 1px var(--accent-fill), var(--shadow-sm); }
.cat-badge--current { color: var(--on-accent, #fff); background: var(--accent-fill); border-style: solid; border-color: var(--accent-fill); }
.shop-dot--current::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(10, 12, 18, .7);
}
.cat-card[aria-busy='true'] { opacity: .6; cursor: progress; }

.shop-backdrop { display: none; }

@media (max-width: 900px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-filters-open { display: inline-flex; }
  /* The sidebar becomes a drawer from the left, over a dimmed page. */
  .shop-filters {
    position: fixed; z-index: var(--layer-dialog); top: 0; bottom: 0; left: 0; width: min(360px, 88vw);
    max-height: none; overflow: auto; padding: 0 18px 24px; background: var(--bg);
    box-shadow: var(--shadow-lg); transform: translateX(-104%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .shop-filters.is-open { transform: none; visibility: visible; transition: transform .2s ease; }
  .shop-filters-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 14px 0 12px; border-bottom: 1px solid var(--line-soft);
  }
  .shop-filters-head h2 { margin: 0; font-size: 20px; }
  .shop-filters-done { padding: 9px 14px; font-size: 14px; }
  .shop-backdrop:not([hidden]) {
    display: block; position: fixed; inset: 0; z-index: calc(var(--layer-dialog) - 1); background: rgba(10, 12, 18, .45);
  }
  body.shop-drawer-open { overflow: hidden; }
  .shop-bar .cat-count { flex-basis: 100%; }
  .shop-sort { margin-left: auto; }
}
@media (max-width: 560px) {
  .shop-main .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shop-main .cat-card { padding: 8px; }
  .shop-main .cat-card-title { font-size: 13.5px; }
  .shop-dots { gap: 4px; }
  .shop-dot { width: 16px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .shop-filters, .shop-filters.is-open { transition: none; }
}
