/* Listing controls shared by both listing layouts: the Filters sheet
   (views/partials/listing/filterSheet.ejs) and the Sort menu
   (views/components/shopSortDropdown.ejs).
   - Phones (views/page/shop.ejs) and tablets: the filters open as a bottom
     sheet with a sticky "Clear all" / "Show N styles" footer.
   - Computers (views/page/shopDesktop.ejs, plp.css) turn the same markup into
     a sticky column at 1024px and up.
   Every rule is scoped to these components, so the rest of the page keeps its
   own styles. */

.plp,
.plp-filters,
.plp-sort,
.plp-scrim {
  --plp-ink: #1d1417;
  --plp-ink-2: #3c3034;
  --plp-muted: #6f6266;
  --plp-line: #f0e6e9;
  --plp-line-2: #e4d6db;
  --plp-blush: #fcf3f5;
  --plp-accent: var(--brand-accent, #8b3a52);
  --plp-sans: 'General Sans', 'Inter', system-ui, sans-serif;
  --plp-ease: cubic-bezier(.2, .7, .2, 1);
}

/* ------------------------------------------------------------- sheet -- */

.plp-filters,
.plp-filters *,
.plp-filters *::before,
.plp-filters *::after { box-sizing: border-box; }
.plp-filters [hidden] { display: none !important; }
:where(.plp-filters) :where(h2, h3, p) { margin: 0; }
:where(.plp-filters) :where(button) { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.plp-filters svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* Older page CSS rings every focused control; only keyboard focus is ringed here. */
.plp-filters :focus:not(:focus-visible),
.plp-sort :focus:not(:focus-visible) { outline: none; }
.plp-filters :is(a, button, input):focus-visible {
  outline: 2px solid var(--plp-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.plp-filters {
  position: fixed;
  z-index: 1001;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: auto;
  height: auto;
  max-height: 88vh;
  max-height: 88dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -12px 40px -20px rgba(29, 20, 23, .35);
  color: var(--plp-ink);
  font-family: var(--plp-sans);
  -webkit-font-smoothing: antialiased;
  transform: translateY(105%);
  visibility: hidden;
  transition: transform .32s var(--plp-ease), visibility 0s .32s;
}
.plp-filters.active { transform: none; visibility: visible; transition: transform .32s var(--plp-ease); }

.plp-filters .plp-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--plp-ink);
}

.plp-filters-head {
  display: flex;
  flex: none;
  align-items: center;
  height: 60px;
  padding: 0 8px 0 20px;
  border-bottom: 1px solid var(--plp-line);
}
.plp-filters-close { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; }
.plp-filters-close svg { width: 20px; height: 20px; }
.plp-filters-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 20px; }
.plp-filters-foot {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--plp-line);
  background: #fff;
}

.plp-filters .plp-link {
  min-height: 44px;
  font-size: 13px;
  color: var(--plp-ink-2);
  text-decoration: underline;
  text-decoration-color: var(--plp-line-2);
  text-underline-offset: 3px;
}
.plp-filters .plp-pill {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  max-width: 260px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--plp-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color .2s;
}
.plp-filters .plp-pill:hover { background: #000; }

.plp-f { border-top: 1px solid var(--plp-line); }
.plp-f:first-child { border-top: 0; }
.plp-f-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  font-size: 13px;
  font-weight: 600;
  color: var(--plp-ink);
  text-align: left;
}
.plp-f-sign { position: relative; width: 11px; height: 11px; }
.plp-f-sign::before,
.plp-f-sign::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 0;
  width: 11px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--plp-ink-2);
  transition: transform .2s;
}
.plp-f-sign::after { transform: rotate(90deg); }
.plp-f-toggle[aria-expanded="true"] .plp-f-sign::after { transform: rotate(0deg); }
.plp-f-panel { display: none; padding-bottom: 18px; }
.plp-f-panel.active { display: block; }

