/* --------------------------------------------------
   ساخت مرحله‌به‌مرحله‌ی اتاق
   -------------------------------------------------- */

/* ═══ تنظیمات ═══ */
.trw-rb {
	--rb-ratio: 3 / 2;   /* نسبت تصویر */
	--rb-radius: 28px;   /* گردی قاب */
	--rb-dot: 12px;   /* اندازه‌ی نقطه‌ی هر مرحله */
	--rb-p: 0;   /* پیشرفت نوار مراحل؛ اسکریپت از ۰ تا ۱ می‌برد */
	--rb-title: clamp(1.6rem, 2.6vw, 2.4rem);   /* اندازه‌ی عنوان مرحله */
	display: grid;
	grid-template-columns: minmax(0, 38fr) minmax(0, 62fr);
	grid-template-areas: "panel stage";
	align-items: center;
	gap: clamp(28px, 4vw, 64px);
	color: var(--trw-text);
}

/* ─── قاب تصویر ─── */
.trw-rb-stage {
	grid-area: stage;
	position: relative;
	padding: 10px;
	border: 1px solid var(--trw-line);
	border-radius: calc(var(--rb-radius) + 10px);
	background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .01));
	box-shadow: 0 40px 100px -50px rgba(146, 61, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
	touch-action: pan-y;
}

/* لبه‌ی نورانی قاب */
.trw-rb-stage::before {
	content: "";
	position: absolute;
	inset: -1px;
	border-radius: inherit;
	padding: 1px;
	background: linear-gradient(130deg, rgba(193, 138, 255, .6), transparent 35%, transparent 65%, rgba(216, 59, 255, .45));
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
}

.trw-rb-frame {
	position: relative;
	aspect-ratio: var(--rb-ratio);
	overflow: hidden;
	border-radius: var(--rb-radius);
	background: var(--trw-section2);
	isolation: isolate;
}

.trw-rb-shot {
	position: absolute;
	inset: 0;
	z-index: 1;
	margin: 0;
	visibility: hidden;
}

.trw-rb-shot.is-on {
	z-index: 2;
	visibility: visible;
}

/* دو کلاس، تا قانون «.elementor img { height: auto }» ارتفاع تصویر را کوتاه نکند */
.trw-rb .trw-rb-img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	max-inline-size: none;
	object-fit: cover;
}

/* پرده‌ی نور: لبه‌ی آشکار شدن تصویر تازه */
.trw-rb-beam {
	position: absolute;
	inset-block: 0;
	left: 100%;
	z-index: 4;
	inline-size: 2px;
	background: linear-gradient(to bottom, transparent, var(--trw-lighter-primary) 20%, var(--trw-white) 50%, var(--trw-lighter-primary) 80%, transparent);
	box-shadow: 0 0 18px 4px var(--trw-glow), 0 0 60px 10px rgba(146, 61, 255, .45);
	opacity: 0;
	pointer-events: none;
}

/* سایه‌ی پایین برای شمارنده */
.trw-rb-shade {
	position: absolute;
	inset: 0;
	z-index: 3;
	background: linear-gradient(to top, rgba(8, 11, 27, .65), transparent 38%);
	pointer-events: none;
}

/* شمارنده‌ی مرحله روی تصویر */
.trw-rb-count {
	position: absolute;
	inset-inline-end: 22px;
	inset-block-end: 16px;
	z-index: 5;
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 0;
	font-family: var(--trw-head-font);
	color: var(--trw-white);
	pointer-events: none;
}

