/* --------------------------------------------------
   هیروی فیلم
   -------------------------------------------------- */

/* ═══ تنظیمات ═══ */
.trw-hf {
	--hf-height: 100svh;   /* ارتفاع صحنه */
	--hf-shade: .9;   /* تیرگی پایین فیلم برای خوانایی تیتر */
	--hf-title: clamp(2.6rem, 6.2vw, 5.75rem);   /* اندازه‌ی تیتر */
	--hf-beat: clamp(1.25rem, 2.4vw, 2.25rem);   /* اندازه‌ی جمله‌های میانی */
	--hf-gap: max(20px, calc((100% - 1280px) / 2));   /* فاصله‌ی متن از لبه‌ها */
	--hf-fog: 16px;   /* غلظت مه روی تیتر پیش از آشکار شدن */
	position: relative;
	block-size: 100vh;
	block-size: var(--hf-height);
	min-block-size: 560px;
	overflow: hidden;
	isolation: isolate;
	background: var(--trw-section1);
	color: var(--trw-text);
}

/* ویجت پین می‌شود؛ transition پیش‌فرض المنتور نباید جابه‌جایی پین را نشان دهد */
.elementor-widget-trw-hero-film,
.pin-spacer > .elementor-widget-trw-hero-film {
	transition: none !important;
}

/* ─── فیلم ─── */
.trw-hf-film,
.trw-hf-poster,
.trw-hf-still,
.trw-hf-video,
.trw-hf-shade,
.trw-hf-grain {
	position: absolute;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
}

.trw-hf-film {
	z-index: -1;
	overflow: hidden;
	transform-origin: 50% 45%;
}

.trw-hf-poster img,
.trw-hf-still img,
.trw-hf-video {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

/* ویدیو وقتی کامل رسید، نرم جای فریم اول را می‌گیرد */
.trw-hf-video {
	opacity: 0;
	transition: opacity .8s ease;
}

.trw-hf.is-ready .trw-hf-video {
	opacity: 1;
}

/* فریم پایانی فقط در حالت ثابت */
.trw-hf-still {
	display: none;
}

/* نور و سایه روی فیلم: بالا برای هدر، پایین برای تیتر */
.trw-hf-shade {
	background:
		linear-gradient(to bottom, rgba(8, 11, 27, .7), transparent 26%),
		linear-gradient(to top, var(--trw-section1) 0%, rgba(12, 16, 38, var(--hf-shade)) 14%, rgba(12, 16, 38, calc(var(--hf-shade) * .45)) 38%, transparent 62%),
		radial-gradient(70% 60% at 50% 45%, transparent 55%, rgba(8, 11, 27, .55));
	pointer-events: none;
}

/* دانه‌ی ریز فیلم؛ حس سینما و پنهان کردن فشرده‌سازی ویدیو */
.trw-hf-grain {
	opacity: .07;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	mix-blend-mode: overlay;
	pointer-events: none;
}

/* ─── جمله‌های رازآلود میان فیلم: وسط صحنه، کوچک و آرام ─── */
.trw-hf-beats {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: end center;
	padding: 0 24px 19vh;
	pointer-events: none;
}

.trw-hf-beat {
	grid-area: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	max-inline-size: 640px;
	margin: 0;
	text-align: center;
	opacity: 0;
	visibility: hidden;
}

.trw-hf-beat-en {
	direction: ltr;
	font-family: var(--trw-body-font);
	font-size: .7rem;
	font-weight: 600;
	letter-spacing: .42em;
	text-transform: lowercase;
	color: var(--trw-light-primary);
}

.trw-hf-beat-fa {
	font-family: var(--trw-head-font);
	font-size: var(--hf-beat);
	font-weight: 800;
	line-height: 1.6;
	color: var(--trw-white);
	text-wrap: balance;
	text-shadow: 0 6px 30px rgba(8, 11, 27, .9);
}

/* ─── متن پایانی ─── */
.trw-hf-copy {
	position: absolute;
	inset-inline-start: var(--hf-gap);
	inset-block-end: clamp(48px, 9vh, 96px);
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 20px;
	max-inline-size: min(780px, calc(100% - 40px));
}

.trw-hf-title {
	margin: 0;
	font-family: var(--trw-head-font);
	font-size: var(--hf-title);
	font-weight: 900;
	line-height: 1.18;
	color: var(--trw-white);
	text-wrap: balance;
	text-shadow: 0 10px 40px rgba(8, 11, 27, .7);
}

/* خط کوچک بالای تیتر (داخل h1، برای کلمه‌ی کلیدی) */
.trw-hf-title .trw-pre {
	display: block;
	margin-block-end: .45em;
	font-family: var(--trw-body-font);
	font-size: max(.95rem, .24em);
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: 0;
	color: var(--trw-lighter-primary);
	text-shadow: none;
}

/* واژه‌های تیتر؛ اسکریپت هر واژه را جدا می‌کند تا یکی‌یکی از مه بیرون بیایند */
.trw-hf-title .trw-w {
	display: inline-block;
	will-change: filter, opacity, transform;
}

.trw-hf-text {
	max-inline-size: 560px;
	margin: 0;
	font-family: var(--trw-body-font);
	font-size: 1.125rem;
	line-height: 1.9;
	color: var(--trw-text);
	text-shadow: 0 4px 24px rgba(8, 11, 27, .8);
}

.trw-hf-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-block-start: 4px;
}

