/**
 * استایل‌های فرانت‌اند زمینه‌آرا.
 * موتورهای پس‌زمینه با متغیرهای --z1 / --z2 / --z-speed رنگ و سرعت می‌گیرند.
 */

/* ===== ظرف پایه‌ی پس‌زمینه ===== */
#zaminara-bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
	background: #0f172a;
}
body.zaminara-active > .zaminara-content-layer {
	position: relative;
	z-index: 1;
}
#zaminara-bg .zaminara-overlay {
	position: absolute;
	inset: 0;
	background: var(--z-overlay-color, #000);
	opacity: calc(var(--z-overlay, 30) / 100);
}

/* ===== خوانایی محتوا روی پس‌زمینه‌ی متحرک ===== */

/*
 * پنل و سایه فقط روی ظرف متن مقاله (zaminara-readable-scope) اعمال می‌شوند
 * که جاوااسکریپت هوشمندانه پیدا می‌کند؛ هدر، منو و فوتر هرگز تغییری نمی‌کنند.
 */

/* حالت «سایه»: سبک‌ترین گزینه، فقط لبه‌ی متن را جدا می‌کند. */
body.zaminara-readable-shadow.zaminara-on-dark .zaminara-readable-scope {
	text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
body.zaminara-readable-shadow.zaminara-on-light .zaminara-readable-scope {
	text-shadow: 0 1px 3px rgba(255, 255, 255, .8);
}

/* حالت «پنل»: یک لایه‌ی نیمه‌شفاف پشت متن مقاله + رنگ متن هماهنگ. */
body.zaminara-readable-panel .zaminara-readable-scope {
	background-color: var(--z-panel, rgba(10, 12, 20, .72)) !important;
	border-radius: 14px;
	padding: clamp(12px, 2.5vw, 28px);
}
body.zaminara-readable-panel.zaminara-on-dark {
	--z-panel: rgba(10, 12, 20, .72);
	--z-ink: #f1f4f9;
	--z-link: #8fc7ff;
}
body.zaminara-readable-panel.zaminara-on-light {
	--z-panel: rgba(255, 255, 255, .78);
	--z-ink: #14161f;
	--z-link: #1f4fd8;
}
body.zaminara-readable-panel .zaminara-readable-scope
	:where(h1, h2, h3, h4, h5, h6, p, li, dd, dt, blockquote, figcaption, td, th, label, small, strong, em, address) {
	color: var(--z-ink) !important;
}
body.zaminara-readable-panel .zaminara-readable-scope
	a:not([class*="button"]):not([class*="btn"]):not(.wp-block-button__link) {
	color: var(--z-link) !important;
}
#zaminara-bg.is-hidden { display: none; }
.zaminara-modal-open { overflow: hidden; }
#zaminara-bg { transition: transform .18s ease-out; }
.zaminara-cursor-glow {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 99980;
	width: var(--za-glow-size, 220px);
	height: var(--za-glow-size, 220px);
	border-radius: 50%;
	background: radial-gradient(circle, rgba(99,102,241,.2), rgba(14,165,233,.08) 42%, transparent 70%);
	pointer-events: none;
	will-change: transform;
}
.zaminara-reveal-item {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity .55s ease var(--za-reveal-delay,0ms), transform .55s ease var(--za-reveal-delay,0ms);
}
.zaminara-reveal-item.is-visible { opacity:1;transform:none; }
.zaminara-page-hidden #zaminara-bg * { animation-play-state: paused !important; }

/* ===== موتور: تصویر ===== */
.zaminara-engine-image {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
.zaminara-engine-video,
.zaminara-engine-slideshow {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
}
.zaminara-engine-video video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.zaminara-slide {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	opacity: 0;
	transition: opacity 1.2s ease;
}
.zaminara-slide.is-active { opacity: 1; }

/* ===== موتور Canvas ===== */
.zaminara-engine-canvas {
	position: absolute;
	inset: 0;
	background: linear-gradient(160deg, var(--z1, #1e293b), var(--z2, #0f172a));
}
.zaminara-canvas {
	display: block;
	width: 100%;
	height: 100%;
}

/* ===== دکمه‌های شناور مشترک ===== */
.zaminara-fab {
	position: fixed;
	z-index: 99990;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	color: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
	transition: transform .2s, box-shadow .2s;
}
.zaminara-fab:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(0, 0, 0, .35); }
.zaminara-fab.pos-bottom-right { bottom: 24px; right: 24px; }
.zaminara-fab.pos-bottom-left  { bottom: 24px; left: 24px; }
.zaminara-fab.pos-top-right    { top: 24px; right: 24px; }
.zaminara-fab.pos-top-left     { top: 24px; left: 24px; }

.zaminara-fab-guide  { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.zaminara-fab-switch { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }

/* دکمه‌ی راهنما با تپش ملایم برای جلب توجه */
.zaminara-fab-guide { animation: zPulse 2.5s ease-in-out infinite; }
@keyframes zPulse {
	0%, 100% { box-shadow: 0 6px 20px rgba(99, 102, 241, .4); }
	50%      { box-shadow: 0 6px 30px rgba(99, 102, 241, .8); }
}

/* ===== پاپ‌آپ کوچک «راهنمایی می‌خواهید؟» ===== */
.zaminara-mini {
	position: fixed;
	z-index: 99991;
	background: #fff;
	border-radius: 14px;
	padding: 16px 18px;
	max-width: 260px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
	direction: rtl;
	font-size: 14px;
	animation: zPop .25s ease;
}
.zaminara-mini p { margin: 0 0 12px; color: #1f2937; line-height: 1.7; }
.zaminara-mini-actions { display: flex; gap: 8px; }
.zaminara-mini button {
	flex: 1;
	border: none;
	border-radius: 8px;
	padding: 8px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
}
.zaminara-mini .z-yes { background: #6366f1; color: #fff; }
.zaminara-mini .z-no  { background: #f1f5f9; color: #475569; }

@keyframes zPop {
	from { opacity: 0; transform: translateY(10px) scale(.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== مودال راهنما (پاپ‌آپ / تمام‌صفحه) ===== */
.zaminara-modal {
	position: fixed;
	inset: 0;
	z-index: 99992;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, .55);
	backdrop-filter: blur(4px);
	direction: rtl;
	animation: zFade .25s ease;
}
.zaminara-modal-box {
	background: #fff;
	border-radius: 18px;
	max-width: 560px;
	width: calc(100% - 40px);
	max-height: 82vh;
	overflow-y: auto;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
	animation: zZoom .3s ease;
}
.zaminara-modal.is-fullscreen .zaminara-modal-box {
	max-width: none;
	width: 100%;
	height: 100%;
	max-height: 100%;
	border-radius: 0;
}
.zaminara-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid #eef0f3;
	position: sticky;
	top: 0;
	background: #fff;
}
.zaminara-modal-header h3 { margin: 0; font-size: 18px; color: #111827; }
.zaminara-modal-close {
	background: #f1f5f9;
	border: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 18px;
	color: #475569;
}
.zaminara-modal-body { padding: 22px; color: #374151; line-height: 2; font-size: 15px; }
.zaminara-modal-body img { max-width: 100%; height: auto; border-radius: 10px; }
.zaminara-step-nav {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 12px;
	padding: 14px 22px 20px;
	border-top: 1px solid #eef0f3;
}
.zaminara-step-nav button { border:0;border-radius:9px;padding:10px 14px;cursor:pointer;background:#e0e7ff;color:#3730a3;font-weight:600; }
.zaminara-step-nav .z-step-next { justify-self:end;background:#4f46e5;color:#fff; }
.zaminara-step-nav button:disabled { opacity:.45;cursor:not-allowed; }
.zaminara-step-nav span { color:#64748b;font-size:13px;white-space:nowrap; }

/* راهنمای متمرکز روی یک عنصر صفحه */
.zaminara-spotlight-frame {
	position: fixed;
	z-index: 99994;
	border: 3px solid #818cf8;
	border-radius: 12px;
	box-shadow: 0 0 0 9999px rgba(15, 23, 42, .72), 0 0 28px rgba(129, 140, 248, .95);
	pointer-events: none;
	animation: zaminaraSpotlightPulse 1.4s ease-in-out infinite;
	transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
}
.zaminara-spotlight-pointer {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 99996;
	font-size: 38px;
	filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .4));
	pointer-events: none;
	transition: left .75s cubic-bezier(.2,.8,.2,1), top .75s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.2,.8,.2,1);
}
.zaminara-spotlight-pointer.is-pointing {
	left: var(--spot-x);
	top: var(--spot-y);
	bottom: auto;
	transform: translate(-45%, -20%) rotate(-18deg);
}
.zaminara-spotlight-message {
	position: fixed;
	z-index: 99997;
	width: min(320px, calc(100vw - 24px));
	padding: 14px;
	background: #fff;
	color: #1f2937;
	border-radius: 12px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
	direction: rtl;
	text-align: right;
}
.zaminara-spotlight-message p { margin: 0 0 12px; line-height: 1.8; }
.zaminara-spotlight-message button { border:0;border-radius:8px;padding:8px 14px;background:#4f46e5;color:#fff;cursor:pointer;font-weight:600; }
@keyframes zaminaraSpotlightPulse {
	0%, 100% { border-color: #818cf8; }
	50% { border-color: #c7d2fe; }
}

@keyframes zFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes zZoom { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ===== پنل انتخاب هنگام بستن راهنما ===== */
.zaminara-choice { text-align: center; padding: 26px 22px; }
.zaminara-choice p { margin: 0 0 18px; font-size: 15px; color: #1f2937; }
.zaminara-choice button {
	display: block;
	width: 100%;
	margin: 8px 0;
	padding: 12px;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
}
.zaminara-choice .z-close-this { background: #e0e7ff; color: #3730a3; }
.zaminara-choice .z-close-all  { background: #fee2e2; color: #991b1b; }

/* ===== منوی کوچک تغییر/خاموش پس‌زمینه ===== */
.zaminara-switch-menu {
	position: fixed;
	z-index: 99991;
	background: #fff;
	border-radius: 14px;
	padding: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
	direction: rtl;
	min-width: 200px;
	animation: zPop .2s ease;
}
.zaminara-switch-menu button {
	display: block;
	width: 100%;
	text-align: right;
	background: none;
	border: none;
	padding: 10px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	color: #374151;
}
.zaminara-switch-menu button:hover { background: #f1f5f9; }

/* دسترس‌پذیری: احترام به کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
	.zaminara-spotlight-frame,
	.zaminara-fab-guide { animation: none !important; }
	.zaminara-spotlight-pointer,
	.zaminara-spotlight-frame { transition: none !important; }
}
