/* ==========================================================================
   Shop filters — left sidebar (Estelia)
   Loaded on: shop, product category/tag (alongside shop.css)
   ========================================================================== */

.est-shop{
  display: flex;
  align-items: flex-start;
  gap: clamp(2rem, 4vw, 3.5rem);
}

.est-shop-main{
  flex: 1 1 auto;
  min-width: 0;
}

.est-shop-filters{
  flex: 0 0 240px;
  width: 240px;
}

.est-shop-filters__mobile-toggle{
  display: none;
}

.est-shop-filters__panel-head{
  display: none;
}

.est-shop-filters__close{
  display: none;
}

.est-shop-filters__form{
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 3vw, 2.25rem);
}

.est-shop-filters__title{
  margin: 0 0 .9rem;
  padding-top: .26rem;
  font-family: var(--est-font-body, "DM Sans", system-ui, sans-serif);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--est-ink, #131313);
}

/* Category / size lists */
.est-shop-filters__list,
.est-shop-filters__size-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}

.est-shop-filters__option,
.est-shop-filters__size-option{
  display: flex;
  align-items: center;
  gap: .625rem;
  font-family: var(--est-font-body, "DM Sans", system-ui, sans-serif);
  font-size: .875rem;
  color: var(--est-ink, #131313);
  cursor: pointer;
}

.est-shop-filters__option input[type="checkbox"],
.est-shop-filters__size-option input[type="checkbox"]{
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--est-ink, #131313);
  cursor: pointer;
  flex: none;
}

.est-shop-filters__option:has(input:disabled){
  opacity: .55;
}

.est-shop-filters__option span:first-of-type,
.est-shop-filters__size-option span:first-of-type{
  flex: 1 1 auto;
}

.est-shop-filters__count{
  font-size: .78rem;
  color: var(--est-ink-muted, #6A6A68);
}

/* Price */
.est-shop-filters__price{
  display: flex;
  align-items: center;
  gap: .625rem;
}

.est-shop-filters__price input[type="number"]{
  width: 100%;
  min-width: 0;
  font-family: var(--est-font-body, "DM Sans", system-ui, sans-serif);
  font-size: .875rem;
  color: var(--est-ink, #131313);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--est-line, #E2E2DF);
  border-radius: 0;
  padding: .5rem 0;
  appearance: textfield;
}

.est-shop-filters__price input[type="number"]::-webkit-outer-spin-button,
.est-shop-filters__price input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

.est-shop-filters__price input[type="number"]:focus-visible{
  outline: 2px solid var(--est-ink, #131313);
  outline-offset: 2px;
}

.est-shop-filters__price-sep{
  color: var(--est-ink-muted, #6A6A68);
}

/* Price slider — two overlapping native <input type="range"> (no library).
   Each one's own track/fill is hidden; only the thumb is interactive
   (pointer-events on the range itself is off), so the two never fight
   over clicks along the track — only where their thumbs actually sit.
   inc/shop-filters.php hides this with the `hidden` attribute until
   shop-filters.js confirms it can drive it. */
.est-shop-filters__price-slider{
  position: relative;
  height: 1.25rem;
  margin-block-start: .5rem;
}

.est-shop-filters__price-track{
  position: absolute;
  inset-inline: .5625rem;
  top: 50%;
  height: 3px;
  background-color: var(--est-line, #E2E2DF);
  border-radius: 999px;
  transform: translateY(-50%);
}

.est-shop-filters__price-track-fill{
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--est-accent, #4A1F45);
  border-radius: 999px;
}

/* Thumbs are native <input type="range">, sized/positioned to sit exactly
   on the 3px visual track above — the runnable-track height IS the input's
   own height (1.25rem), so centering the thumb within it only takes
   (runnable-track height - thumb size) / 2, no magic offsets. */
.est-shop-filters__price-range{
  position: absolute;
  inset-inline: 0;
  top: 0;
  width: 100%;
  height: 1.25rem;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}

.est-shop-filters__price-range--min{ z-index: 1; }
.est-shop-filters__price-range--max{ z-index: 2; }

.est-shop-filters__price-range::-webkit-slider-runnable-track{
  -webkit-appearance: none;
  background: transparent;
  height: 1.25rem;
}
.est-shop-filters__price-range::-moz-range-track{
  background: transparent;
  height: 1.25rem;
  border: none;
}

.est-shop-filters__price-range::-webkit-slider-thumb{
  -webkit-appearance: none;
  pointer-events: auto;
  width: 1.125rem;
  height: 1.125rem;
  margin-block-start: .0625rem; /* (1.25rem track - 1.125rem thumb) / 2 */
  border-radius: 50%;
  background-color: var(--est-bg, #fff);
  box-shadow: 0 0 0 1.5px var(--est-accent, #4A1F45), 0 1px 4px rgba(19, 19, 19, .2);
  cursor: pointer;
  transition: box-shadow var(--est-dur-fast, 200ms) var(--est-ease, cubic-bezier(.22,1,.36,1));
}
.est-shop-filters__price-range::-moz-range-thumb{
  pointer-events: auto;
  width: 1.125rem;
  height: 1.125rem;
  border: none;
  border-radius: 50%;
  background-color: var(--est-bg, #fff);
  box-shadow: 0 0 0 1.5px var(--est-accent, #4A1F45), 0 1px 4px rgba(19, 19, 19, .2);
  cursor: pointer;
  transition: box-shadow var(--est-dur-fast, 200ms) var(--est-ease, cubic-bezier(.22,1,.36,1));
}

.est-shop-filters__price-range:hover::-webkit-slider-thumb,
.est-shop-filters__price-range:active::-webkit-slider-thumb{
  box-shadow: 0 0 0 1.5px var(--est-accent-dark, #341530), 0 1px 4px rgba(19, 19, 19, .25);
}
.est-shop-filters__price-range:hover::-moz-range-thumb,
.est-shop-filters__price-range:active::-moz-range-thumb{
  box-shadow: 0 0 0 1.5px var(--est-accent-dark, #341530), 0 1px 4px rgba(19, 19, 19, .25);
}

.est-shop-filters__price-range:focus-visible::-webkit-slider-thumb{
  outline: 2px solid var(--est-accent, #4A1F45);
  outline-offset: 2px;
}
.est-shop-filters__price-range:focus-visible::-moz-range-thumb{
  outline: 2px solid var(--est-accent, #4A1F45);
  outline-offset: 2px;
}

/* Color swatches */
.est-shop-filters__swatch-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.est-shop-filters__swatch-option{
  display: block;
  cursor: pointer;
}

.est-shop-filters__swatch-option input{
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.est-shop-filters__swatch{
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background-color: var(--est-swatch-color, #CCC);
  box-shadow: inset 0 0 0 1px rgba(19, 19, 19, .18);
  transition: box-shadow 200ms var(--est-ease, cubic-bezier(.22,1,.36,1));
}

.est-shop-filters__swatch-option:hover .est-shop-filters__swatch{
  box-shadow: inset 0 0 0 1px rgba(19, 19, 19, .35), 0 0 0 2px var(--est-bg, #fff), 0 0 0 3px var(--est-ink, #131313);
}

/* Selection ring sits a background-colored gap away from the swatch, not
   flush against it: flush meant a dark ring on a dark swatch (black,
   burgundy, navy…) had no visible edge at all — reported as "can't tell
   what's selected" on those colors. The gap gives the ring its own
   boundary against the page instead of against the swatch color. */
.est-shop-filters__swatch-option input:checked + .est-shop-filters__swatch{
  box-shadow: inset 0 0 0 1px rgba(19, 19, 19, .35), 0 0 0 2px var(--est-bg, #fff), 0 0 0 4px var(--est-ink, #131313);
}

.est-shop-filters__swatch-option input:focus-visible + .est-shop-filters__swatch{
  outline: 2px solid var(--est-ink, #131313);
  outline-offset: 2px;
}

/* Reset button */
.est-shop-filters__reset{
  align-self: flex-start;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--est-font-body, "DM Sans", system-ui, sans-serif);
  font-size: .8125rem;
  letter-spacing: .02em;
  color: var(--est-ink-muted, #6A6A68);
  background-color: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

/* Without appearance:none above, some browsers paint their own native
   button hover/active shading (a near-solid dark block) on top of the
   author background — reported as the reset button turning into an
   unreadable block on hover. */
.est-shop-filters__reset:hover,
.est-shop-filters__reset:active,
.est-shop-filters__reset:focus{
  background-color: transparent;
  box-shadow: none;
  outline: none;
}

.est-shop-filters__reset:hover,
.est-shop-filters__reset:focus-visible{
  color: var(--est-ink, #131313);
}

/* Loading state while an AJAX fetch is in flight */
.est-shop-grid[aria-busy="true"]{
  opacity: .45;
  pointer-events: none;
  transition: opacity 200ms var(--est-ease, cubic-bezier(.22,1,.36,1));
}

/* Empty state */
.est-shop-empty{
  padding: clamp(2rem, 6vw, 3.5rem) 0;
  text-align: center;
}

.est-shop-empty p{
  margin: 0 0 1rem;
  font-family: var(--est-font-body, "DM Sans", system-ui, sans-serif);
  color: var(--est-ink-muted, #6A6A68);
}

.est-shop-empty .est-shop-filters__reset{
  display: inline-block;
  margin: 0 auto;
}

/* Narrower grid when the sidebar is present: shop.css sets 2/3/4 columns
   with !important (it has to — WooCommerce core loads after it at equal
   specificity). Beating that here needs !important too; the extra
   .est-shop-main ancestor gives this the higher specificity, and the
   'estelia-shop' dependency on this stylesheet's enqueue guarantees it
   loads after shop.css, so it also wins any tie. Desktop stays at 3
   columns instead of 4 — the main column is ~300px narrower than the
   full .grid-container with the sidebar in place. */
body.woocommerce .est-shop-main ul.products,
body.woocommerce-page .est-shop-main ul.products{
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
@media (min-width: 48em){
  body.woocommerce .est-shop-main ul.products,
  body.woocommerce-page .est-shop-main ul.products{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 75em){
  body.woocommerce .est-shop-main ul.products,
  body.woocommerce-page .est-shop-main ul.products{
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* --------------------------------------------------------------------------
   Mobile (< 48em): sidebar becomes an off-canvas panel opened by a
   "Filtrer" button above the grid.
   -------------------------------------------------------------------------- */
@media (max-width: 47.99em){
  .est-shop{
    display: block;
  }

  .est-shop-filters{
    width: auto;
    flex: initial;
    margin: 0 0 1.5rem;
  }

  .est-shop-filters__mobile-toggle{
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--est-font-body, "DM Sans", system-ui, sans-serif);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--est-ink, #131313);
    background: transparent;
    border: 1px solid var(--est-ink, #131313);
    padding: .75rem 1.25rem;
    cursor: pointer;
  }

  .est-shop-filters__panel{
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    padding: 1.5rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 300ms var(--est-ease, cubic-bezier(.22,1,.36,1));
  }

  .est-shop-filters.is-open .est-shop-filters__panel{
    transform: translateX(0);
  }

  .est-shop-filters__panel-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--est-line, #E2E2DF);
  }

  .est-shop-filters__panel-title{
    font-family: var(--est-font-display, "Instrument Serif", Georgia, serif);
    font-size: 1.25rem;
    color: var(--est-ink, #131313);
  }

  .est-shop-filters__close{
    display: block;
    font-size: 1.5rem;
    line-height: 1;
    background: none;
    border: 0;
    color: var(--est-ink, #131313);
    cursor: pointer;
    padding: 0;
  }

  body.est-shop-filters-open{
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce){
  .est-shop-filters__panel{
    transition: none;
  }
}
