/*
 * Marketly Product Finder. Colours and type follow the store's theme where it
 * exposes design tokens (Shamasy's --color-* variables), with neutral
 * fallbacks elsewhere. Everything is scoped under .mpf (the floating widget)
 * and .mpf-inline / .mpf-alt (the entry points placed inside the page).
 */

.mpf,
.mpf-inline,
.mpf-alt {
	--mpf-accent: var(--color-leaf, #83b735);
	--mpf-accent-deep: var(--color-leaf-deep, #5e8f1e);
	--mpf-accent-tint: var(--color-leaf-tint, #eef4e1);
	--mpf-ink: var(--color-ink, #1f2a17);
	--mpf-on-accent: var(--color-forest-deep, #1a2913);
	--mpf-muted: var(--color-muted, #67705c);
	--mpf-canvas: var(--color-canvas, #ffffff);
	--mpf-panel: var(--color-panel, #f4f5ec);
	--mpf-line: color-mix(in srgb, var(--mpf-ink) 12%, transparent);
	--mpf-side: 1.1rem;
	--mpf-bottom: 1.1rem;
}

.mpf {
	position: fixed;
	z-index: 140;
	inset-block-end: var(--mpf-bottom);
	font-family: inherit;
	color: var(--mpf-ink);
	line-height: 1.6;
}

.mpf--left {
	left: var(--mpf-side);
}

.mpf--right {
	right: var(--mpf-side);
}

.mpf svg {
	width: 1.15em;
	height: 1.15em;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.mpf button,
.mpf a {
	font: inherit;
	cursor: pointer;
}

/* Sticky "buy" bars on product pages sit at the bottom on phones. */
@media (max-width: 40rem) {
	.single-product .mpf {
		--mpf-bottom: 5.6rem;
	}
}

.mpf-launcher {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 3rem;
	padding: 0 1.15rem;
	border: 0;
	border-radius: 999px;
	background: var(--mpf-accent);
	color: var(--mpf-on-accent);
	font-weight: 600;
	font-size: 0.95rem;
	box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--mpf-accent-deep) 70%, transparent);
	transition: transform 0.18s ease;
}

.mpf-launcher:hover {
	transform: translateY(-2px);
}

.mpf-launcher:focus-visible,
.mpf-chip:focus-visible,
.mpf-btn:focus-visible,
.mpf-icon:focus-visible {
	outline: 2px solid var(--mpf-accent-deep);
	outline-offset: 2px;
}

.mpf.is-open .mpf-launcher {
	display: none;
}

.mpf-panel {
	display: flex;
	flex-direction: column;
	width: min(23rem, calc(100vw - 2 * var(--mpf-side)));
	max-height: min(36rem, calc(100vh - 2.5rem));
	overflow: hidden;
	background: var(--mpf-canvas);
	border: 1px solid var(--mpf-line);
	border-radius: 1.25rem;
	box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--mpf-ink) 35%, transparent);
	animation: mpf-in 0.22s ease both;
}

.mpf-panel[hidden] {
	display: none;
}

@keyframes mpf-in {
	from {
		opacity: 0;
		transform: translateY(0.75rem);
	}
}

.mpf-head {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.6rem 0.6rem 0.6rem 0.75rem;
	border-bottom: 1px solid var(--mpf-line);
}

.mpf-title {
	flex: 1;
	margin: 0;
	padding-inline-start: 0.4rem;
	font-weight: 700;
	font-size: 1rem;
}

.mpf-title--named {
	display: flex;
	align-items: center;
	gap: 0.55rem;
}

.mpf-avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 2.1rem;
	height: 2.1rem;
	border-radius: 50%;
	background: var(--mpf-accent);
	color: var(--mpf-on-accent);
	font-size: 1rem;
	line-height: 1;
}

.mpf-who {
	display: grid;
	line-height: 1.25;
}

.mpf-who__role {
	color: var(--mpf-muted);
	font-size: 0.75rem;
	font-weight: 400;
}

.mpf-icon {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--mpf-ink);
}

.mpf-icon:hover {
	background: var(--mpf-panel);
}

.mpf-icon[hidden] {
	display: none;
}

.mpf-log {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	padding: 0.9rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.mpf-msg {
	max-width: 88%;
	margin: 0;
	padding: 0.5rem 0.8rem;
	border-radius: 1rem;
	font-size: 0.92rem;
}

.mpf-msg--bot {
	align-self: flex-start;
	background: var(--mpf-panel);
	border-start-start-radius: 0.35rem;
}

.mpf-msg--me {
	align-self: flex-end;
	background: var(--mpf-accent-tint);
	color: var(--mpf-accent-deep);
	font-weight: 600;
	border-start-end-radius: 0.35rem;
}

.mpf-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	padding: 0.25rem 0.9rem 0.9rem;
}

.mpf-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 2.5rem;
	padding: 0.35rem 0.95rem;
	border: 1px solid color-mix(in srgb, var(--mpf-ink) 22%, transparent);
	border-radius: 999px;
	background: var(--mpf-canvas);
	color: var(--mpf-ink);
	font-size: 0.9rem;
	text-decoration: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.mpf-chip:hover {
	border-color: var(--mpf-accent-deep);
	background: var(--mpf-accent-tint);
	color: var(--mpf-accent-deep);
}

.mpf-chip--wa {
	width: 100%;
	justify-content: center;
	border-color: var(--mpf-accent);
	color: var(--mpf-accent-deep);
	font-weight: 600;
}

.mpf-loading {
	margin: 0;
	color: var(--mpf-muted);
	font-size: 0.88rem;
}

.mpf-cards {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.mpf-card {
	display: flex;
	gap: 0.7rem;
	padding: 0.45rem;
	border: 1px solid var(--mpf-line);
	border-radius: 0.9rem;
	background: var(--mpf-canvas);
}

.mpf-card__media {
	flex: none;
	width: 4.6rem;
	height: 4.6rem;
	overflow: hidden;
	border-radius: 0.65rem;
	background: var(--mpf-panel);
}

.mpf-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mpf-card__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15rem;
	min-width: 0;
}

.mpf-card__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--mpf-ink);
	font-size: 0.86rem;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
}

.mpf-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 0.4rem;
	margin: 0;
	color: var(--mpf-accent-deep);
	font-size: 0.9rem;
	font-weight: 700;
}

