/* =========================================================
   FARSHESTAN — SHOP
   Heritage + modernism:
   - Persian script set as display type beside the Latin
   - madder red + indigo, the two classic rug dyes
   - each rug on a warm white card; space instead of rules
========================================================= */

@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/Vazirmatn.ttf') format('truetype');
  font-display: swap;
}

:root {
  --cream: #f7f2eb;
  --sand: #ece4d8;
  --paper: #ffffff;
  --ink: #000000;
  --muted: #5e574f;
  --madder: #A52A2A;
  --indigo: #1f2a44;
  --card: #fffdf9;

  --serif: 'Noto Naskh Arabic', serif;
  --sans: 'Vazirmatn', sans-serif;

  --gutter: 3rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Type scale shared by every page (the homepage headline sets it) */
  --h-display: clamp(1.75rem, 3.4vw, 2.75rem);   /* page titles and section headings */
  --h-fa: clamp(1.5rem, 2.4vw, 2rem);            /* the Persian word above a heading */
  --h-title: clamp(1.4rem, 2vw, 1.75rem);        /* product names, empty states, smaller headings */
  --h-sub: clamp(1.2rem, 1.6vw, 1.45rem);        /* card and list headings */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

/* The menu's logo images must keep their natural width */
#menuBar img {
  max-width: none;
}

button {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--madder);
  outline-offset: 3px;
}

.fa {
  font-family: var(--serif);
  direction: rtl;
  unicode-bidi: isolate;
}


/* =========================================================
   SLIDE-UP INFO PANEL
========================================================= */

#slidePanel {
  position: fixed;
  left: 0;
  bottom: -100%;
  width: 100%;
  height: 100%;
  background: var(--cream);
  z-index: 100002;
  transition: bottom 0.6s var(--ease);
}

#panelContent {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}


/* =========================================================
   INTRO — Latin and Persian titles facing each other
========================================================= */

#shop-intro {
  padding: 140px var(--gutter) 2.5rem;
}

/* Persian word above the Latin title, as on the homepage */
.shop-intro-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "persian"
    "latin"
    "text";
}

#shop-intro h1 {
  grid-area: latin;
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--h-display);
  line-height: 1.1;
}

#shop-intro .fa-title {
  grid-area: persian;
  justify-self: start;
  margin: 0 0 0.35rem;
  font-size: var(--h-fa);
  font-weight: 400;
  line-height: 1.2;
  color: var(--madder);
}

#shop-intro p {
  grid-area: text;
  margin: 1.1rem 0 0;
  max-width: 62ch;
  font-size: 1.05rem;
  line-height: 1.55;
}

/* Pages without the intro still need to clear the fixed menu */
body.no-intro #filter-controls {
  margin-top: 120px;
}


/* =========================================================
   FILTER BAR
========================================================= */

#filter-controls {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 var(--gutter);
  padding: 0.75rem;
  background: var(--sand);
}

.filter-heading {
  margin: 0 0.75rem 0 0.25rem;
}

.filter-heading label {
  font-size: 0.95rem;
  color: var(--muted);
}

#result-count {
  margin-left: auto;
  margin-right: 0.25rem;
  font-size: 0.95rem;
  color: var(--muted);
}


/* ---------- dropdown trigger ---------- */

.custom-select-wrapper {
  position: relative;
  outline: none;
}

