/* ============================================================================
   SIMPLY ARI — SHOP STYLESHEET   (v1.2.4)
   ----------------------------------------------------------------------------
   Styles the WooCommerce product archive (/shop/) to match the site design.

   Loaded by the child theme's functions.php, conditionally with is_shop(),
   AFTER simply-ari.css (handle dependency 'simplyari-custom') so it can rely
   on that file's design tokens and .sa-eyebrow-line component.

   v1.1.2 fixes:
   - v1.1.1 killed the clearfix ::before/::after but only the `.woocommerce`
     selector variant. woocommerce-layout.css declares the SAME clearfix
     under `.woocommerce-page` — that twin survived and kept the phantom box
     above the image. v1.1.2 kills every variant, and broadens the image
     float override to match.

   v1.1.1 fixes (found by reading woocommerce.css):
   - The image looked "raised" because WooCommerce adds clearfix
     ::before/::after pseudo-elements (display:table) to every widget <li>.
     The ::before renders as a phantom box ABOVE the image. It never showed
     in DevTools because pseudo-elements aren't clickable. v1.1.1 removes
     both pseudo-elements with content:none — this is the actual fix.
   - Recently Viewed back to ONE item per row.
   - Image overrides WooCommerce's float:right / width:32px properly.

   v1.0.9 fixes:
   - The image was breaking OUT of the <li> (li box ended at the price; the
     image overflowed above it). Root cause: the image wasn't a normal
     in-flow block so it didn't add to the li's height. v1.0.9 makes the
     image a plain in-flow block with width:100% + aspect-ratio:1, fully
     contained and identical-square for every item.
   - This also resolves: uneven thumbnail sizes, excess item height, and
     uneven divider spacing. Items are now compact 2-up mini cards matching
     the main product grid.

   v1.0.8 fixes:
   - Recently Viewed images were rendering far larger than 88px (WooCommerce
     ships width="300" attributes + its own sizing rule). v1.0.8 pins the
     image to 80px with !important on width/height/max-width and a more
     specific selector (incl. img.attachment-woocommerce_thumbnail).
   - Widget heading no longer collides with the first item: the title gets
     bottom margin + a divider, and the list clears it.

   v1.0.7 fixes:
   - DevTools confirmed the exact culprit: WooCommerce's rule
     `ul.product_list_widget li { padding:.6em 0 .6em 5em }` reserves a 5em
     LEFT gutter for an absolutely-positioned thumbnail. v1.0.7 also forces
     position:static on the image (so it leaves that gutter) and zeroes the
     li's min-height:5em. Combined with v1.0.6's padding/overflow fixes,
     the stacked layout fully holds.

   v1.0.6 fixes:
   - Recently Viewed: DevTools confirmed the image fix works; the real bug
     was the TITLE clipped on its left edge. Cause: WooCommerce leaves left
     padding/indent on the li/a to clear the (now removed) image float, and
     v1.0.5's overflow:hidden then clipped it. v1.0.6 zeroes all inherited
     left spacing and sets overflow:visible so the title can't be clipped.

   v1.0.5 fixes:
   - Recently Viewed: WooCommerce core's `float:left` on the widget
     thumbnail was beating v1.0.4's plain `float:none`. Now every layout
     property is forced with !important and the float is cleared, so the
     stacked layout (image / title / price) always holds.

   v1.0.4 fixes:
   - Header centering: Astra's `body.archive .ast-archive-description
     {text-align:left}` out-specified the v1.0.3 rule. Now matched with a
     `body.archive ...` selector so the title actually centers.
   - Recently Viewed switched to a STACKED layout (image, title, price
     below) — fits the narrow sidebar; the title no longer clips.

   v1.0.3 fixes:
   - Scope broadened from .woocommerce-shop to .ast-woo-shop-archive, which
     Astra puts on BOTH /shop/ AND /product-category/* pages. Fixes styling
     vanishing on category archives. (Also requires the functions.php
     condition to use is_product_taxonomy() — see README.)
   - Recently Viewed: variable/sale products output multiple loose price
     spans; the link is now hard-capped and the title clamped to 2 lines so
     price pieces can't overlap the thumbnail or wrap badly.
   - Archive header styled: serif title + centered teal accent rule, works
     for both "Shop" and category names; term description styled too.

   v1.0.2 fixes (from live screenshots):
   - Category count and Recently-Viewed price are SIBLINGS of the <a>, not
     children — so flex the <li>, not the <a>. Fixes count dropping to its
     own line and the price wrapping / text overlapping the thumbnail.

   v1.0.1 fixes:
   - Image placeholder gradient removed (it bled a mint strip under photos).
   - Sidebar category list restyled as a clean vertical list, not cramped
     horizontal pills (the widget lives in the narrow sidebar).
   - Recently Viewed restyled for the narrow sidebar (was a wide mint band).
   - Shop title polished so it stands on its own; eyebrow now optional.
   - Selectors raised in specificity to beat Astra's .ast-article-post /
     .ast-grid-common-col rules on the product <li>.

   MAINTENANCE: bump the version in the functions.php enqueue on each edit.
   ============================================================================ */

