/* SM Plant Sales: parts listing pages (Parts and every sub-category). Scoped to body.smp-parts-archive.
   The Parts page grid is an Elementor products widget and the sub-category pages use the theme's
   list layout, so these rules override both to give one card grid. */
body.smp-parts-archive {
	--smp-navy: #003768;
	--smp-amber: #f9b101;
	--smp-amber-dark: #d99a00;
	--smp-ink: #1a1a1a;
	--smp-muted: #545d68;
	--smp-line: #dfe3e8;
	--smp-line-strong: #b9c1ca;
	--smp-radius: 6px;
}

/* Grid: 2 columns on phones, 3 on tablets, 4 on desktop */
body.smp-parts-archive ul.products {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	gap: 12px !important;
	margin: 0 0 32px !important;
	padding: 0 !important;
}
@media (min-width: 600px) {
	body.smp-parts-archive ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 16px !important; }
}
@media (min-width: 1024px) {
	body.smp-parts-archive ul.products { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 20px !important; }
}
body.smp-parts-archive ul.products::before,
body.smp-parts-archive ul.products::after { display: none !important; content: none !important; }

/* Card: white with a thin border. Part photos are shot on white, so the image sits straight on the card. */
body.smp-parts-archive ul.products li.product {
	width: auto !important; float: none !important; margin: 0 !important; padding: 0 !important;
	display: flex !important; flex-direction: column !important; align-items: stretch !important;
	background: #fff !important; border: 1px solid var(--smp-line) !important; border-radius: var(--smp-radius) !important;
	box-shadow: none !important; overflow: hidden; text-align: left !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.smp-parts-archive ul.products li.product:hover,
body.smp-parts-archive ul.products li.product:focus-within {
	border-color: var(--smp-line-strong) !important;
	box-shadow: 0 4px 14px rgba(0, 38, 74, 0.08) !important;
}
body.smp-parts-archive ul.products li.product .astra-shop-thumbnail-wrap,
body.smp-parts-archive ul.products li.product .astra-shop-summary-wrap {
	flex-basis: auto !important; max-width: 100% !important; width: 100% !important; float: none !important; margin: 0 !important;
}
body.smp-parts-archive ul.products li.product .astra-shop-thumbnail-wrap {
	flex: 0 0 auto !important; padding: 0 !important; background: #fff !important; border-bottom: 1px solid var(--smp-line);
}
body.smp-parts-archive ul.products li.product .astra-shop-thumbnail-wrap a { display: block; }
body.smp-parts-archive ul.products li.product img {
	display: block; width: 100% !important; height: auto !important; aspect-ratio: 1 / 1; object-fit: contain;
	background: #fff; margin: 0 !important; padding: 8px; box-sizing: border-box; border-radius: 0 !important;
}

/* Text block: brand range, name, price, then the button pinned to the bottom so rows line up */
body.smp-parts-archive ul.products li.product .astra-shop-summary-wrap {
	display: flex !important; flex-direction: column !important; flex: 1 1 auto !important;
	gap: 6px; padding: 12px 14px 14px !important;
}
body.smp-parts-archive ul.products li.product .ast-woo-product-category {
	display: block; margin: 0 !important; padding: 0 !important;
	font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: 0.04em; text-transform: uppercase;
	color: var(--smp-muted) !important; opacity: 1;
}
body.smp-parts-archive ul.products li.product .ast-loop-product__link,
body.smp-parts-archive ul.products li.product .woocommerce-loop-product__link { text-decoration: none; }
body.smp-parts-archive ul.products li.product .woocommerce-loop-product__title {
	margin: 0 !important; padding: 0 !important;
	font-size: 15px !important; font-weight: 600 !important; line-height: 1.35 !important;
	text-transform: none !important; letter-spacing: 0 !important; text-align: left !important;
	color: var(--smp-navy) !important; overflow-wrap: anywhere;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
body.smp-parts-archive ul.products li.product .ast-loop-product__link:hover .woocommerce-loop-product__title,
body.smp-parts-archive ul.products li.product .ast-loop-product__link:focus-visible .woocommerce-loop-product__title { text-decoration: underline; }

/* The grid is for scanning: the full description is one click away */
body.smp-parts-archive ul.products li.product .ast-woo-shop-product-description { display: none !important; }

body.smp-parts-archive ul.products li.product .price {
	display: block; margin: 2px 0 0 !important; padding: 0 !important;
	font-size: 17px !important; font-weight: 700 !important; line-height: 1.3; color: var(--smp-ink) !important; text-align: left !important;
}
body.smp-parts-archive ul.products li.product .price .poa-price { font-size: 15px; font-weight: 600; color: var(--smp-muted); }
body.smp-parts-archive ul.products li.product .price .smp-exvat { font-size: 12px; font-weight: 600; color: var(--smp-muted); }

body.smp-parts-archive ul.products li.product .button {
	margin: auto 0 0 !important; width: 100% !important; min-height: 44px;
	display: inline-flex !important; align-items: center; justify-content: center;
	padding: 10px 12px !important; border: 0 !important; border-radius: var(--smp-radius) !important;
	background: var(--smp-amber) !important; color: var(--smp-ink) !important;
	font-size: 14px !important; font-weight: 700 !important; line-height: 1.2 !important;
	letter-spacing: 0.01em !important; text-transform: none !important; white-space: normal; text-align: center;
}
body.smp-parts-archive ul.products li.product .button:hover,
body.smp-parts-archive ul.products li.product .button:focus-visible { background: var(--smp-amber-dark) !important; color: var(--smp-ink) !important; }
body.smp-parts-archive ul.products li.product .button:focus-visible { outline: 3px solid var(--smp-navy); outline-offset: 2px; }
body.smp-parts-archive ul.products li.product .button.loading { opacity: 0.7; }
body.smp-parts-archive ul.products li.product .added_to_cart {
	display: block; margin: 6px 0 0; font-size: 14px; font-weight: 600; color: var(--smp-navy); text-align: center;
}

/* Breadcrumb, as on the part page */
body.smp-parts-archive .smp-crumbs { margin: 0 0 12px; font-size: 14px; color: var(--smp-muted); }
body.smp-parts-archive .smp-crumbs .woocommerce-breadcrumb { margin: 0; padding: 0; font-size: inherit; color: inherit; }
body.smp-parts-archive .smp-crumbs a { color: var(--smp-navy); text-decoration: none; }
body.smp-parts-archive .smp-crumbs a:hover, body.smp-parts-archive .smp-crumbs a:focus { text-decoration: underline; }
body.smp-parts-archive .smp-crumb-sep { margin: 0 8px; color: #9aa3ad; }

/* Header under the page title: search and range links */
body.smp-parts-archive #primary { margin-top: 28px; }
body.smp-parts-archive .woocommerce-products-header { margin-bottom: 0; }
body.smp-parts-archive .woocommerce-products-header__title {
	margin: 0 0 6px; color: var(--smp-navy); font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem); line-height: 1.15;
}
.smp-parts-head { margin: 0 0 24px; }
.smp-parts-head *, .smp-parts-head *::before, .smp-parts-head *::after { box-sizing: border-box; }
.smp-parts-lead { margin: 0 0 16px; max-width: 62ch; font-size: 16px; line-height: 1.5; color: var(--smp-muted); }
.smp-parts-search { margin: 0 0 14px; max-width: 720px; }
.smp-parts-search-row { display: flex; gap: 8px; }
.smp-parts-search input[type="search"] {
	flex: 1 1 auto; min-width: 0; height: 50px; margin: 0; padding: 0 16px;
	border: 1px solid var(--smp-line-strong); border-radius: var(--smp-radius); background: #fff;
	font-size: 16px; color: var(--smp-ink);
}
.smp-parts-search input[type="search"]:focus { outline: 3px solid var(--smp-amber); outline-offset: 0; border-color: var(--smp-navy); }
.smp-parts-search button {
	flex: 0 0 auto; height: 50px; margin: 0; padding: 0 24px; border: 0; border-radius: var(--smp-radius);
	background: var(--smp-navy); color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.01em; text-transform: none; cursor: pointer;
}
.smp-parts-search button:hover, .smp-parts-search button:focus-visible { background: #00264a; }
.smp-parts-search button:focus-visible { outline: 3px solid var(--smp-amber); outline-offset: 2px; }

.smp-ranges { margin: 0; }
.smp-ranges ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.smp-ranges li { margin: 0; padding: 0; }
.smp-ranges a {
	display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
	border: 1px solid var(--smp-line); border-radius: 999px; background: #fff;
	color: var(--smp-navy); font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
.smp-ranges a:hover, .smp-ranges a:focus-visible { border-color: var(--smp-navy); }
.smp-ranges a[aria-current="page"] { background: var(--smp-navy); border-color: var(--smp-navy); color: #fff; }
.smp-range-count { font-size: 12px; font-weight: 600; color: var(--smp-muted); font-variant-numeric: tabular-nums; }
.smp-ranges a[aria-current="page"] .smp-range-count { color: rgba(255, 255, 255, 0.8); }
.smp-ranges-narrow { display: none; }
.smp-ranges-narrow summary {
	display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px;
	border: 1px solid var(--smp-line-strong); border-radius: var(--smp-radius); background: #fff;
	color: var(--smp-navy); font-size: 15px; font-weight: 700; cursor: pointer; list-style: none;
}
.smp-ranges-narrow summary::-webkit-details-marker { display: none; }
.smp-ranges-narrow summary::after {
	content: ""; flex: 0 0 auto; width: 9px; height: 9px; margin-top: -4px;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 0.15s ease;
}
.smp-ranges-narrow[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.smp-ranges-narrow summary:focus-visible { outline: 3px solid var(--smp-amber); outline-offset: 2px; }
.smp-ranges-narrow ul { margin-top: 10px; }

/* Help panel after the grid */
.smp-help-panel {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
	margin: 40px 0 8px; padding: 24px; border-radius: var(--smp-radius); background: var(--smp-navy); color: #fff;
}
.smp-help-panel * { box-sizing: border-box; }
.smp-help-text { flex: 1 1 360px; min-width: 0; }
.smp-help-panel h2 { margin: 0 0 6px; color: #fff; font-size: 1.35rem; line-height: 1.25; text-transform: none; }
.smp-help-panel p { margin: 0; color: rgba(255, 255, 255, 0.88); font-size: 15px; line-height: 1.5; }
.smp-help-panel .smp-help-small { margin-top: 6px; font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.smp-help-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.smp-help-btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
	border-radius: var(--smp-radius); background: var(--smp-amber); color: var(--smp-ink) !important;
	font-size: 15px; font-weight: 700; text-decoration: none !important; white-space: nowrap;
}
.smp-help-btn-alt { background: transparent; color: #fff !important; border: 1px solid rgba(255, 255, 255, 0.6); }
.smp-help-btn:hover, .smp-help-btn:focus-visible { background: var(--smp-amber-dark); }
.smp-help-btn-alt:hover, .smp-help-btn-alt:focus-visible { background: rgba(255, 255, 255, 0.12); }
.smp-help-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Toolbar: the range links replace the theme's flyout filter */
body.smp-parts-archive .astra-shop-filter-button { display: none !important; }
/* flex-direction: the theme turns this row into a centred column on phones (.ast-header-break-point) */
body.smp-parts-archive .ast-shop-toolbar-container { display: flex; flex-direction: row !important; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
body.smp-parts-archive .woocommerce-result-count { margin: 0 !important; font-size: 14px; color: var(--smp-muted); }
body.smp-parts-archive .woocommerce-ordering { margin: 0 !important; }
body.smp-parts-archive .ast-shop-toolbar-container > .smp-vat-switch { margin-left: auto; }
body.smp-parts-archive .ast-shop-toolbar-aside-wrap { display: flex; align-items: center; gap: 10px; margin: 0 !important; }
/* Products per page: once, under the pagination. The top copy floats beside the grid and squeezes it. */
body.smp-parts-archive .ast-shop-toolbar-container + form.products-per-page { display: none !important; }
body.smp-parts-archive form.products-per-page { float: none !important; display: flex; justify-content: center; margin: 12px 0 0 !important; }

@media (max-width: 599px) {
	body.smp-parts-archive #primary { margin-top: 16px; }
	body.smp-parts-archive .smp-crumbs { margin-bottom: 8px; font-size: 13px; }
	.smp-parts-lead { font-size: 15px; margin-bottom: 12px; }
	.smp-parts-head { margin-bottom: 18px; }
	.smp-parts-search input[type="search"], .smp-parts-search button { height: 48px; }
	.smp-parts-search button { padding: 0 18px; }
	.smp-help-panel { padding: 20px; }
	.smp-help-actions, .smp-help-btn { width: 100%; }
	/* Ranges: one button that opens the full list */
	.smp-ranges-wide { display: none; }
	.smp-ranges-narrow { display: block; }
	/* Toolbar: result count on its own line, then sort and the VAT switch side by side */
	body.smp-parts-archive .ast-shop-toolbar-container > .ast-shop-toolbar-aside-wrap:first-child { flex: 1 1 100%; }
	body.smp-parts-archive .ast-shop-toolbar-container > .ast-shop-toolbar-aside-wrap:last-child { flex: 1 1 0; min-width: 0; order: 2; }
	body.smp-parts-archive .ast-shop-toolbar-container > .smp-vat-switch { order: 3; margin-left: 0; }
	body.smp-parts-archive .woocommerce-ordering, body.smp-parts-archive .woocommerce-ordering select { width: 100%; min-width: 0; }
}

/* Pagination */
body.smp-parts-archive nav.woocommerce-pagination ul { border: 0 !important; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
body.smp-parts-archive nav.woocommerce-pagination ul li { border: 0 !important; margin: 0 !important; }
body.smp-parts-archive nav.woocommerce-pagination ul li a,
body.smp-parts-archive nav.woocommerce-pagination ul li span {
	min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
	padding: 0 10px !important; border: 1px solid var(--smp-line) !important; border-radius: var(--smp-radius);
	color: var(--smp-navy) !important; background: #fff !important; font-weight: 600; line-height: 1;
}
body.smp-parts-archive nav.woocommerce-pagination ul li span.current { background: var(--smp-navy) !important; border-color: var(--smp-navy) !important; color: #fff !important; }
body.smp-parts-archive nav.woocommerce-pagination ul li a:hover,
body.smp-parts-archive nav.woocommerce-pagination ul li a:focus-visible { border-color: var(--smp-navy) !important; }

@media (max-width: 599px) {
	body.smp-parts-archive ul.products li.product .astra-shop-summary-wrap { padding: 10px 10px 12px !important; }
	body.smp-parts-archive ul.products li.product .woocommerce-loop-product__title { font-size: 14px !important; }
	body.smp-parts-archive ul.products li.product .price { font-size: 16px !important; }
	body.smp-parts-archive ul.products li.product .ast-woo-product-category { font-size: 11px; }
}
