/* ============================================================================
   ALPHA PEPTIDES — WooCommerce GLUE CSS   (owner: tuju-woo / P5)

   Scope rules, so this sheet can never fight tuju-shop or tuju-product:

   1. `.ap-woo` / `.ap-woo__inner` exist ONLY inside `woocommerce.php`'s
      FALLBACK branch, i.e. only while `archive-product.php` /
      `taxonomy-product_cat.php` / `single-product.php` are absent. Once
      tuju-shop or tuju-product ship a template, `.ap-woo` never renders and
      these rules match nothing. Zero overlap by construction.

   2. `ul.products.ap-woo-loop` is tagged by `inc/ap-woo.php` on
      `woocommerce_product_loop_start` — i.e. on loops WooCommerce itself
      printed (related products, up-sells, cross-sells, `[products]`, widgets,
      the fallback archive). An agent that prints its own `<ul class="products">`
      in a template does NOT get this class, so its own grid stands alone.
      Kill switch: add_filter( 'ap_woo_loop_class', '__return_empty_string' );

   ⛔ NOT IN THIS FILE, ON PURPOSE:
      - anything matching `.ap-cart-*` — the cart drawer is the
        `alphapeptides-checkout` plugin's, markup + CSS + JS + AJAX.
      - `.ap-pcard*` card internals — tuju-homepage's `ap-card.css`.
      - `.ap-hdr__cart*` — tuju-homepage's `ap-chrome.css`.
      - hiding `section.related.products` below ~1000px. The source DOES hide it
        (Blocksy `ct-hidden-sm ct-hidden-md`), but that is a PDP design decision
        and belongs to tuju-product. Reported, not shipped.
   ========================================================================= */

/* --------------------------------------------------------------------------
   1. FALLBACK page wrapper for Woo screens rendered by woocommerce.php
   -------------------------------------------------------------------------- */