.custom-select {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 42px;
  padding: 0.55rem 1rem;
  background: var(--cream);
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.custom-select:hover,
.custom-select-wrapper.open .custom-select {
  background: var(--ink);
  color: var(--cream);
}

.custom-select-wrapper:focus-visible {
  outline: 2px solid var(--madder);
  outline-offset: 2px;
}

.custom-select .selected {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.arrow {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 0.25rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.35s var(--ease);
}

.custom-select-wrapper.open .custom-select .arrow {
  transform: translateY(2px) rotate(-135deg);
}


/* ---------- swatches ---------- */

.color-swatch {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.swatch-all {
  background:
    radial-gradient(circle at 15% 50%, red 10%, transparent 50%),
    radial-gradient(circle at 35% 25%, orange 10%, transparent 50%),
    radial-gradient(circle at 55% 50%, yellow 10%, transparent 50%),
    radial-gradient(circle at 75% 25%, green 10%, transparent 50%),
    radial-gradient(circle at 90% 50%, blue 10%, transparent 50%),
    radial-gradient(circle at 70% 70%, indigo 10%, transparent 50%),
    radial-gradient(circle at 40% 75%, violet 10%, transparent 50%);
  background-blend-mode: screen;
}


/* ---------- dropdown panel ---------- */

.custom-options {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-width: calc(100vw - 2rem);
  padding: 0.5rem;
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(31, 42, 68, 0.14);
  z-index: 60;
}

.custom-select-wrapper.open .custom-options {
  display: block;
  animation: dropIn 0.25s var(--ease);
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.price-options .dropdown-header {
  justify-content: flex-end;
}

.reset-button {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.color-option:hover {
  background: var(--cream);
}

.color-option.selected::after {
  content: '';
  margin-left: auto;
  width: 5px;
  height: 10px;
  border-right: 1.5px solid var(--madder);
  border-bottom: 1.5px solid var(--madder);
  transform: translate(-3px, -2px) rotate(45deg);
}


/* ---------- price slider ---------- */

.price-options {
  min-width: 290px;
}

.price-slider-container {
  padding: 0.5rem 0.5rem 0.75rem;
}

#priceRangeLabel {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 1rem;
}

.range-slider {
  position: relative;
  height: 20px;
}

.slider-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: var(--ink);
  z-index: 1;
}

.range-slider input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  z-index: 2;
}

.range-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: transparent;
}

.range-slider input[type="range"]::-moz-range-track {
  height: 2px;
  background: transparent;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  margin-top: -7px;
  background: var(--madder);
  transform: rotate(45deg);
  cursor: grab;
}

.range-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 0;
  background: var(--madder);
  transform: rotate(45deg);
  cursor: grab;
}


/* =========================================================
   PRODUCT GRID — square white tiles, no rules
========================================================= */

#image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 3.5rem 1.5rem;
  padding: 2.5rem var(--gutter) 7rem;
}

#image-grid:empty::before {
  content: 'Loading the collection…';
  grid-column: 1 / -1;
  padding: 5rem 0;
  text-align: center;
  font-family: var(--serif);
  font-size: var(--h-sub);
  color: var(--muted);
}

.image-item {
  cursor: pointer;
  outline: none;
  background: var(--card);
  transition: box-shadow 0.4s ease;
}

.image-item:hover {
  box-shadow: 0 14px 34px rgba(60, 40, 20, 0.1);
}

.image-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  padding: 2.2rem 2.2rem 1.2rem;
  background: transparent;
  overflow: hidden;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.22));
  transition: transform 0.8s var(--ease);
}

.image-item:hover .image-frame img,
.image-item:focus-visible .image-frame img {
  transform: scale(1.05);
}

.image-item:focus-visible {
  outline: 2px solid var(--madder);
  outline-offset: 3px;
}

/* Gallery label: town in small capitals, design in serif, then the price */
.image-caption {
  padding: 0.4rem 1rem 1.8rem;
  text-align: center;
}

.caption-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.5;
}

.caption-title .t-town {
  display: block;
}

.caption-title .t-design {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.caption-subtitle {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--ink);
  white-space: nowrap;
}

.image-item:hover .caption-title {
  color: var(--madder);
}

.grid-message {
  grid-column: 1 / -1;
  padding: 5rem 0;
  text-align: center;
}

.grid-message h2 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-weight: normal;
  font-size: var(--h-title);
}

.grid-message p {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  color: var(--muted);
}


/* =========================================================
   BUTTONS
========================================================= */

