/*
 * Store controls that rely on generic WooCommerce/Astra list rules.
 * Keep them outside LiteSpeed UCSS so archive pagination is stable on every
 * generated page, including category and translated archive routes.
 */

body.woocommerce nav.woocommerce-pagination {
  margin: 36px 0 0 !important;
  text-align: left !important;
}

body.woocommerce nav.woocommerce-pagination ul.page-numbers {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  list-style: none !important;
}

body.woocommerce nav.woocommerce-pagination ul.page-numbers li {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

body.woocommerce nav.woocommerce-pagination ul.page-numbers li > :is(a, span).page-numbers {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 30px;
  height: 30px;
  padding: 6px;
  border: 1px solid var(--text-primary) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-heading) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  text-align: center;
  text-decoration: none !important;
  font-synthesis: none;
}

body.woocommerce nav.woocommerce-pagination ul.page-numbers li > span.page-numbers.current {
  border-color: var(--text-primary) !important;
  background: var(--text-primary) !important;
  color: var(--text-inverse) !important;
}

body.woocommerce nav.woocommerce-pagination ul.page-numbers li > a.page-numbers:hover,
body.woocommerce nav.woocommerce-pagination ul.page-numbers li > a.page-numbers:focus-visible {
   background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}

@media (min-width: 922px) {
  body.woocommerce nav.woocommerce-pagination {
    text-align: right !important;
  }

  body.woocommerce nav.woocommerce-pagination ul.page-numbers {
    justify-content: flex-end !important;
  }
}

@media (max-width: 767px) {
  body.woocommerce nav.woocommerce-pagination {
    margin-top: 28px !important;
  }

  body.woocommerce nav.woocommerce-pagination ul.page-numbers {
    gap: 6px;
  }
}

/* The archive's product summary is a separate Astra white strip. Keep this
 * runtime layer outside UCSS because dark mode is toggled after first paint. */
html[data-theme="dark"] .astra-shop-summary-wrap {
  background-color: var(--surface-primary) !important;
}

html[data-theme="dark"] .astra-shop-summary-wrap :is(
  .ast-loop-product__link,
  .woocommerce-loop-product__title,
  .price,
  .price *
) {
  color: var(--text-primary) !important;
}

/* Astra gives archive thumbnails a bottom image margin. Its exposed parent
 * strip must follow the dark page surface; product-photo pixels stay intact. */
html[data-theme="dark"] .woocommerce ul.products li.product .astra-shop-thumbnail-wrap,
html[data-theme="dark"] .woocommerce ul.products li.product .astra-shop-thumbnail-wrap > a {
  background-color: var(--surface-primary) !important;
}

/* WooCommerce cards also carry Astra's generic .ast-article-post class. Astra
 * gives that class a white article background and a bottom divider; Chrome can
 * expose the backing colour on fractional grid edges as a full card outline.
 * Archive products are image + summary, not article cards, so neutralise the
 * article-card layer itself instead of patching borders on its children. */
body:is(.ast-woo-shop-archive, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
ul.products li.product.ast-article-post {
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

/* Some Astra versions draw the article divider through a pseudo-element rather
 * than the card border. Product cards do not use those article decorations. */
body:is(.ast-woo-shop-archive, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
ul.products li.product.ast-article-post::before,
body:is(.ast-woo-shop-archive, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
ul.products li.product.ast-article-post::after {
  opacity: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .breadcrumb-sort-wrapper .la-sort-dropdown .custom-selected {
  color: var(--text-primary) !important;
}

html[data-theme="dark"] .breadcrumb-sort-wrapper .la-sort-dropdown .custom-selected::after {
  width: 7px !important;
  height: 7px !important;
  flex-basis: 7px !important;
  background-image: none !important;
  border-right: 1px solid var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
  transform: translateY(-2px) rotate(45deg);
}

/* Product-card imagery does not change with the site theme. */
html[data-theme="dark"] .woocommerce ul.products li.product .la-oak-label,
html[data-theme="dark"] .woocommerce-page ul.products li.product .la-oak-label {
  color: #1f1f1f !important;
}
