/* ویجت استوری — سه استایلِ ردیف + مودال. بدونِ وابستگی. */

.sf-story {
	position: relative;
	margin-block: 16px;
}

.sf-story__rail {
	display: flex;
	gap: 14px;
	list-style: none;
	margin: 0;
	padding: 2px 0 6px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.sf-story__rail::-webkit-scrollbar {
	display: none;
}

.sf-story__item {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.sf-story__open {
	display: block;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	text-align: center;
	font: inherit;
	color: inherit;
	line-height: 1.3;
}

/* بدونِ نشانگرِ فوکوسِ دیداری (تصمیمِ محصول). فوکوس همچنان برمی‌گردد
   تا جای کاربر در صفحه گم نشود، فقط کادری دیده نمی‌شود. */
.sf-story__open:focus,
.sf-story__open:focus-visible {
	outline: none;
}

.sf-story__label {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	color: var(--sf-story-label);
	white-space: var(--sf-story-clamp, nowrap);
	overflow: hidden;
	text-overflow: ellipsis;
}

/* uncropped_titles در پنل به‌ازای هر استوری تنظیم می‌شود */
.sf-story__item--wrap .sf-story__label {
	white-space: normal;
}

/* ---------- استایل دایره ---------- */

.sf-story--circle .sf-story__ring {
	position: relative;
	display: block;
	width: 90px;
	height: 90px;
	border-radius: 50%;
	padding: 3px;
	box-sizing: border-box;
}

.sf-story--circle .sf-story__ring::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	padding: 3px;
	background: linear-gradient(45deg, var(--sf-story-ring-1) 25%, var(--sf-story-ring-2) 100%);
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
}

.sf-story--circle .sf-story__ring img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

.sf-story--circle .sf-story__label {
	width: 90px;
}

/* مرورگرِ بدونِ mask-composite: حلقه با border ساده */
@supports not (mask-composite: exclude) {
	.sf-story--circle .sf-story__ring::before {
		display: none;
	}
	.sf-story--circle .sf-story__ring {
		border: 3px solid var(--sf-story-ring-1);
	}
}

/* ---------- استایل کارت ---------- */

.sf-story--card .sf-story__open {
	position: relative;
}

.sf-story--card .sf-story__ring {
	position: relative;
	display: block;
	width: 118px;
	height: 190px;
	border-radius: var(--sf-story-radius, 12px);
	overflow: hidden;
}

.sf-story--card .sf-story__ring img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sf-story--card .sf-story__ring::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(0deg, rgba(0, 0, 0, .6), transparent 55%);
}

.sf-story--card .sf-story__ring::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
	border: 2px solid var(--sf-story-ring-1);
	pointer-events: none;
}

.sf-story--card .sf-story__label {
	position: absolute;
	inset-inline: 10px;
	bottom: 10px;
	margin: 0;
	z-index: 2;
	color: #fff;
	font-size: 13px;
	text-align: start;
}

/* ---------- استایل نوار ---------- */

.sf-story--strip .sf-story__rail {
	gap: 10px;
}

.sf-story--strip .sf-story__open {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px;
	padding-inline-end: 16px;
	border-radius: 999px;
	border: 1px solid var(--sf-story-ring-1);
	background: #fff;
}

.sf-story--strip .sf-story__ring {
	position: relative;
	flex: 0 0 auto;
	display: block;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	overflow: hidden;
}

.sf-story--strip .sf-story__ring img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sf-story--strip .sf-story__label {
	margin: 0;
	font-size: 14px;
	max-width: 130px;
}

/* ---------- فلش‌ها ---------- */

.sf-story__nav {
	position: absolute;
	top: 30px;
	z-index: 2;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #333;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
	cursor: pointer;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	line-height: 1;
}

.sf-story__nav--prev { inset-inline-start: -8px; }
.sf-story__nav--next { inset-inline-end: -8px; }

.sf-story__nav:disabled {
	opacity: .35;
	cursor: default;
}

@media (min-width: 992px) {
	.sf-story__nav:not([hidden]) {
		display: flex;
	}
}

/* ---------- حالت دیده‌شده ---------- */

