/* ============================================================================
 * Pershume — shop archive + brand taxonomy (MOBILE-FIRST).
 *
 * Enqueue ONLY on the product listing pages (is_shop() / is_product_category()
 * / is_product_taxonomy() / is_tax('product_brand')). Loads AFTER style.css and
 * woocommerce.css and OWNS the whole archive + brand layout, so it reuses the
 * :root tokens from style.css (--accent / --ink / --line / --gut / --radius …).
 *
 * Authored mobile-first: the base rules target a ~390px phone (80% of traffic);
 * min-width media queries scale up to tablet (2-col) and desktop (3-col, sticky
 * sidebar). Every grid uses minmax(0,1fr) so cards never force overflow.
 * Class names match the markup emitted by inc/template-functions.php so the
 * existing drawer / collapse / chip JS in theme.js keeps working untouched.
 * ========================================================================== */

/* ---------------------------------------------------------------------------
 * Page header (shop / category / tag) + brand hero
 * ------------------------------------------------------------------------- */
.shop-head {
  position: relative;
  overflow: hidden;
  padding-block: clamp(38px, 8vw, 64px) clamp(28px, 5vw, 42px);
  background: linear-gradient(120deg, #2a2348 0%, #4a4ab2 58%, #6b6bb3 100%);
}
/* a thin brass rule closing the band — the one recurring "label" hairline */
.shop-head::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: var(--brass);
}
.shop-head .label {
  margin-bottom: 11px;
}
.shop-head-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
}
.shop-head h1 {
  font-size: clamp(32px, 8vw, 52px);
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1.15;
  color: #fff;
}
/* eyebrow — a small brass marker + label, the "catalogue" motif reused
   across the shop masthead. */
.sh-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brass);
}
.sh-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--brass);
  transform: rotate(45deg);
  flex: none;
}
.sh-main { min-width: 0; }
/* result count — a ledger figure, not a pill badge */
.sh-count {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-inline-start: 20px;
  border-inline-start: 1px solid rgba(255, 255, 255, .28);
}
.shc-n {
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 800;
  line-height: 1;
  color: #fff;
}
.shc-lb {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .68);
  white-space: nowrap;
}
.shop-head .sh-sub {
  margin-top: 8px;
  max-width: 52ch;
  font-size: 13.5px;
  line-height: 1.9;
  font-weight: 300;
  color: rgba(255, 255, 255, .78);
}
.shop-head .sh-desc {
  margin-top: 8px;
  max-width: 64ch;
  font-size: 13.5px;
  line-height: 1.95;
  font-weight: 300;
  color: rgba(255, 255, 255, .78);
}
/* brand archive pages (taxonomy-product_brand.php) share the .shop-head box
   model but keep their own light hero — restore light-page colors here. */
.brand-head h1 {
  color: var(--ink);
  font-weight: 700;
}
.brand-head .sh-sub,
.brand-head .sh-desc {
  color: var(--ink-soft);
}
.shop-head .sh-desc p {
  margin: 0 0 .5em;
}
.shop-head .sh-desc p:last-child {
  margin-bottom: 0;
}

/* result-count pill */
.shop-head .res-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 15px;
  border-radius: 30px;
  background: rgba(107, 107, 179, .08);
  border: 1px solid rgba(107, 107, 179, .2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-deep);
  white-space: nowrap;
}
.shop-head .res-count b {
  font-weight: 800;
  color: var(--accent-deep);
}

