/**
 * Shop archive and product-category archives: the product card grid.
 *
 * Loaded by fg_enqueue_shop_styles() on is_shop() / is_product_taxonomy().
 * Cards are rendered by core's loop templates with the button swapped for a
 * plain View link (fg_loop_view_link() in functions.php).
 *
 * Same design system as checkout/cart/product/membership: white cards,
 * square corners, --fg-line borders, brand green actions, Lato. Scoped
 * body.woocommerce.archive, which covers /shop/ and every product_cat
 * archive, with the usual specificity edge over the late-loading external
 * stylesheets. Known blog-style.css hazards handled below:
 *   - h1-h6 green underline + 500px max-width (would hit card titles)
 *   - ul.products a.button { position:absolute; bottom:10%; right:0 }
 *     (buttons over titles -- same trap as the related-products cards)
 */

:root {
	--fg-green: #50ae26;
	--fg-green-dark: #46991f;
	--fg-ink: #1c1e21;
	--fg-muted: #6b7280;
	--fg-line: #e2e5e8;
	--fg-field: #b8bfc6;
	--fg-surface: #ffffff;
	--fg-radius: 0; /* square corners across the store, per design */
}

/* -------------------------------------------------------------------------
 * Container. #content owns the gutter, same deal as cart/checkout.
 * ---------------------------------------------------------------------- */
body.woocommerce.archive #content {
	max-width: 900px;
	margin: 0 auto;
	box-sizing: border-box;
}

body.woocommerce.archive .fullpostentry,
body.woocommerce.archive #blogcontent,
body.woocommerce.archive .fp__woo-commerce #blogcontent {
	max-width: none;
	width: 100%;
	padding: 0;
	font-family: Lato, arial, helvetica, sans-serif;
}

/* Page title keeps the site's green h1 underline from the external styles;
   just un-constrain it (500px max-width would clip the rule short). */
body.woocommerce.archive .woocommerce-products-header .page-title {
	max-width: none;
	width: 100%;
	margin: 0 0 18px;
	box-sizing: border-box;
}

body.woocommerce.archive .fp__woo-commerce .woocommerce-breadcrumb {
	margin: 0 0 16px;
	font-size: 13px;
	color: var(--fg-muted);
}

body.woocommerce.archive .fp__woo-commerce .woocommerce-breadcrumb a {
	color: var(--fg-green);
}

/* Removed server-side (woocommerce_before_shop_loop unhooks); kept here so a
   cached fragment can never resurrect them. */
body.woocommerce.archive .woocommerce-result-count,
body.woocommerce.archive .woocommerce-ordering {
	display: none;
}

/* -------------------------------------------------------------------------
 * Notices ("... has been added to your cart", errors). Same card treatment
 * as product/checkout pages -- this stylesheet loads where they do not.
 * ---------------------------------------------------------------------- */
body.woocommerce.archive .fp__woo-commerce .woocommerce-message,
body.woocommerce.archive .fp__woo-commerce .woocommerce-info,
body.woocommerce.archive .fp__woo-commerce .woocommerce-error {
	box-shadow: none;
	outline: none;
	background: var(--fg-surface);
	background-color: var(--fg-surface);
	border: 1px solid var(--fg-line);
	border-left: 4px solid var(--fg-green);
	border-radius: var(--fg-radius);
	margin: 0 0 18px;
	padding: 13px 16px;
	list-style: none;
	font-size: 14px;
	line-height: 1.5;
	color: var(--fg-ink);
	text-align: left;
}

body.woocommerce.archive .fp__woo-commerce .woocommerce-error {
	border-left-color: #d63638;
	color: #b32d2e;
}

/* -------------------------------------------------------------------------
 * The grid.
 * ---------------------------------------------------------------------- */
body.woocommerce.archive .fp__woo-commerce ul.products {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 220px, 1fr ) );
	gap: 18px;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product {
	list-style: none;
	float: none;
	width: auto;
	max-width: none;
	margin: 0;
	padding: 14px;
	position: relative; /* sale badge anchor */
	display: flex;
	flex-direction: column;
	background: var(--fg-surface);
	border: 1px solid var(--fg-line);
	border-radius: var(--fg-radius);
	box-sizing: border-box;
	text-align: center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product:hover {
	border-color: var(--fg-field);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

/* The image + title + price block is one link; it flexes so the View button
   below it pins to the card bottom and all buttons align across a row. */
body.woocommerce.archive .fp__woo-commerce ul.products li.product a.woocommerce-LoopProduct-link {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	color: var(--fg-ink);
	text-decoration: none;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product img {
	width: 100%;
	height: auto;
	margin: 0;
	border-radius: 0;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product .woocommerce-loop-product__title {
	max-width: none;
	margin: 10px 0 4px;
	padding: 0;
	border: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--fg-ink);
	text-align: center;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product .price {
	display: block;
	margin: 2px 0 12px;
	font-size: 14px;
	font-weight: 700;
	color: var(--fg-ink);
}

/* "From:" prefix and "/ month" suffix on the subscription: quiet, so the
   number carries the line. */
body.woocommerce.archive .fp__woo-commerce ul.products li.product .price .from,
body.woocommerce.archive .fp__woo-commerce ul.products li.product .price .subscription-details {
	font-weight: 400;
	font-size: 13px;
	color: var(--fg-muted);
}

/* The View link. position:static overrides blog-style's absolute placement
   (bottom:10%/right:0 -- lands on the title otherwise). */
body.woocommerce.archive .fp__woo-commerce ul.products li.product a.button {
	position: static;
	display: block;
	width: 100%;
	margin: 0;
	padding: 11px 16px;
	border: 0;
	border-radius: var(--fg-radius);
	background-color: var(--fg-green);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product a.button:hover,
body.woocommerce.archive .fp__woo-commerce ul.products li.product a.button:focus {
	background-color: var(--fg-green-dark);
	color: #fff;
	opacity: 1;
}

body.woocommerce.archive .fp__woo-commerce ul.products li.product .onsale {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 1;
	margin: 0;
	padding: 3px 10px;
	background: var(--fg-green);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 0;
	min-height: 0;
	min-width: 0;
	line-height: 1.4;
}

/* -------------------------------------------------------------------------
 * Narrow screens: same 10px gutter as cart/checkout, two-up cards.
 * ---------------------------------------------------------------------- */
@media (max-width: 800px) {
	body.woocommerce.archive #content {
		padding-left: 10px;
		padding-right: 10px;
	}

	body.woocommerce.archive .fp__woo-commerce ul.products {
		grid-template-columns: repeat( auto-fill, minmax( 150px, 1fr ) );
		gap: 12px;
	}

	body.woocommerce.archive .fp__woo-commerce ul.products li.product {
		padding: 10px;
	}
}

/* -------------------------------------------------------------------------
 * Dark mode ("theme-fg" cookie -> body.dark-mode; the external styles turn
 * #wrapper near-black). Every rule in this file reads the tokens, so dark
 * support is this flip. Anything hardcoded light above was converted to a
 * token when this block landed -- keep it that way.
 * ---------------------------------------------------------------------- */
body.dark-mode {
	--fg-ink: #e8eaed;
	--fg-muted: #9aa1a8;
	--fg-line: #3a3d41;
	--fg-field: #5b6167;
	--fg-surface: #242628;
}
