/* Floating Contact Buttons – front end
 * Breakpoints: mobile ≤767px · tablet 768–1024px · desktop ≥1025px
 * Selectors are scoped to #fcb so theme / page-builder button styles don't leak in.
 */

#fcb {
	--s: var(--fcb-size, 56px);
	--x: var(--fcb-x, 24px);
	--y: var(--fcb-y, 24px);
	--r: calc(var(--s) / 2);
	--shadow: none;
	position: fixed;
	bottom: calc(var(--y) + env(safe-area-inset-bottom, 0px));
	z-index: var(--fcb-z, 9999);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--fcb-gap, 12px);
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 15px;
	line-height: 1;
	pointer-events: none; /* only the buttons themselves are clickable */
}
#fcb.fcb--right { right: calc(var(--x) + env(safe-area-inset-right, 0px)); }
#fcb.fcb--left  { left: calc(var(--x) + env(safe-area-inset-left, 0px)); align-items: flex-start; }
#fcb.fcb--shape-rounded { --r: calc(var(--s) * 0.28); }
#fcb.fcb--shape-square  { --r: 4px; }
#fcb.fcb--shadow { --shadow: 0 6px 18px rgba(0, 0, 0, 0.22), 0 2px 4px rgba(0, 0, 0, 0.12); }

#fcb .fcb__list {
	display: flex;
	flex-direction: column;
	align-items: inherit;
	gap: var(--fcb-gap, 12px);
	margin: 0;
	padding: 0;
}

/* ---------- Button ---------- */
#fcb .fcb__btn {
	position: relative;
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	box-sizing: border-box;
	height: var(--s);
	min-width: var(--s);
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--r);
	background: var(--fcb-bg, #25d366);
	color: var(--fcb-fg, #fff);
	box-shadow: var(--shadow);
	font: inherit;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	pointer-events: auto;
	-webkit-tap-highlight-color: transparent;
	transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
#fcb.fcb--right .fcb__btn { flex-direction: row-reverse; }
#fcb .fcb__btn:hover {
	color: var(--fcb-fg, #fff);
	background: var(--fcb-bg, #25d366);
	text-decoration: none;
	transform: translateY(-2px) scale(1.05);
	filter: brightness(1.06);
}
#fcb .fcb__btn:active { transform: scale(0.96); }
#fcb .fcb__btn:focus { outline: none; }
#fcb .fcb__btn:focus-visible {
	outline: 3px solid var(--fcb-bg, #25d366);
	outline-offset: 3px;
}

#fcb .fcb__icon {
	display: grid;
	place-items: center;
	flex: 0 0 var(--s);
	width: var(--s);
	height: var(--s);
}
#fcb .fcb__icon > *,
#fcb .fcb__icon svg,
#fcb .fcb__icon img {
	grid-area: 1 / 1;
}
#fcb .fcb__icon svg,
#fcb .fcb__icon img {
	display: block;
	width: calc(var(--s) * 0.5);
	height: calc(var(--s) * 0.5);
	max-width: none;
	margin: 0;
	fill: currentColor;
	object-fit: contain;
}

/* ---------- Labels ---------- */

/* Icons only: keep the text for screen readers. */
#fcb.fcb--labels-never .fcb__label {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Title + optional second line. */
#fcb .fcb__label-inner {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	text-align: left;
}
#fcb .fcb__label-title { font-weight: 600; }
#fcb .fcb__label-sub { font-size: 0.86em; font-weight: 500; opacity: 0.95; letter-spacing: 0.01em; }

/* Always: pill buttons. */
#fcb.fcb--float.fcb--labels-always .fcb__label { padding: 0 2px 0 20px; }
#fcb.fcb--float.fcb--labels-always.fcb--left .fcb__label { padding: 0 20px 0 2px; }
#fcb.fcb--float.fcb--labels-always.fcb--right .fcb__label { padding: 0 2px 0 20px; }
#fcb.fcb--float.fcb--labels-always .fcb__btn { --r: calc(var(--s) / 2); }
#fcb.fcb--float.fcb--labels-always.fcb--shape-rounded .fcb__btn { --r: calc(var(--s) * 0.28); }
#fcb.fcb--float.fcb--labels-always.fcb--shape-square .fcb__btn { --r: 4px; }

/* Hover: tooltip bubble beside the button. */
#fcb.fcb--float.fcb--labels-hover .fcb__label {
	position: absolute;
	top: 50%;
	padding: 8px 12px;
	border-radius: 6px;
	background: #fff;
	color: #1f2933;
	font-size: 14px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
