/* Action Network Custom Embed: sticky "Take action" button. Copyright (c) Florian Hülsebusch - admk, https://admk.de
 * Colours come from CSS variables set by sticky.js (widget settings); the defaults below are neutral. */
.ance-sticky {
	--ance-bg: #b2ee2f;
	--ance-fg: #000;
	--ance-r: 70px;
	--ance-bottom: 20px;
	--ance-c1: #b2ee2f;
	--ance-tr: #e9e9e9;
	--ance-shadow: 5px 5px 30px rgba(0, 0, 0, 0.5);
	position: fixed;
	z-index: 1000;
	bottom: calc(var(--ance-bottom) + env(safe-area-inset-bottom, 0px));
	box-sizing: border-box;
	width: 360px;
	max-width: calc(100vw - 24px);
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.ance-sticky.is-on {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.3s ease;
}
.ance-sticky[data-pos="center"] { left: 50%; translate: -50% 0; }
.ance-sticky[data-pos="left"] { left: 8vw; }
.ance-sticky[data-pos="right"] { right: 8vw; }

.ance-sticky__inner { display: flex; flex-direction: column; gap: 10px; }
.ance-sticky.has-panel-bg { padding: 12px; border-radius: 16px; transition: opacity 0.3s ease, background-color 0.3s ease, visibility 0s linear 0.3s; }
.ance-sticky.has-panel-bg.has-btn.has-bar { background: var(--ance-pbg); }

.ance-sticky a.ance-sticky__btn,
.ance-sticky a.ance-sticky__btn:visited {
	display: block;
	box-sizing: border-box;
	padding: 12px 24px;
	border-radius: var(--ance-r);
	background: var(--ance-bg);
	color: var(--ance-fg);
	font: inherit;
	font-family: var(--ance-b-ff, inherit);
	font-size: var(--ance-b-fs, 1.225rem);
	font-weight: var(--ance-b-fw, 500);
	font-style: var(--ance-b-st, normal);
	line-height: var(--ance-b-lh, 1.3);
	letter-spacing: var(--ance-b-ls, normal);
	text-transform: var(--ance-b-tt, none);
	text-align: center;
	text-decoration: var(--ance-b-td, none);
	position: relative;
	pointer-events: auto;
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.3s ease, visibility 0s;
}
/* button not needed (a form is in view): fade out, the bar takes its place */
.ance-sticky:not(.has-btn) a.ance-sticky__btn {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.ance-sticky a.ance-sticky__btn:hover,
.ance-sticky a.ance-sticky__btn:focus-visible,
.ance-sticky a.ance-sticky__btn:active {
	background: var(--ance-hbg, var(--ance-bg));
	color: var(--ance-hfg, var(--ance-fg));
}
/* default hover: a bit darker (no filter: it would create a stacking context and lift the shadow over the bar) */
@supports (background: color-mix(in srgb, red, blue)) {
	.ance-sticky a.ance-sticky__btn:hover,
	.ance-sticky a.ance-sticky__btn:focus-visible,
	.ance-sticky a.ance-sticky__btn:active {
		background: var(--ance-hbg, color-mix(in srgb, var(--ance-bg) 88%, #000));
	}
}

/* Drop shadows live on pseudo-elements with a negative z-index. Neither the button nor the bar creates a
 * stacking context, so both shadows are painted behind both elements and never cover each other. */
.ance-sticky__btn::before,
.ance-sticky__bar::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	box-shadow: var(--ance-shadow);
	pointer-events: none;
}
.ance-sticky a.ance-sticky__btn:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }

/* Nested like the horizontal counter bar: outer rim (inner padding) > rail > fill, text on top */
.ance-sticky__bar {
	position: relative;
	box-sizing: border-box;
	padding: 0.3em;
	font-family: var(--ance-c-ff, inherit);
	font-size: var(--ance-c-fs, 0.95rem);
	font-weight: var(--ance-c-fw, normal);
	font-style: var(--ance-c-st, normal);
	letter-spacing: var(--ance-c-ls, normal);
	text-transform: var(--ance-c-tt, none);
	text-decoration: var(--ance-c-td, none);
	border-radius: 999px;
	background: var(--ance-tr);
	/* slides by position, not transform: a transform would make the bar a stacking context and lift its shadow */
	top: 0;
	transition: top 0.35s cubic-bezier(0.22, 0.8, 0.3, 1), opacity 0.3s ease, visibility 0s;
}
.ance-sticky__bar[hidden] { display: none; }
.ance-sticky:not(.has-btn) .ance-sticky__bar { top: var(--ance-shift, 60px); }
.ance-sticky:not(.has-bar) .ance-sticky__bar {
	opacity: 0;
	visibility: hidden;
	transition: top 0.35s cubic-bezier(0.22, 0.8, 0.3, 1), opacity 0.25s ease, visibility 0s linear 0.25s;
}
.ance-sticky__rail {
	position: relative;
	height: max(24px, 1.6em);
	border-radius: 999px;
}
.ance-sticky__fill {
	height: 100%;
	width: 0;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--ance-c1), var(--ance-c2, var(--ance-c1)));
	transition: width 0.6s ease;
}
.ance-sticky__text {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.3em;
	padding: 0 12px;
	color: var(--ance-tx, var(--ance-fg));
	line-height: var(--ance-c-lh, 1);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ance-sticky__text strong { font-weight: bolder; }

/* Phones: full width bar at the bottom edge */
@media (max-width: 767px) {
	.ance-sticky,
	.ance-sticky[data-pos] {
		left: 0;
		right: 0;
		width: auto;
		max-width: none;
		translate: none;
		padding: 12px 16px;
		bottom: 0;
		/* default distance (20px) adds nothing on phones, a raised value (cookie banner) does */
		padding-bottom: calc(12px + max(0px, var(--ance-bottom, 20px) - 20px) + env(safe-area-inset-bottom, 0px));
	}
	.ance-sticky.has-panel-bg { border-radius: 16px 16px 0 0; }
	.ance-sticky a.ance-sticky__btn { padding: 14px 24px; }
}

@media (prefers-reduced-motion: reduce) {
	.ance-sticky,
	.ance-sticky.is-on,
	.ance-sticky__fill,
	.ance-sticky__bar,
	.ance-sticky a.ance-sticky__btn { transition: none; }
}
@media print { .ance-sticky { display: none; } }