/* brand hero */
.brand-head {
  padding-block: clamp(26px, 6vw, 52px) clamp(20px, 4vw, 32px);
  background:
    radial-gradient(130% 120% at 0% 0%, rgba(74, 74, 178, .12) 0%, rgba(74, 74, 178, 0) 58%),
    radial-gradient(120% 120% at 100% 0%, rgba(107, 107, 179, .08) 0%, rgba(107, 107, 179, 0) 55%),
    var(--paper);
}
.brand-head .brand-head-main {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand-head .brand-logo {
  flex: none;
}
.brand-head .brand-logo img {
  display: block;
  max-height: 56px;
  width: auto;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(74, 74, 178, .08);
}

/* ---------------------------------------------------------------------------
 * Layout shell
 * ------------------------------------------------------------------------- */
.shop {
  padding-block: clamp(26px, 6vw, 64px) clamp(44px, 8vw, 90px);
}
.shop-grid {
  display: block;
  align-items: start;
}
.shop-main {
  min-width: 0;
}

/* ---------------------------------------------------------------------------
 * Mobile filter trigger + sort toolbar
 * ------------------------------------------------------------------------- */
.filter-bar-m {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 20px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 30px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .3s, border-color .3s;
}
.filter-btn:hover,
.filter-btn:focus-visible {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  outline: none;
}
.filter-btn svg {
  width: 17px;
  height: 17px;
}
.filter-btn .filter-btn-n {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  margin-inline-start: 2px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tb-count {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 300;
}
.tb-count b {
  color: var(--ink);
  font-weight: 700;
}

/* ---------------------------------------------------------------------------
 * Sort control — a compact native <details>/<summary> dropdown.
 *
 * WHY a dropdown and not the previous 4-across pill row: at a 390px viewport
 * a "پیش‌فرض / پرفروش‌ترین / جدیدترین / ارزان‌ترین / گران‌ترین" pill row
 * cannot fit on-screen — it either wraps to two lines (pushes the grid down)
 * or scrolls horizontally, and a horizontal scroller has near-zero
 * discoverability: nothing signals "گران‌ترین" is one swipe away, so most
 * shoppers never find it. A single trigger showing the CURRENT choice is
 * always fully visible, opens a real ≥44px-per-row menu, and — because it's
 * a native <details> element — works with zero JS (keyboard: Tab + Enter/
 * Space toggles it; every option is a plain <a href> so it degrades to a
 * normal link list even with CSS/JS off).
 * ------------------------------------------------------------------------- */
.sort-dd {
  position: relative;
  align-self: flex-start;
}
.sort-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 30px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  transition: border-color .25s, color .25s;
}
.sort-trigger::-webkit-details-marker {
  display: none;
}
.sort-trigger::marker {
  content: "";
}
.sort-trigger svg:first-child {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex: none;
}
.sort-trigger .st-lbl {
  color: var(--ink-soft);
}
.sort-trigger .st-cur {
  color: var(--ink);
  font-weight: 700;
}
.sort-trigger .st-chev {
  width: 14px;
  height: 14px;
  flex: none;
  margin-inline-start: 2px;
  transition: transform .3s cubic-bezier(.2, .7, .3, 1);
}
.sort-dd[open] .sort-trigger {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.sort-dd[open] .st-chev {
  transform: rotate(180deg);
}
@keyframes sortMenuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sort-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 20;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(28, 27, 36, .16);
  animation: sortMenuIn .18s ease;
}
.sort-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background .2s, color .2s;
}
.sort-opt:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.sort-opt.on {
  background: rgba(107, 107, 179, .09);
  color: var(--accent-deep);
}
.sort-opt .so-ck {
  color: var(--accent);
  font-size: 12px;
}

/* ---------------------------------------------------------------------------
 * Active filters — a removable chip strip shown above the grid the moment
 * any facet is applied, so a shopper always sees (and can undo) what's
 * narrowing their results without opening the sidebar/drawer.
 * ------------------------------------------------------------------------- */
.active-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.af-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.af-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 8px 0 12px;
  background: rgba(107, 107, 179, .08);
  border: 1px solid rgba(107, 107, 179, .22);
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  transition: background .2s, border-color .2s;
}
.af-chip:hover {
  background: rgba(107, 107, 179, .15);
}
.af-chip .af-x {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(107, 107, 179, .16);
  font-size: 10px;
  line-height: 1;
}
.af-clear {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .2s;
}
.af-clear:hover {
  color: var(--ink);
}

/* ---------------------------------------------------------------------------
 * Sidebar — off-canvas drawer on phones, sticky rail on desktop
 * ------------------------------------------------------------------------- */
