/**
 * Mobile full-screen search (proxy-search-mobile.js, [proxy_search_mobile]).
 *
 * Scoped to max-width:1025px, the same breakpoint as the tab bar that opens
 * it; above that the layer never shows and the desktop dropdown is the
 * search.
 *
 * Tokens come from proxy-complex-core-features/assets/nav-shell.css, loaded
 * on every front-end page. Each var() carries the token's value as a
 * fallback so this still renders on brand if core-features is deactivated —
 * the same pattern as the desktop dropdown's styles in proxy-search.css.
 *
 * Status colours are deliberately only muted brown and rust: "In stock" and
 * "Sold out" are muted, "Low stock" is rust. No green anywhere.
 */

.pxm {
	display: none;
}

@media (max-width: 1025px) {

	.pxm {
		--pxm-muted: rgba(82, 53, 27, 0.6);
		--pxm-hairline: var(--border-hairline, rgba(82, 53, 27, 0.15));
		--pxm-tint: var(--pc-brown-08, rgba(67, 47, 31, 0.08));
		--pxm-tabbar: 62px;

		display: block;
		position: fixed;
		inset: 0;
		/* Under the tab bar (200) and the cart/more drawers (205/210), so
		   Search behaves like the tab it is: the other tabs stay tappable and
		   the cart drawer opens over it. */
		z-index: 190;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		padding-bottom: calc(var(--pxm-tabbar) + env(safe-area-inset-bottom, 0px));
		background: var(--surface-page, #f9dfbe);
		color: var(--text-body, #52351b);
		font-family: var(--font-body, "Aspekta 450", sans-serif);
		-webkit-tap-highlight-color: transparent;
	}

	.pxm[hidden] {
		display: none;
	}

	html.pxm-open,
	html.pxm-open body {
		overflow: hidden;
	}

	html.pxm-open #ast-scroll-top {
		display: none !important;
	}

	/* Astra styles every bare <button> (fill, padding, and a separate
	   :hover/:focus fill a tap also triggers). Reset once for the whole
	   layer rather than per control. */
	.pxm button,
	.pxm button:hover,
	.pxm button:focus,
	.pxm button:active {
		box-shadow: none;
		outline: none;
		text-transform: none;
		letter-spacing: normal;
	}

	.pxm button:focus-visible,
	.pxm a:focus-visible {
		outline: 2px solid var(--accent, #df6f36);
		outline-offset: 2px;
	}

	/* ---------- Search bar (sticky) ---------- */

	.pxm__bar {
		position: sticky;
		top: 0;
		z-index: 2;
		padding: 14px 18px 10px;
		background: var(--surface-page, #f9dfbe);
		border-bottom: 1px solid var(--pxm-hairline);
	}

	/* The Search tab's root header (core-features' .pc-root-header), edge to
	   edge above the field and pinned with it. The results page draws the
	   same pair, so opening the layer over it doesn't shift anything. */
	.pxm__bar .pc-root-header {
		margin: -14px -18px 12px;
	}

	.pxm__form {
		margin: 0;
	}

	.pxm__field {
		display: flex;
		align-items: center;
		gap: 10px;
		min-height: 48px;
		padding: 0 4px 0 13px;
		border: 2px solid var(--border-strong, #432f1f);
		border-radius: var(--radius-md, 12px);
		background: var(--surface-card, #f3dcc6);
		color: var(--pxm-muted);
		transition: border-color 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
	}

	.pxm__field:focus-within {
		border-color: var(--accent, #df6f36);
		box-shadow: 0 0 0 3px rgba(223, 111, 54, 0.15);
	}

	.pxm__field > svg {
		flex: none;
	}

	/* 16px, not the design's 0.85rem: iOS zooms the whole page into any
	   field under 16px on focus.

	   The !importants: on WooCommerce pages `.woocommerce input[type=search]`
	   paints inputs white with its own border and padding, and outranks
	   this selector — until focus, when :focus tipped it back, so the field
	   showed a white box only while unselected. */
	.pxm .pxm__input,
	.pxm .pxm__input:focus {
		flex: 1;
		min-width: 0;
		height: 44px;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		outline: none;
		font-family: var(--font-body, "Aspekta 450", sans-serif);
		font-size: 16px;
		color: var(--text-heading, #432f1f);
		-webkit-appearance: none;
		appearance: none;
	}

	.pxm__input::placeholder {
		color: var(--pxm-muted);
		opacity: 1;
	}

	.pxm__input::-webkit-search-cancel-button,
	.pxm__input::-webkit-search-decoration {
		-webkit-appearance: none;
	}

	.pxm .pxm__clear {
		flex: none;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		background: none;
		color: var(--pxm-muted);
		cursor: pointer;
	}

	.pxm .pxm__clear[hidden] {
		display: none;
	}

	/* Thin progress sweep under the bar while a search is in flight. */
	.pxm__bar::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: -1px;
		height: 2px;
		background: linear-gradient(90deg, transparent, var(--accent, #df6f36), transparent);
		background-size: 40% 100%;
		background-repeat: no-repeat;
		opacity: 0;
		transition: opacity 0.15s ease-in-out;
	}

	.pxm.is-loading .pxm__bar::after {
		opacity: 1;
		animation: pxm-sweep 0.9s linear infinite;
	}

	@keyframes pxm-sweep {
		from { background-position: -40% 0; }
		to { background-position: 140% 0; }
	}

	/* ---------- Landing: recent + popular ---------- */

	.pxm__landing {
		padding: 20px 18px;
	}

	.pxm__landing[hidden],
	.pxm__results[hidden],
	.pxm__section[hidden] {
		display: none;
	}

	.pxm__section + .pxm__section {
		margin-top: 22px;
	}

	.pxm__section-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 24px;
		margin-bottom: 6px;
	}

	.pxm__eyebrow {
		margin: 0;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		/* !important: the theme sets heading sizes with !important. */
		font-size: 0.72rem !important;
		font-weight: 500;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		line-height: 1.3;
		color: var(--pxm-muted);
	}

	.pxm .pxm__text-btn {
		margin: -10px -8px -10px 0;
		padding: 10px 8px;
		border: 0;
		background: none;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.8rem;
		font-weight: 500;
		color: var(--accent, #df6f36);
		cursor: pointer;
	}

	.pxm__recent {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.pxm__recent-row {
		display: flex;
		align-items: center;
		margin: 0;
	}

	.pxm .pxm__recent-term {
		flex: 1;
		min-width: 0;
		display: flex;
		align-items: center;
		gap: 12px;
		min-height: 44px;
		padding: 0;
		border: 0;
		background: none;
		text-align: left;
		font-family: var(--font-body, "Aspekta 450", sans-serif);
		font-size: 0.95rem;
		color: var(--text-heading, #432f1f);
		cursor: pointer;
	}

	.pxm__recent-term svg {
		flex: none;
		color: var(--pxm-muted);
	}

	.pxm__recent-term span {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.pxm .pxm__recent-remove {
		flex: none;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		margin-right: -12px;
		padding: 0;
		border: 0;
		background: none;
		color: var(--pxm-muted);
		cursor: pointer;
	}

	.pxm__chips {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		margin-top: 8px;
	}

	.pxm__chips--center {
		justify-content: center;
	}

	/* Neutral outline — these are shortcuts, not selected filters, so they
	   never take the accent. */
	.pxm .pxm__chip,
	.pxm .pxm__chip:hover,
	.pxm .pxm__chip:focus {
		display: inline-flex;
		align-items: center;
		min-height: 40px;
		padding: 0 14px;
		border: 1.5px solid var(--border-default, rgba(73, 49, 29, 0.51));
		border-radius: var(--radius-pill, 9999px);
		background: transparent;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.85rem;
		font-weight: 500;
		line-height: 1.2;
		color: var(--text-heading, #432f1f);
		text-decoration: none;
		cursor: pointer;
	}

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

	.pxm__count {
		margin: 0;
		padding: 12px 18px 4px;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.75rem;
		color: var(--pxm-muted);
	}

	.pxm__message {
		margin: 0;
		padding: 28px 18px;
		text-align: center;
		color: var(--pxm-muted);
	}

	.pxm-list {
		padding: 4px 18px 8px;
	}

	.pxm-card {
		border-top: 1px solid var(--pxm-hairline);
	}

	.pxm-card:last-child {
		border-bottom: 1px solid var(--pxm-hairline);
	}

	.pxm-card__row {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 12px 0;
	}

	.pxm-card__link,
	.pxm-printing__link {
		flex: 1;
		min-width: 0;
		display: flex;
		align-items: center;
		color: inherit;
		text-decoration: none;
	}

	.pxm-card__link {
		gap: 12px;
	}

	.pxm-card__thumb {
		flex: none;
		width: 48px;
		height: 66px;
		border-radius: 6px;
		object-fit: cover;
		background: var(--surface-sunken, #f3dcc6);
	}

	.pxm-card__main,
	.pxm-printing__main {
		flex: 1;
		min-width: 0;
	}

	.pxm-card__name {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		font-family: var(--font-display, "Aspekta 550", sans-serif);
		font-size: 0.95rem;
		font-weight: 600;
		line-height: 1.25;
		color: var(--text-heading, #432f1f);
	}

	.pxm-card__price {
		display: block;
		margin-top: 3px;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.8rem;
		font-weight: 700;
		color: var(--accent, #df6f36);
	}

	.pxm-card.is-oos .pxm-card__thumb {
		opacity: 0.5;
	}

	.pxm-card.is-oos .pxm-card__name,
	.pxm-card.is-oos .pxm-card__price {
		color: var(--pxm-muted);
	}

	/* "{N} printings" pill — the only other tap target on a card row. */
	.pxm .pxm-pill,
	.pxm .pxm-pill:hover,
	.pxm .pxm-pill:focus {
		flex: none;
		display: inline-flex;
		align-items: center;
		gap: 4px;
		min-height: 40px;
		padding: 0 12px;
		border: 2px solid var(--border-default, rgba(73, 49, 29, 0.51));
		border-radius: var(--radius-pill, 9999px);
		background: transparent;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.75rem;
		font-weight: 700;
		white-space: nowrap;
		color: var(--text-heading, #432f1f);
		cursor: pointer;
		transition: border-color 0.25s ease-in-out, background-color 0.25s ease-in-out, opacity 0.15s ease-in-out;
	}

	/* A larger hit area than the drawn pill, without growing the pill. */
	.pxm-pill {
		position: relative;
	}

	.pxm-pill::before {
		content: "";
		position: absolute;
		inset: -4px -6px;
	}

	.pxm-pill__chevron {
		transition: transform 0.25s ease-in-out;
	}

	.pxm .pxm-card.is-expanded .pxm-pill {
		border-color: var(--accent, #df6f36);
		background: var(--pxm-tint);
	}

	.pxm-card.is-expanded .pxm-pill__chevron {
		transform: rotate(-90deg);
	}

	.pxm-card.is-pending .pxm-pill {
		opacity: 0.6;
	}

	/* ---------- Printings ---------- */

	.pxm-printings {
		box-sizing: border-box;
		padding-bottom: 12px;
	}

	.pxm-printings[hidden] {
		display: none;
	}

	.pxm-printings__inner {
		padding: 6px 8px;
		border-radius: var(--radius-lg, 16px);
		background: var(--pxm-tint);
	}

	.pxm-printing {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 9px 4px;
	}

	.pxm-printing + .pxm-printing {
		border-top: 1px solid var(--pxm-hairline);
	}

	.pxm-printing__link {
		gap: 10px;
	}

	.pxm-printing__thumb {
		flex: none;
		width: 40px;
		height: 55px;
		border-radius: 5px;
		object-fit: cover;
		background: var(--surface-sunken, #f3dcc6);
	}

	.pxm-printing__card {
		display: block;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		font-family: var(--font-display, "Aspekta 550", sans-serif);
		font-size: 0.85rem;
		font-weight: 600;
		color: var(--text-heading, #432f1f);
	}

	/* Wraps to a second line rather than truncating: the tail is exactly the
	   finish and language that tell two printings apart. */
	.pxm-printing__name {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.78rem;
		font-weight: 700;
		line-height: 1.3;
		color: var(--text-heading, #432f1f);
	}

	.pxm-printing__meta {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		column-gap: 7px;
		margin-top: 3px;
	}

	.pxm-printing__price {
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.78rem;
		font-weight: 700;
		color: var(--accent, #df6f36);
	}

	.pxm-printing__stock {
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.68rem;
		font-weight: 700;
		color: var(--pxm-muted);
	}

	.pxm-printing__stock.is-low {
		color: var(--accent, #df6f36);
	}

	.pxm-printing.is-oos .pxm-printing__thumb {
		opacity: 0.5;
	}

	.pxm-printing.is-oos .pxm-printing__name,
	.pxm-printing.is-oos .pxm-printing__price {
		color: var(--pxm-muted);
	}

	.pxm-list--flat .pxm-printing {
		padding: 10px 0;
	}

	.pxm-list--flat .pxm-printing:first-child {
		border-top: 1px solid var(--pxm-hairline);
	}

	.pxm-list--flat .pxm-printing:last-child {
		border-bottom: 1px solid var(--pxm-hairline);
	}

	/* Add: a full pill, fixed width, so "Added" swaps in at the same size
	   and nothing in the row moves. */
	.pxm .pxm-add,
	.pxm .pxm-add:hover,
	.pxm .pxm-add:focus {
		flex: none;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 5px;
		width: 92px;
		height: 44px;
		padding: 0 10px;
		border: 0;
		border-radius: var(--radius-pill, 9999px);
		background: var(--accent, #df6f36);
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.75rem;
		font-weight: 700;
		white-space: nowrap;
		color: #fff;
		cursor: pointer;
		transition: background-color 0.25s ease-in-out, opacity 0.15s ease-in-out;
	}

	.pxm .pxm-add:active {
		background: var(--accent-press, #b35324);
	}

	.pxm .pxm-add.is-busy {
		opacity: 0.7;
		pointer-events: none;
	}

	.pxm .pxm-add.is-added,
	.pxm .pxm-add.is-error {
		background: var(--pc-brown-dark, #432f1f);
		color: var(--pc-parchment, #f9dfbe);
	}

	.pxm-soldout {
		flex: none;
		width: 92px;
		text-align: center;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.72rem;
		font-weight: 700;
		color: var(--pxm-muted);
	}

	.pxm__see-all {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 44px;
		margin: 8px 18px 16px;
		font-family: var(--font-ui, "Aspekta 500", sans-serif);
		font-size: 0.85rem;
		font-weight: 700;
		color: var(--accent, #df6f36);
		text-decoration: none;
	}

	/* ---------- No results ---------- */

	.pxm-empty {
		padding: 48px 28px 24px;
		text-align: center;
	}

	.pxm-empty__icon {
		display: inline-flex;
		color: var(--pxm-muted);
	}

	.pxm-empty__title {
		margin: 14px 0 6px;
		font-family: var(--font-display, "Aspekta 550", sans-serif);
		font-size: 1.05rem;
		font-weight: 600;
		line-height: 1.3;
		color: var(--text-heading, #432f1f);
		overflow-wrap: anywhere;
	}

	.pxm-empty__hint {
		margin: 0 auto;
		max-width: 290px;
		font-size: 0.85rem;
		line-height: 1.45;
		color: var(--pxm-muted);
	}

	.pxm-empty__eyebrow {
		margin-top: 32px;
	}

	@media (prefers-reduced-motion: reduce) {
		.pxm-pill__chevron,
		.pxm__field,
		.pxm .pxm-pill,
		.pxm .pxm-add {
			transition: none;
		}

		.pxm.is-loading .pxm__bar::after {
			animation: none;
		}
	}
}

/* ---------- Tablets ----------
   The field, the landing and the results read in core-features'
   nav-shell.css centred column; the bar's hairline still runs edge to
   edge. */
@media (min-width: 600px) and (max-width: 1025px) {
	.pxm__form,
	.pxm__landing,
	.pxm__count,
	.pxm__message,
	.pxm-list {
		max-width: var(--pc-measure, 720px);
		margin-inline: auto;
	}
}