#fcb.fcb--float.fcb--labels-hover.fcb--right .fcb__label { right: calc(100% + 12px); transform: translate(8px, -50%); }
#fcb.fcb--float.fcb--labels-hover.fcb--left  .fcb__label { left: calc(100% + 12px);  transform: translate(-8px, -50%); }
#fcb.fcb--float.fcb--labels-hover .fcb__label::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 8px; height: 8px;
	background: inherit;
	transform: translateY(-50%) rotate(45deg);
}
#fcb.fcb--float.fcb--labels-hover.fcb--right .fcb__label::after { right: -4px; }
#fcb.fcb--float.fcb--labels-hover.fcb--left  .fcb__label::after { left: -4px; }
#fcb.fcb--float.fcb--labels-hover .fcb__btn:hover .fcb__label,
#fcb.fcb--float.fcb--labels-hover .fcb__btn:focus-visible .fcb__label {
	opacity: 1;
	visibility: visible;
	transform: translate(0, -50%);
}

/* ---------- Menu (toggle) layout ---------- */
#fcb.fcb--toggle .fcb__list {
	visibility: hidden;
	pointer-events: none;
	transition: visibility 0s linear 0.3s;
}
#fcb.fcb--toggle .fcb__list .fcb__btn {
	opacity: 0;
	transform: translateY(14px) scale(0.85);
	pointer-events: none;
	transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
#fcb.fcb--toggle.is-open .fcb__list {
	visibility: visible;
	transition-delay: 0s;
}
#fcb.fcb--toggle.is-open .fcb__list .fcb__btn {
	opacity: 1;
	transform: none;
	pointer-events: auto;
	transition-delay: calc(var(--fcb-i, 0) * 45ms);
}
#fcb.fcb--toggle.is-open .fcb__list .fcb__btn:hover {
	transform: translateY(-2px) scale(1.05);
	transition-delay: 0s;
}

#fcb .fcb__icon-open,
#fcb .fcb__icon-close {
	display: grid;
	place-items: center;
	transition: transform 0.3s ease, opacity 0.2s ease;
}
#fcb .fcb__icon-close { opacity: 0; transform: rotate(-90deg) scale(0.5); }
#fcb.is-open .fcb__icon-open  { opacity: 0; transform: rotate(90deg) scale(0.5); }
#fcb.is-open .fcb__icon-close { opacity: 1; transform: none; }
#fcb.is-open .fcb__toggle::before,
#fcb.is-open .fcb__toggle .fcb__icon { animation: none; }
#fcb.is-open .fcb__toggle { animation: none; }