.sb-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(28, 27, 36, .5);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s, visibility .35s;
}
.sb-overlay.on {
  opacity: 1;
  visibility: visible;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  z-index: 91;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  box-shadow: -18px 0 44px rgba(74, 74, 178, .14);
  transform: translateX(100%);
  transition: transform .4s cubic-bezier(.2, .7, .3, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px var(--gut) 0;
}
.sidebar.open {
  transform: translateX(0);
}

.sb-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 14px;
  margin-bottom: 4px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.sb-head .sbh-t {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.sb-head .sbh-t svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.sb-clear {
  margin-inline-start: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  transition: opacity .25s;
}
.sb-clear:hover {
  opacity: .65;
}
.sb-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  transition: border-color .25s, color .25s;
}
.sb-close:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* collapsible groups — collapsed by default UNLESS they already have an
   active selection (pershume_filter_group_tax() decides server-side, so
   there's no flash-of-wrong-state on load); the count badge in the header
   means a shopper can see what's picked WITHOUT expanding the group. */
.fgroup {
  border-bottom: 1px solid var(--line-soft);
}
.fg-head {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
}
.fg-head .fg-t {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.fg-head .fg-n {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
.fgroup.has-active .fg-head {
  color: var(--accent-deep);
}
.fg-head .fg-ar {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
  transition: transform .3s cubic-bezier(.2, .7, .3, 1);
}
.fgroup.collapsed .fg-ar {
  transform: rotate(-90deg);
}
.fg-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 2px 16px;
}
.fgroup.collapsed .fg-body {
  display: none;
}

/* checkbox rows (brand / concentration) */
.crow {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 2px 0;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  transition: color .25s;
}
.crow:hover {
  color: var(--ink);
}
.crow input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.crow .box {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  transition: background .2s, border-color .2s;
}
.crow input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}
.crow input:checked + .box::after {
  content: "✓";
}
.crow input:focus-visible + .box {
  box-shadow: 0 0 0 3px rgba(107, 107, 179, .25);
}
.crow .ct {
  flex: 1;
  min-width: 0;
}
.crow input:checked ~ .ct {
  color: var(--ink);
  font-weight: 600;
}
.crow .cn {
  flex: none;
  font-family: "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #9a9aa6;
}

/* chips (notes / volume) */
.fchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 6px;
}
.fchip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 30px;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  transition: color .25s, border-color .25s, background .25s;
}
/* visually hidden but still in the a11y tree (unlike the `hidden` attribute,
   which some browsers drop from accessibility entirely) */
.fchip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.fchip:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.fchip.on {
  background: rgba(107, 107, 179, .09);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 700;
}
.fchip:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * Price range — a real dual-handle slider (vanilla JS in theme.js) ABOVE two
 * plain number inputs. WHY both: the slider gives a fast, visual "roughly
 * here" gesture that matches how shoppers actually think about price
 * ("give or take"), while the number inputs stay for exact entry/keyboard
 * users and ARE the actual submitted values — so with JS disabled this
 * degrades to exactly the old two-input form, unchanged.
 * ------------------------------------------------------------------------- */
.price-slider {
  position: relative;
  height: 30px;
  margin: 6px 6px 4px;
  /* numeric sliders read fine LTR even inside an RTL page — this keeps the
     min-handle predictably at the visual start and the max-handle at the
     visual end, regardless of page direction. */
  direction: ltr;
}
.ps-track {
  position: absolute;
  top: 13px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
}
.ps-fill {
  position: absolute;
  top: 13px;
  height: 4px;
  border-radius: 4px;
  background: var(--accent);
}
.ps-range {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.ps-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(74, 74, 178, .3);
  cursor: pointer;
}
.ps-range::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(74, 74, 178, .3);
  cursor: pointer;
}
.ps-range::-moz-range-track {
  background: transparent;
}
.ps-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(107, 107, 179, .28);
}

.ps-vals {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.ps-vals label {
  flex: 1 1 100px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.ps-vals input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  transition: border-color .25s, box-shadow .25s;
}
.ps-vals input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107, 107, 179, .14);
  outline: none;
}
.ps-vals input::-webkit-outer-spin-button,
.ps-vals input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ps-cur {
  flex: none;
  font-size: 11.5px;
  color: #9a9aa6;
}

/* apply button — sticks to the drawer base on phones */
.sb-apply {
  position: sticky;
  bottom: 0;
  z-index: 2;
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 30px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 -10px 22px rgba(255, 255, 255, .85);
  transition: background .3s, border-color .3s;
}
.sb-apply:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

/* ---------------------------------------------------------------------------
 * Product grid — 1 col (phone) → 2 col (tablet) → 3 col (desktop)
 * ------------------------------------------------------------------------- */
.shop-main .grid,
.pershume-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* ---------------------------------------------------------------------------
 * Empty state
 * ------------------------------------------------------------------------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: clamp(48px, 12vw, 80px) 20px;
  color: var(--ink-soft);
}
.empty h3 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.empty p {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.9;
  max-width: 36ch;
  margin-inline: auto;
}

/* ---------------------------------------------------------------------------
 * Pagination (Persian numerals are produced by pershume_fa_pagination())
 * ------------------------------------------------------------------------- */
