/**
 * wwh/shop-grid — paginated product grid for the wwh_product archive.
 *
 * Plate-card layout matching the v3 design system: 4:5 image, italic
 * title, category eyebrow, maker line, price + stock row.
 */

.wwh-fp-shop-wrap {
	max-width: 1320px;
	margin: 0 auto;
	padding: 4rem clamp(1.5rem, 5vw, 4rem);
	transition: opacity 150ms ease;
}

.wwh-fp-shop-wrap[aria-busy="true"] {
	opacity: 0.5;
	pointer-events: none;
}

/* Toolbar — category chips + sort dropdown. Mirrors wwh-makers__chips. */
.wwh-shop__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	margin: 0 0 2.5rem;
}

.wwh-shop__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	flex: 1 1 auto;
}

.wwh-shop__chip {
	display: inline-flex;
	align-items: center;
	padding: 0.4rem 1rem;
	background: rgba( 255, 255, 255, 0.85 );
	color: var( --wp--preset--color--ink, #241823 );
	border: 1px solid rgba( 36, 24, 35, 0.18 );
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--ui), 'Montserrat', sans-serif;
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 500;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.wwh-shop__chip:hover {
	background: #fff;
	border-color: rgba( 36, 24, 35, 0.4 );
}
.wwh-shop__chip.is-active,
.wwh-shop__chip[aria-current="page"] {
	background: var( --wp--preset--color--ink, #241823 );
	color: #f2e6d8;
	border-color: var( --wp--preset--color--ink, #241823 );
}
.wwh-shop__chip:focus-visible {
	outline: 2px solid var( --wp--preset--color--gold, #c9a86b );
	outline-offset: 3px;
}
.wwh-shop__chip--toggle {
	margin-left: 0.5rem;
	border-style: dashed;
}
.wwh-shop__chip--toggle.is-active {
	border-style: solid;
}

.wwh-shop__sort {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-family: var(--wp--preset--font-family--ui), 'Montserrat', sans-serif;
	font-size: var(--wp--preset--font-size--cap);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink-caption, #5a544d);
}
.wwh-shop__sort label {
	cursor: default;
}
.wwh-shop__sort select {
	font-family: inherit;
	font-size: var(--wp--preset--font-size--caption);
	letter-spacing: 0.04em;
	text-transform: none;
	padding: 0.4rem 2rem 0.4rem 0.85rem;
	background: rgba( 255, 255, 255, 0.85 );
	color: var( --wp--preset--color--ink, #241823 );
	border: 1px solid rgba( 36, 24, 35, 0.18 );
	border-radius: 999px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23241823' stroke-width='1.5' d='M1 1l4 4 4-4'/></svg>");
	background-repeat: no-repeat;
	background-position: right 0.85rem center;
}
.wwh-shop__sort select:focus-visible {
	outline: 2px solid var( --wp--preset--color--gold, #c9a86b );
	outline-offset: 3px;
}

.wwh-shop__empty {
	color: var( --wp--preset--color--ink-caption, #5A544D );
	font-style: italic;
}

/* GST note for the whole grid. A real colour rather than a lower opacity, so it
   stays a readable disclosure — the same token .wwh-shop__empty relies on.

   F-4: this was `var(--muted, #6B7689)`. Two problems. `--muted` is defined
   NOWHERE, so the #6B7689 fallback always won — the var() was decorative. And
   #6B7689 measures 4.00:1 on the site's warm-cream #F2EFEA background, under
   the 4.5:1 AA needs. It passes (4.59:1) on white, which is presumably where it
   was checked. ink-caption is the theme's existing caption colour and gives
   6.52:1 on cream. This text is a tax disclosure — it has to be legible. */
.wwh-shop__gst {
	color: var( --wp--preset--color--ink-caption, #5A544D );
	font-size: 0.875rem;
	margin: 1rem 0 0;
}

@media (max-width: 720px) {
	.wwh-shop__toolbar {
		flex-direction: column;
		align-items: stretch;
	}
	.wwh-shop__sort {
		justify-content: flex-end;
	}
	/*
	 * WCAG 1.4.10 (Reflow) — a flex item defaults to `min-width: auto`, which
	 * refuses to shrink below its content's intrinsic width. The maker <select>
	 * is 256px wide, so at 320px the toolbar's children measured 324px inside a
	 * 257px parent and pushed 43px of horizontal scroll onto the whole page.
	 * `min-width: 0` lets them shrink to the column; the select then truncates
	 * with an ellipsis instead of overflowing.
	 *
	 * The carousel above had a *separate* reflow bug at the same breakpoint
	 * (see featured-products/style.css) — fixing one did not fix the other, and
	 * both had to go before /shop/ was clean at 320px.
	 * (WCAG.md F-3, audited 2026-09-16.)
	 */
	.wwh-shop__chips,
	.wwh-shop__sort {
		min-width: 0;
	}
	/*
	 * Three levels all had to give before /shop/ was clean at 320px, and fixing
	 * any one alone left the page still overflowing:
	 *   1. the toolbar's children needed min-width:0 (flex items default to
	 *      min-width:auto and refuse to shrink below their content);
	 *   2. the sort form needed to WRAP — its label ("Sort by", ~68px) and the
	 *      256px <select> sat on one line, so the form measured 324px inside a
	 *      257px column no matter what min-width said;
	 *   3. the <select> itself needed min-width:0 and flex:1 1 auto so it takes
	 *      the remaining width and truncates, rather than forcing its intrinsic
	 *      size.
	 */
	.wwh-shop__sort {
		flex-wrap: wrap;
	}
	.wwh-shop__sort select {
		min-width: 0;
		flex: 1 1 100%;
		max-width: 100%;
	}
}

.wwh-fp-shop-wrap .section.shop > .row {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 2rem 1.5rem;
}

.wwh-fp-shop-wrap .product {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.wwh-fp-shop-wrap .product a {
	color: inherit;
	text-decoration: none;
}

.wwh-fp-shop-wrap .product .img {
	aspect-ratio: 4 / 5;
	overflow: hidden;
	background: var(--wp--preset--color--warm-cream-2, #E9E4DB);
}

.wwh-fp-shop-wrap .product .img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}

.wwh-fp-shop-wrap .product:hover .img img {
	transform: scale(1.03);
}

.wwh-fp-shop-wrap .product .body {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.wwh-fp-shop-wrap .product .cat {
	font-family: var(--wp--preset--font-family--ui), 'Montserrat', sans-serif;
	font-size: var(--wp--preset--font-size--cap);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink-caption, #5a544d);
	margin-bottom: 0.125rem;
}

.wwh-fp-shop-wrap .product .name {
	font-family: var(--wp--preset--font-family--display), 'DM Serif Display', serif;
	font-style: italic;
	font-weight: 400;
	font-size: var(--wp--preset--font-size--display-h-3);
	line-height: 1.2;
	color: var(--wp--preset--color--ink-primary, #1a1613);
	margin: 0.125rem 0;
}

.wwh-fp-shop-wrap .product .maker {
	font-family: var(--wp--preset--font-family--body), 'EB Garamond', serif;
	font-style: italic;
	font-size: var(--wp--preset--font-size--caption);
	color: var(--wp--preset--color--ink-caption, #5a544d);
	line-height: 1.4;
}

.wwh-fp-shop-wrap .product .row2 {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-top: 0.5rem;
	padding-top: 0.5rem;
	border-top: 1px solid rgba(26, 22, 19, 0.12);
	gap: 0.75rem;
}

.wwh-fp-shop-wrap .product .price {
	font-family: var(--wp--preset--font-family--ui), 'Montserrat', sans-serif;
	font-size: var(--wp--preset--font-size--cap);
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--ink-primary, #1a1613);
	white-space: nowrap;
}

.wwh-fp-shop-wrap .product .stock {
	font-family: var(--wp--preset--font-family--ui), 'Montserrat', sans-serif;
	font-size: var(--wp--preset--font-size--cap);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink-caption, #5a544d);
	white-space: nowrap;
}

.wwh-fp-shop-wrap .product .stock.is-low {
	color: rgba(180, 80, 60, 0.85);
}

@media (max-width: 1100px) {
	.wwh-fp-shop-wrap .section.shop > .row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
	.wwh-fp-shop-wrap .section.shop > .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
	.wwh-fp-shop-wrap .section.shop > .row { grid-template-columns: 1fr; }
}

/* Visually-hidden text. Defined per-block, matching the existing convention
   (handmaker-layout/style.css, home-calendar.css) — there is no global rule. */
.wwh-shop .screen-reader-text,
.wwh-shop__chip .screen-reader-text {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0,0,0,0);
	white-space: nowrap; border: 0;
}

/* Pagination.
   paginate_links( 'type' => 'list' ) emits a <ul class="page-numbers">, so the
   list-reset is load-bearing: without it the nav renders as a bulleted column
   inside the grid's first cell. Shared by shop-grid and makers-grid, which use
   the same wrapper class.
   Pills mirror .wwh-shop__chip (same border, radius, focus ring) so the
   pager reads as part of the same control set as the filters above it. */
.wwh-shop-pagination {
	margin-top: 2.5rem;
	grid-column: 1 / -1;
}
.wwh-shop-pagination ul.page-numbers {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
}
.wwh-shop-pagination ul.page-numbers > li {
	margin: 0;
	padding: 0;
}
/* Scoped to `li > *`, not a bare .page-numbers: paginate_links() puts the
   SAME class on the wrapping <ul>, so an unscoped rule paints a full-width
   pill behind the whole pager. */
.wwh-shop-pagination li > .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	padding: 0.4rem 0.85rem;
	background: rgba( 255, 255, 255, 0.85 );
	color: var( --wp--preset--color--ink, #241823 );
	border: 1px solid rgba( 36, 24, 35, 0.18 );
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--ui), 'Montserrat', sans-serif;
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 500;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.wwh-shop-pagination li > a.page-numbers:hover {
	background: #fff;
	border-color: rgba( 36, 24, 35, 0.4 );
}
.wwh-shop-pagination li > .page-numbers.current {
	background: var( --wp--preset--color--ink, #241823 );
	color: #f2e6d8;
	border-color: var( --wp--preset--color--ink, #241823 );
}
/* The ellipsis is not interactive — no pill, no border. */
.wwh-shop-pagination li > .page-numbers.dots {
	background: none;
	border-color: transparent;
	min-width: 0;
	padding: 0.4rem 0.25rem;
	color: var(--wp--preset--color--ink-caption, #5a544d);
}
.wwh-shop-pagination li > .page-numbers.prev,
.wwh-shop-pagination li > .page-numbers.next {
	letter-spacing: 0.08em;
}
.wwh-shop-pagination li > .page-numbers:focus-visible {
	outline: 2px solid var( --wp--preset--color--gold, #c9a86b );
	outline-offset: 3px;
}
@media (max-width: 480px) {
	/* Keep the pager to one line on a phone: numbers stay, prose shrinks. */
	.wwh-shop-pagination li > .page-numbers {
		min-width: 2.25rem;
		padding: 0.35rem 0.6rem;
	}
}
