/* ------------------------------------------------------------------
   Всплывающее сообщение «Есть вопросы? Закажите звонок».
   Разметка — theme-functions/popup-arefino.php, поведение —
   assets/arefino-popup.js. Окно висит в правом нижнем углу на всех
   страницах и не перекрывает модалку формы (её z-index выше).
   ------------------------------------------------------------------ */

.arefino-popup {
	position: fixed;
	right: 24px;
	/* Выше кнопки «наверх» (она висит в правом нижнем углу темы). */
	bottom: 92px;
	z-index: 99990;
	transform: translateY(24px);
	opacity: 0;
	visibility: hidden;
	transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
	pointer-events: none;
}

/* Классы ставит скрипт: сначала is-ready (окно в документе), потом is-open. */
.arefino-popup.is-ready {
	visibility: visible;
	transition-delay: 0s;
}

.arefino-popup.is-open {
	transform: translateY(0);
	opacity: 1;
	pointer-events: auto;
}

/* Карточка сжимается по длине текста (max-content), а не занимает
   фиксированные 268px: в ней всего две короткие строки и трубка. */
.arefino-popup__card {
	position: relative;
	width: max-content;
	max-width: min(230px, calc(100vw - 48px));
	padding: 15px 16px 14px;
	background: #fff;
	border: 1px solid #eeedee;
	border-radius: 15px;
	box-shadow: 0 14px 36px rgba(24, 24, 24, .16);
	color: #181818;
	font-family: var(--wf-base-family, "Onest", -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
	text-align: left;
}

/* Треугольник-«хвостик» сообщения вниз, к трубке под фразой. */
.arefino-popup__card::after {
	content: "";
	position: absolute;
	left: 36px;
	bottom: -8px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-right: 1px solid #eeedee;
	border-bottom: 1px solid #eeedee;
	transform: rotate(45deg);
	border-bottom-right-radius: 3px;
}

.arefino-popup__close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 22px;
	height: 22px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: #a9a2a0;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}

.arefino-popup__close:hover,
.arefino-popup__close:focus-visible {
	background: #f4f4f4;
	color: #181818;
}

.arefino-popup__title {
	margin: 0 0 2px;
	padding-right: 20px;
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.25;
	color: #181818;
}

.arefino-popup__subtitle {
	margin: 0 0 12px;
	font-size: 12.5px;
	line-height: 1.35;
	color: #615454;
}

/* --------------------------- трубка --------------------------- */

.arefino-popup__call {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ff8562;
	color: #181818;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(255, 133, 98, .45);
	transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.arefino-popup__call:hover,
.arefino-popup__call:focus-visible {
	background: #e0663f;
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(224, 102, 63, .5);
	outline: none;
}

.arefino-popup__call:focus-visible {
	box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(224, 102, 63, .55);
}

.arefino-popup__call:active {
	transform: translateY(0) scale(.97);
}

.arefino-popup__icon {
	position: relative;
	z-index: 1;
	display: block;
	width: 22px;
	height: 22px;
	animation: arefino-popup-ring 2.6s ease-in-out infinite;
}

/* Мягкие круги, расходящиеся от трубки. */
.arefino-popup__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #ff8562;
	animation: arefino-popup-pulse 2.6s ease-out infinite;
}

@keyframes arefino-popup-ring {
	0%, 72%, 100% { transform: rotate(0deg); }
	76% { transform: rotate(-14deg); }
	80% { transform: rotate(12deg); }
	84% { transform: rotate(-9deg); }
	88% { transform: rotate(6deg); }
	92% { transform: rotate(0deg); }
}

@keyframes arefino-popup-pulse {
	0% { transform: scale(1); opacity: .55; }
	70% { transform: scale(1.6); opacity: 0; }
	100% { transform: scale(1.6); opacity: 0; }
}

/* --------------------------- состояния --------------------------- */

/* Пока открыта форма заявки — сообщение уезжает, чтобы не мешать. */
.arefino-popup.is-muted {
	transform: translateY(12px);
	opacity: 0;
	pointer-events: none;
}

/* --------------------------- мобильная версия --------------------------- */

@media (max-width: 767px) {
	.arefino-popup {
		right: 12px;
		left: auto;
		/* над нижним мобильным меню (max-height 60px) и кнопкой «наверх» */
		bottom: 118px;
	}

	.arefino-popup__card {
		width: max-content;
		max-width: calc(100vw - 24px);
		margin-left: auto;
		padding: 13px 14px 12px;
	}

	.arefino-popup__call {
		width: 42px;
		height: 42px;
	}
}

/* --------------------------- доступность --------------------------- */

@media (prefers-reduced-motion: reduce) {
	.arefino-popup,
	.arefino-popup__call,
	.arefino-popup__close {
		transition: none;
	}

	.arefino-popup__icon,
	.arefino-popup__pulse {
		animation: none;
	}

	.arefino-popup__pulse {
		opacity: 0;
	}
}

.arefino-popup *,
.arefino-popup *::before,
.arefino-popup *::after {
	box-sizing: border-box;
}
