/*
 * STRUCTURE AUDIT — shop listing families across Appily / sibling storefronts (do not reuse):
 * - Left sidebar + uniform auto-fill minmax() card grid (most trader clones, A93, A95, many a*-shop.css).
 * - A119 / shoppers-hub-3 sl-*: sticky command rail + category horizontal scroll LANES (ol packets per aisle).
 * - A97 spool rack: thread-rack filters + uniform product grid + slide filter rack.
 * - A119 tidepool (prior): left aside sieve + uniform bento specimen grid (ts-sieve / ts-bento).
 * - Combstrip / numbered horizontal product STRIPS (Ninetytwo shop).
 * - Spool / bobbin mosaic editorial spans with top filter drawer (A115).
 * - Drift lens / pigment chip filters + card wall (several a110–a118).
 * - Spotlight split: sticky PDP preview + scrolling list (not yet used on A120).
 * - Pagination: centered numeral row (a36-shop-pagination) — layout reused; product region must differ.
 *
 * THIS FILE — MOSAIC COMMAND (Appily onehundredtwenty):
 * - Sticky sh-command bar: labelled search + sort + refine (dialog); aisle chips row (no sidebar).
 * - Results: uniform pack grid (equal cells, square frames, contain-fit photos) — not span mosaic or aisle lanes.
 * - Mobile: chip scroll, bottom-anchored filter dialog, 2.75rem touch targets.
 */

.page-shop {
  overflow-x: clip;
}

.sh-shop {
  padding-bottom: var(--at-space-6);
}

.sh-shop__mast {
  padding: var(--at-space-5) 0 var(--at-space-3);
}

.sh-shop__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: var(--at-space-3) 0 0;
  padding: 0;
}

.sh-shop__active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: var(--at-space-3) 0 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
}

.sh-shop__active a {
  font-weight: 600;
  color: var(--at-moss);
}

.sh-shop__stage {
  padding-bottom: var(--at-space-7);
}

.sh-shop__stage-inner {
  display: flex;
  flex-direction: column;
  gap: var(--at-space-5);
  min-width: 0;
}

/* —— Command bar —— */
body.a120-body.page-shop .sh-command {
  padding: var(--at-space-4);
  background: color-mix(in srgb, var(--at-surface) 94%, var(--at-canvas) 6%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--at-line);
  border-radius: var(--at-radius-lg);
  box-shadow: var(--at-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--at-space-3);
}

@media (max-width: 767px) {
  body.a120-body.page-shop .sh-command {
    margin-inline: calc(-1 * var(--at-gutter));
    padding: var(--at-space-3) var(--at-gutter);
    border-radius: 0;
    border-inline: none;
    box-shadow: 0 0.35rem 1rem color-mix(in srgb, var(--at-ink) 6%, transparent);
  }
}

.sh-command__bar {
  display: grid;
  gap: var(--at-space-3);
  align-items: end;
}

@media (min-width: 768px) {
  .sh-command__bar {
    grid-template-columns: minmax(0, 1.4fr) minmax(8rem, 10rem) auto auto;
  }
}

@media (max-width: 767px) {
  .sh-command__bar {
    grid-template-columns: 1fr;
  }

  .sh-command__submit,
  .sh-command__refine {
    width: 100%;
    justify-content: center;
  }
}

.sh-command__search label,
.sh-command__sort label {
  display: block;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--at-ink-soft);
}

.sh-command__submit,
.sh-command__refine {
  min-height: 2.75rem;
  min-width: 2.75rem;
}

.sh-command__refine {
  position: relative;
}

.sh-command__badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: var(--at-radius-pill);
  background: var(--at-terra);
  color: var(--at-surface);
  font-family: var(--at-font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.sh-command__chips {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.sh-command__chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-height: 2.75rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  font-weight: 600;
  text-decoration: none;
  color: var(--at-ink-soft);
  border-radius: var(--at-radius-pill);
  border: 1px solid var(--at-line);
  background: var(--at-canvas);
  transition: border-color var(--at-dur) var(--at-ease), background var(--at-dur) var(--at-ease), color var(--at-dur) var(--at-ease);
}

.sh-command__chip:hover {
  border-color: color-mix(in srgb, var(--at-moss) 40%, var(--at-line));
  color: var(--at-ink);
}

.sh-command__chip:focus-visible {
  outline: 2px solid var(--at-moss);
  outline-offset: 2px;
}

.sh-command__chip.is-active {
  background: var(--at-moss);
  color: var(--at-surface);
  border-color: var(--at-moss);
}

.sh-command__chip-n {
  opacity: 0.85;
  margin-left: 0.25rem;
}

.sh-command__meter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  color: var(--at-ink-soft);
}

.sh-command__meter-track {
  flex: 1 1 8rem;
  height: 0.4rem;
  border-radius: var(--at-radius-pill);
  background: var(--at-canvas-deep);
  overflow: hidden;
}

.sh-command__meter-fill {
  display: block;
  height: 100%;
  width: var(--sh-fill, 0%);
  background: var(--at-moss-light);
  border-radius: inherit;
}