.mpf-card__price del {
	color: var(--mpf-muted);
	font-size: 0.75rem;
	font-weight: 400;
}

.mpf-btn {
	margin-block-start: 0.2rem;
	padding: 0.3rem 0.85rem;
	border-radius: 999px;
	background: var(--mpf-accent);
	color: var(--mpf-on-accent);
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none;
}

.mpf-btn:hover {
	background: var(--mpf-accent-deep);
	color: #fff;
}

.mpf-foot {
	margin: 0;
	padding: 0.4rem;
	border-top: 1px solid var(--mpf-line);
	color: var(--mpf-muted);
	font-size: 0.7rem;
	text-align: center;
	direction: ltr;
}

/* Phones: a bottom sheet across the screen. */
@media (max-width: 40rem) {
	.mpf.is-open {
		inset-inline: 0.6rem;
		inset-block-end: 0.6rem;
		left: 0.6rem;
		right: 0.6rem;
	}

	.mpf.is-open .mpf-panel {
		width: 100%;
		max-height: 82vh;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mpf-panel {
		animation: none;
	}

	.mpf-launcher {
		transition: none;
	}
}

/* ------------------------------------------------------------------ *
 * Result badge
 * ------------------------------------------------------------------ */

.mpf-card__badge {
	padding: 0.05rem 0.55rem;
	border-radius: 999px;
	background: var(--color-amber, #fbbc34);
	color: var(--mpf-on-accent);
	font-size: 0.7rem;
	font-weight: 700;
}

/* ------------------------------------------------------------------ *
 * Invite bubble (above the launcher, once per visit)
 * ------------------------------------------------------------------ */

.mpf-invite {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	width: min(19rem, calc(100vw - 2 * var(--mpf-side)));
	margin-block-end: 0.6rem;
	padding: 0.75rem 0.75rem 0.75rem 0.9rem;
	background: var(--mpf-canvas);
	border: 1px solid var(--mpf-line);
	border-radius: 1rem;
	box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--mpf-ink) 40%, transparent);
	animation: mpf-in 0.3s ease both;
}

.mpf-invite__text {
	flex: 1;
	margin: 0;
	font-size: 0.88rem;
	line-height: 1.55;
}

.mpf-invite__name {
	display: block;
	color: var(--mpf-accent-deep);
	font-size: 0.8rem;
}

.mpf-invite__yes {
	flex: none;
	padding: 0.4rem 0.95rem;
	border: 0;
	border-radius: 999px;
	background: var(--mpf-accent);
	color: var(--mpf-on-accent);
	font-weight: 700;
	font-size: 0.85rem;
}

.mpf-invite__close {
	position: absolute;
	inset-block-start: -0.55rem;
	inset-inline-end: -0.55rem;
	display: grid;
	place-items: center;
	width: 1.6rem;
	height: 1.6rem;
	padding: 0;
	border: 1px solid var(--mpf-line);
	border-radius: 50%;
	background: var(--mpf-canvas);
	color: var(--mpf-muted);
}

.mpf.is-open .mpf-invite {
	display: none;
}

/* ------------------------------------------------------------------ *
 * In-grid card on shop and category pages (spans the whole row)
 * ------------------------------------------------------------------ */

.mpf-inline {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.9rem 1.1rem;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 1.1rem 1.25rem;
	list-style: none;
	background: var(--mpf-accent-tint);
	border: 1px solid color-mix(in srgb, var(--mpf-accent) 45%, transparent);
	border-radius: 1.1rem;
	color: var(--mpf-ink);
	font-family: inherit;
}

.mpf-inline__icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 50%;
	background: var(--mpf-canvas);
	color: var(--mpf-accent-deep);
}

.mpf-inline__icon svg {
	width: 1.4rem;
	height: 1.4rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.mpf-inline__text {
	flex: 1 1 14rem;
	min-width: 0;
}

.mpf-inline__title {
	margin: 0;
	font-weight: 700;
	font-size: 1.05rem;
}

.mpf-inline__body {
	margin: 0.15rem 0 0;
	color: var(--mpf-muted);
	font-size: 0.9rem;
}

.mpf-inline__btn {
	flex: none;
	min-height: 2.75rem;
	padding: 0 1.3rem;
	border: 0;
	border-radius: 999px;
	background: var(--mpf-accent);
	color: var(--mpf-on-accent);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.mpf-inline__btn:hover {
	background: var(--mpf-accent-deep);
	color: #fff;
}

@media (max-width: 40rem) {
	.mpf-inline__btn {
		width: 100%;
	}
}

/* ------------------------------------------------------------------ *
 * "Not quite it?" line under the buy buttons on product pages
 * ------------------------------------------------------------------ */

.mpf-alt {
	margin: 0.9rem 0 0;
	color: var(--mpf-muted);
	font-size: 0.92rem;
}

.mpf-alt__link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--mpf-accent-deep);
	font: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 0.25em;
	cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
	.mpf-invite {
		animation: none;
	}
}