.ast-woo-shop-archive {
  --co-teal:   #3a9c8e;
  --co-pink:   #e05a9a;
  --co-text:   #2d2233;
  --co-muted:  #7a6e82;
  --co-cream:  #fdf9f6;
  --co-navy:   #1a2440;
  --co-r:      16px;
  --co-pill:   40px;
}

/* ---- PAGE CANVAS ---- */
.ast-woo-shop-archive.ast-plain-container,
.ast-woo-shop-archive .ast-woocommerce-container {
  background: var(--co-cream);
}

/* ---- ARCHIVE HEADER ----
   The archive title: "Shop" on /shop/, or the category name on
   /product-category/*. Astra ships `body.archive .ast-archive-description
   { text-align:left }` — a higher-specificity selector — so we MUST match
   that `body.archive ...` shape here to win and center the title. */
body.archive .ast-archive-description,
.ast-woo-shop-archive .ast-archive-description {
  background: transparent;
  border: 0;
  text-align: center !important;
  padding: 30px 16px 6px;
  margin-bottom: 6px;
}
body.archive .ast-archive-description .ast-archive-title,
.ast-woo-shop-archive .ast-archive-description .ast-archive-title {
  position: relative;
  display: block;
  width: 100%;
  text-align: center !important;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(34px, 4.5vw, 50px) !important;
  font-weight: 600;
  color: var(--co-text);
  line-height: 1.15;
  margin: 0;
  padding-bottom: 16px;
}
/* short teal accent rule, centered under the title */
body.archive .ast-archive-description .ast-archive-title::after,
.ast-woo-shop-archive .ast-archive-description .ast-archive-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 54px;
  height: 3px;
  border-radius: 3px;
  background: var(--co-teal);
}
/* category term description, if present */
.ast-woo-shop-archive .term-description {
  max-width: 540px;
  margin: 14px auto 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
  color: var(--co-muted);
}

/* ---- RESULT COUNT + SORT ---- */
.ast-woo-shop-archive .woocommerce-result-count {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--co-muted);
}
.ast-woo-shop-archive .woocommerce-ordering select.orderby {
  border: 1px solid rgba(58,156,142,0.22);
  border-radius: var(--co-pill);
  padding: 9px 36px 9px 18px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 12px;
  color: var(--co-text);
  background-color: #fff;
}

/* ============================================================================
   PRODUCT CARDS
   The product <li> also carries Astra's .ast-article-post and
   .ast-grid-common-col. Selectors below include .ast-article-post to win
   specificity over Astra core, and force centre alignment over Astra's
   .desktop-align-left.
   ============================================================================ */
.ast-woo-shop-archive ul.products li.product.ast-article-post,
.ast-woo-shop-archive ul.products li.product {
  background: #fff;
  border: 1px solid rgba(224,90,154,0.10);
  border-radius: var(--co-r);
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(224,90,154,0.06);
  transition: transform 0.25s, box-shadow 0.25s;
  text-align: center;
}
.ast-woo-shop-archive ul.products li.product.ast-article-post:hover,
.ast-woo-shop-archive ul.products li.product:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 44px rgba(224,90,154,0.13);
}

/* image area — PLAIN WHITE. (v1.0.0 used a gradient here; because the real
   product photos don't fully fill the square wrapper, the gradient showed
   as a mint strip under each image. White fixes that cleanly.) */
