/**
 * The floating WhatsApp button and its card.
 *
 * Stacking, against the rest of the suite: above page content and the product page's sticky buy
 * bar (30), below the bag toast (90) and the navbar's drawers (100) - a chat button must never
 * cover the cart the shopper just opened.
 *
 * Every control states its own background, border and colour: a theme styles `a`, `button` and
 * `p` directly, and an inherited value loses to any rule that matches the element.
 */

.avh-wa {
	--avh-wa-green: #25D366;
	--avh-wa-ink: #191410;
	--avh-wa-cream: #f7f1e6;
	--avh-wa-pure: #fffdf9;
	--avh-wa-line: rgba(25, 20, 16, 0.1);
	--avh-wa-muted: rgba(25, 20, 16, 0.62);
	--avh-wa-font: var(--avh-font-body, "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif);

	/*
	 * --avh-wa-offset and --avh-wa-lift live on :root, not here, because the theme's back-to-top
	 * button (outside this element) has to move with them. Lift is set by the script when
	 * something - the product page's buy bar, another theme's scroll-top button - would sit on
	 * top of the button.
	 */
	position: fixed;
	bottom: calc(var(--avh-wa-offset, 20px) + var(--avh-wa-lift, 0px) + env(safe-area-inset-bottom, 0px));
	z-index: 80;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	font-family: var(--avh-wa-font);
	transition: bottom 240ms ease;
}

.avh-wa--right {
	right: max(var(--avh-wa-offset, 20px), env(safe-area-inset-right, 0px));
	align-items: flex-end;
}

.avh-wa--left {
	left: max(var(--avh-wa-offset, 20px), env(safe-area-inset-left, 0px));
	align-items: flex-start;
}

/* --- Back to top --------------------------------------------------------------------------- */

/*
 * Replaces the theme's (Blocksy's is switched off in PHP). In the same column as the chat button,
 * centred over it, so the two can never overlap - which is what the theme's did.
 */
.avh-wa.avh-wa .avh-wa__top {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--avh-wa-ink);
	box-shadow: 0 8px 20px -8px rgba(25, 20, 16, 0.5);
	color: var(--avh-wa-cream);
	text-decoration: none;
	cursor: pointer;
	transition: opacity 240ms ease, transform 240ms ease, visibility 240ms, background 200ms ease;
}

.avh-wa--right .avh-wa__top {
	margin-right: calc((3.5rem - 2.75rem) / 2);
}

.avh-wa--left .avh-wa__top {
	margin-left: calc((3.5rem - 2.75rem) / 2);
}

.avh-wa.avh-wa .avh-wa__top:hover {
	background: #2a221c;
}

.avh-wa.avh-wa .avh-wa__top:hover .avh-wa__chevron {
	transform: translateY(-2px);
}

.avh-wa .avh-wa__chevron {
	position: relative;
	transition: transform 200ms ease;
}

/* With the script running it waits until the visitor has scrolled; without it, it is always there. */
.avh-wa.is-js .avh-wa__top:not(.is-shown) {
	visibility: hidden;
	opacity: 0;
	transform: translateY(10px) scale(0.9);
	pointer-events: none;
}

/* Out of the way while the chat card is open. */
.avh-wa.is-open .avh-wa__top {
	display: none;
}

.avh-wa .avh-wa__ring {
	position: absolute;
	/* Outside the button's edge, so the ring reads against the page rather than the dark circle. */
	inset: -6px;
	width: calc(100% + 12px);
	height: calc(100% + 12px);
	transform: rotate(-90deg);
	pointer-events: none;
}

.avh-wa .avh-wa__ring circle {
	fill: none;
	stroke-width: 2.25;
}

.avh-wa .avh-wa__ring-track {
	stroke: rgba(194, 154, 79, 0.28);
}

.avh-wa .avh-wa__ring-fill {
	stroke: #c29a4f;
	stroke-linecap: round;
	/* 2 * pi * 22.5 */
	stroke-dasharray: 141.37;
	stroke-dashoffset: 141.37;
}

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

.avh-wa.avh-wa .avh-wa__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--avh-wa-green);
	box-shadow: 0 10px 24px -8px rgba(25, 20, 16, 0.45), 0 2px 6px rgba(25, 20, 16, 0.12);
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	transition: transform 200ms ease, box-shadow 200ms ease;
}

.avh-wa.avh-wa .avh-wa__button:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 28px -8px rgba(25, 20, 16, 0.5), 0 2px 6px rgba(25, 20, 16, 0.14);
}

