/* Catalog and product detail surfaces. ------------------------------------ */

.am-m4-main {
	min-width: 0;
}

.am-m4-page-header,
.am-m4-filter-panel,
.am-m4-results,
.am-m4-breadcrumb,
.am-m4-detail-layout {
	margin-inline: auto;
	max-width: var(--am-content-wide);
	position: relative;
}

/* Page header --------------------------------------------------------------- */

.am-m4-page-header {
	align-items: flex-end;
	display: flex;
	gap: var(--am-space-6);
	justify-content: space-between;
	margin-bottom: var(--am-space-5);
}

.am-m4-page-header > div {
	max-width: 46rem;
	min-width: 0;
}

.am-m4-page-header h1 {
	margin-bottom: var(--am-space-2);
}

.am-m4-page-header p,
.am-m4-results__heading h2,
.am-m4-results__heading p,
.am-m4-detail-header h1,
.am-m4-detail-header p,
.am-m4-detail-card > :last-child,
.am-m4-detail-footer p {
	margin-bottom: 0;
}

.am-m4-page-header > div > p:last-child,
.am-m4-detail-footer p {
	color: var(--am-text-muted);
}

.am-m4-synthetic-notice {
	background: var(--am-status-info-bg);
	border-left: 3px solid var(--am-navy-700);
	border-radius: var(--am-radius-control);
	color: var(--am-text-muted);
	font-size: var(--am-text-sm);
	margin: 0;
	max-width: 24rem;
	padding: var(--am-space-3) var(--am-space-4);
}

/* Filter bar ----------------------------------------------------------------- */

.am-m4-filter-panel,
.am-m4-results,
.am-m4-detail-card,
.am-m4-detail-visual {
	background: var(--am-white);
	border: 1px solid var(--am-border-strong);
	border-radius: var(--am-radius-card);
}

.am-m4-filter-panel {
	border-bottom: 0;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	padding: var(--am-space-4);
}

/* Flex-wrap (not a fixed grid) so the bar reflows under zoom as well as at breakpoints. */
.am-m4-filter-form {
	align-items: end;
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-3);
}

.am-m4-field {
	display: grid;
	flex: 1 1 9rem;
	gap: var(--am-space-1);
	min-width: 0;
}

.am-m4-field--search {
	flex: 2 1 14rem;
}

.am-m4-field label,
.am-m4-filter-form__availability label {
	color: var(--am-text-subtle);
	font-size: var(--am-text-xs);
	font-weight: 600;
	letter-spacing: 0.02em;
}

.am-m4-field input,
.am-m4-field select {
	background: var(--am-white);
	border: 1px solid var(--am-border-strong);
	border-radius: var(--am-radius-control);
	color: var(--am-text);
	min-height: 2.75rem;
	min-width: 0;
	padding: var(--am-space-2) var(--am-space-3);
	width: 100%;
}

.am-m4-field input:hover,
.am-m4-field select:hover {
	border-color: var(--am-silver-500);
}

.am-m4-field select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328415f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-position: right var(--am-space-3) center;
	background-repeat: no-repeat;
	background-size: 1rem;
	padding-right: 2.25rem;
}

.am-m4-field--search {
	position: relative;
}

.am-m4-field--search .am-icon {
	bottom: 0.8rem;
	color: var(--am-text-subtle);
	left: var(--am-space-3);
	pointer-events: none;
	position: absolute;
}

.am-m4-field--search input {
	padding-left: 2.5rem;
}

.am-m4-filter-form__availability {
	align-items: center;
	border: 1px solid var(--am-border-strong);
	border-radius: var(--am-radius-control);
	display: flex;
	flex: 0 0 auto;
	gap: var(--am-space-2);
	min-height: 2.75rem;
	padding-inline: var(--am-space-3);
}

.am-m4-filter-form__availability input {
	accent-color: var(--am-navy-900);
	height: 1.1rem;
	margin: 0;
	width: 1.1rem;
}

.am-m4-filter-form__availability label {
	color: var(--am-text);
	font-size: var(--am-text-sm);
	font-weight: 500;
	letter-spacing: 0;
	white-space: nowrap;
}