/* پیش از رسیدن اسکریپت، متن پایانی پنهان است تا رازآلودی از همان اول حفظ شود؛
   اگر اسکریپت نرسید، کلاس is-film برداشته و همه‌چیز نمایان می‌شود */
.trw-hf.is-film .trw-hf-kicker,
.trw-hf.is-film .trw-hf-text,
.trw-hf.is-film .trw-hf-actions {
	opacity: 0;
	visibility: hidden;
	animation: trw-hf-unfog .6s ease 8s forwards;
}

.trw-hf.is-film .trw-hf-title {
	opacity: .1;
	filter: blur(var(--hf-fog));
	animation: trw-hf-unfog .6s ease 8s forwards;
}

/* اگر اسکریپت هیچ‌وقت اجرا نشد، بعد از ۸ ثانیه متن خودش نمایان می‌شود */
@keyframes trw-hf-unfog {
	to {
		opacity: 1;
		visibility: visible;
		filter: none;
	}
}

/* خط کوچک بالای تیتر هنگام جدا شدن واژه‌ها هم بلوک می‌ماند */
.trw-hf-title .trw-pre.trw-w {
	display: block;
}

/* ─── راهنمای اسکرول ─── */
.trw-hf-cue {
	position: absolute;
	inset-block-end: 26px;
	left: 50%;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin: 0;
	transform: translateX(-50%);
	font-family: var(--trw-body-font);
	font-size: .75rem;
	color: rgba(255, 255, 255, .6);
}

.trw-hf-cue i {
	position: relative;
	inline-size: 1px;
	block-size: 42px;
	overflow: hidden;
	background: rgba(255, 255, 255, .16);
}

.trw-hf-cue i::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	top: -40%;
	block-size: 40%;
	background: var(--trw-grad);
	animation: trw-hf-cue 2.2s var(--trw-ease) infinite;
}

@keyframes trw-hf-cue {
	to {
		top: 100%;
	}
}

/* نوار باریک پیشرفت فیلم، پایین صحنه */
.trw-hf-progress {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	z-index: 2;
	block-size: 2px;
	background: rgba(255, 255, 255, .06);
}

.trw-hf-progress i {
	position: absolute;
	inset: 0;
	background: var(--trw-grad);
	box-shadow: 0 0 12px var(--trw-glow);
	transform-origin: right;
	transform: scaleX(0);
}

/* ─── حالت ثابت: فریم پایانی، همه‌ی متن‌ها، بدون ویدیو و جمله‌های میانی ─── */
.trw-hf.is-still .trw-hf-still {
	display: block;
}

.trw-hf.is-still .trw-hf-video,
.trw-hf.is-still .trw-hf-beats,
.trw-hf.is-still .trw-hf-cue,
.trw-hf.is-still .trw-hf-progress {
	display: none;
}

.trw-hf.is-still .trw-hf-title,
.trw-hf.is-still .trw-hf-kicker,
.trw-hf.is-still .trw-hf-text,
.trw-hf.is-still .trw-hf-actions {
	opacity: 1;
	visibility: visible;
	filter: none;
}

/* ─── تبلت ─── */
@media (max-width: 1024px) {
	.trw-hf {
		--hf-gap: 20px;
	}
}

/* ─── موبایل: صحنه همچنان تمام‌صفحه؛ متن پایین، دکمه‌ها تمام‌عرض ─── */
@media (max-width: 767px) {
	.trw-hf {
		--hf-gap: 15px;
		--hf-title: clamp(2.3rem, 10.5vw, 3rem);
		--hf-beat: 1.25rem;
		min-block-size: 520px;
	}

	.trw-hf-copy {
		inset-block-end: 40px;
		gap: 16px;
		max-inline-size: calc(100% - 30px);
	}

	.trw-hf-text {
		font-size: 1rem;
		line-height: 1.85;
	}

	.trw-hf-actions {
		flex-direction: column;
		align-items: stretch;
		inline-size: 100%;
	}

	.trw-hf-actions .trw-btn {
		justify-content: center;
	}

	.trw-hf-cue {
		inset-block-end: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.trw-hf-cue i::after {
		animation: none;
	}

	.trw-hf-video {
		transition: none;
	}
}