.woocommerce-pagination {
  margin-top: clamp(30px, 6vw, 54px);
}
.woocommerce-pagination ul {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
}
.woocommerce-pagination ul li {
  margin: 0;
  border: 0;
}
.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: border-color .25s, color .25s, background .25s;
}
.woocommerce-pagination ul li a:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.woocommerce-pagination ul li span.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===========================================================================
 * ≥ 600px — header row, inline toolbar
 * ========================================================================= */
@media (min-width: 600px) {
  .shop-main .grid,
  .pershume-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-head-row {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
  }
  .shop-head .res-count {
    margin-top: 0;
    align-self: flex-end;
  }
  .sh-count {
    align-self: flex-end;
  }
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .tb-sort {
    flex-wrap: wrap;
  }
}

/* ===========================================================================
 * ≥ 768px — widen brand logo
 * ========================================================================= */
@media (min-width: 768px) {
  .brand-head .brand-logo img {
    max-height: 64px;
  }
}

/* ===========================================================================
 * ≥ 901px — static sidebar rail, no drawer / overlay; 2-col product grid
 * ========================================================================= */
@media (min-width: 901px) {
  .shop-grid {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: clamp(24px, 3vw, 44px);
  }
  .filter-bar-m {
    display: none;
  }
  .sb-overlay {
    display: none;
  }
  .sidebar {
    position: sticky;
    top: 96px;
    inset-inline-end: auto;
    bottom: auto;
    z-index: auto;
    width: auto;
    max-height: calc(100vh - 116px);
    padding: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
    overflow-y: auto;
    overscroll-behavior: auto;
  }
  .sb-close {
    display: none;
  }
  .sb-head {
    padding-top: 0;
  }
  .sb-apply {
    position: static;
    box-shadow: none;
  }
  .shop-main .grid,
  .pershume-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(14px, 1.6vw, 22px);
  }
}

/* ===========================================================================
 * ≥ 1081px — 3-col product grid (matches the homepage .grid)
 * ========================================================================= */