/* ---------- Attention animations ---------- */
#fcb .fcb-anim-pulse::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	animation: fcb-pulse 2.2s ease-out infinite;
	animation-delay: calc(var(--fcb-i, 0) * 0.35s);
}
@keyframes fcb-pulse {
	0%   { box-shadow: 0 0 0 0 var(--fcb-bg, #25d366); opacity: 0.6; }
	70%  { box-shadow: 0 0 0 16px var(--fcb-bg, #25d366); opacity: 0; }
	100% { box-shadow: 0 0 0 16px var(--fcb-bg, #25d366); opacity: 0; }
}

#fcb .fcb-anim-bounce .fcb__icon {
	animation: fcb-bounce 2.6s ease-in-out infinite;
	animation-delay: calc(var(--fcb-i, 0) * 0.3s);
}
@keyframes fcb-bounce {
	0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
	35% { transform: translateY(-9px); }
	60% { transform: translateY(-4px); }
}

#fcb .fcb-anim-shake .fcb__icon {
	animation: fcb-shake 3s ease-in-out infinite;
	animation-delay: calc(var(--fcb-i, 0) * 0.4s);
}
@keyframes fcb-shake {
	0%, 24%, 100% { transform: rotate(0); }
	3%  { transform: rotate(-16deg); }
	6%  { transform: rotate(14deg); }
	9%  { transform: rotate(-12deg); }
	12% { transform: rotate(10deg); }
	15% { transform: rotate(-6deg); }
	18% { transform: rotate(4deg); }
}

#fcb .fcb-anim-wobble .fcb__icon {
	animation: fcb-wobble 3s ease-in-out infinite;
	animation-delay: calc(var(--fcb-i, 0) * 0.4s);
}
@keyframes fcb-wobble {
	0%, 30%, 100% { transform: none; }
	5%  { transform: translateX(-5px) rotate(-5deg); }
	10% { transform: translateX(4px) rotate(3deg); }
	15% { transform: translateX(-3px) rotate(-3deg); }
	20% { transform: translateX(2px) rotate(2deg); }
	25% { transform: translateX(-1px) rotate(-1deg); }
}

#fcb .fcb-anim-glow {
	animation: fcb-glow 2.4s ease-in-out infinite;
	animation-delay: calc(var(--fcb-i, 0) * 0.35s);
}
@keyframes fcb-glow {
	0%, 100% { box-shadow: var(--shadow), 0 0 0 0 transparent; }
	50%      { box-shadow: var(--shadow), 0 0 18px 5px var(--fcb-bg, #25d366); }
}

/* ---------- Entrance ---------- */
#fcb.fcb--enter-slide { animation: fcb-in-slide 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) var(--fcb-delay, 0s) both; }
#fcb.fcb--enter-zoom  { animation: fcb-in-zoom 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.35) var(--fcb-delay, 0s) both; }
#fcb.fcb--enter-fade  { animation: fcb-in-fade 0.6s ease var(--fcb-delay, 0s) both; }
#fcb.fcb--right.fcb--enter-zoom { transform-origin: bottom right; }
#fcb.fcb--left.fcb--enter-zoom  { transform-origin: bottom left; }
@keyframes fcb-in-slide { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes fcb-in-zoom  { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes fcb-in-fade  { from { opacity: 0; } to { opacity: 1; } }


/* =====================================================================
   EDGE TABS – square tabs flush to the screen edge, vertically placed,
   sliding out on hover (or tap) to reveal title + second line.
   ===================================================================== */
#fcb.fcb--edge {
	top: var(--fcb-top, 50%);
	bottom: auto;
	translate: 0 -50%;
	--er: 0px;
}
#fcb.fcb--edge.fcb--right { right: 0; }
#fcb.fcb--edge.fcb--left  { left: 0; }
#fcb.fcb--edge.fcb--shape-rounded { --er: 8px; }
#fcb.fcb--edge.fcb--shape-circle  { --er: calc(var(--s) / 2); }
#fcb.fcb--edge.fcb--shadow { --shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }

#fcb.fcb--edge.fcb--right .fcb__btn { border-radius: var(--er) 0 0 var(--er); }
#fcb.fcb--edge.fcb--left  .fcb__btn { border-radius: 0 var(--er) var(--er) 0; }
#fcb.fcb--edge .fcb__btn:hover,
#fcb.fcb--edge .fcb__btn:active {
	transform: none;
	filter: brightness(1.08);
}
#fcb.fcb--edge .fcb__btn:focus-visible { outline-offset: -3px; outline-color: #fff; }
#fcb.fcb--edge .fcb__icon svg,
#fcb.fcb--edge .fcb__icon img {
	width: calc(var(--s) * 0.48);
	height: calc(var(--s) * 0.48);
	transition: transform 0.3s ease;
}

/* Sliding label */
#fcb.fcb--edge .fcb__label {
	display: block;
	max-width: 0;
	overflow: hidden;
	transition: max-width 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#fcb.fcb--edge .fcb__label-inner {
	box-sizing: border-box;
	padding: 0 4px 0 20px;
	opacity: 0;
	transform: translateX(12px);
	transition: opacity 0.25s ease, transform 0.35s ease;
}
#fcb.fcb--edge.fcb--left .fcb__label-inner {
	padding: 0 20px 0 4px;
	transform: translateX(-12px);
}
#fcb.fcb--edge.fcb--labels-hover .fcb__btn:hover .fcb__label,
#fcb.fcb--edge.fcb--labels-hover .fcb__btn:focus-visible .fcb__label,
#fcb.fcb--edge .fcb__btn.is-expanded .fcb__label,
#fcb.fcb--edge.fcb--labels-always .fcb__label {
	max-width: min(320px, calc(100vw - var(--s) - 12px));
}
#fcb.fcb--edge.fcb--labels-hover .fcb__btn:hover .fcb__label-inner,
#fcb.fcb--edge.fcb--labels-hover .fcb__btn:focus-visible .fcb__label-inner,
#fcb.fcb--edge .fcb__btn.is-expanded .fcb__label-inner,
#fcb.fcb--edge.fcb--labels-always .fcb__label-inner {
	opacity: 1;
	transform: none;
	transition-delay: 0.08s;
}
#fcb.fcb--edge.fcb--labels-hover .fcb__btn:hover .fcb__icon svg,
#fcb.fcb--edge.fcb--labels-hover .fcb__btn:hover .fcb__icon img,
#fcb.fcb--edge .fcb__btn.is-expanded .fcb__icon svg,
#fcb.fcb--edge .fcb__btn.is-expanded .fcb__icon img {
	transform: scale(1.08) rotate(-8deg);
}