/* —— Filter sheet —— */
.sh-sheet {
  margin: auto;
  max-width: 28rem;
  width: calc(100% - 2rem);
  max-height: min(90vh, 40rem);
  padding: 0;
  border: none;
  border-radius: var(--at-radius-lg);
  background: var(--at-surface);
  box-shadow: var(--at-shadow-lg);
}

.sh-sheet::backdrop {
  background: rgba(30, 45, 36, 0.45);
}

@media (max-width: 767px) {
  .sh-sheet {
    margin: 0;
    width: 100%;
    max-width: none;
    max-height: 85vh;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--at-radius-lg) var(--at-radius-lg) 0 0;
  }
}

.sh-sheet__form {
  display: flex;
  flex-direction: column;
  gap: var(--at-space-3);
  padding: var(--at-space-4);
  max-height: inherit;
  overflow: auto;
}

.sh-sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--at-space-3);
}

.sh-sheet__head .ds-title {
  font-size: var(--at-text-lg);
  margin: 0;
}

.sh-sheet__field {
  display: grid;
  gap: 0.35rem;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
}

.sh-sheet__group {
  border: 1px solid var(--at-line);
  border-radius: var(--at-radius-md);
  padding: var(--at-space-3);
  margin: 0;
}

.sh-sheet__group legend {
  font-family: var(--at-font-ui);
  font-weight: 600;
  padding: 0 0.25rem;
}

.sh-sheet__scroll {
  max-height: 10rem;
  overflow: auto;
}

.sh-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  min-height: 2.75rem;
  padding: 0.35rem 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
}

.sh-check input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.sh-sheet__price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--at-space-3);
}

.sh-sheet__note {
  margin: 0 0 var(--at-space-2);
  font-size: var(--at-text-xs);
  color: var(--at-ink-soft);
}

.sh-sheet__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--at-space-3);
  justify-content: flex-end;
  padding-top: var(--at-space-2);
}

.sh-sheet__meter {
  font-family: var(--at-font-ui);
  font-size: var(--at-text-sm);
}

/* —— Empty —— */
.sh-empty {
  text-align: center;
  padding: var(--at-space-6);
}

.sh-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--at-space-3);
  justify-content: center;
  margin-top: var(--at-space-4);
}

/* —— Pack grid (uniform cells) —— */
.sh-mosaic {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--at-space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

@media (min-width: 640px) {
  .sh-mosaic {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .sh-mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--at-space-4) var(--at-space-5);
  }
}

.sh-mosaic__cell {
  min-width: 0;
  display: flex;
}

.sh-tile.ds-card {
  padding: 0;
  width: 100%;
}

.sh-tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow var(--at-dur) var(--at-ease);
}

.sh-tile:hover {
  box-shadow: var(--at-shadow-md);
}

.sh-tile.is-sold-out {
  opacity: 0.88;
}

.sh-tile__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  aspect-ratio: 1;
  margin: var(--at-space-3) var(--at-space-3) 0;
  border-radius: var(--at-radius-md);
  overflow: hidden;
  background: color-mix(in srgb, var(--at-dew) 88%, var(--at-surface) 12%);
  border: 1px solid var(--at-line);
}

.sh-tile__media img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: var(--at-space-2);
  box-sizing: border-box;
}

.sh-tile__badge {
  position: absolute;
  top: var(--at-space-2);
  left: var(--at-space-2);
  z-index: 1;
}

.sh-tile__body {
  padding: var(--at-space-3);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 auto;
}

.sh-tile__sku {
  margin: 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--at-moss-light);
}

.sh-tile__title {
  margin: 0;
  font-family: var(--at-font-display);
  font-size: var(--at-text-sm);
  font-weight: 400;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.6em;
}

.sh-tile__title a {
  text-decoration: none;
  color: var(--at-ink);
  overflow-wrap: anywhere;
}

.sh-tile__title a:hover {
  color: var(--at-moss);
}

.sh-tile__price {
  margin: 0;
  font-family: var(--at-font-ui);
  font-size: var(--at-text-md);
  font-weight: 700;
  color: var(--at-terra);
}

.sh-tile__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: var(--at-space-2);
}

@media (min-width: 480px) {
  .sh-tile__actions {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.sh-tile__actions .ds-btn,
.sh-tile__actions form {
  width: 100%;
  min-width: 0;
}

.sh-tile__actions .ds-btn {
  min-height: 2.5rem;
  padding-inline: 0.5rem;
  font-size: var(--at-text-xs);
  justify-content: center;
}

.sh-tile__actions form button {
  width: 100%;
  min-height: 2.5rem;
}

.ds-btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* —— Pagination —— */
.sh-pages {
  display: flex;
  justify-content: center;
  padding-top: var(--at-space-4);
}

.sh-pages .a36-shop-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  font-family: var(--at-font-ui);
}

.sh-pages .a36-page-num,
.sh-pages .a36-page-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  border-radius: var(--at-radius-md);
  text-decoration: none;
  color: var(--at-ink);
  border: 1px solid var(--at-line);
  background: var(--at-surface);
}

.sh-pages .a36-page-num.is-active {
  background: var(--at-moss);
  color: var(--at-surface);
  border-color: var(--at-moss);
}

.sh-pages .a36-page-gap {
  padding: 0 0.25rem;
  color: var(--at-ink-soft);
}