.avh-wa .avh-wa__button svg,
.avh-wa .avh-wa__card svg {
	display: block;
	flex: none;
}

.avh-wa .avh-wa__button:focus-visible,
.avh-wa .avh-wa__top:focus-visible,
.avh-wa .avh-wa__card a:focus-visible,
.avh-wa .avh-wa__card button:focus-visible {
	outline: 2px solid var(--avh-wa-ink);
	outline-offset: 3px;
}

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

.avh-wa .avh-wa__card {
	width: min(22rem, calc(100vw - 2 * var(--avh-wa-offset, 20px)));
	max-height: calc(100vh - 7rem - var(--avh-wa-lift, 0px));
	overflow: auto;
	border: 1px solid var(--avh-wa-line);
	border-radius: 1.1rem;
	background: var(--avh-wa-pure);
	box-shadow: 0 24px 48px -16px rgba(25, 20, 16, 0.35);
	color: var(--avh-wa-ink);
	transform-origin: bottom right;
	animation: avh-wa-in 200ms ease-out;
}

.avh-wa--left .avh-wa__card {
	transform-origin: bottom left;
}

/*
 * Any display rule - the theme's, or our own display:flex on the status line - outranks the
 * browser's [hidden] rule, so it is restated here above every one of them (0,4,0).
 */
.avh-wa.avh-wa [hidden][hidden] {
	display: none;
}

@keyframes avh-wa-in {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

.avh-wa .avh-wa__head {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	padding: 1rem 1rem 0.9rem;
	background: var(--avh-wa-ink);
	color: var(--avh-wa-cream);
}

.avh-wa .avh-wa__head-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	flex: none;
	border-radius: 999px;
	background: var(--avh-wa-green);
	color: #fff;
}

.avh-wa .avh-wa__head-text {
	flex: 1 1 auto;
	min-width: 0;
}

.avh-wa.avh-wa .avh-wa__title {
	margin: 0;
	color: var(--avh-wa-cream);
	font-family: var(--avh-font-heading, "Fraunces", Georgia, serif);
	font-size: 1.05rem;
	font-weight: 500;
	line-height: 1.25;
}

.avh-wa.avh-wa .avh-wa__status {
	display: flex;
	gap: 0.4rem;
	align-items: center;
	margin: 0.2rem 0 0;
	color: rgba(247, 241, 230, 0.75);
	font-size: 0.75rem;
}

.avh-wa .avh-wa__status::before {
	content: "";
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 999px;
	background: #c9a76a;
}

.avh-wa .avh-wa__status.is-open::before {
	background: var(--avh-wa-green);
}

.avh-wa.avh-wa .avh-wa__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	flex: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	box-shadow: none;
	color: var(--avh-wa-cream);
	cursor: pointer;
}

.avh-wa.avh-wa .avh-wa__close:hover {
	background: rgba(255, 255, 255, 0.1);
}

.avh-wa .avh-wa__body {
	padding: 1rem;
}

.avh-wa.avh-wa .avh-wa__text,
.avh-wa.avh-wa .avh-wa__away {
	margin: 0 0 0.9rem;
	color: var(--avh-wa-ink);
	font-size: 0.875rem;
	line-height: 1.55;
}

.avh-wa.avh-wa .avh-wa__away {
	padding: 0.6rem 0.75rem;
	border-radius: 0.6rem;
	background: var(--avh-wa-cream);
	font-size: 0.8125rem;
}

.avh-wa.avh-wa .avh-wa__start {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
	padding: 0.8rem 1rem;
	border-radius: 999px;
	background: var(--avh-wa-green);
	color: #fff;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
}

.avh-wa.avh-wa .avh-wa__start:hover {
	filter: brightness(0.95);
}

.avh-wa.avh-wa .avh-wa__list {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Some themes draw their own list markers in ::before. */
.avh-wa .avh-wa__list li {
	margin: 0;
	padding: 0;
}

.avh-wa .avh-wa__list li::before,
.avh-wa .avh-wa__list li::marker {
	content: none;
}

.avh-wa.avh-wa .avh-wa__contact {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--avh-wa-line);
	border-radius: 0.8rem;
	background: var(--avh-wa-pure);
	color: var(--avh-wa-ink);
	text-decoration: none;
	transition: border-color 160ms ease, background 160ms ease;
}

.avh-wa.avh-wa .avh-wa__contact:hover {
	border-color: var(--avh-wa-green);
	background: #f4fbf6;
}

