/* =========================================================================
   Shop + product-category pages
   Scoped to body.fmke-shop (added by shop-style.php).
   ========================================================================= */

/* ---- Page frame + breadcrumb ----------------------------------------- */
body.fmke-shop .storefront-breadcrumb {
  background: #F6F3EE;
  margin: 0 !important;
  padding: 18px 0 6px !important;
}
body.fmke-shop .storefront-breadcrumb .col-full { max-width: 1280px; }
body.fmke-shop .woocommerce-breadcrumb { margin: 0 !important; padding: 0 !important; font-size: 13px; }
body.fmke-shop .woocommerce-breadcrumb a { font-weight: 700; text-decoration: none; }
body.fmke-shop .woocommerce-breadcrumb a:hover { text-decoration: none; color: var(--fmke-primary-dark); }

body.fmke-shop .site-content { background: #F6F3EE; padding: 14px 0 56px; margin: 0; }

/* ---- Two-column layout: sidebar | products --------------------------- */
body.fmke-shop .site-content > .col-full {
  max-width: 1280px;
}
body.fmke-shop .site-content > .col-full:has(> .fmke-shop-sidebar) {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  column-gap: 28px;
  align-items: start;
}
body.fmke-shop .site-content > .col-full::before,
body.fmke-shop .site-content > .col-full::after { display: none !important; }
body.fmke-shop .site-content > .col-full > * { grid-column: 1 / -1; }
body.fmke-shop .site-content > .col-full > .fmke-shop-sidebar { grid-column: 1; grid-row: 1; }
body.fmke-shop .site-content > .col-full > #primary { grid-column: 2; grid-row: 1; }
body.fmke-shop #secondary { display: none !important; }

body.fmke-shop #primary {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  min-width: 0;
}
body.fmke-shop .site-main { margin: 0; }