.cta-button,
.add-to-cart {
  padding: 0.95rem 1.5rem;
  border: none;
  background-color: var(--ink);
  color: var(--cream);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.cta-button:hover,
.add-to-cart:hover {
  background-color: var(--indigo);
}


/* =========================================================
   PRODUCT MODAL — square, image flush on white
========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(31, 42, 68, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  width: min(1120px, 100%);
  max-height: calc(100vh - 4rem);
  overflow: auto;
  background: var(--cream);
  transition: transform 0.45s var(--ease);
}

.modal.hidden .modal-content {
  transform: translateY(24px);
}

#modal-image {
  width: 100%;
  height: 100%;
  min-height: 520px;
  max-height: calc(100vh - 4rem);
  padding: 3rem;
  object-fit: contain;
  background: var(--sand);
  cursor: zoom-in;
  touch-action: none;
}

/* Zoom loupe */
.modal-media {
  position: relative;
  display: flex;
  min-width: 0;
}

.loupe-lens {
  position: absolute;
  z-index: 2;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  pointer-events: none;
  background-repeat: no-repeat;
  background-color: var(--sand);
  box-shadow: 0 0 0 3px var(--cream), 0 12px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  transition: opacity 0.2s, transform 0.25s var(--ease);
}

.loupe-lens.on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.loupe-hint {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  pointer-events: none;
}

#modal-description {
  display: none;
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  padding: 1px 8px;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 1.7rem;
  font-weight: 200;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.modal-text {
  display: flex;
  flex-direction: column;
  align-self: center;
  padding: 3.5rem 3rem;
}

.modal-origin {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--madder);
}

.modal-title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-weight: normal;
  font-size: var(--h-title);
  line-height: 1.2;
}

.modal-price {
  margin: 0 0 2rem;
  font-size: 1.25rem;
}

.collapsible-section + .collapsible-section {
  margin-top: 0.25rem;
}

.collapsible-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 0;
  border: 0;
  background: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

/* + / − toggle instead of a chevron */
.collapsible-btn .arrow {
  position: relative;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 0;
  transform: none;
}

.collapsible-btn .arrow::before,
.collapsible-btn .arrow::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease);
}

.collapsible-btn .arrow::after {
  transform: rotate(90deg);
}

.collapsible-btn.expanded .arrow::after {
  transform: rotate(0deg);
}

.collapsible-content p {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
}

.add-to-cart {
  width: 100%;
  margin-top: 2rem;
  padding: 1.05rem;
}

.add-to-cart.added,
.add-to-cart.added:hover {
  background-color: var(--madder);
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {
  .modal-content {
    grid-template-columns: 1fr;
  }

  #modal-image {
    min-height: 0;
    height: auto;
    max-height: 48vh;
    padding: 2rem 2rem 2.75rem;
  }

  .modal-text {
    padding: 2rem 1.5rem 2.5rem;
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 1rem;
  }

  #shop-intro {
    padding-top: 120px;
  }

  #filter-controls {
    margin: 0;
  }

  .filter-heading {
    display: none;
  }

  .custom-select-wrapper.price-select-wrapper .custom-options {
    left: auto;
    right: 0;
  }

  .price-options {
    min-width: 260px;
  }

  #image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.25rem 0.75rem;
    padding-top: 1.5rem;
  }

  .image-frame {
    padding: 1.1rem 1.1rem 0.8rem;
  }

  .image-caption {
    padding: 0.3rem 0.6rem 1.4rem;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    max-height: 94vh;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}


/* =========================================================
   SHOP BY REGION (above the footer)
========================================================= */

.section-fa {
  display: block;
  margin: 0 0 0.35rem;
  font-size: var(--h-fa);
  text-align: left;
}

.text-link {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.by-region {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  grid-template-areas:
    "head  map"
    "panel map";
  column-gap: 3rem;
  align-items: center;
  padding: 5rem var(--gutter);
  background: var(--sand);
  color: var(--ink);
}

.region-head { grid-area: head; align-self: end; }
.by-region .map-wrap { grid-area: map; }
.region-panel { grid-area: panel; align-self: start; }

.by-region .section-fa {
  color: var(--madder);
}

.by-region h2 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--h-display);
  line-height: 1.1;
}

.region-intro {
  margin: 0 0 2rem;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.region-panel {
  min-height: 210px;
  padding: 1.5rem;
  background: var(--card);
}

.region-panel .hint {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--ink);
  vertical-align: -1px;
}

.legend i.ring {
  width: 8px;
  height: 8px;
  background: transparent;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.6);
  outline: 1.5px dashed rgba(0, 0, 0, 0.45);
  outline-offset: 3px;
}

.region-panel .place-fa {
  display: block;
  font-size: var(--h-fa);
  line-height: 1.2;
  color: var(--madder);
  text-align: left;
}

.region-panel h3 {
  margin: 0.4rem 0 0.25rem;
  font-family: var(--serif);
  font-weight: normal;
  font-size: var(--h-title);
}

.region-panel .meta {
  margin: 0 0 1rem;
  color: var(--muted);
}