.avh-wa .avh-wa__contact-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.1rem;
	height: 2.1rem;
	flex: none;
	border-radius: 999px;
	background: var(--avh-wa-green);
	color: #fff;
}

.avh-wa .avh-wa__contact-text {
	display: grid;
	flex: 1 1 auto;
	min-width: 0;
}

.avh-wa .avh-wa__contact-label {
	color: var(--avh-wa-ink);
	font-size: 0.9rem;
	font-weight: 600;
}

.avh-wa .avh-wa__contact-note {
	color: var(--avh-wa-muted);
	font-size: 0.75rem;
}

.avh-wa .avh-wa__arrow {
	color: var(--avh-wa-muted);
}

/* --- Topics: "How can we help?" ------------------------------------------------------------- */

.avh-wa.avh-wa .avh-wa__ask,
.avh-wa.avh-wa .avh-wa__direct {
	margin: 0 0 0.55rem;
	color: var(--avh-wa-muted);
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.avh-wa.avh-wa .avh-wa__direct {
	margin-top: 1rem;
}

.avh-wa.avh-wa .avh-wa__topic-list {
	display: grid;
	gap: 0.4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.avh-wa .avh-wa__topic-list li {
	margin: 0;
	padding: 0;
}

.avh-wa .avh-wa__topic-list li::before,
.avh-wa .avh-wa__topic-list li::marker {
	content: none;
}

.avh-wa.avh-wa .avh-wa__topic {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	justify-content: space-between;
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--avh-wa-line);
	border-radius: 999px;
	background: var(--avh-wa-pure);
	color: var(--avh-wa-ink);
	font-size: 0.86rem;
	font-weight: 500;
	line-height: 1.3;
	text-decoration: none;
	transition: border-color 160ms ease, background 160ms ease;
}

.avh-wa.avh-wa .avh-wa__topic:hover,
.avh-wa.avh-wa .avh-wa__topic:focus-visible {
	border-color: var(--avh-wa-green);
	background: #f4fbf6;
}

.avh-wa .avh-wa__topic svg {
	flex: none;
	color: var(--avh-wa-muted);
}

/* --- Compose: the message, editable, before it goes to WhatsApp -------------------------------- */

.avh-wa.avh-wa .avh-wa__back {
	display: inline-flex;
	gap: 0.3rem;
	align-items: center;
	margin: 0 0 0.6rem;
	padding: 0.2rem 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--avh-wa-muted);
	font: inherit;
	font-size: 0.78rem;
	cursor: pointer;
}

.avh-wa.avh-wa .avh-wa__back:hover {
	color: var(--avh-wa-ink);
}

.avh-wa.avh-wa .avh-wa__compose-label {
	display: block;
	margin: 0 0 0.4rem;
	color: var(--avh-wa-ink);
	font-size: 0.9rem;
	font-weight: 600;
}

.avh-wa.avh-wa .avh-wa__textarea {
	display: block;
	width: 100%;
	min-height: 6.5rem;
	box-sizing: border-box;
	margin: 0;
	padding: 0.7rem 0.8rem;
	border: 1px solid var(--avh-wa-line);
	border-radius: 0.8rem;
	background: #fff;
	box-shadow: none;
	color: var(--avh-wa-ink);
	-webkit-text-fill-color: var(--avh-wa-ink);
	caret-color: var(--avh-wa-green);
	font: inherit;
	font-size: 0.88rem;
	line-height: 1.5;
	resize: vertical;
}

.avh-wa.avh-wa .avh-wa__textarea:focus {
	border-color: var(--avh-wa-green);
	outline: 2px solid color-mix(in srgb, var(--avh-wa-green) 35%, transparent);
	outline-offset: 0;
}

.avh-wa.avh-wa .avh-wa__hint {
	margin: 0.4rem 0 0.85rem;
	color: var(--avh-wa-muted);
	font-size: 0.74rem;
}

.avh-wa.avh-wa .avh-wa__hours {
	margin: 0.9rem 0 0;
	color: var(--avh-wa-muted);
	font-size: 0.72rem;
	letter-spacing: 0.02em;
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.avh-wa,
	.avh-wa .avh-wa__button,
	.avh-wa .avh-wa__top,
	.avh-wa .avh-wa__chevron,
	.avh-wa .avh-wa__card {
		transition: none;
		animation: none;
	}
}

@media print {
	.avh-wa {
		display: none;
	}
}