@media (min-width: 1081px) {
  .shop-main .grid,
  .pershume-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* search-results: non-product hits render as a simple text card in the grid */
.search-post {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  text-decoration: none;
  color: inherit;
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.search-post:hover {
  border-color: rgba(107, 107, 179, .35);
  box-shadow: 0 16px 34px -20px rgba(40, 36, 80, .3);
  transform: translateY(-4px);
}
.search-post h3 { font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.search-post p { font-size: 13px; font-weight: 300; line-height: 1.9; color: var(--ink-soft); }
.search-post .sp-more { margin-top: auto; font-size: 12.5px; font-weight: 600; color: var(--accent-deep); }

/* Friendlier filter rail and phone drawer: clear sections, larger targets,
   and a visible selected state without changing the filter behavior. */
.pv-shop-sidebar.pv-filters-accordion .sidebar{
  padding:14px;border:1px solid var(--line);border-radius:18px;
  background:linear-gradient(180deg,#fff 0%,#fbfaff 100%);
  box-shadow:0 8px 26px rgba(48,44,84,.055)
}
.pv-shop-sidebar.pv-filters-accordion .sb-head{gap:8px;padding:2px 2px 13px;margin-bottom:8px;border-bottom-color:var(--line-soft)}
.pv-shop-sidebar.pv-filters-accordion .sb-head .sbh-t{gap:8px;font-size:15px;font-weight:800}
.pv-shop-sidebar.pv-filters-accordion .sb-head .sbh-t svg{width:19px;height:19px}
.pv-shop-sidebar.pv-filters-accordion .sb-clear{padding:6px 9px;border:1px solid rgba(107,107,179,.16);border-radius:9px;background:#f7f6fc;font-size:10.5px;font-weight:700;white-space:nowrap}
.pv-shop-sidebar.pv-filters-accordion .sb-close{width:34px;height:34px;border-radius:10px;font-size:15px}
.pv-shop-sidebar.pv-filters-accordion .fgroup{margin:4px 0;padding:0;border:0}
.pv-shop-sidebar.pv-filters-accordion .fg-head{min-height:46px;padding:0 10px;border:1px solid transparent;border-radius:11px;background:#f7f6fb;font-size:13px;font-weight:800;transition:background .2s,border-color .2s,color .2s}
.pv-shop-sidebar.pv-filters-accordion .fg-head:hover{background:#f0eff9}
.pv-shop-sidebar.pv-filters-accordion .fgroup.has-active .fg-head{border-color:rgba(107,107,179,.18);background:#f2f0fb;color:var(--accent-deep)}
.pv-shop-sidebar.pv-filters-accordion .fg-head .fg-t{align-items:center;gap:7px}
.pv-shop-sidebar.pv-filters-accordion .fg-head .fg-n{display:inline-flex;align-items:center;justify-content:center;min-width:19px;height:19px;padding:0 5px;border-radius:99px;background:rgba(107,107,179,.11);font-size:10px}
.pv-shop-sidebar.pv-filters-accordion .fg-head .fg-ar{width:22px;height:22px;padding:4px;border-radius:7px;background:#fff;color:var(--ink-soft)}
.pv-shop-sidebar.pv-filters-accordion .fg-body{gap:6px;margin-top:5px;padding:8px;border:1px solid var(--line-soft);border-radius:12px;background:rgba(255,255,255,.88)}
.pv-shop-sidebar.pv-filters-accordion .crow{min-height:42px;padding:0 8px;border:1px solid transparent;border-radius:9px;font-size:12px;color:var(--ink)}
.pv-shop-sidebar.pv-filters-accordion .crow:hover{background:#faf9fe;border-color:var(--line-soft)}
.pv-shop-sidebar.pv-filters-accordion .crow.on{border-color:rgba(107,107,179,.2);background:#f5f3fc;color:var(--accent-deep)}
.pv-shop-sidebar.pv-filters-accordion .crow .box{width:19px;height:19px;border-color:#d8d5e7;border-radius:6px}
.pv-shop-sidebar.pv-filters-accordion .crow input:checked + .box{border-color:var(--accent);background:var(--accent)}
.pv-shop-sidebar.pv-filters-accordion .crow .ct{font-size:12px;font-weight:650}
.pv-shop-sidebar.pv-filters-accordion .crow .cn{min-width:30px;padding:3px 6px;border-radius:99px;background:#f3f2f7;text-align:center;font-size:9.5px;color:#858292}
.pv-shop-sidebar.pv-filters-accordion .crow.on .cn{background:rgba(107,107,179,.1);color:var(--accent-deep)}
.pv-shop-sidebar.pv-filters-accordion .fchips{gap:6px;padding:2px 0 3px}
.pv-shop-sidebar.pv-filters-accordion .fchip{min-height:38px;padding:0 10px;border-radius:10px;background:#fff;font-size:11.5px}
.pv-shop-sidebar.pv-filters-accordion .fchip.on{background:#f3f1fb;border-color:rgba(107,107,179,.28)}
.pv-shop-sidebar.pv-filters-accordion .price-slider{height:34px;margin:3px 8px 8px}
.pv-shop-sidebar.pv-filters-accordion .ps-track,.pv-shop-sidebar.pv-filters-accordion .ps-fill{top:15px;height:4px}
.pv-shop-sidebar.pv-filters-accordion .ps-range{top:7px;height:20px}
.pv-shop-sidebar.pv-filters-accordion .ps-range::-webkit-slider-thumb{width:21px;height:21px;box-shadow:0 2px 7px rgba(74,74,178,.22)}
.pv-shop-sidebar.pv-filters-accordion .ps-vals{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:0 0 2px;font-size:10px}
.pv-shop-sidebar.pv-filters-accordion .ps-vals label{display:grid;grid-template-columns:1fr;gap:5px;min-width:0}
.pv-shop-sidebar.pv-filters-accordion .ps-vals input{height:40px;padding:0 9px;border-radius:9px;text-align:center;font-size:12px}
.pv-shop-sidebar.pv-filters-accordion .ps-cur{grid-column:1/-1;text-align:left;font-size:9.5px}
.pv-shop-sidebar.pv-filters-accordion .sb-apply{min-height:46px;margin-top:12px;padding:11px 14px;border-radius:12px;font-size:13px;font-weight:800;box-shadow:0 7px 16px rgba(107,107,179,.2)}
@media(max-width:900px){
  .pv-shop-sidebar.pv-filters-accordion .sidebar{width:min(380px,94vw);padding:14px 14px max(12px,env(safe-area-inset-bottom));border-radius:18px 0 0 18px}
  .pv-shop-sidebar.pv-filters-accordion .sb-head{top:0;padding-top:5px}
  .pv-shop-sidebar.pv-filters-accordion .sb-apply{padding-bottom:max(11px,env(safe-area-inset-bottom))}
}
@media(min-width:901px){
  .pv-shop-sidebar.pv-filters-accordion .sidebar{padding:14px;}
  .pv-shop-sidebar.pv-filters-accordion .sb-apply{position:sticky;bottom:0;z-index:2;background:var(--accent);box-shadow:0 7px 16px rgba(107,107,179,.2)}
}