.trw-rb-count b {
	font-size: clamp(2rem, 3.4vw, 3rem);
	font-weight: 900;
	line-height: 1;
	background: linear-gradient(to bottom, var(--trw-white) 20%, var(--trw-light-primary));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.trw-rb-count span {
	font-size: .95rem;
	font-weight: 700;
	color: rgba(255, 255, 255, .55);
}

/* ─── ستون متن ─── */
.trw-rb-panel {
	grid-area: panel;
	display: flex;
	flex-direction: column;
	gap: 32px;
	min-inline-size: 0;
}

/* متن مراحل روی هم؛ ارتفاع ستون به بلندترین متن می‌رسد تا دکمه‌ها جابه‌جا نشوند */
.trw-rb-copies {
	display: grid;
}

.trw-rb-copy {
	grid-area: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 18px;
}

.trw-rb-copy[hidden] {
	display: flex;
	visibility: hidden;
}

.trw-rb-title {
	margin: 0;
	font-family: var(--trw-head-font);
	font-size: var(--rb-title);
	font-weight: 900;
	line-height: 1.35;
	color: var(--trw-white);
	text-wrap: balance;
}

.trw-rb-text {
	margin: 0;
	font-family: var(--trw-body-font);
	font-size: 1rem;
	line-height: 2;
	color: var(--trw-light-text);
}

/* ─── نوار مراحل: خط دقیقاً از وسط نقطه‌ها می‌گذرد ─── */
.trw-rb-steps {
	position: relative;
	display: grid;
	grid-template-columns: repeat(var(--rb-n), minmax(0, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

.trw-rb-steps::before,
.trw-rb-steps::after {
	content: "";
	position: absolute;
	inset-block-start: calc(var(--rb-dot) / 2 - .5px);
	inset-inline-start: calc(var(--rb-dot) / 2);
	inset-inline-end: calc(100% / var(--rb-n) - var(--rb-dot) / 2);
	block-size: 1px;
	background: rgba(255, 255, 255, .14);
	pointer-events: none;
}

.trw-rb-steps::after {
	background: var(--trw-grad);
	box-shadow: 0 0 12px var(--trw-glow);
	transform-origin: right;
	transform: scaleX(var(--rb-p));
	transition: transform .8s var(--trw-ease);
}

.trw-rb-steps li {
	position: relative;
	z-index: 1;
	min-inline-size: 0;
}

.trw-rb-step {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	inline-size: 100%;
	margin: 0;
	padding: 0 0 4px;
	border: 0;
	background: none;
	cursor: pointer;
	font-family: var(--trw-body-font);
	font-size: .8125rem;
	font-weight: 600;
	line-height: 1.5;
	text-align: start;
	color: rgba(255, 255, 255, .45);
	transition: color .4s ease;
}

/* برچسب در ستون خودش می‌شکند؛ در ستون flex، اندازه‌ی محتوا می‌گرفت و روی برچسب کناری می‌افتاد */
.trw-rb-step span {
	display: block;
	max-inline-size: 100%;
	padding-inline-end: 10px;
	overflow-wrap: anywhere;
}

.trw-rb-step i {
	flex: none;
	inline-size: var(--rb-dot);
	block-size: var(--rb-dot);
	border: 2px solid rgba(255, 255, 255, .3);
	border-radius: 50%;
	background: var(--trw-section1);
	transition: background-color .4s ease, border-color .4s ease, box-shadow .4s ease, transform .4s var(--trw-ease);
}

.trw-rb-step:hover,
.trw-rb-step:focus-visible {
	color: rgba(255, 255, 255, .85);
}

.trw-rb-step:focus-visible {
	outline: 2px solid var(--trw-lighter-primary);
	outline-offset: 4px;
	border-radius: 6px;
}

.trw-rb-step.is-on {
	color: rgba(255, 255, 255, .8);
}

.trw-rb-step.is-on i {
	border-color: var(--trw-white);
	background: var(--trw-secondary);
	box-shadow: 0 0 0 5px var(--trw-glow-soft), 0 0 18px var(--trw-glow);
}

.trw-rb-step.is-now {
	color: var(--trw-white);
}

.trw-rb-step.is-now i {
	transform: scale(1.25);
}

/* ─── دکمه‌ها ─── */
.trw-rb-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 18px;
}

.trw-rb-prev {
	display: grid;
	place-items: center;
	inline-size: 50px;
	block-size: 50px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .18);
	border-radius: 50%;
	background: rgba(255, 255, 255, .05);
	color: var(--trw-white);
	cursor: pointer;
	transition: background-color .4s ease, border-color .4s ease, opacity .3s ease, transform .4s var(--trw-ease);
}

.trw-rb-prev svg {
	inline-size: 20px;
	block-size: 20px;
}

.trw-rb-prev:hover:not(:disabled),
.trw-rb-prev:focus-visible {
	border-color: var(--trw-light-primary);
	background: rgba(146, 61, 255, .2);
	transform: translateX(3px);
}

.trw-rb-prev:focus-visible {
	outline: 2px solid var(--trw-lighter-primary);
	outline-offset: 3px;
}

.trw-rb-prev:disabled {
	opacity: .35;
	cursor: default;
}

.trw-rb-next {
	border: 0;
	cursor: pointer;
}

/* دکمه‌ی پایانی فقط در مرحله‌ی آخر */
.trw-rb-cta {
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .4s ease, visibility .4s, transform .5s var(--trw-ease);
}

.trw-rb.is-last .trw-rb-cta {
	opacity: 1;
	visibility: visible;
	transform: none;
}

/* بدون GSAP: جابه‌جایی ساده با محو شدن */
.trw-rb.is-plain .trw-rb-shot {
	transition: opacity .6s ease, visibility .6s;
	opacity: 0;
}

.trw-rb.is-plain .trw-rb-shot.is-on {
	opacity: 1;
}

/* ─── تبلت و موبایل: تصویر بالا، متن و دکمه‌ها زیرش ─── */
@media (max-width: 1024px) {
	.trw-rb {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "stage" "panel";
		gap: 28px;
	}
}

@media (max-width: 767px) {
	.trw-rb {
		--rb-radius: 20px;
		--rb-title: 1.5rem;
		gap: 22px;
	}

	.trw-rb-stage {
		padding: 6px;
		border-radius: calc(var(--rb-radius) + 6px);
	}

	.trw-rb-panel {
		gap: 24px;
	}

	/* در موبایل نام مراحل زیر نقطه‌ها نمی‌آید؛ برچسب بالای عنوان، مرحله‌ی فعلی را می‌گوید */
	.trw-rb-step span {
		display: none;
	}

	.trw-rb-nav .trw-rb-next {
		flex: 1;
		justify-content: center;
	}

	.trw-rb-cta {
		flex-basis: 100%;
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.trw-rb-steps::after,
	.trw-rb-step,
	.trw-rb-step i,
	.trw-rb-prev,
	.trw-rb-cta {
		transition: none;
	}
}