.plp-check {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--plp-ink-2);
  cursor: pointer;
}
.plp-check:hover { color: var(--plp-ink); }
.plp-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1.5px solid #b9aab0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.plp-check input:checked {
  border-color: var(--plp-ink);
  background: var(--plp-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.plp-check:has(input:checked) { color: var(--plp-ink); font-weight: 600; }
/* The category tree: a parent includes everything indented under it. */
.plp-check--depth-0 { font-weight: 500; color: var(--plp-ink); }
.plp-check--depth-1 { padding-left: 22px; }
.plp-check--depth-2 { padding-left: 44px; font-size: 13.5px; }

.plp-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.plp-filters .size-option {
  min-height: 42px;
  padding: 0 2px;
  white-space: nowrap;
  border: 1px solid var(--plp-line-2);
  border-radius: 9px;
  font-size: 13px;
  color: var(--plp-ink-2);
  transition: border-color .15s, background-color .15s, color .15s;
}
.plp-filters .size-option:hover { border-color: var(--plp-ink-2); }
.plp-filters .size-option.selected { border-color: var(--plp-ink); background: var(--plp-ink); color: #fff; font-weight: 600; }

.plp-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.plp-filters .plp-color {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 42px;
  font-size: 14px;
  color: var(--plp-ink-2);
  text-align: left;
}
.plp-filters .plp-color i {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(29, 20, 23, .16);
}
.plp-filters .plp-color span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plp-filters .plp-color:hover span { color: var(--plp-ink); }
.plp-filters .plp-color.selected i { box-shadow: inset 0 0 0 1px rgba(29, 20, 23, .16), 0 0 0 2px #fff, 0 0 0 3.5px var(--plp-ink); }
.plp-filters .plp-color.selected span { font-weight: 600; color: var(--plp-ink); }
.plp-filters :is(.plp-f-more, .shop-toggle-more-colors) {
  min-height: 40px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--plp-ink-2);
  text-decoration: underline;
  text-decoration-color: var(--plp-line-2);
  text-underline-offset: 3px;
}

.plp-price { display: flex; align-items: flex-end; gap: 8px; }
.plp-filters .price-input-group { flex: 1; min-width: 0; }
.plp-price-label { display: block; margin-bottom: 6px; font-size: 11px; color: var(--plp-muted); }
.plp-filters .price-input-wrapper { position: relative; display: block; }
.plp-filters .price-symbol { position: absolute; top: 50%; left: 11px; transform: translateY(-50%); font-size: 13px; color: var(--plp-muted); pointer-events: none; }
.plp-filters .price-input {
  width: 100%;
  height: 44px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--plp-line-2);
  border-radius: 9px;
  background: #fff;
  font: 500 16px var(--plp-sans);
  color: var(--plp-ink);
  -moz-appearance: textfield;
  appearance: textfield;
}
.plp-filters .price-input::-webkit-outer-spin-button,
.plp-filters .price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.plp-filters .price-input:focus { border-color: var(--plp-ink-2); outline: none; }
.plp-price-dash { padding-bottom: 12px; color: var(--plp-muted); }

/* Two native range inputs share one track; only their thumbs take the
   pointer, so either can be dragged. */
.plp-filters .range-slider-container { position: relative; height: 24px; margin: 14px 8px 0; touch-action: none; }
.plp-filters .range-track,
.plp-filters .range-progress { position: absolute; top: 11px; height: 2px; border-radius: 2px; }
.plp-filters .range-track { left: 0; right: 0; background: var(--plp-line-2); }
.plp-filters .range-progress { background: var(--plp-ink); }
.plp-filters .range-thumb { display: none; }
.plp-filters .range-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  background: none;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}
.plp-filters .range-input::-webkit-slider-runnable-track { height: 24px; background: none; }
.plp-filters .range-input::-moz-range-track { height: 24px; background: none; }
.plp-filters .range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border: 1.5px solid var(--plp-ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(29, 20, 23, .15);
  pointer-events: auto;
  cursor: grab;
}
.plp-filters .range-input::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--plp-ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(29, 20, 23, .15);
  pointer-events: auto;
  cursor: grab;
}
.plp-filters .range-input:focus-visible { outline: none; }
.plp-filters .range-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(139, 58, 82, .25); }

.plp-scrim {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: block;
  background: rgba(29, 20, 23, .4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility 0s .3s;
}
.plp-scrim.active { opacity: 1; visibility: visible; transition: opacity .3s; }

/* The page behind an open sheet stays put. */
html.filter-open,
body.filter-open { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; overscroll-behavior: none; }

/* Phones' classic layout: the sheet floats, so the old filter column of the
   grid is gone on wider phone-sized screens too. */
@media (min-width: 768px) {
  .main-content:has(> .plp-filters) { display: block; }
}

/* -------------------------------------------------------------- sort -- */

/* A small menu under the Sort button: one line per option, a tick and bold
   type on the chosen one, 44px rows. It never shrinks below its longest
   label and never runs off a narrow screen. */
.plp-sort { position: relative; }
.plp-sort .plp-sort-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: max-content;
  min-width: 232px;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 6px;
  border: 1px solid var(--plp-line-2);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px -18px rgba(29, 20, 23, .3);
  font-family: var(--plp-sans);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .18s, transform .18s, visibility 0s .18s;
}
.plp-sort .plp-sort-menu.active { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .18s; }
.plp-sort .plp-sort-menu::before { content: none; }
.plp-sort .sort-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  font: 400 14px/1.2 var(--plp-sans);
  color: var(--plp-ink-2);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.plp-sort .sort-item:hover { background: var(--plp-blush); color: var(--plp-ink); }
.plp-sort .sort-item:focus-visible { outline: 2px solid var(--plp-accent); outline-offset: -2px; }
.plp-sort .sort-item.active { background: var(--plp-blush); font-weight: 600; color: var(--plp-ink); }
.plp-sort .sort-item .checkmark { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--plp-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.plp-sort .sort-item.active .checkmark { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .plp-filters,
  .plp-scrim,
  .plp-sort .plp-sort-menu { transition: none !important; }
}
