/* ==========================================================================
   WooCommerce archive layout + Mobile/Tablet filters drawer
   Single source of truth:
   - Desktop: sidebar static left (grid)
   - <=1023px: sidebar becomes off-canvas drawer (body.bohemy-filters-open)
   ========================================================================== */

/* ---------- Desktop / Base layout (sidebar left, products right) ---------- */
.shop-archive-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}

.shop-sidebar,
.shop-products {
  min-width: 0;
}

/* Toolbar (ordering always visible, filters button only on <=1023px) */
.bohemy-archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 18px 0 22px;
}

.bohemy-archive-toolbar .woocommerce-ordering {
  margin: 0 !important;
}

/* Hide mobile-only UI by default (desktop) */
.bohemy-filters-toggle,
.bohemy-filters-overlay,
.bohemy-filters-drawer-header {
  display: none;
}

/* Safety: ensure the button text is visible when it’s shown */
.bohemy-filters-toggle__icon,
.bohemy-filters-toggle__text {
  display: inline-block !important;
  color: #111 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ---------- Mobile/Tablet: drawer mode ---------- */
@media (max-width: 1023px) {
  .shop-archive-layout {
    display: block;
  }

  .bohemy-archive-toolbar {
    justify-content: space-between;
    gap: 10px;
  }

  /* Filters toggle button */
  .bohemy-filters-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 12px 18px;
    border: 1px solid #e6e6e6;
    border-radius: 9999px;
    background: #fff;

    font-family: Brandon-Regular, serif;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px !important;
    color: #111 !important;

    cursor: pointer;
    user-select: none;
    white-space: nowrap;
  }

  .bohemy-filters-toggle__icon {
    font-size: 14px !important;
    line-height: 1;
  }

  /* Ordering select matches pill style */
  .bohemy-archive-toolbar .woocommerce-ordering {
    width: 50%;
  }

  .bohemy-archive-toolbar .woocommerce-ordering select {
    width: 100%;
    border-radius: 9999px;
  }

  /* Overlay */
  .bohemy-filters-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;

    z-index: 99998;
  }

  body.bohemy-filters-open .bohemy-filters-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* Drawer (reuse sidebar element) */
  .shop-sidebar#bohemy-filters-drawer {
    position: fixed;
    top: 0;
    right: 0;

    height: 100vh;
    width: min(420px, 88vw);

    background: #fff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);

    transform: translateX(110%);
    opacity: 0;
    pointer-events: none;

    transition: transform 0.25s ease, opacity 0.25s ease;

    z-index: 99999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    padding: 16px 18px 22px;
  }

  body.bohemy-filters-open .shop-sidebar#bohemy-filters-drawer {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  body.bohemy-filters-open {
    overflow: hidden;
  }

  /* Drawer header (title + close) */
  .bohemy-filters-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 6px 0 14px;
    border-bottom: 1px solid #eee;
    margin-bottom: 14px;
  }

  .bohemy-filters-drawer-title {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    color: #111;
  }

  .bohemy-filters-close {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    border: 1px solid #e6e6e6;
    background: #fff;

    color: #111 !important;
    font-size: 24px !important;
    line-height: 1 !important;

    cursor: pointer;
  }

  /* Accordion for YITH blocks */
  #bohemy-filters-drawer .yith-wcan-filter .filter-title {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin: 16px 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
  }

  #bohemy-filters-drawer .yith-wcan-filter .filter-title::after {
    content: "▾";
    font-size: 14px;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
  }

  #bohemy-filters-drawer .yith-wcan-filter .filter-content {
    display: none;
  }

  #bohemy-filters-drawer .yith-wcan-filter.is-open .filter-content {
    display: block;
  }

  #bohemy-filters-drawer .yith-wcan-filter.is-open .filter-title::after {
    transform:
