/**
 * Plush Toys Storefront Child Theme — WooCommerce archive / loop
 *
 * Unified product cards: white surface with border + soft shadow, image
 * on top, left-aligned title and stock status, and a footer row pairing
 * a bold price with a pill-shaped magenta "Add to cart" button.
 *
 * Dependencies: variables.css, typography.css, layout.css
 */

/* Hide Storefront's default products header on archive pages */
.plush-product-archive .woocommerce-products-header {
	display: none;
}

/* Hide Storefront's sorting wrapper (ordering dropdown + result count) */
.storefront-sorting {
	display: none;
}

/* ========================================
   HOMEPAGE HOOK (front-page.php)
   ======================================== */

.plush-homepage .site-main {
	padding-top: 0;
	padding-bottom: var(--space-16);
}

.plush-homepage .content-area {
	max-width: var(--container-max-width);
	margin: 0 auto;
}

.plush-homepage-products,
.plush-homepage-products .plush-product-grid {
	padding-top: 0;
	margin-top: 0;
}

/* Homepage (.home body class): collapse Storefront's default content padding
   and suppress any page-template siblings (entry-header, featured image,
   widget regions, breadcrumb, empty post titles) that would otherwise push
   the grid down the page. Only our #primary.plush-homepage wrapper renders. */
body.home .site-content,
body.home .site-content > .col-full {
	padding-top: 0;
}

body.home #content > .col-full > *:not(#primary),
body.home .hentry > .entry-header,
body.home .entry-header:not(.plush-shop-header),
body.home .page-header:not(.plush-shop-header),
body.home .storefront-hero,
body.home .storefront-post-header,
body.home .woocommerce-breadcrumb,
body.home .post-thumbnail,
body.home .entry-title:empty {
	display: none !important;
}

.plush-homepage-title {
	font-size: var(--text-size-3xl);
	font-weight: var(--font-weight-bold);
	color: var(--color-text-primary);
	letter-spacing: var(--tracking-tight);
	margin: 0 0 var(--space-6);
}

@media (min-width: 768px) {
	.plush-homepage-title {
		font-size: var(--text-size-4xl);
	}
}

.plush-homepage-header::after {
	content: "";
	display: block;
	width: 56px;
	height: 3px;
	border-radius: var(--radius-pill);
	background-color: var(--color-accent);
	margin: 0 auto;
}

.plush-no-products {
	text-align: center;
	padding: var(--space-16) var(--space-4);
	color: var(--color-text-secondary);
	font-size: var(--text-size-lg);
}

/* Accessibility */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* ========================================
   PRODUCT GRID
   ======================================== */

.plush-product-grid {
	display: grid;
	grid-template-columns: repeat(1, 1fr);
	gap: var(--space-10);
	padding: var(--space-10) var(--container-padding-x);
	max-width: 1440px;
	margin: 0 auto;
	list-style: none;
}

@media (min-width: 640px) {
	.plush-product-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.plush-product-grid {
		grid-template-columns: repeat(3, 1fr);
		column-gap: var(--space-16);
		row-gap: var(--space-12);
		padding: var(--space-12) var(--space-8);
	}
}

/* ========================================
   PRODUCT CARD
   ======================================== */

.plush-product-card {
	display: flex;
	flex-direction: column;
	list-style: none;
	margin: 0;
	padding: var(--space-6);
	background-color: var(--color-bg-card);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.plush-product-card:hover,
.plush-product-card:focus-within {
	transform: translateY(-4px);
	box-shadow: var(--shadow-card-hover);
}

.plush-product-link {
	display: block;
	text-decoration: none;
	color: inherit;
	border-radius: var(--radius-md);
}

.plush-product-link:hover,
.plush-product-link:focus,
.plush-product-link:active {
	text-decoration: none;
	color: inherit;
	outline: none;
	box-shadow: none;
}

.plush-product-link:focus-visible {
	outline: none;
	box-shadow: none;
}

/* ----- Image ----- */

.plush-product-image {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--radius-md);
}

.plush-product-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: transform var(--transition-slow);
}

.plush-product-card:hover .plush-product-image img {
	transform: scale(1.03);
}

.plush-product-image .woocommerce-loop-product__link {
	display: block;
}

.plush-product-image .attachment-woocommerce_thumbnail,
.plush-product-image .woocommerce-placeholder {
	margin: 0;
	display: block;
}

/* ----- Stock badge row (right-aligned, just below image) ----- */

.plush-product-stock-row {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--space-4);
}

.plush-product-stock {
	display: inline-block;
	padding: var(--space-1) var(--space-3);
	border-radius: var(--radius-pill);
	font-size: var(--text-size-xs);
	font-weight: var(--font-weight-semibold);
	line-height: 1.4;
	background-color: rgba(34, 197, 94, 0.14);
	color: #1F8B4A;
}

.plush-product-stock--outofstock {
	background-color: rgba(225, 29, 72, 0.12);
	color: var(--color-error);
}

.plush-product-stock--onbackorder {
	background-color: rgba(255, 159, 28, 0.16);
	color: #B86E00;
}

/* ----- Title ----- */

.plush-product-info {
	text-align: left;
	padding-top: var(--space-4);
}

.plush-product-title {
	font-family: var(--font-display);
	font-size: 18px;
	font-weight: var(--font-weight-bold);
	color: var(--color-text-primary);
	line-height: var(--leading-snug);
	margin: 0;
}

/* ----- Price (pushed to the bottom of the card by margin-top: auto) ----- */

.plush-product-meta {
	margin-top: auto;
	padding-top: var(--space-6);
}

.plush-product-price {
	display: block;
	margin: 0;
}

.woocommerce .plush-product-card .plush-product-price .price,
.woocommerce .plush-product-card .plush-product-price > span,
.woocommerce .plush-product-card .plush-product-price .woocommerce-Price-amount,
.woocommerce .plush-product-card .plush-product-price .woocommerce-Price-currencySymbol,
.plush-product-card .plush-product-price .price,
.plush-product-card .plush-product-price .woocommerce-Price-amount {
	background: transparent;
	color: var(--color-accent);
	padding: 0;
	font-family: var(--font-display);
	font-weight: 800;
	font-size: 32px;
	letter-spacing: -0.02em;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1, "lnum" 1;
	white-space: nowrap;
}

/* ----- Full-width Add-to-cart button (icon + text) ----- */

.plush-product-cart {
	margin-top: var(--space-5);
}

.plush-product-cart .button,
.plush-product-cart a.button,
.plush-product-cart .add_to_cart_button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	width: 100%;
	height: 52px;
	padding: 0 var(--space-5);
	border: 0;
	border-radius: var(--radius-pill);
	background-color: var(--color-accent);
	color: var(--color-text-inverse);
	font-family: var(--font-display);
	font-size: var(--text-size-base);
	font-weight: var(--font-weight-semibold);
	letter-spacing: 0;
	line-height: 1;
	box-shadow: none;
	cursor: pointer;
	transition: background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.plush-product-cart .button::before,
.plush-product-cart a.button::before,
.plush-product-cart .add_to_cart_button::before {
	content: "";
	display: inline-block;
	width: 18px;
	height: 18px;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z'/><path d='M3 6h18'/><path d='M16 10a4 4 0 0 1-8 0'/></svg>");
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}

.plush-product-cart .button:hover,
.plush-product-cart a.button:hover,
.plush-product-cart .add_to_cart_button:hover {
	background-color: var(--color-accent-hover);
	color: var(--color-text-inverse);
	transform: translateY(-1px);
}

.plush-product-cart .button:focus-visible,
.plush-product-cart a.button:focus-visible,
.plush-product-cart .add_to_cart_button:focus-visible {
	outline: none;
	box-shadow: var(--shadow-focus);
}

/* Suppress the "View cart →" link WooCommerce appends after an AJAX add.
   The appended element has classes .added_to_cart.wc-forward (no .button). */
.plush-product-cart .added_to_cart,
.plush-product-cart a.added_to_cart,
.plush-product-cart .wc-forward {
	display: none !important;
}

.plush-product-cart .button.loading {
	opacity: 0.7;
}

.plush-product-price .woocommerce-Price-amount,
.plush-product-price .woocommerce-Price-currencySymbol {
	color: inherit;
}

/* Sale price: show only the new (sale) price; hide the struck-through original. */
.plush-product-price ins {
	background: transparent;
	text-decoration: none;
	color: inherit;
	margin: 0;
}

.plush-product-price del {
	display: none;
}

/* ========================================
   STRIP WOO GRID DEFAULTS
   ======================================== */

.plush-product-card:hover .plush-product-image::before,
.plush-product-card:hover .plush-product-image::after {
	display: none;
}

/* Star rating (if shown) — left-aligned under title */
.plush-product-card .star-rating {
	margin: var(--space-2) 0 0;
	font-size: var(--text-size-xs);
}

/* ========================================
   MOTION PREFERENCE
   ======================================== */

@media (prefers-reduced-motion: reduce) {
	.plush-product-card,
	.plush-product-image,
	.plush-product-image img {
		transition: none;
	}

	.plush-product-card:hover,
	.plush-product-card:hover .plush-product-image img {
		transform: none;
	}
}