/* Edge entrance slides in from the side. */
#fcb.fcb--edge.fcb--right.fcb--enter-slide { animation-name: fcb-in-right; }
#fcb.fcb--edge.fcb--left.fcb--enter-slide  { animation-name: fcb-in-left; }
#fcb.fcb--edge.fcb--right.fcb--enter-zoom  { transform-origin: right center; }
#fcb.fcb--edge.fcb--left.fcb--enter-zoom   { transform-origin: left center; }
@keyframes fcb-in-right { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: none; } }
@keyframes fcb-in-left  { from { opacity: 0; transform: translateX(-100%); } to { opacity: 1; transform: none; } }

/* Touch screens: hover never fires, so labels only open by tap (when enabled). */
@media (hover: none) {
	#fcb.fcb--edge.fcb--labels-hover .fcb__btn:hover .fcb__label { max-width: 0; }
	#fcb.fcb--edge.fcb--labels-hover .fcb__btn:hover .fcb__label-inner { opacity: 0; }
	#fcb.fcb--edge .fcb__btn.is-expanded .fcb__label { max-width: min(320px, calc(100vw - var(--s) - 12px)); }
	#fcb.fcb--edge .fcb__btn.is-expanded .fcb__label-inner { opacity: 1; }
	#fcb.fcb--edge .fcb__btn:hover { filter: none; }
}

/* ---------- Responsive ---------- */

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
	#fcb { --s: var(--fcb-size-t, 52px); }
	.fcb-hide-tablet { display: none !important; }
}

/* Desktop */
@media (min-width: 1025px) {
	.fcb-hide-desktop { display: none !important; }
}

/* Mobile */
@media (max-width: 767px) {
	#fcb {
		--s: var(--fcb-size-m, 48px);
		--x: var(--fcb-x-m, 14px);
		--y: var(--fcb-y-m, 16px);
		font-size: 14px;
	}
	.fcb-hide-mobile { display: none !important; }

	/* Icons only on phones unless "keep labels on mobile" is ticked. */
	#fcb.fcb--float:not(.fcb--labels-mobile) .fcb__label {
		position: absolute !important;
		width: 1px; height: 1px;
		padding: 0 !important;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		opacity: 1; visibility: visible;
		box-shadow: none;
	}
	#fcb.fcb--float:not(.fcb--labels-mobile) .fcb__label::after { display: none; }
}

/* Touch screens have no hover: show hover-labels as pills only if kept on mobile, otherwise hide them. */
@media (hover: none) {
	#fcb.fcb--float.fcb--labels-hover .fcb__label {
		position: absolute !important;
		width: 1px; height: 1px; padding: 0;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
	}
	#fcb.fcb--float.fcb--labels-hover.fcb--labels-mobile .fcb__label {
		position: static !important;
		width: auto; height: auto;
		padding: 0 2px 0 18px;
		overflow: visible;
		clip: auto; clip-path: none;
		opacity: 1; visibility: visible;
		background: none; color: inherit; box-shadow: none;
		font-size: inherit;
		transform: none;
	}
	#fcb.fcb--float.fcb--labels-hover.fcb--labels-mobile.fcb--left .fcb__label { padding: 0 18px 0 2px; }
	#fcb.fcb--float.fcb--labels-hover.fcb--labels-mobile .fcb__label::after { display: none; }
	#fcb.fcb--float .fcb__btn:hover { transform: none; filter: none; }
}

/* Very small phones: shrink a little more so a tall stack never covers the page. */
@media (max-width: 360px) {
	#fcb { --s: min(var(--fcb-size-m, 48px), 44px); --fcb-gap: 10px; }
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
	#fcb, #fcb *, #fcb *::before, #fcb *::after {
		animation: none !important;
		transition-duration: 0.01ms !important;
	}
}

@media print {
	#fcb { display: none !important; }
}
