/* ساختار مطالب همیار — فهرست مطالب در سایدبار راست، کنار مطلب، چسبان، مثل نمونه */
/* فقط در صفحات تکی مطالب بارگذاری می‌شود */

/* ابزارک در سایدبار چسبان بماند (مثل نمونه: top:80px) */
.single .widget_hamyar_ps_toc {
	position: sticky;
	top: 80px;
}

.single .mstoc {
	--mstoc-accent: #2563eb;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
}

/* نوار پیشرفت بالای فهرست */
.single .mstoc__progress {
	height: 3px;
	background: #eef2ff;
}

.single .mstoc__progress span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--mstoc-accent);
}

/* سربرگ فهرست: عنوان + دکمه باز و بسته کردن */
.single .mstoc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px;
}

.single .mstoc__heading {
	font-weight: 700;
	font-size: 16px;
}

.single .mstoc__toggle {
	background: none;
	border: 0;
	padding: 4px;
	margin: 0;
	cursor: pointer;
	line-height: 0;
	color: inherit;
}

.single .mstoc__toggle svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	transition: transform .2s ease;
}

.single .mstoc.is-collapsed .mstoc__toggle svg {
	transform: rotate(180deg);
}

/* فهرست */
.single .mstoc__nav {
	padding: 0 16px 14px;
}

.single .mstoc__list {
	margin: 0;
	padding-right: 22px;
	list-style-type: persian;
}

.single .mstoc__list li {
	margin: 6px 0;
}

.single .mstoc__list li.mstoc__item--h3 {
	margin-right: 18px;
	font-size: 14px;
}

.single .mstoc__list a {
	display: block;
	padding: 6px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
}

.single .mstoc__list a:hover {
	text-decoration: underline;
}

/* هایلایت ملایم آیتم فعال با مشخصه آبی، مثل نمونه */
.single .mstoc__list a.is-active {
	color: var(--mstoc-accent);
	font-weight: 700;
	background: #eff6ff;
	box-shadow: inset -3px 0 0 var(--mstoc-accent);
}

.single .mstoc__loading {
	color: #6b7280;
}

/* تیتر لنگردار زیر هدر چسبان پنهان نماند */
.single h2[id],
.single h3[id] {
	scroll-margin-top: 90px;
}

/* پرش نرم به بخش‌ها */
@media (prefers-reduced-motion: no-preference) {
	.single {
		scroll-behavior: smooth;
	}
}

/* چسبان‌کردن با جاوااسکریپت (position: fixed) — چون sticky در قالب جنه کار نمی‌کند */
.single .widget_hamyar_ps_toc.hamyar-toc-pinned {
	position: fixed;
	top: 80px;
	z-index: 60;
}

.single .widget_hamyar_ps_toc.hamyar-toc-at-bottom {
	position: absolute;
	z-index: 60;
}

/* ===== موبایل — نسخه 1.0.9 ===== */
/* نوار پایین، شیت فهرست و بازسازی منوی موبایل؛ فقط تا عرض 991 پیکسل */
.hamyar-mobile-bar,
.hamyar-toc-sheet {
	display: none;
}

