/* WhatsApp greeting (inc/wa-greeting.php): a card left of the WhatsApp button,
   bottom-aligned with it and lifted with it above bottom bars (--bh-wa-lift).
   Fixed position only: no layout shift. */
.bh-wag {
	--bh-wag-gap: 14px;
	position: fixed; z-index: var(--z-float);
	right: calc(20px + var(--bh-wa-size, 56px) + var(--bh-wag-gap) + env(safe-area-inset-right));
	bottom: calc(20px + env(safe-area-inset-bottom));
	box-sizing: border-box; width: 300px; max-width: calc(100vw - var(--bh-wa-size, 56px) - 20px - var(--bh-wag-gap) - 16px);
	padding: 18px 20px 16px;
	border-radius: 14px 14px 4px 14px;
	background: var(--wp--preset--color--white); color: var(--wp--preset--color--body);
	box-shadow: 0 0 0 1px var(--wp--preset--color--line), 0 12px 32px rgba(15, 27, 45, .18), 0 2px 6px rgba(15, 27, 45, .08);
	font: 400 0.875rem/1.45 var(--wp--preset--font-family--body);
	opacity: 0; transform: translate(8px, calc(-1 * var(--bh-wa-lift, 0px)));
	transition: opacity 240ms ease, transform 240ms var(--wp--custom--ease, ease);
}
.bh-wag *, .bh-wag *::before, .bh-wag *::after { box-sizing: border-box; }
.bh-wag[hidden] { display: none; }
.bh-wag.is-in { opacity: 1; transform: translate(0, calc(-1 * var(--bh-wa-lift, 0px))); }
/* Tail toward the avatar, near the bottom right. */
.bh-wag::after {
	content: ""; position: absolute; right: -6px; bottom: 18px;
	width: 12px; height: 12px; background: var(--wp--preset--color--white);
	box-shadow: 1px -1px 0 var(--wp--preset--color--line);
	transform: rotate(45deg);
}
.bh-wag p { margin: 0; }
.bh-wag__title { padding-right: 24px; font-weight: 700; font-size: 0.96875rem; color: var(--wp--preset--color--primary); }
.bh-wag__text { margin-top: 2px !important; color: var(--wp--preset--color--body); }
.bh-wag__note { margin-top: 10px !important; font-size: 0.75rem; color: var(--wp--preset--color--muted); }
.bh-wag__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.bh-wag__chip {
	display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
	border: 1px solid var(--wp--preset--color--sand); border-radius: 18px;
	background: var(--wp--preset--color--white); color: var(--wp--preset--color--primary);
	font-weight: 600; font-size: 0.8125rem; text-decoration: none; white-space: nowrap;
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.bh-wag__chip:hover { background: #25D366; border-color: #25D366; color: #fff; }
.bh-wag__chip:focus-visible { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 2px; }
.bh-wag__chips--one .bh-wag__chip { border-color: #25D366; background: #25D366; color: #fff; }
.bh-wag__chips--one .bh-wag__chip:hover { background: #1ebe5a; }
.bh-wag__close {
	position: absolute; top: 8px; right: 8px;
	display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
	border: 0; border-radius: 50%; background: transparent; color: var(--wp--preset--color--muted); cursor: pointer;
}
.bh-wag__close:hover { background: var(--wp--preset--color--light); color: var(--wp--preset--color--primary); }
.bh-wag__close:focus-visible { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 1px; }
.bh-wag .bh-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* "Typing": three dots first, then the text. */
.bh-wag__typing { display: none; gap: 5px; align-items: center; height: 22px; padding: 0 4px; }
.bh-wag.is-typing .bh-wag__typing { display: inline-flex; }
.bh-wag.is-typing .bh-wag__body { display: none; }
.bh-wag__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--wp--preset--color--sand); animation: bh-wag-dot 1s infinite ease-in-out; }
.bh-wag__typing i:nth-child(2) { animation-delay: .15s; }
.bh-wag__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bh-wag-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.bh-wag.is-typing { width: auto; padding: 14px 18px; }
.bh-wag.is-typing .bh-wag__close { display: none; }

/* The avatar's bounce when the card arrives. */
.bh-wa.is-bounce .bh-wa__avatar, .bh-wa.is-bounce .bh-wa__circle { animation: bh-wa-bounce 400ms ease-out; }
@keyframes bh-wa-bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
/* The hover label would sit under the card. */
html.bh-wag-open .bh-wa__label { display: none; }

/* The phone bars of listings and agent profiles, as for the button. */
@media (max-width: 899px) { body:has(.bh-listing-mobile-bar) .bh-wag { --bh-wa-lift: 76px; } }
@media (max-width: 1023px) { body:has(.bh-agent-bar) .bh-wag { --bh-wa-lift: 70px; } }
body.bh-mv-map-open .bh-wag { display: none; }

/* Phones: a more compact card. */
@media (max-width: 781px) {
	.bh-wag { --bh-wag-gap: 10px; width: 264px; padding: 14px 14px 12px; font-size: 0.8125rem; }
	.bh-wag__title { font-size: 0.90625rem; }
	.bh-wag__chips { margin-top: 10px; }
	.bh-wag__chip { min-height: 34px; padding: 0 12px; }
	.bh-wag__note { margin-top: 8px !important; }
}
@media (prefers-reduced-motion: reduce) {
	.bh-wag { transition: opacity 1ms; }
	.bh-wa.is-bounce .bh-wa__avatar, .bh-wa.is-bounce .bh-wa__circle, .bh-wag__typing i { animation: none; }
}
@media print { .bh-wag { display: none !important; } }