.ast-woo-shop-archive ul.products li.product .astra-shop-thumbnail-wrap {
  position: relative;
  background: #fff;
  overflow: hidden;
}
.ast-woo-shop-archive ul.products li.product .astra-shop-thumbnail-wrap img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s;
}
.ast-woo-shop-archive ul.products li.product:hover .astra-shop-thumbnail-wrap img {
  transform: scale(1.04);
}

/* text block — force centre over Astra's desktop-align-left */
.ast-woo-shop-archive ul.products li.product .astra-shop-summary-wrap {
  padding: 14px 15px 18px;
  text-align: center !important;
}
.ast-woo-shop-archive ul.products li.product .woocommerce-loop-product__title {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--co-text);
  line-height: 1.35;
  padding: 0;
  margin: 0 0 5px;
}

/* price — pink; sale: original struck in muted, current in pink.
   Note: Astra core colours the price with --ast-global-color-3 at high
   specificity, so this rule is scoped tightly to win. */
.ast-woo-shop-archive ul.products li.product .price,
.ast-woo-shop-archive ul.products li.product .price ins {
  color: var(--co-pink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.ast-woo-shop-archive ul.products li.product .price del {
  color: var(--co-muted);
  font-weight: 400;
  font-size: 11px;
  margin-right: 3px;
}

/* add to cart / select options — full-width pill, fills teal on card hover */
.ast-woo-shop-archive ul.products li.product .button,
.ast-woo-shop-archive ul.products li.product a.add_to_cart_button {
  display: block;
  width: 100%;
  margin: 6px 0 0;
  background: transparent;
  border: 1.5px solid var(--co-teal);
  color: var(--co-teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 10px 8px;
  border-radius: var(--co-pill);
}
.ast-woo-shop-archive ul.products li.product:hover .button,
.ast-woo-shop-archive ul.products li.product:hover a.add_to_cart_button {
  background: var(--co-teal);
  color: #fff;
}

/* SALE badge — WooCommerce outputs <span class="onsale"> automatically */
.ast-woo-shop-archive ul.products li.product .onsale {
  position: absolute;
  top: 12px;
  left: 12px;
  right: auto;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 4px 11px;
  border-radius: var(--co-pill);
  background: var(--co-teal);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.7;
}

/* ============================================================================
   SIDEBAR  (#secondary)  — price filter, categories, recently viewed
   All three widgets stay in the sidebar. Each is wrapped in
   .ast-woo-sidebar-widget. Styled as a cohesive narrow rail.
   ============================================================================ */
.ast-woo-shop-archive #secondary .ast-woo-sidebar-widget {
  background: #fff;
  border: 1px solid rgba(58,156,142,0.14);
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 22px;
}
.ast-woo-shop-archive #secondary .widget-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--co-text);
  margin: 0 0 12px;
  line-height: 1.2;
}

/* ---- price filter slider ---- */
.ast-woo-shop-archive #secondary .widget_price_filter .price_slider,
.ast-woo-shop-archive #secondary .widget_price_filter .ui-slider {
  background: #e1f5ee;
  border-radius: 4px;
  height: 4px;
}
.ast-woo-shop-archive #secondary .widget_price_filter .ui-slider-range {
  background: var(--co-teal);
}
.ast-woo-shop-archive #secondary .widget_price_filter .ui-slider-handle {
  background: #fff;
  border: 2px solid var(--co-teal);
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.ast-woo-shop-archive #secondary .widget_price_filter .price_label {
  font-size: 12px;
  color: var(--co-muted);
}

/* ---- CATEGORY LIST ----
   Real markup:  <li> <a><span __name>Cat</span></a> <span -count>5</span> </li>
   The count span is a SIBLING of the <a>, not inside it — so we flex the
   <li> (not the <a>) to put name-link + count on one row. */
.ast-woo-shop-archive #secondary .wc-block-product-categories-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ast-woo-shop-archive #secondary .wc-block-product-categories-list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(58,156,142,0.10);
}
.ast-woo-shop-archive #secondary .wc-block-product-categories-list-item:last-child {
  border-bottom: 0;
}
.ast-woo-shop-archive #secondary .wc-block-product-categories-list-item > a {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--co-text);
  text-decoration: none;
}
.ast-woo-shop-archive #secondary .wc-block-product-categories-list-item > a:hover {
  color: var(--co-teal);
}
.ast-woo-shop-archive #secondary .wc-block-product-categories-list-item-count {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--co-muted);
}