@media (max-width: 991px) {
	/* نوار اشتراک‌گذاری چسبان قالب پنهان می‌شود تا دو نوار پایین روی هم نباشند؛
	   گزینه قالب دست نمی‌خورد و با غیرفعال‌کردن افزونه برمی‌گردد */
	#share-buttons-mobile,
	.mobile-share-buttons-spacer {
		display: none !important;
	}

	/* جا برای نوار پایین، تا فوتر زیر آن پنهان نماند */
	body {
		padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
	}

	/* دکمه بازگشت به بالا روی نوار پایین نیاید */
	#go-to-top,
	.tie-go-to-top {
		bottom: 76px !important;
	}

	/* فهرست سایدبار در موبایل انتهای مطلب نمی‌آید؛ همان فهرست در شیت پایینی است */
	.single .widget_hamyar_ps_toc {
		display: none;
	}

	/* نوار پایین ثابت */
	.hamyar-mobile-bar {
		display: flex;
		position: fixed;
		right: 0;
		left: 0;
		bottom: 0;
		z-index: 200;
		height: 60px;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		background: #fff;
		border-top: 1px solid #e5e7eb;
		box-shadow: 0 -2px 12px rgba(0, 0, 0, .08);
	}

	.hamyar-mb-btn {
		flex: 1 1 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 2px;
		min-width: 0;
		background: none;
		border: 0;
		padding: 6px 2px;
		font-size: 11px;
		font-weight: 600;
		line-height: 1.2;
		color: #374151;
		text-decoration: none;
		cursor: pointer;
	}

	.hamyar-mb-btn svg {
		width: 22px;
		height: 22px;
	}

	.hamyar-mb-btn--primary {
		background: #2563eb;
		color: #fff;
	}

	/* شیت فهرست */
	.hamyar-toc-sheet {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 300;
		visibility: hidden;
		pointer-events: none;
	}

	.hamyar-toc-sheet.is-open {
		visibility: visible;
		pointer-events: auto;
	}

	.hamyar-toc-sheet__backdrop {
		position: absolute;
		inset: 0;
		background: rgba(0, 0, 0, .45);
		opacity: 0;
		transition: opacity .25s ease;
	}

	.hamyar-toc-sheet.is-open .hamyar-toc-sheet__backdrop {
		opacity: 1;
	}

	.hamyar-toc-sheet__panel {
		position: absolute;
		right: 0;
		left: 0;
		bottom: 0;
		max-height: 72vh;
		display: flex;
		flex-direction: column;
		background: #fff;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, .18);
		transform: translateY(100%);
		transition: transform .28s ease;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.hamyar-toc-sheet.is-open .hamyar-toc-sheet__panel {
		transform: translateY(0);
	}

	.hamyar-toc-sheet__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 10px 12px 0;
		flex: none;
	}

	.hamyar-toc-sheet__grabber {
		width: 40px;
		height: 4px;
		border-radius: 999px;
		background: #d1d5db;
		margin: 0 auto;
	}

	.hamyar-toc-sheet__close {
		flex: none;
		width: 32px;
		height: 32px;
		border: 0;
		border-radius: 999px;
		background: #f3f4f6;
		color: #374151;
		font-size: 20px;
		line-height: 1;
		cursor: pointer;
	}

	.hamyar-toc-sheet__body {
		overflow-y: auto;
		padding: 4px 12px 16px;
	}

	.hamyar-toc-sheet .mstoc {
		border: 0;
		border-radius: 0;
	}

	.hamyar-toc-sheet .mstoc__header {
		padding-top: 8px;
	}

	body.hamyar-sheet-open {
		overflow: hidden;
	}

	/* منوی موبایل — بازسازی کامل (پنل کشویی تیره قالب، روشن و مرتب می‌شود) */
	.side-aside {
		background: #fff !important;
		color: #111827;
		width: min(340px, 88vw) !important;
	}

	.side-aside .side-aside-wrapper {
		background: #fff !important;
	}

	#mobile-container {
		padding: 16px;
		color: #111827;
	}

	#mobile-container form input[type="search"],
	#mobile-container form input[type="text"] {
		width: 100%;
		height: 46px;
		border: 1px solid #e5e7eb;
		border-radius: 999px;
		background: #f3f4f6;
		padding: 0 16px;
		font-size: 15px;
		color: #111827;
	}

	#mobile-container ul {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	#mobile-container ul li a {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 14px 12px;
		font-size: 16px;
		font-weight: 600;
		color: #1f2937 !important;
		text-decoration: none;
		border-bottom: 1px solid #f1f5f9;
		border-radius: 12px;
	}

	#mobile-container ul li a:hover {
		background: #eff6ff;
		color: #2563eb !important;
	}

	.side-aside .close-side-aside {
		background: #f3f4f6 !important;
		color: #111827 !important;
		border-radius: 50%;
	}

	/* کارت عضویت بالای منو */
	.hamyar-menu-cta {
		background: linear-gradient(135deg, #2563eb, #1d4ed8);
		color: #fff;
		border-radius: 16px;
		padding: 16px;
		margin: 12px 0 16px;
		text-align: center;
	}

	.hamyar-menu-cta__title {
		font-size: 17px;
		font-weight: 700;
	}

	.hamyar-menu-cta__sub {
		font-size: 13px;
		opacity: .9;
		margin: 4px 0 12px;
	}

	.hamyar-menu-cta__btn {
		display: inline-block;
		background: #fff;
		color: #1d4ed8;
		font-weight: 700;
		font-size: 15px;
		text-decoration: none;
		border-radius: 999px;
		padding: 10px 20px;
	}

	/* آیکون‌های اجتماعی پایین منو */
	#mobile-container .social-icons,
	#mobile-container .tie-social-icons,
	.side-aside .social-icons,
	.side-aside .tie-social-icons {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		justify-content: center;
		padding: 16px 0 8px;
	}

	#mobile-container .social-icons a,
	#mobile-container .tie-social-icons a,
	.side-aside .social-icons a,
	.side-aside .tie-social-icons a {
		width: 40px;
		height: 40px;
		border-radius: 50%;
		background: #f3f4f6;
		color: #374151;
		display: flex;
		align-items: center;
		justify-content: center;
	}
}