.am-m4-filter-form__actions {
	display: flex;
	flex: 0 0 auto;
	gap: var(--am-space-2);
}

.am-m4-filter-form__actions .am-button {
	white-space: nowrap;
}

/* Results ------------------------------------------------------------------- */

.am-m4-results {
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	padding: var(--am-space-4);
}

.am-m4-results__heading {
	align-items: baseline;
	border-bottom: 1px solid var(--am-border);
	display: flex;
	gap: var(--am-space-4);
	justify-content: space-between;
	margin-bottom: var(--am-space-4);
	padding-bottom: var(--am-space-3);
}

.am-m4-results__heading h2 {
	font-size: var(--am-text-base);
}

.am-m4-results__heading p {
	color: var(--am-text-subtle);
	font-size: var(--am-text-sm);
	font-variant-numeric: var(--am-tnum);
	white-space: nowrap;
}

.am-m4-product-grid {
	display: grid;
	gap: var(--am-space-4);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
}

/* Product card ------------------------------------------------------------- */

.am-m4-product-card {
	background: var(--am-white);
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-card);
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	transition:
		border-color var(--am-duration) var(--am-ease),
		box-shadow var(--am-duration) var(--am-ease);
}

.am-m4-product-card:hover,
.am-m4-product-card:focus-within {
	border-color: var(--am-silver-500);
	box-shadow: var(--am-shadow-2);
}

.am-m4-product-card__visual,
.am-m4-detail-placeholder {
	align-items: center;
	background: var(--am-surface);
	display: flex;
	justify-content: center;
}

.am-m4-product-card__visual {
	border-bottom: 1px solid var(--am-border);
	min-height: 12rem;
	padding: var(--am-space-3);
}

.am-m4-product-card__visual img {
	height: 11.5rem;
	object-fit: contain;
	width: 100%;
}

.am-m4-package-placeholder {
	align-items: end;
	background: var(--am-white);
	border: 1px solid var(--am-silver-300);
	border-left: 0.6rem solid var(--am-brand);
	display: flex;
	height: 8rem;
	justify-content: center;
	padding: var(--am-space-1);
	width: 5.5rem;
}

.am-m4-package-placeholder span {
	color: var(--am-text-muted);
	font-size: 0.52rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	max-width: 100%;
	text-align: center;
	text-transform: uppercase;
	white-space: nowrap;
}

.am-m4-package-placeholder--large {
	height: 19rem;
	width: 13rem;
}

.am-m4-product-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--am-space-2);
	min-width: 0;
	padding: var(--am-space-4);
}

.am-m4-product-card__badges,
.am-m4-detail-header__badges {
	align-items: flex-start;
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-2);
}

.am-m4-product-card__badges {
	min-height: 1.5rem;
}

.am-m4-status {
	align-items: center;
	background: var(--am-status-neutral-bg);
	border-radius: var(--am-radius-pill);
	color: var(--am-status-neutral-fg);
	display: inline-flex;
	font-size: var(--am-text-xs);
	font-weight: 600;
	gap: 0.4rem;
	line-height: 1.25;
	padding: 0.2rem 0.65rem;
}

.am-m4-status::before {
	background: currentcolor;
	border-radius: 50%;
	content: "";
	flex: none;
	height: 0.4rem;
	width: 0.4rem;
}

.am-m4-status--available {
	background: var(--am-status-success-bg);
	color: var(--am-status-success-fg);
}

.am-m4-status--limited {
	background: var(--am-status-warning-bg);
	color: var(--am-status-warning-fg);
}

.am-m4-status--unavailable {
	background: var(--am-status-danger-bg);
	color: var(--am-status-danger-fg);
}

.am-m4-status--unknown {
	background: var(--am-status-neutral-bg);
	color: var(--am-status-neutral-fg);
}

.am-m4-product-card__title {
	font-size: var(--am-text-md);
	line-height: 1.25;
	margin: 0;
	overflow-wrap: anywhere;
}