/* ---- RECENTLY VIEWED ----  REBUILD: Step 1 CORRECTED (v1.2.2)
   ----------------------------------------------------------------------------
   KEY FINDING (confirmed by toggling the line live):
   `padding` on the <li> BREAKS this widget — WooCommerce's image is
   absolutely positioned, so it anchors to the <li>'s padding box. Adding
   <li> padding shifts that box and drags the image OVER the text.
   => NEVER put padding on the <li>. Use margin for item spacing instead;
   margin doesn't move the padding box, so the image stays put.

   Step 1 (corrected): item separation only — a divider + margin. No padding
   on the <li>. Nothing else touched. Default markup:
   <li> <a><img><span.product-title></a> <span.amount> </li>
   ---------------------------------------------------------------------------- */
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li {
  /* NO padding here — it moves the absolute image. Use margin only. */
  margin: 0 0 12px 0;
  padding-bottom: 12px;            /* SAFE: bottom-only padding doesn't shift
                                      the image (image anchors top-left). */
  border-bottom: 1px solid rgba(58,156,142,0.12);
}
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

/* ---- RECENTLY VIEWED ----  REBUILD: Step 2 (v1.2.3): text + price sizing
   Product name and price were inheriting a large size — as big as the
   widget title — leaving no hierarchy. Step 2 sizes ONLY the .product-title
   and the price spans. It does NOT touch the <li> (locked rule: never pad
   the <li>), the image, or layout. */

/* product name — smaller than the widget title, clear but compact */
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li .product-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--co-text);
}
/* Step 3 (v1.2.4): hover — product name turns teal, matching the category
   links above it. The clickable element is the whole <li>'s <a>; hovering
   it recolors the .product-title span inside. Also a subtle image fade. */
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li > a {
  transition: opacity 0.15s ease;
}
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li > a:hover .product-title {
  color: var(--co-teal);
}
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li > a:hover img {
  opacity: 0.85;
}

/* price — smaller still; sits below the name as the quietest line.
   covers regular price, the <ins> sale price, and the range dash. */
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li .woocommerce-Price-amount,
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li ins,
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li > span[aria-hidden] {
  font-size: 12px;
  font-weight: 700;
  color: var(--co-pink);
  text-decoration: none;
}

/* sale: the struck-through original price, muted and lighter */
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li del,
.ast-woo-shop-archive #secondary .widget_recently_viewed_products ul.product_list_widget li del .woocommerce-Price-amount {
  font-size: 11px;
  font-weight: 400;
  color: var(--co-muted);
}

/* ============================================================================
   PAGINATION — its own clearly separated band
   ============================================================================ */
.ast-woo-shop-archive nav.woocommerce-pagination {
  margin-top: 16px;
  padding: 40px 0;
  border-top: 1px solid #e6dcd0;
  text-align: center;
}
.ast-woo-shop-archive nav.woocommerce-pagination ul {
  border: none;
  display: inline-flex;
  gap: 8px;
}
.ast-woo-shop-archive nav.woocommerce-pagination ul li {
  border: none;
  margin: 0;
}
.ast-woo-shop-archive nav.woocommerce-pagination ul li a.page-numbers,
.ast-woo-shop-archive nav.woocommerce-pagination ul li span.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(58,156,142,0.22);
  background: #fff;
  color: var(--co-muted);
  font-size: 14px;
  font-weight: 700;
}
/* Astra core colours .current with --ast-global-color-2 — scoped to win */
.ast-woo-shop-archive nav.woocommerce-pagination ul li span.page-numbers.current {
  background: var(--co-teal);
  border-color: var(--co-teal);
  color: #fff;
}
.ast-woo-shop-archive nav.woocommerce-pagination ul li a.page-numbers:hover {
  border-color: var(--co-teal);
  color: var(--co-teal);
  background: #fff;
}
.ast-woo-shop-archive nav.woocommerce-pagination ul li a.next,
.ast-woo-shop-archive nav.woocommerce-pagination ul li a.prev {
  width: auto;
  padding: 0 22px;
  border-radius: var(--co-pill);
  color: var(--co-teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 921px) {
  .ast-woo-shop-archive #secondary,
  .ast-woo-shop-archive #primary { width: 100%; }
}

/* END OF SIMPLY ARI SHOP STYLESHEET */