.region-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.region-thumbs button {
  width: 78px;
  aspect-ratio: 4 / 5;
  padding: 6px;
  border: 0;
  background: var(--cream);
  cursor: pointer;
  outline: 2px solid transparent;
  transition: outline-color 0.2s, background-color 0.2s;
}

.region-thumbs button:hover {
  outline-color: var(--madder);
  background: var(--sand);
}

.region-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.region-panel .text-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--ink);
}

.region-panel .text-link:hover {
  color: var(--madder);
}

/* The map */
.map {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.map-dark .map-grid { fill: rgba(0, 0, 0, 0.12); }

.map-sea {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
}

.map-dark .map-sea { fill: rgba(0, 0, 0, 0.35); }

.place .dot { r: 9; transition: fill 0.3s; }
.place.region .dot { r: 8; fill-opacity: 0.85; }
.map-dark .place .dot { fill: var(--ink); }
.map-dark .place .ring { fill: none; stroke: rgba(0, 0, 0, 0.45); stroke-width: 1.5; stroke-dasharray: 3 4; }
.place .pulse { fill: none; stroke: var(--madder); stroke-width: 2; opacity: 0; }
.place.on .dot { fill: var(--madder); }
.place.on .pulse {
  opacity: 1;
  transform-origin: center;
  transform-box: fill-box;
  animation: placePulse 2s var(--ease) infinite;
}
@keyframes placePulse {
  from { transform: scale(0.7); opacity: 0.9; }
  to { transform: scale(1.6); opacity: 0; }
}
.place.dim { opacity: 0.45; }
.place[tabindex] { cursor: pointer; outline: none; }
.place[tabindex]:hover .dot,
.place[tabindex]:focus-visible .dot { fill: var(--madder); }
.place[tabindex]:focus-visible .pulse { opacity: 1; }

.map-label {
  font-family: var(--sans);
  font-size: 17px;
}

.map-dark .map-label { fill: rgba(0, 0, 0, 0.7); }

.map-tip rect { fill: var(--indigo); }
.map-tip-fa { font-family: var(--serif); font-size: 30px; fill: #f0b8a8; direction: rtl; }
.map-tip-en { font-family: var(--sans); font-size: 21px; fill: var(--cream); }

@media (max-width: 900px) {
  .by-region {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "map"
      "panel";
    row-gap: 1.5rem;
    padding-top: 3.5rem;
  }

  .region-panel {
    min-height: 0;
  }
}


/* =========================================================
   FILTERS — search bar above colour and price chips
   (built by shop-filters.js; the original controls in
   #filter-controls stay in the page, hidden, as the state
   that shop.js filters by)
========================================================= */

#filter-controls { display: none; }
.shop-filters {
  position: relative; z-index: 40;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 0 var(--gutter);
}
.filter-search { order: -1; }

.fx button { font: inherit; color: inherit; cursor: pointer; }
.fx .fa { font-family: var(--serif); direction: rtl; }
.fx button:focus-visible, .fx input:focus-visible { outline: 2px solid var(--madder); outline-offset: 2px; }
.filter-empty { grid-column: 1 / -1; }

/* ---------- colour and price chips ---------- */
.filter-chips { padding: 0.25rem 0 0; }
.chips-row { display: flex; align-items: center; gap: 1rem; padding: 0.45rem 0; }
.chips-label { flex: 0 0 4.5rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.chips-colours, .chips-prices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem; border: 0; border-radius: 999px;
  background: var(--card); font-size: 0.95rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s, color 0.2s;
}
.chips-chip i { width: 14px; height: 14px; border-radius: 50%; }
.chips-chip small { color: var(--muted); font-size: 0.8rem; }
.chips-chip:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.chips-chip.on { background: var(--ink); color: var(--cream); box-shadow: none; }
.chips-chip.on small { color: rgba(247, 242, 235, 0.7); }
.chips-chip.on i { box-shadow: 0 0 0 2px var(--cream); }
.chips-foot { display: flex; gap: 1.25rem; align-items: baseline; padding-top: 0.6rem; }
.chips-count { color: var(--muted); font-size: 0.95rem; }
.chips-clear { padding: 0; border: 0; background: none; text-decoration: underline; text-underline-offset: 3px; color: var(--ink) !important; font-size: 0.95rem !important; }
.chips-clear:hover { color: var(--madder) !important; }
.chips-clear[hidden] { display: none; }

/* ---------- search bar ---------- */
.sr-icon { width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; position: relative; flex: none; }
.sr-icon::after { content: ''; position: absolute; right: -6px; bottom: -6px; width: 8px; height: 2px; background: var(--ink); transform: rotate(45deg); }
.filter-search { position: relative; }
.search-box {
  display: flex; align-items: center; gap: 0.9rem; min-height: 56px; padding: 0.3rem 1rem 0.3rem 1.2rem;
  background: var(--card); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 1px 0 rgba(0,0,0,0.02);
  transition: box-shadow 0.25s;
}
.search-box:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink), 0 18px 40px -24px rgba(40,25,10,0.45); }
.search-field { position: relative; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.search-tokens { display: contents; }
.search-tok {
  display: inline-flex; align-items: center; gap: 0.45rem; height: 34px; padding: 0 0.6rem 0 0.8rem;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--cream) !important; font-size: 0.9rem !important;
  animation: searchpop 0.35s cubic-bezier(.34,1.56,.64,1);
}
.search-tok i { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--cream); }
.search-tok span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(247,242,235,0.15); font-size: 0.85rem; }
.search-tok:hover { background: var(--madder); }
@keyframes searchpop { from { transform: scale(0.6); opacity: 0; } }
.search-in { flex: 1; min-width: 8rem; height: 42px; padding: 0; border: 0; background: none; font-family: var(--serif); font-size: var(--h-sub); color: var(--ink); outline: none !important; }
.search-in::placeholder { color: #a39a8e; }
.search-ph { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-family: var(--serif); font-size: var(--h-sub); color: #a39a8e; pointer-events: none; white-space: nowrap; overflow: hidden; max-width: 100%; }
.search-ph::after { content: ''; display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -0.15em; background: var(--madder); animation: searchblink 1s steps(1) infinite; }
@keyframes searchblink { 50% { opacity: 0; } }
.search-ph[hidden] { display: none; }
.search-count { color: var(--muted); white-space: nowrap; font-size: 0.95rem; }
.search-kbd { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--sand); color: var(--muted); font: 600 0.85rem var(--sans); }
.search-panel {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  max-height: min(60vh, 520px); overflow-y: auto; padding: 0.6rem 0.6rem 0.8rem;
  background: var(--card); box-shadow: 0 24px 60px -20px rgba(40, 25, 10, 0.4);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity 0.2s, transform 0.25s var(--ease), visibility 0.2s;
}
.search-panel.open { opacity: 1; visibility: visible; transform: none; }
.search-group { padding: 0.35rem 0.4rem; }
.search-gh { margin: 0.3rem 0 0.45rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.search-items { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.search-item { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.8rem; border: 0; border-radius: 999px; background: var(--cream); font-size: 0.92rem !important; transition: background-color 0.15s, color 0.15s; }
.search-l { display: inline-flex; align-items: center; gap: 0.5rem; }
.search-item i { width: 12px; height: 12px; border-radius: 50%; }
.search-item img { width: 22px; height: 28px; object-fit: contain; margin: -4px 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }
.search-item .fa { color: var(--madder); font-size: 1rem; }
.search-item small { color: var(--muted); font-size: 0.75rem; }
.search-item:hover, .search-item.act { background: var(--ink); color: var(--cream) !important; }
.search-item:hover .fa, .search-item.act .fa { color: #f0b8a8; }
.search-item:hover small, .search-item.act small { color: rgba(247,242,235,0.7); }
.search-item.go { border-radius: 0; width: 100%; justify-content: space-between; background: var(--sand); }
.search-item.zero { opacity: 0.38; cursor: default; }

@media (max-width: 700px) {
  .chips-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .chips-label { flex: none; }
  .chips-colours, .chips-prices { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 0.2rem; scrollbar-width: none; }
  .chips-chip { flex: 0 0 auto; }
  .chips-colours::-webkit-scrollbar, .chips-prices::-webkit-scrollbar { display: none; }
  .search-kbd { display: none; }
  .search-box { padding-left: 0.9rem; gap: 0.6rem; }
  .search-count { font-size: 0.85rem; }
  .search-panel { max-height: 55vh; }
}

@media (prefers-reduced-motion: reduce) {
  .search-tok, .search-ph::after { animation: none; }
}