.ap-woo {
	background: var(--ap-bg, #fff);
}

.ap-woo__inner {
	max-width: var(--ap-max, 1280px);
	margin: 0 auto;
	padding: clamp(26px, 4vw, 48px) var(--ap-gut, clamp(20px, 4vw, 56px)) clamp(48px, 7vw, 86px);
	font-family: var(--ap-font, inherit);
	color: var(--ap-ink-2, #3A4458);
}

.ap-woo__inner > h1.page-title {
	margin: 0 0 10px;
	font-family: var(--ap-font, inherit);
	font-size: clamp(28px, 3.2vw, 40px);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.06;
	color: var(--ap-ink, #0B1322);
}

.ap-woo__inner .woocommerce-result-count,
.ap-woo__inner .woocommerce-ordering {
	font-size: 14.5px;
	color: var(--ap-ink-3, #6E7890);
}

/* --------------------------------------------------------------------------
   2. GRID for WooCommerce-generated product loops
   -------------------------------------------------------------------------- */

/* ⛔ WooCommerce's own woocommerce.css ships
       .woocommerce ul.products li.product { float: left; width: 22.05%; margin: 0 3.8% 2.992em 0 }
   at 0,2,2. `float` takes every card OUT of grid flow, so a bare
   `ul.products { display:grid }` silently collapses the row and the cards
   stack at 22% width — the same failure family as the squeezed account rail.
   The selectors below are 0,3,1 / 0,3,2, which is >= Woo's, and they neutralise
   the float explicitly rather than hoping grid wins. */
body.ap-stg ul.products.ap-woo-loop {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(16px, 1.6vw, 22px);
	margin: 28px 0 0;
	padding: 0;
	list-style: none;
	clear: both;
}

body.ap-stg ul.products.ap-woo-loop > li.product {
	float: none;
	width: auto;
	margin: 0;
	padding: 0;
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

body.ap-stg ul.products.ap-woo-loop > li.product::before,
body.ap-stg ul.products.ap-woo-loop > li.product::after {
	content: none;
	display: none;
}

@media (max-width: 980px) {
	body.ap-stg ul.products.ap-woo-loop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
	body.ap-stg ul.products.ap-woo-loop {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
}

/* --------------------------------------------------------------------------
   3. MINIMAL card fallback inside those loops

   `ap-card.css` styles `.ap-pcard*` (the home variant) and the shared blue
   `.ap-pcard__cta`, but the 'grid' variant's own wrappers
   (`figure`, `.ct-media-container`, `.ap-bestseller`, `.ct-woo-card-actions`)
   have NO rule anywhere in the theme yet — tuju-shop owns their real design.
   These few lines stop them rendering broken in the meantime; they are the
   plainest possible shape, not a design.
   -------------------------------------------------------------------------- */
body.ap-stg ul.products.ap-woo-loop > li.product > figure {
	position: relative;
	margin: 0;
	border: 1px solid var(--ap-line, #E2E6ED);
	border-radius: var(--ap-radius, 14px);
	overflow: hidden;
	background: #fff;
}

body.ap-stg ul.products.ap-woo-loop .ct-media-container {
	display: block;
	aspect-ratio: 1 / 1;
	background-color: #F4EADC;
	overflow: hidden;
}

body.ap-stg ul.products.ap-woo-loop .ct-media-container img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: contain;
	display: block;
	margin: 0;
}

body.ap-stg ul.products.ap-woo-loop .onsale {
	position: absolute;
	top: 10px;
	left: 10px;
	right: auto;
	z-index: 2;
	margin: 0;
	min-width: 0;
	min-height: 0;
	padding: 4px 10px;
	border-radius: 6px;
	background: var(--ap-blue, #2563EB);
	color: #fff;
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
}

body.ap-stg ul.products.ap-woo-loop .ap-bestseller {
	align-self: flex-start;
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--ap-cream, #F4F6FA);
	border: 1px solid var(--ap-line, #E2E6ED);
	color: var(--ap-ink-2, #3A4458);
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

body.ap-stg ul.products.ap-woo-loop h2.woocommerce-loop-product__title {
	margin: 0;
	padding: 0;
	font-family: var(--ap-font, inherit);
	font-size: 17px;
	font-weight: 800;
	letter-spacing: 0.01em;
	line-height: 1.2;
	text-transform: uppercase;
}

body.ap-stg ul.products.ap-woo-loop h2.woocommerce-loop-product__title a {
	color: var(--ap-ink, #0B1322);
	text-decoration: none;
}

body.ap-stg ul.products.ap-woo-loop h2.woocommerce-loop-product__title a:hover {
	color: var(--ap-blue, #2563EB);
}

body.ap-stg ul.products.ap-woo-loop > li.product .price {
	margin: 0;
	font-size: 16px;
	font-weight: 800;
	color: var(--ap-ink, #0B1322);
}

body.ap-stg ul.products.ap-woo-loop > li.product .price del {
	margin-right: 6px;
	font-weight: 600;
	color: var(--ap-ink-3, #6E7890);
}

body.ap-stg ul.products.ap-woo-loop > li.product .price ins {
	text-decoration: none;
}

body.ap-stg ul.products.ap-woo-loop ul.entry-meta {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 12.5px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

body.ap-stg ul.products.ap-woo-loop ul.entry-meta a {
	color: var(--ap-ink-3, #6E7890);
	text-decoration: none;
}

body.ap-stg ul.products.ap-woo-loop .ct-woo-card-actions {
	margin-top: auto;
}

/* --------------------------------------------------------------------------
   4. Woo collateral headings inside a Woo-generated section
   -------------------------------------------------------------------------- */
body.ap-stg section.related > h2,
body.ap-stg section.up-sells > h2,
body.ap-stg .cross-sells > h2 {
	margin: 0;
	font-family: var(--ap-font, inherit);
	font-size: clamp(22px, 2.2vw, 30px);
	font-weight: 800;
	letter-spacing: -0.025em;
	line-height: 1.06;
	color: var(--ap-ink, #0B1322);
}