.am-m4-product-card__strengths {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-1);
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-m4-product-card__strengths li,
.am-m4-detail-strength {
	background: var(--am-surface-2);
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-sm);
	color: var(--am-navy-900);
	font-size: var(--am-text-xs);
	font-variant-numeric: var(--am-tnum);
	font-weight: 600;
	padding: 0.15rem 0.5rem;
}

.am-m4-detail-strength {
	display: inline-flex;
	margin-top: var(--am-space-2);
}

.am-m4-product-card__sku,
.am-m4-product-card__rule,
.am-m4-detail-header__sku {
	color: var(--am-text-subtle);
	font-size: var(--am-text-xs);
	font-variant-numeric: var(--am-tnum);
	margin: 0;
	overflow-wrap: anywhere;
}

.am-m4-product-card__sku span,
.am-m4-detail-header__sku span {
	font-weight: 600;
}

.am-m4-product-card__pricing {
	border-top: 1px solid var(--am-border);
	display: grid;
	margin-top: auto;
	padding-top: var(--am-space-3);
}

.am-m4-product-card__pricing > span {
	color: var(--am-text-subtle);
	font-size: var(--am-text-xs);
}

.am-m4-product-card__pricing strong {
	font-size: var(--am-text-lg);
	font-variant-numeric: var(--am-tnum);
	letter-spacing: -0.01em;
	overflow-wrap: anywhere;
}

.am-m4-product-card__unavailable {
	color: var(--am-danger);
	font-size: var(--am-text-base);
}

.am-m4-product-card__link {
	margin-top: var(--am-space-2);
	width: 100%;
}

/* Catalog states ------------------------------------------------------------- */

.am-m4-state {
	background: var(--am-surface);
	border: 1px dashed var(--am-border-strong);
	border-radius: var(--am-radius-card);
	padding: var(--am-space-8) var(--am-space-6);
	text-align: center;
}

.am-m4-state .am-icon {
	color: var(--am-text-subtle);
	margin: 0 auto var(--am-space-3);
}

.am-m4-state h3 {
	margin-bottom: var(--am-space-2);
}

.am-m4-state p {
	color: var(--am-text-muted);
	margin: 0 auto var(--am-space-5);
	max-width: 38rem;
}

.am-m4-state--error {
	border-color: var(--am-danger);
	border-style: solid;
}

.am-m4-state--error .am-icon {
	color: var(--am-danger);
}

/* Breadcrumb ----------------------------------------------------------------- */

.am-m4-breadcrumb {
	margin-bottom: var(--am-space-4);
}

.am-m4-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-m4-breadcrumb li {
	color: var(--am-text-muted);
	display: flex;
	font-size: 0.82rem;
	gap: var(--am-space-2);
	min-width: 0;
	overflow-wrap: anywhere;
}

.am-m4-breadcrumb li + li::before {
	color: var(--am-silver-500);
	content: "/";
}

.am-m4-breadcrumb a {
	color: var(--am-link);
}

/* Product detail (restyled in a later stage; rules preserved) ---------------- */

.am-m4-detail-layout {
	display: grid;
	gap: clamp(var(--am-space-5), 3vw, var(--am-space-10));
	grid-template-columns: minmax(20rem, 0.95fr) minmax(24rem, 1.05fr);
}

.am-m4-detail-visual {
	align-self: start;
	display: block;
	min-width: 0;
	overflow: hidden;
	position: sticky;
	top: calc(var(--am-topbar-height) + var(--am-space-4));
}

.am-m4-detail-placeholder {
	background: var(--am-surface);
	min-height: 34rem;
	padding: var(--am-space-5);
}

.am-m4-detail-placeholder img {
	height: auto;
	max-height: 38rem;
	object-fit: contain;
	width: 100%;
}

.am-m4-detail-visual > p {
	color: var(--am-text-muted);
	font-size: 0.78rem;
	margin: 0;
	padding: var(--am-space-4);
	text-align: center;
}

.am-m4-detail-content {
	display: grid;
	gap: var(--am-space-3);
	min-width: 0;
}

.am-m4-detail-header {
	align-items: start;
	display: flex;
	gap: var(--am-space-5);
	justify-content: space-between;
	min-width: 0;
}