.sf-story__item.is-seen .sf-story__ring::before {
	background: #c9c9c9;
	border-color: #c9c9c9;
}

.sf-story--strip .sf-story__item.is-seen .sf-story__open {
	border-color: #c9c9c9;
}

.sf-story.is-init .sf-story__ring::before {
	transition: background .25s ease;
}

/* ---------- موبایل ---------- */

@media (max-width: 767px) {
	.sf-story__rail {
		margin-inline: -15px;
		padding-inline: 15px;
		scroll-padding-inline-start: 15px;
		gap: 10px;
	}
	.sf-story--circle .sf-story__ring {
		width: 75px;
		height: 75px;
	}
	.sf-story--circle .sf-story__label {
		width: 75px;
		font-size: 12px;
	}
	.sf-story--card .sf-story__ring {
		width: 96px;
		height: 156px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sf-story *,
	.sf-story__rail {
		transition: none !important;
		scroll-behavior: auto !important;
	}
}

/* ================= مودال ================= */

.sf-story-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--sf-story-modal-bg, #111);
	touch-action: none;
	user-select: none;
}

.sf-story-modal[hidden] {
	display: none;
}

.sf-story-modal__stage {
	position: relative;
	width: 100%;
	max-width: 430px;
	height: 100%;
	max-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

@media (min-width: 576px) {
	.sf-story-modal__stage {
		height: 92vh;
		border-radius: 12px;
	}
}

.sf-story-modal__media {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sf-story-modal__media img,
.sf-story-modal__media video {
	max-width: 100%;
	max-height: 100%;
	display: block;
}

.sf-story-modal.is-fullsize .sf-story-modal__media img,
.sf-story-modal.is-fullsize .sf-story-modal__media video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* نوار پیشرفت */

.sf-story-modal__bars {
	position: absolute;
	top: 10px;
	inset-inline: 10px;
	z-index: 3;
	display: flex;
	gap: 4px;
}

.sf-story-modal__bars span {
	flex: 1 1 0;
	height: 3px;
	border-radius: 3px;
	background: rgba(255, 255, 255, .35);
	overflow: hidden;
}

/* transform-origin کلیدواژهٔ منطقی نمی‌پذیرد، پس جهت را دستی آینه می‌کنیم */
.sf-story-modal__bars i {
	display: block;
	height: 100%;
	width: 100%;
	background: #fff;
	transform: scaleX(0);
	transform-origin: left center;
	animation-name: sfStoryBar;
	animation-timing-function: linear;
	animation-fill-mode: forwards;
	animation-play-state: paused;
}

html[dir=rtl] .sf-story-modal__bars i {
	transform-origin: right center;
}

@keyframes sfStoryBar {
	to { transform: scaleX(1); }
}

/* هدر */

.sf-story-modal__head {
	position: absolute;
	top: 22px;
	inset-inline: 10px;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 8px;
	color: #fff;
}

.sf-story-modal__title {
	flex: 1 1 auto;
	font-size: 14px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sf-story-modal__head button {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .35);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.sf-story-modal__head button:focus {
	outline: none;
}

.sf-story-modal__head button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sf-story-modal__cta:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sf-story-modal__mute {
	display: none;
}

.sf-story-modal.has-audio .sf-story-modal__mute {
	display: block;
}

.sf-story-modal.is-muted .sf-story-modal__mute {
	opacity: .5;
}

/* دکمهٔ اقدام */

.sf-story-modal__cta {
	position: absolute;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 4;
	background: var(--sf-story-cta-bg, #000);
	color: var(--sf-story-cta-fg, #fff);
	border-radius: var(--sf-story-cta-radius, 8px);
	padding: var(--sf-story-cta-pad, 12px 24px);
	font-size: var(--sf-story-cta-size, 16px);
	text-decoration: none;
	max-width: 80%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sf-story-modal__cta[hidden] {
	display: none;
}

/* نوارِ پیشرفت عمداً از prefers-reduced-motion مستثناست:
   این انیمیشن تزئینی نیست، تایمرِ اسلاید است و خاموش‌کردنش پخش را متوقف می‌کند. */


.widget-item.widget-story-story {
    margin-bottom: 0 !important;
}