/**
 * Floating WhatsApp widget.
 *
 * A fixed corner button and the chat card it opens. Self-contained: no theme
 * tokens, so it renders the same on every template.
 */

.mr-wa {
	--mr-wa-green: #25d366;
	--mr-wa-green-dark: #1da851;
	--mr-wa-ink: #111b21;
	--mr-wa-muted: #667781;

	position: fixed;
	bottom: 22px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mr-wa--left {
	left: 22px;
}

.mr-wa--right {
	right: 22px;
}

/* ---------------------------------------------------------------------
 * The button
 * ------------------------------------------------------------------ */

.mr-wa__toggle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--mr-wa-green);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba( 0, 0, 0, 0.28 );
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.mr-wa__toggle:hover {
	background: var(--mr-wa-green-dark);
	transform: scale( 1.05 );
}

.mr-wa__toggle:focus-visible {
	outline: 3px solid rgba( 37, 211, 102, 0.5 );
	outline-offset: 3px;
}

.mr-wa__toggle-icon {
	transition: opacity 0.2s ease, transform 0.2s ease;
}

/* The close cross, hidden until the card is open. */
.mr-wa__toggle-close {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30px;
	line-height: 1;
	opacity: 0;
	transform: rotate( -90deg );
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.mr-wa.is-open .mr-wa__toggle-icon {
	opacity: 0;
	transform: rotate( 90deg );
}

.mr-wa.is-open .mr-wa__toggle-close {
	opacity: 1;
	transform: rotate( 0deg );
}

/* A gentle attract pulse before it is first opened. */
.mr-wa__toggle::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba( 37, 211, 102, 0.6 );
	animation: mr-wa-pulse 2.4s ease-out infinite;
}

.mr-wa.is-open .mr-wa__toggle::after {
	animation: none;
}

@keyframes mr-wa-pulse {
	0% { box-shadow: 0 0 0 0 rgba( 37, 211, 102, 0.5 ); }
	70% { box-shadow: 0 0 0 16px rgba( 37, 211, 102, 0 ); }
	100% { box-shadow: 0 0 0 0 rgba( 37, 211, 102, 0 ); }
}

/* ---------------------------------------------------------------------
 * The card
 * ------------------------------------------------------------------ */

.mr-wa__panel {
	position: absolute;
	bottom: 74px;
	width: 320px;
	max-width: calc( 100vw - 44px );
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.24 );
	overflow: hidden;
	transform-origin: bottom center;
	animation: mr-wa-in 0.18s ease-out;
}

.mr-wa--left .mr-wa__panel {
	left: 0;
	transform-origin: bottom left;
}

.mr-wa--right .mr-wa__panel {
	right: 0;
	transform-origin: bottom right;
}

@keyframes mr-wa-in {
	from { opacity: 0; transform: translateY( 12px ) scale( 0.96 ); }
	to { opacity: 1; transform: translateY( 0 ) scale( 1 ); }
}

/* The green bar: mark, name, and the way out. */
.mr-wa__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px;
	background: var(--mr-wa-green);
	color: #fff;
}

/*
 * A white disc behind the glyph, so the mark reads as a mark rather than as
 * a shape cut out of the bar. A photograph, when one is set, fills it.
 */
.mr-wa__header-avatar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #fff;
	color: var(--mr-wa-green);
	overflow: hidden;
}

.mr-wa__header-icon {
	width: 24px;
	height: 24px;
}

.mr-wa__avatar-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.mr-wa__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Darker than the bar rather than lighter: a hole, not a highlight. */
.mr-wa__panel-close {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.14 );
	color: #fff;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.mr-wa__panel-close:hover {
	background: rgba( 0, 0, 0, 0.26 );
}

.mr-wa__panel-close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/*
 * The messages. Each bubble hugs its own text — a short line should look
 * like a short message — so the column aligns them left and lets them size
 * themselves, up to the width of the card.
 */
.mr-wa__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	padding: 18px 16px 16px;
	background: #fff;
}

.mr-wa__bubble {
	max-width: 100%;
	margin: 0;
	padding: 12px 16px;
	border: 1px solid #eceff1;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 11, 20, 26, 0.10 );
	color: var(--mr-wa-ink);
	font-size: 14px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.mr-wa__bubble strong {
	font-weight: 700;
}

.mr-wa__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin-top: 6px;
	padding: 14px 20px;
	border-radius: 999px;
	background: var(--mr-wa-green);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.mr-wa__cta:hover,
.mr-wa__cta:focus {
	background: var(--mr-wa-green-dark);
	color: #fff;
	transform: translateY( -1px );
}

.mr-wa__cta:focus-visible {
	outline: 3px solid rgba( 37, 211, 102, 0.5 );
	outline-offset: 2px;
}

.mr-wa__cta-icon {
	flex: 0 0 auto;
}

@media ( max-width: 480px ) {

	.mr-wa {
		bottom: 16px;
	}

	.mr-wa--left {
		left: 16px;
	}

	.mr-wa--right {
		right: 16px;
	}
}

@media ( prefers-reduced-motion: reduce ) {

	.mr-wa__toggle::after {
		animation: none;
	}

	.mr-wa__panel {
		animation: none;
	}

	.mr-wa__cta:hover,
	.mr-wa__cta:focus {
		transform: none;
	}
}

/* ---------------------------------------------------------------------
 * Hardening against host resets
 *
 * Some templates reset bare elements inside a wrapper this widget happens to
 * sit within — the portfolio page, for instance, carries a `.map :where(button)`
 * reset on <body class="map">, which strips the toggle's green fill and turns
 * its white glyph dark. Re-asserting the essentials at two-class specificity
 * puts them beyond the reach of any single-class or :where() reset, whatever
 * the cascade order.
 * ------------------------------------------------------------------ */

.mr-wa .mr-wa__toggle {
	background: var(--mr-wa-green);
	color: #fff;
}

.mr-wa .mr-wa__toggle:hover {
	background: var(--mr-wa-green-dark);
}

.mr-wa .mr-wa__header-avatar {
	background: #fff;
	color: var(--mr-wa-green);
}

.mr-wa .mr-wa__panel-close {
	background: rgba( 0, 0, 0, 0.14 );
	color: #fff;
}

.mr-wa .mr-wa__panel-close:hover {
	background: rgba( 0, 0, 0, 0.26 );
}

.mr-wa .mr-wa__bubble {
	background: #fff;
	color: var(--mr-wa-ink);
}

.mr-wa .mr-wa__cta {
	background: var(--mr-wa-green);
	color: #fff;
}

.mr-wa .mr-wa__cta:hover,
.mr-wa .mr-wa__cta:focus {
	background: var(--mr-wa-green-dark);
	color: #fff;
}