/* ---- Sidebar card ---------------------------------------------------- */
body.fmke-shop .fmke-shop-sidebar {
  float: none !important;
  width: auto !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 22px 20px 24px;
  background: #fff;
  border: 1px solid var(--fmke-border);
  border-radius: 16px;
  box-shadow: var(--fmke-shadow);
}
body.fmke-shop .fmke-shop-sidebar-title {
  position: relative;
  margin: 0 0 14px !important;
  padding-bottom: 12px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 19px; font-weight: 600; color: var(--fmke-dark);
}
body.fmke-shop .fmke-shop-sidebar-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 34px; height: 3px; border-radius: 3px; background: var(--fmke-primary);
}
/* Category list */
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li {
  border-bottom: 0 !important;
  margin: 0 0 2px;
  padding: 0 6px 0 0;
  border-radius: 10px;
  transition: background .15s ease;
}
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li:hover { background: #FFFAF4; }
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li > a {
  display: block !important;
  padding: 10px 10px 10px 12px !important;
  font-size: 14.5px; font-weight: 600; color: var(--fmke-dark);
  text-decoration: none !important;
}
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li > a::before { color: var(--fmke-primary) !important; opacity: 1; margin-right: 10px; }
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li > a:hover { color: var(--fmke-primary-dark); }
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li.current-cat { background: var(--fmke-primary-light); }
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li.current-cat > a { color: var(--fmke-primary-dark); font-weight: 800; }
body.fmke-shop .fmke-shop-sidebar .widget_product_categories .count {
  margin: 0; padding: 2px 9px;
  background: var(--fmke-primary-light); color: var(--fmke-primary-dark);
  font-size: 11.5px; font-weight: 800; border-radius: 999px;
}
body.fmke-shop .fmke-shop-sidebar .widget_product_categories li.current-cat > .count { background: #fff; }
body.fmke-shop .fmke-shop-sidebar .widget_product_categories ul.children { padding-left: 12px; margin: 0 0 6px; }

/* Price filter */
body.fmke-shop .fmke-price-filter { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--fmke-border); }
body.fmke-shop .fmke-price-filter-fields { gap: 10px; margin-bottom: 14px; }
body.fmke-shop .fmke-price-field {
  min-width: 0; padding: 0 12px; border: 1.5px solid var(--fmke-border); border-radius: 10px; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
body.fmke-shop .fmke-price-field:focus-within { border-color: var(--fmke-primary); box-shadow: 0 0 0 3px rgba(255,106,0,.16); }
body.fmke-shop .fmke-price-field input[type="number"] {
  min-width: 0; min-height: 42px; padding: 0 !important; font-size: 14.5px; box-shadow: none !important; border: 0 !important; background: transparent !important;
}
body.fmke-shop .fmke-price-filter-apply {
  display: block; width: 100%; padding: 12px 16px !important; box-sizing: border-box;
  background: var(--fmke-primary) !important; color: #fff !important;
  border: 0 !important; border-radius: 999px !important;
  font-size: 14px !important; font-weight: 800 !important; text-transform: none !important;
}
body.fmke-shop .fmke-price-filter-apply:hover { background: var(--fmke-primary-dark) !important; box-shadow: var(--fmke-shadow-hover); }
body.fmke-shop .fmke-price-filter-clear { margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--fmke-primary-dark); text-decoration: none !important; }

/* ---- Heading + category pills ---------------------------------------- */
body.fmke-shop .woocommerce-products-header { margin: 0 0 14px !important; padding: 0; }
body.fmke-shop .woocommerce-products-header__title.page-title {
  position: relative; text-align: left !important;
  margin: 0 0 4px !important; padding: 0 0 12px;
  font-size: 30px; line-height: 1.2;
}
body.fmke-shop .woocommerce-products-header__title.page-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 44px; height: 4px; border-radius: 4px; background: var(--fmke-primary);
}
body.fmke-shop .woocommerce-products-header .term-description,
body.fmke-shop .woocommerce-products-header .page-description { margin: 12px 0 0; font-size: 14.5px; line-height: 1.7; color: #3D5A49; }

body.fmke-shop .fmke-cat-shortcuts {
  margin: 0 0 14px !important;
  padding: 4px 2px 10px !important;
  scroll-snap-type: x proximity;
}
body.fmke-shop .fmke-cat-shortcut { scroll-snap-align: start; padding: 7px 16px 7px 7px; font-weight: 600; }

/* ---- Toolbar: result count (left) · sort (right) ---------------------- */
body.fmke-shop .storefront-sorting {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  box-sizing: border-box;
  margin: 0 0 20px !important; padding: 10px 16px !important;
  background: #fff; border: 1px solid var(--fmke-border) !important; border-radius: 14px;
  box-shadow: var(--fmke-shadow);
}
body.fmke-shop .storefront-sorting > :empty,
body.fmke-shop .storefront-sorting .woocommerce-pagination:not(:has(*)) { display: none !important; }
body.fmke-shop .storefront-sorting .woocommerce-result-count {
  order: 0; float: none !important; margin: 0 !important; font-size: 13.5px; font-weight: 600; color: var(--fmke-muted);
}
body.fmke-shop .storefront-sorting .woocommerce-ordering { order: 1; float: none !important; margin: 0 0 0 auto !important; }
body.fmke-shop .woocommerce-ordering select,
body.fmke-shop .woocommerce-ordering .orderby {
  box-sizing: border-box; height: 40px; min-height: 40px; margin: 0;
  padding: 0 36px 0 16px !important;
  border: 1.5px solid var(--fmke-border) !important; border-radius: 999px !important;
  font-size: 13.5px; font-weight: 700; color: var(--fmke-dark);
}
body.fmke-shop .woocommerce-ordering select:focus { box-shadow: 0 0 0 3px rgba(255,106,0,.16); }
/* bottom toolbar (pagination) sits centered */
body.fmke-shop .storefront-sorting .woocommerce-pagination { order: 2; margin: 0 auto; float: none; }
body.fmke-shop .storefront-sorting:has(.woocommerce-pagination:has(*)) { justify-content: center; }

/* ---- Product grid ---------------------------------------------------- */
body.fmke-shop ul.products {
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)) !important;
  gap: 20px !important;
  margin: 0 0 24px !important;
  padding: 0 !important;
}

