/* ============================================================
   Products page — page-scoped styles.
   ============================================================ */

/* ====================================================
   COMPACT HERO
   ==================================================== */
.products-hero {
  position: relative;
  padding-block: var(--sp-6) var(--sp-5);
  background-color: var(--color-bg-alt);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.products-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../svg/paisley-watermark.5487159d7eb2.svg") right -100px center / 500px no-repeat;
  opacity: 0.05;
  z-index: -1;
}
.products-hero h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-block: var(--sp-3) var(--sp-2);
  font-weight: 700;
}
.products-hero p {
  max-width: 56ch;
  margin-inline: auto;
  color: var(--color-ink-soft);
  font-size: var(--fs-small);
}

/* ====================================================
   MAIN LAYOUT — filters + grid
   ==================================================== */
.products-main {
  padding-block: var(--sp-6);
}
.products-layout {
  display: grid;
  gap: var(--sp-6);
  grid-template-columns: 1fr;
}
@media (min-width: 992px) {
  .products-layout {
    grid-template-columns: 260px 1fr;
    gap: var(--sp-7);
    align-items: start;
  }
}

/* ====================================================
   FILTER SIDEBAR
   ==================================================== */
.filter-sidebar {
  background-color: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: sticky;
  top: calc(var(--nav-height) + var(--sp-3));
  max-height: calc(100vh - var(--nav-height) - var(--sp-5));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold) transparent;
}
@media (max-width: 991.98px) {
  /* On mobile the sidebar lives inside a Bootstrap offcanvas;
     these resets unwrap it from its sticky styling */
  .filter-sidebar {
    position: static;
    max-height: none;
    border: none;
    border-radius: 0;
    padding: 0;
  }
}

.filter__group {
  padding-block: var(--sp-4);
  border-bottom: 1px solid var(--color-line);
}
.filter__group:first-child { padding-top: 0; }
.filter__group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.filter__title {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-ink);
  margin-bottom: var(--sp-3);
}

/* Checkbox list */
.filter__check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.filter__check {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-body);
  color: var(--color-ink-soft);
  padding-block: var(--sp-1);
  transition: color var(--dur-fast) var(--ease-out);
}
.filter__check:hover { color: var(--color-primary); }
.filter__check input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--r-sm);
  background-color: var(--color-surface);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  position: relative;
}
.filter__check input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
.filter__check input:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--color-bg);
  border-bottom: 2px solid var(--color-bg);
  transform: rotate(-45deg) translate(1px, -1px);
}
.filter__check input:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}
.filter__check-count {
  margin-left: auto;
  font-size: var(--fs-tiny);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* Price range */
.filter__price {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.filter__price-values {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-small);
  color: var(--color-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.filter__range-wrap {
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
}
.filter__range-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--color-line);
  border-radius: var(--r-pill);
}
.filter__range-fill {
  position: absolute;
  height: 3px;
  background-color: var(--color-primary);
  border-radius: var(--r-pill);
}
.filter__range-wrap input[type="range"] {
  position: absolute;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: none;
  height: 32px;
  margin: 0;
}
.filter__range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--color-primary);
  border: 2px solid var(--color-bg);
  box-shadow: var(--shadow-1);
  cursor: grab;
  pointer-events: auto;
  margin-top: 0;
}
.filter__range-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--color-primary);
  border: 2px solid var(--color-bg);
  box-shadow: var(--shadow-1);
  cursor: grab;
  pointer-events: auto;
}

/* In-stock toggle */
.filter__switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-body);
  color: var(--color-ink);
}
.filter__switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  height: 22px;
  background-color: var(--color-line);
  border-radius: var(--r-pill);
  position: relative;
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-out);
  flex-shrink: 0;
}
.filter__switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-1);
  transition: left var(--dur-base) var(--ease-out);
}
.filter__switch input:checked { background-color: var(--color-primary); }
.filter__switch input:checked::after { left: 18px; }

/* Reset button */
.filter__reset {
  width: 100%;
  margin-top: var(--sp-4);
}

/* ====================================================
   TOOLBAR (above grid)
   ==================================================== */
.products-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-5);
}
.products-toolbar__count {
  font-size: var(--fs-small);
  color: var(--color-ink-soft);
}
.products-toolbar__count strong {
  color: var(--color-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.products-toolbar__actions {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
}
.products-toolbar__sort {
  min-width: 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A1F1F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--sp-7);
  cursor: pointer;
}
.products-toolbar__filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
@media (min-width: 992px) {
  .products-toolbar__filter-btn { display: none; }
}

/* ====================================================
   PRODUCTS GRID
   ==================================================== */
.products-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
}
@media (min-width: 576px) { .products-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .products-grid { grid-template-columns: repeat(3, 1fr); } }

/* ====================================================
   LOAD MORE
   ==================================================== */
.products-loadmore {
  text-align: center;
  margin-top: var(--sp-6);
}
.products-loadmore button {
  min-width: 200px;
}

/* ====================================================
   EMPTY STATE
   ==================================================== */
.products-empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
  background-color: var(--color-surface);
  border: 1px dashed var(--color-line);
  border-radius: var(--r-lg);
}
.products-empty__icon {
  width: 96px;
  height: 96px;
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  background-color: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold-deep);
}
.products-empty h3 {
  font-size: 1.375rem;
  margin-bottom: var(--sp-2);
}
.products-empty p {
  color: var(--color-ink-soft);
  margin-bottom: var(--sp-5);
  max-width: 40ch;
  margin-inline: auto;
}

/* ====================================================
   ACTIVE FILTER PILLS
   ==================================================== */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-line);
  border-radius: var(--r-pill);
  font-size: var(--fs-tiny);
  color: var(--color-ink);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.active-filter-pill:hover {
  background-color: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}
.active-filter-pill::after {
  content: "×";
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
}

/* Offcanvas: ensure the mobile filter drawer matches our look */
.products-offcanvas {
  background-color: var(--color-bg);
}
.products-offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--color-line);
}
.products-offcanvas .offcanvas-title {
  font-family: var(--font-display);
  color: var(--color-primary);
}