.am-m4-detail-header > div:first-child {
	min-width: 0;
}

.am-m4-detail-header h1,
.am-m4-detail-header__sku {
	overflow-wrap: anywhere;
}

.am-m4-detail-header h1 {
	font-size: var(--am-text-2xl);
	margin-bottom: var(--am-space-3);
}

.am-m4-detail-header__meta {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-3);
}

.am-m4-detail-header__meta .am-m4-detail-strength {
	margin-top: 0;
}

.am-m4-detail-header__sku {
	margin: 0;
}

.am-m4-detail-header__badges {
	justify-content: flex-end;
}

.am-m4-variation-selector {
	background: var(--am-white);
	border: 1px solid var(--am-border-strong);
	border-radius: var(--am-radius-card);
	display: grid;
	gap: var(--am-space-3);
	padding: var(--am-space-4);
}

.am-m4-variation-selector > span {
	font-size: 0.82rem;
	font-weight: 700;
}

.am-m4-variation-selector > div {
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-2);
}

.am-m4-variation-selector__option {
	border: 1px solid var(--am-border-strong);
	border-radius: var(--am-radius-control);
	color: var(--am-navy-900);
	font-variant-numeric: var(--am-tnum);
	font-weight: 600;
	min-width: 4.5rem;
	padding: var(--am-space-2) var(--am-space-3);
	text-align: center;
	text-decoration: none;
	transition: background-color var(--am-duration) var(--am-ease), border-color var(--am-duration) var(--am-ease);
}

.am-m4-variation-selector__option:hover {
	background: var(--am-surface-2);
	color: var(--am-navy-950);
}

.am-m4-variation-selector__option.is-selected {
	background: var(--am-navy-900);
	border-color: var(--am-navy-900);
	color: var(--am-white);
}

.am-m4-detail-card {
	min-width: 0;
	padding: var(--am-space-5);
}

.am-m4-detail-card h2 {
	font-size: var(--am-text-md);
	margin-bottom: var(--am-space-3);
}

.am-m4-detail-card > p:last-child {
	color: var(--am-text-muted);
}