/* ---- Product cards ---------------------------------------------------- */
body.fmke-shop ul.products li.product {
  display: flex !important; flex-direction: column;
  box-sizing: border-box;
  padding: 12px 12px 14px !important;
  border-radius: 16px !important;
  text-align: left;
}
body.fmke-shop ul.products li.product:hover { border-color: var(--fmke-primary) !important; }
body.fmke-shop ul.products li.product > a.woocommerce-LoopProduct-link,
body.fmke-shop ul.products li.product > a:first-of-type { display: block; }
body.fmke-shop ul.products li.product img {
  width: 100%; height: auto; margin: 0 0 12px !important;
  aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px !important; background: var(--fmke-primary-light);
}
body.fmke-shop ul.products li.product .woocommerce-loop-product__title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  margin: 0 0 6px !important; padding: 0 !important;
  font-size: 14.5px !important; font-weight: 700 !important; line-height: 1.35; color: var(--fmke-dark);
}
body.fmke-shop ul.products li.product .star-rating { margin: 0 0 6px; }
body.fmke-shop ul.products li.product .price {
  display: block; margin: 0 0 12px; font-size: 16px; font-weight: 800; color: var(--fmke-primary-dark) !important;
}
body.fmke-shop ul.products li.product .price del { color: var(--fmke-muted); font-size: 13px; font-weight: 500; opacity: 1; margin-right: 4px; }
body.fmke-shop ul.products li.product .price ins { background: none; text-decoration: none; }
/* Add-to-cart pinned to the bottom so buttons line up across a row */
body.fmke-shop ul.products li.product a.button,
body.fmke-shop ul.products li.product a.add_to_cart_button {
  margin: auto 0 0 !important; width: 100%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 11px 14px !important; border-radius: 999px !important;
  font-size: 13.5px !important; font-weight: 800 !important;
}
/* No theme underline on card text / links */
body.fmke-shop ul.products li.product a,
body.fmke-shop ul.products li.product a:hover,
body.fmke-shop .fmke-cat-shortcut,
body.fmke-shop .fmke-cat-shortcut:hover { text-decoration: none !important; }
body.fmke-shop ul.products li.product .woocommerce-loop-product__title:hover { color: var(--fmke-primary-dark); }
/* Wishlist heart: floats over the image, under the SALE badge */
body.fmke-shop ul.products li.product .fmke-wishlist-btn {
  position: absolute !important; top: 46px; right: 14px; z-index: 3;
  width: 34px !important; height: 34px !important; padding: 0 !important; margin: 0 !important;
  background: #fff !important; border: 0 !important; border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(31,61,44,.2) !important; color: var(--fmke-primary) !important;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
body.fmke-shop ul.products li.product .fmke-wishlist-btn.is-saved { background: var(--fmke-primary) !important; color: #fff !important; }
body.fmke-shop ul.products li.product .fmke-wishlist-btn-label { display: none; }

/* Pagination pills */
body.fmke-shop .woocommerce-pagination ul.page-numbers { gap: 8px; border: 0; }
body.fmke-shop .woocommerce-pagination ul.page-numbers li { border: 0 !important; margin: 0; }
body.fmke-shop .woocommerce-pagination ul.page-numbers li .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 14px; box-sizing: border-box;
  border: 1.5px solid var(--fmke-border); border-radius: 999px; background: #fff; color: var(--fmke-dark); font-weight: 700; text-decoration: none;
}
body.fmke-shop .woocommerce-pagination ul.page-numbers li .page-numbers.current { background: var(--fmke-primary); border-color: var(--fmke-primary); color: #fff; }

/* Mobile "Categories & price" toggle: hidden on desktop */
.fmke-shop-filter-toggle { display: none; }

/* ---- Tablet ---------------------------------------------------------- */
@media (min-width: 783px) and (max-width: 1024px) {
  body.fmke-shop .site-content > .col-full:has(> .fmke-shop-sidebar) { grid-template-columns: 230px minmax(0, 1fr); column-gap: 20px; }
  body.fmke-shop .fmke-shop-sidebar { padding: 18px 14px 20px; }
  body.fmke-shop ul.products { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important; gap: 16px !important; }
}

/* ---- Phones ---------------------------------------------------------- */
@media (max-width: 782px) {
  body.fmke-shop .storefront-breadcrumb { padding: 12px 0 2px !important; }
  body.fmke-shop .site-content { padding: 8px 0 44px; }
  body.fmke-shop .site-content > .col-full:has(> .fmke-shop-sidebar) { display: block; }
  body.fmke-shop .woocommerce-products-header__title.page-title { font-size: 25px; }

  /* Toggle button */
  .fmke-shop-filter-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box;
    margin: 0 0 12px; padding: 13px 16px;
    background: #fff !important; color: var(--fmke-dark) !important;
    border: 1px solid var(--fmke-border) !important; border-radius: 14px !important;
    box-shadow: var(--fmke-shadow) !important;
    font-size: 14.5px !important; font-weight: 800 !important; text-transform: none !important; text-align: left; cursor: pointer;
  }
  .fmke-shop-filter-toggle svg:first-child { color: var(--fmke-primary); }
  .fmke-shop-filter-toggle__label { flex: 1; }
  .fmke-shop-filter-toggle__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--fmke-primary); }
  .fmke-shop-filter-toggle__chev { transition: transform .18s ease; color: var(--fmke-muted); }
  .fmke-shop-filter-toggle[aria-expanded="true"] .fmke-shop-filter-toggle__chev { transform: rotate(180deg); }
  .fmke-shop-filter-toggle:hover { background: #fff !important; color: var(--fmke-dark) !important; }

  /* Sidebar collapses only once JS has set up the toggle */
  body.fmke-shop .fmke-shop-sidebar.is-collapsible:not(.is-open) { display: none; }
  body.fmke-shop .fmke-shop-sidebar { margin: 0 0 16px !important; padding: 18px 16px 20px; }

  body.fmke-shop .site-content > .col-full > #primary { margin-top: 0 !important; }

  /* Count on the left, sort on the right — one row, not two */
  body.fmke-shop .storefront-sorting { flex-wrap: nowrap; gap: 10px; padding: 8px 12px !important; margin-bottom: 14px !important; }
  body.fmke-shop .storefront-sorting .woocommerce-result-count { font-size: 12.5px; line-height: 1.3; }
  body.fmke-shop .storefront-sorting .woocommerce-ordering { flex: 0 1 auto; min-width: 0; }
  body.fmke-shop .woocommerce-ordering select { height: 38px; min-height: 38px; max-width: 150px; font-size: 12.5px; padding: 0 30px 0 12px !important; }

  body.fmke-shop ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  body.fmke-shop ul.products li.product { padding: 8px 8px 12px !important; border-radius: 14px !important; }
  body.fmke-shop ul.products li.product img { border-radius: 10px !important; margin-bottom: 10px !important; }
  body.fmke-shop ul.products li.product .woocommerce-loop-product__title { font-size: 13.5px !important; }
  body.fmke-shop ul.products li.product .price { font-size: 14.5px; margin-bottom: 10px; }
  body.fmke-shop ul.products li.product a.button,
  body.fmke-shop ul.products li.product a.add_to_cart_button { padding: 10px 8px !important; font-size: 12.5px !important; }
  body.fmke-shop ul.products li.product .fmke-wishlist-btn { top: 40px; right: 10px; width: 30px !important; height: 30px !important; }
}
@media (max-width: 480px) {
  /* style.css stacks the toolbar into a column here; keep count + sort on one row */
  body.fmke-shop .storefront-sorting { flex-direction: row; align-items: center; }
  /* Narrow cards: stack the M-Pesa badge and SALE tag instead of overlapping */
  body.fmke-shop ul.products li.product .fmke-badges { top: 6px; left: 6px; right: 46px; }
  body.fmke-shop ul.products li.product .fmke-badge { padding: 3px 8px; font-size: 9.5px; white-space: nowrap; }
  body.fmke-shop ul.products li.product .fmke-badge-icon { display: none; }
  body.fmke-shop ul.products li.product .onsale { top: 6px !important; right: 6px !important; left: auto !important; }
}
@media (max-width: 340px) {
  body.fmke-shop ul.products { grid-template-columns: 1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
  .fmke-shop-filter-toggle__chev { transition: none; }
}

/* ==========================================================================
   Phones: everything on /shop and /product-category/... must FIT the screen
   (wrap / shrink / truncate) instead of relying on sideways scrolling.
   ========================================================================== */
@media (max-width: 782px) {
  /* Grid/flex children are allowed to shrink below their content width. */
  body.fmke-shop .site-content > .col-full,
  body.fmke-shop .site-content > .col-full > *,
  body.fmke-shop #primary,
  body.fmke-shop .site-main,
  body.fmke-shop .fmke-shop-sidebar { min-width: 0; max-width: 100%; box-sizing: border-box; }

  /* Headings, breadcrumb, descriptions: wrap long words instead of running off. */
  body.fmke-shop .woocommerce-breadcrumb,
  body.fmke-shop .woocommerce-products-header__title,
  body.fmke-shop .woocommerce-products-header .term-description,
  body.fmke-shop .fmke-shop-sidebar { overflow-wrap: anywhere; word-break: normal; }

  /* Category pills: wrap onto several rows instead of a sideways-scrolling strip. */
  body.fmke-shop .fmke-cat-shortcuts {
    flex-wrap: wrap !important;
    overflow: visible !important;
    scroll-snap-type: none;
    gap: 8px !important;
  }
  body.fmke-shop .fmke-cat-shortcut {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    padding: 6px 12px 6px 6px;
  }
  body.fmke-shop .fmke-cat-shortcut-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Banner: slider and its tabs shrink to the screen width. */
  body.fmke-shop .fmke-ssb { width: 100%; max-width: 100%; box-sizing: border-box; }
  body.fmke-shop .fmke-ssb__tabs { min-width: 0; }
  body.fmke-shop .fmke-ssb__tab,
  body.fmke-shop .fmke-ssb--cat .fmke-ssb__tab { min-width: 0; }
  body.fmke-shop .fmke-ssb__tablabel { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  body.fmke-shop .fmke-ssb__title { overflow-wrap: anywhere; max-width: 100%; }
  body.fmke-shop .fmke-ssb__copy { box-sizing: border-box; }

  /* Toolbar (result count + sort): count may wrap, dropdown shrinks. */
  body.fmke-shop .storefront-sorting { flex-wrap: wrap; max-width: 100%; }
  body.fmke-shop .storefront-sorting .woocommerce-result-count { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
  body.fmke-shop .storefront-sorting .woocommerce-ordering { flex: 0 1 150px; min-width: 0; margin-left: auto !important; }
  body.fmke-shop .woocommerce-ordering select { width: 100%; max-width: 100%; }
  body.fmke-shop .storefront-sorting .woocommerce-pagination { max-width: 100%; }
  body.fmke-shop .woocommerce-pagination ul.page-numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

  /* Sidebar filters (categories, price fields). */
  body.fmke-shop .fmke-shop-sidebar * { max-width: 100%; box-sizing: border-box; }
  body.fmke-shop .fmke-shop-sidebar input,
  body.fmke-shop .fmke-shop-sidebar select { min-width: 0; }
  body.fmke-shop .fmke-price-filter-fields,
  body.fmke-shop .fmke-shop-sidebar form { display: flex; flex-wrap: wrap; gap: 8px; }
  body.fmke-shop .fmke-price-field { flex: 1 1 110px; min-width: 0; }

  /* Product cards: contents wrap/clamp inside the card. */
  body.fmke-shop ul.products li.product { min-width: 0; max-width: 100%; overflow: hidden; }
  body.fmke-shop ul.products li.product .woocommerce-loop-product__title { overflow-wrap: anywhere; }
  body.fmke-shop ul.products li.product .price { max-width: 100%; overflow-wrap: anywhere; }
  body.fmke-shop ul.products li.product .fmke-card-rating { flex-wrap: wrap; max-width: 100%; }
  body.fmke-shop ul.products li.product a.button,
  body.fmke-shop ul.products li.product a.add_to_cart_button {
    max-width: 100%; white-space: normal; line-height: 1.25; overflow-wrap: anywhere;
  }
  body.fmke-shop ul.products li.product .fmke-badges { flex-wrap: wrap; }

  /* No-results / notices / term descriptions. */
  body.fmke-shop .woocommerce-info,
  body.fmke-shop .woocommerce-message,
  body.fmke-shop .woocommerce-error { max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
}
