/**
 * استایل پاپ‌آپ کمپین.
 * متغیرهای --cpop-* از تنظیمات افزونه به‌صورت inline تزریق می‌شوند.
 */

.cpop {
	--cpop-width: 600px;
	--cpop-radius: 8px;
	--cpop-overlay: 0.65;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
}

.cpop.is-open {
	display: flex;
}

.cpop[hidden] {
	display: none;
}

/* کادر با اسکریپت فوکوس می‌گیرد؛ حلقه‌ی فوکوس روی آن لازم نیست. */
.cpop:focus,
.cpop:focus-visible {
	outline: none;
}

.cpop__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, var(--cpop-overlay));
}

.cpop__box {
	position: relative;
	width: var(--cpop-width);
	max-width: 92%;
	animation: cpop-in 0.28s ease-out;
}

@keyframes cpop-in {
	from {
		transform: translateY(24px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.cpop__link {
	display: block;
	line-height: 0;
	text-decoration: none;
	box-shadow: none;
}

.cpop__img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: var(--cpop-radius);
}

.cpop__img--mobile {
	display: none;
}

.cpop__close {
	position: absolute;
	top: -52px;
	left: 0;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.cpop__close:hover,
.cpop__close:focus-visible {
	background: rgba(0, 0, 0, 0.85);
}

/* کادر گفتگو فقط برای صفحه‌خوان‌ها فوکوس می‌گیرد؛ حلقه‌ی فوکوس لازم ندارد. */

/* حلقه‌ی فوکوس فقط هنگام ناوبری واقعی با کیبورد. */
.cpop__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* روی موبایل: از پایین بالا می‌آید و در صورت وجود، تصویر عمودی نمایش داده می‌شود. */
@media (max-width: 640px) {
	.cpop {
		align-items: flex-end;
	}

	.cpop__box {
		margin-bottom: 16px;
	}

	.cpop--has-mobile .cpop__img--desktop {
		display: none;
	}

	.cpop--has-mobile .cpop__img--mobile {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpop__box {
		animation: none;
	}
}