.am-m4-documents__list {
	display: grid;
	gap: var(--am-space-2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-m4-documents__list li {
	align-items: center;
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-control);
	display: flex;
	gap: var(--am-space-3);
	min-width: 0;
	padding: var(--am-space-2) var(--am-space-3);
}

.am-m4-documents__list .am-icon {
	color: var(--am-text-subtle);
}

.am-m4-documents__list a {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.am-m4-detail-card p {
	overflow-wrap: anywhere;
}

.am-m4-pricing-card {
	overflow: hidden;
}

.am-m4-pricing-card__heading {
	align-items: center;
	display: flex;
	gap: var(--am-space-4);
	justify-content: space-between;
}

.am-m4-pricing-card__heading h2 {
	margin-bottom: 0;
}

.am-m4-pricing-card__heading span {
	color: var(--am-text-muted);
	font-size: 0.78rem;
}

.am-m4-detail-price {
	align-items: baseline;
	border-bottom: 1px solid var(--am-border);
	display: flex;
	gap: var(--am-space-4);
	justify-content: space-between;
	margin: var(--am-space-3) 0 0;
	padding-bottom: var(--am-space-3);
}

.am-m4-detail-price span {
	color: var(--am-text-muted);
}

.am-m4-detail-price strong {
	font-size: 1.5rem;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
	text-align: right;
}

.am-m4-inline-state {
	background: var(--am-surface);
	border-left: 3px solid var(--am-danger);
	border-radius: var(--am-radius-control);
	padding: var(--am-space-4);
}

.am-m4-inline-state p {
	margin: var(--am-space-1) 0 0;
}

.am-m4-price-table {
	border-collapse: separate;
	border-spacing: 0;
	display: block;
	font-size: 0.88rem;
	margin-top: var(--am-space-3);
	max-width: 100%;
	table-layout: fixed;
	width: 100%;
}

.am-m4-price-table caption,
.am-m4-price-table thead {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.am-m4-price-table tbody {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	width: 100%;
}

.am-m4-price-table tr {
	border: 1px solid var(--am-border);
	display: grid;
	gap: var(--am-space-1);
	padding: var(--am-space-3);
	text-align: center;
}

.am-m4-price-table tr + tr {
	border-left: 0;
}

.am-m4-price-table th,
.am-m4-price-table td {
	border: 0;
	overflow-wrap: anywhere;
	padding: 0;
	text-align: center;
	vertical-align: top;
}

.am-m4-price-table th {
	color: var(--am-text-subtle);
	font-size: var(--am-text-xs);
	font-weight: 600;
}

.am-m4-price-table td {
	font-variant-numeric: var(--am-tnum);
}

.am-m4-price-table td:first-of-type {
	color: var(--am-navy-950);
	font-size: var(--am-text-lg);
	font-weight: 700;
}

.am-m4-price-table td:last-child {
	color: var(--am-text-subtle);
	font-size: var(--am-text-xs);
}

.am-m4-price-table tr {
	background: var(--am-surface);
}

.am-m4-detail-info-grid {
	display: grid;
	gap: var(--am-space-3);
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.am-m4-detail-footer {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--am-space-4);
	justify-content: flex-start;
}

/* Responsive ------------------------------------------------------------------ */

@media (max-width: 74rem) {
	.am-m4-field--search {
		flex-basis: 100%;
	}

	.am-m4-detail-layout {
		gap: var(--am-space-5);
		grid-template-columns: minmax(18rem, 0.9fr) minmax(22rem, 1.1fr);
	}
}

@media (max-width: 64rem) {
	.am-m4-product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 58rem) {
	.am-m4-detail-layout {
		grid-template-columns: 1fr;
	}

	.am-m4-detail-visual {
		position: static;
	}
}

@media (max-width: 50rem) {
	.am-m4-page-header {
		align-items: stretch;
		flex-direction: column;
		gap: var(--am-space-4);
	}

	.am-m4-synthetic-notice {
		max-width: none;
	}

	.am-m4-product-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 40rem) {
	.am-m4-product-grid,
	.am-m4-detail-info-grid,
	.am-m4-price-table tbody {
		grid-template-columns: 1fr;
	}

	.am-m4-field,
	.am-m4-field--search,
	.am-m4-filter-form__availability,
	.am-m4-filter-form__actions {
		flex-basis: 100%;
	}

	.am-m4-filter-form__actions,
	.am-m4-filter-form__actions .am-button,
	.am-m4-detail-footer .am-button {
		width: 100%;
	}

	.am-m4-filter-form__availability label {
		white-space: normal;
	}

	.am-m4-results__heading,
	.am-m4-detail-header,
	.am-m4-detail-price {
		align-items: flex-start;
		flex-direction: column;
	}

	.am-m4-results__heading {
		gap: var(--am-space-1);
	}

	.am-m4-detail-price {
		gap: var(--am-space-2);
	}

	.am-m4-detail-price strong {
		text-align: left;
	}

	.am-m4-price-table tr + tr {
		border-left: 1px solid var(--am-border);
		border-top: 0;
	}

	.am-m4-detail-placeholder {
		min-height: 22rem;
		padding: var(--am-space-4);
	}

	.am-m4-detail-placeholder img {
		max-height: 22rem;
	}

	.am-m4-package-placeholder--large {
		height: 15rem;
		width: 10rem;
	}

	.am-m4-state {
		padding: var(--am-space-6) var(--am-space-4);
	}

	.am-m4-breadcrumb li:last-child {
		flex-basis: 100%;
	}

	.am-m4-breadcrumb li:last-child::before {
		display: none;
	}
}

@media (max-width: 22rem) {
	.am-m4-filter-panel,
	.am-m4-results,
	.am-m4-detail-card {
		padding: var(--am-space-3);
	}

	.am-m4-results__heading p {
		white-space: normal;
	}

	.am-m4-price-table {
		font-size: 0.78rem;
	}

	.am-m4-price-table th,
	.am-m4-price-table td {
		padding-inline: var(--am-space-1);
	}
}
