/*!
 * plp.css — product list page (task T2).
 *
 * Additive only: site.css is never modified. Loaded from site/src/pages/
 * products.html because scripts/build.py auto-injects site/assets/css/<route
 * folder>.css and the route folder here is "products", not "plp".
 */

/* ------------------------------------------------------------------ *
 * 1. [hidden] must win over the display utilities on the same element.
 *    The imported markup pairs `hidden` with .flex/.grid classes, which
 *    would otherwise keep filtered-out cards on screen.
 * ------------------------------------------------------------------ */
[data-products-grid] > a[hidden],
[data-pagination][hidden],
[data-empty-state][hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ *
 * 2. Card badges.
 *    The captured card carried an inline --tone per box type; the replica
 *    has category data instead, so the tone comes from data-category.
 *    Only booster boxes / small gift sets / accessories were visible on the
 *    original list page, so only those three tones are known; everything
 *    else falls back to the design system's steel chip.
 * ------------------------------------------------------------------ */
[data-products-grid] .type-chip {
  --tone: var(--plp-tone, var(--color-type-steel));
}
[data-products-grid] a[data-category="booster-boxes"] { --plp-tone: #ff6a1f; }
[data-products-grid] a[data-category="small-gift-sets"] { --plp-tone: #ffcb05; }
[data-products-grid] a[data-category="accessories"] { --plp-tone: #3cb867; }

/* a product without a unit price, or without a set, hides that chip */
[data-products-grid] a[data-per-unit=""] .type-chip-unit { display: none; }
[data-products-grid] a[data-set=""] .set-code { display: none; }

/* out of stock reads "Enquire": muted, no live pulse */
[data-products-grid] a[data-stock="Enquire"] .plp-stock { color: var(--color-on-surface-variant); }
[data-products-grid] a[data-stock="Enquire"] .plp-dot {
  background: var(--color-outline);
  animation: none;
}

/* ------------------------------------------------------------------ *
 * 3. Below lg the imported sidebar is display:none and the "Filters"
 *    button has nothing to open. Reuse the same <aside> as a drawer so the
 *    markup, counts and classes stay identical to the desktop sidebar.
 * ------------------------------------------------------------------ */
.plp-drawer-backdrop,
.plp-drawer-bar {
  display: none;
}

@media (max-width: 1023.98px) {
  body.plp-filters-open {
    overflow: hidden;
  }

  body.plp-filters-open .plp-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgb(11 15 26 / 45%);
  }

  [data-filters-panel].plp-open {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 60;
    width: 100% !important;
    max-width: none;
    margin: 0;
    padding: 0 1rem 2rem;
    background: var(--color-surface);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* the sidebar is sticky on desktop; inside the drawer it just scrolls */
  [data-filters-panel].plp-open > .sticky {
    position: static;
    top: auto;
  }

  [data-filters-panel].plp-open .plp-drawer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.75rem 0.25rem;
    background: var(--color-surface);
  }

  .plp-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 9999px;
    background: #fff;
    color: var(--color-ink);
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgb(196 202 214 / 35%);
  }
}
