/*
 * برگه‌ی سند متنی — قوانین، شرایط استفاده، مهربانی.
 *
 * ⚠️ همه‌چیز با پیشوند `ild-` است و هیچ کلاس تیلویندی اینجا نیست: کلاسی که در
 * بیلد `site.css` نباشد بی‌صدا بی‌اثر می‌شود.
 *
 * زبان بصری هم‌خانواده‌ی ژورنال است — کاغذ روشن روی زمینه‌ی مینتی، لهجه‌ی سبز
 * برند، و عرض خط خوانا. تفاوتش این است که اینجا متن طولانی و مرجع است، نه
 * ویترین؛ پس تیترها آرام‌ترند و فاصله‌ی سطرها بازتر.
 */

.ild {
	--ild-green: #00833d;
	--ild-forest: #10261b;
	--ild-mint: #f2faf5;
	--ild-sage: #c3d9ca;
	--ild-paper: #fffdf8;
	--ild-ink: #1c2b22;
	--ild-muted: #5c6b62;

	display: block;
	background: var(--ild-mint);
	padding: 24px 16px 64px;
	color: var(--ild-ink);
	font-size: 17px;
	line-height: 2.05;
}

.ild-crumbs {
	max-width: 1180px;
	margin: 0 auto 12px;
	font-size: 13px;
}

/* ==========================================
   سربرگ سند
========================================== */

.ild-head {
	max-width: 1180px;
	margin: 0 auto 26px;
	padding: 0 4px;
}

.ild-title {
	margin: 0 0 8px;
	font-size: clamp(26px, 4vw, 40px);
	font-weight: 800;
	line-height: 1.45;
	color: var(--ild-forest);
}

.ild-title::after {
	content: "";
	display: block;
	width: 62px;
	height: 5px;
	margin-top: 14px;
	border-radius: 3px;
	background: var(--ild-green);
}

.ild-meta {
	margin: 14px 0 0;
	font-size: 13px;
	color: var(--ild-muted);
}

/* ==========================================
   چیدمان: فهرست کنار متن
========================================== */

.ild-wrap {
	display: grid;
	grid-template-columns: 268px minmax(0, 1fr);
	gap: 26px;
	align-items: start;
	max-width: 1180px;
	margin: 0 auto;
}

.ild-wrap.ild-solo {
	grid-template-columns: minmax(0, 1fr);
	max-width: 900px;
}

.ild-aside {
	position: sticky;
	top: 96px;
	max-height: calc(100vh - 130px);
	overflow: auto;
	overscroll-behavior: contain;
}

.ild-toc {
	background: var(--ild-paper);
	border: 1px solid var(--ild-sage);
	border-radius: 14px;
	padding: 14px 16px;
}

.ild-toc-title {
	cursor: pointer;
	font-weight: 800;
	font-size: 15px;
	color: var(--ild-forest);
	list-style: none;
}

.ild-toc-title::-webkit-details-marker {
	display: none;
}

.ild-toc-title::before {
	content: "▾";
	margin-inline-end: 6px;
	color: var(--ild-green);
}

.ild-toc:not([open]) .ild-toc-title::before {
	content: "▸";
}

.ild-toc-list {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
	counter-reset: ild-toc;
	font-size: 14px;
	line-height: 1.9;
}

.ild-toc-item a {
	display: block;
	padding: 3px 10px 3px 6px;
	border-inline-start: 3px solid transparent;
	color: var(--ild-ink);
	text-decoration: none;
	transition: border-color 0.15s, background 0.15s;
}

.ild-toc-item a:hover,
.ild-toc-item a:focus {
	background: var(--ild-mint);
	border-inline-start-color: var(--ild-green);
	color: var(--ild-green);
}

.ild-lvl-3 a {
	padding-inline-start: 20px;
	font-size: 13px;
	color: var(--ild-muted);
}

/* ==========================================
   کاغذ متن
========================================== */

.ild-paper {
	background: var(--ild-paper);
	border: 1px solid var(--ild-sage);
	border-radius: 18px;
	padding: clamp(20px, 4vw, 46px);
	box-shadow: 0 10px 30px rgba(16, 38, 27, 0.06);
	overflow-wrap: anywhere;
}

.ild-paper > :first-child {
	margin-top: 0;
}

.ild-paper h2 {
	margin: 46px 0 16px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--ild-sage);
	font-size: clamp(21px, 2.6vw, 27px);
	font-weight: 800;
	line-height: 1.6;
	color: var(--ild-forest);
	scroll-margin-top: 110px;
}

.ild-paper h3 {
	margin: 34px 0 12px;
	font-size: clamp(18px, 2.2vw, 21px);
	font-weight: 700;
	line-height: 1.7;
	color: var(--ild-green);
	scroll-margin-top: 110px;
}

.ild-paper h4 {
	margin: 26px 0 10px;
	font-size: 17px;
	font-weight: 700;
	color: var(--ild-forest);
}

.ild-paper p {
	margin: 0 0 18px;
	text-align: justify;
}

.ild-paper ul,
.ild-paper ol {
	margin: 0 0 20px;
	padding-inline-start: 26px;
}

.ild-paper li {
	margin-bottom: 9px;
}

.ild-paper li::marker {
	color: var(--ild-green);
}

.ild-paper a {
	color: var(--ild-green);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ild-paper a:hover {
	color: var(--ild-forest);
}

.ild-paper strong,
.ild-paper b {
	color: var(--ild-forest);
}

.ild-paper blockquote {
	margin: 24px 0;
	padding: 14px 18px;
	border-inline-start: 4px solid var(--ild-green);
	border-radius: 0 12px 12px 0;
	background: var(--ild-mint);
	color: var(--ild-forest);
}

.ild-paper hr {
	margin: 34px 0;
	border: 0;
	border-top: 1px dashed var(--ild-sage);
}

/* تصویر و ویدئو: هرگز از کاغذ بیرون نزنند */
.ild-paper img,
.ild-paper video,
.ild-paper iframe {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
}

/*
 * ⚠️ محافظ آیکن‌های درون‌خطی.
 *
 * یک `<svg>` بدون عرض و ارتفاع تا کل عرض ظرفش بزرگ می‌شود. آیکن‌های جامانده از
 * آکاردئون المنتور دقیقاً همین بودند و هر کدام به یک لکه‌ی سیاه تمام‌صفحه تبدیل
 * شدند. محتوا از آن‌ها پاک شد، ولی این سقف می‌ماند تا اگر روزی آیکنی از جای
 * دیگری وارد متن شد، دوباره صفحه را نترکاند.
 */
.ild-paper svg {
	max-width: 1.2em;
	max-height: 1.2em;
	vertical-align: middle;
}

.ild-paper figure {
	margin: 24px 0;
}

.ild-paper figcaption {
	margin-top: 8px;
	font-size: 13px;
	color: var(--ild-muted);
	text-align: center;
}

/* جدول‌های طولانی قوانین روی موبایل باید افقی اسکرول شوند، نه صفحه */
.ild-paper table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	margin: 0 0 22px;
	font-size: 15px;
}

.ild-paper th,
.ild-paper td {
	border: 1px solid var(--ild-sage);
	padding: 9px 12px;
}

.ild-paper th {
	background: var(--ild-mint);
	color: var(--ild-forest);
}

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

@media (max-width: 900px) {
	.ild {
		padding: 16px 12px 44px;
		font-size: 16px;
		line-height: 1.95;
	}

	.ild-wrap {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	/*
	 * روی موبایل فهرست بالای متن می‌نشیند و بسته باز می‌شود — بستنش کار سه خط
	 * جاوااسکریپت در `page-doc.php` است، چون `open` را CSS نمی‌تواند بردارد.
	 */
	.ild-aside {
		position: static;
		max-height: none;
	}

	.ild-toc[open] .ild-toc-list {
		max-height: 46vh;
		overflow: auto;
	}
}

/* ==========================================
   چاپ — این صفحه‌ها را واقعاً چاپ می‌گیرند
========================================== */

@media print {
	.ild {
		background: #fff;
		padding: 0;
		font-size: 12pt;
		line-height: 1.7;
	}

	.ild-aside,
	.ild-crumbs {
		display: none !important;
	}

	.ild-paper {
		border: 0;
		border-radius: 0;
		box-shadow: none;
		padding: 0;
	}

	.ild-paper h2,
	.ild-paper h3 {
		break-after: avoid;
	}

	.ild-paper a::after {
		content: " (" attr(href) ")";
		font-size: 10pt;
		color: #444;
	}
}

/* ==========================================
   ۱۴۰۵/۰۹/۰۱ UX برگه‌های قوانین (فائزه نوروزی)
========================================== */
.ild-toc-count {
	display: inline-block;
	min-width: 22px;
	margin-inline-start: 6px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--ild-mint);
	color: var(--ild-green);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.8;
	text-align: center;
}
.ild-toc-search {
	display: block;
	width: 100%;
	margin: 12px 0 0;
	padding: 7px 12px;
	border: 1px solid var(--ild-sage);
	border-radius: 10px;
	background: #fff;
	font: inherit;
	font-size: 14px;
	line-height: 1.6;
}
.ild-toc-search:focus {
	outline: none;
	border-color: var(--ild-green);
	box-shadow: 0 0 0 3px rgba(0, 131, 61, 0.15);
}
.ild-toc-item a.is-active {
	background: var(--ild-mint);
	border-inline-start-color: var(--ild-green);
	color: var(--ild-green);
	font-weight: 700;
}
.ild-toc-item[hidden] {
	display: none;
}

/* سرفصل‌های بند (h3): کارت کم‌رنگ تا مرز بندها بی خط جداکننده دیده شود */
.ild-paper h3 {
	padding: 6px 14px;
	border-inline-start: 4px solid var(--ild-green);
	border-radius: 0 10px 10px 0;
	background: var(--ild-mint);
}
.ild-paper h2 + h3,
.ild-paper .ild-note + h3 {
	margin-top: 18px;
}
/* بندی که از فهرست یا پیوند به آن رسیده‌اند لحظه‌ای برجسته می‌شود */
.ild-paper :target {
	animation: ild-flash 1.6s ease-out 1;
}
@keyframes ild-flash {
	0% { box-shadow: 0 0 0 6px rgba(0, 131, 61, 0.28); }
	100% { box-shadow: 0 0 0 0 rgba(0, 131, 61, 0); }
}
.ild-lead {
	font-size: 19px;
	font-weight: 700;
	color: var(--ild-forest);
}
.ild-note {
	display: inline-block;
	padding: 6px 14px;
	border-radius: 10px;
	background: #fff7e6;
	border: 1px solid #f3dfb4;
	color: #6b4f12;
	font-size: 14px;
	line-height: 1.9;
}
.ild-note strong {
	color: inherit;
}
/* ویدئوهای راهنما: کنار هم روی دسکتاپ، زیر هم روی موبایل */
.ild-videos {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 16px;
	margin: 0 0 26px;
}
.ild-videos figure {
	margin: 0;
	padding: 10px;
	border: 1px solid var(--ild-sage);
	border-radius: 14px;
	background: #fff;
}
.ild-videos .wp-video,
.ild-videos video {
	width: 100% !important;
	max-width: 100%;
}
.ild-videos figcaption {
	font-weight: 700;
	color: var(--ild-forest);
	font-size: 14px;
}
.ild-top {
	position: fixed;
	inset-inline-start: 18px;
	bottom: 22px;
	z-index: 40;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--ild-green);
	color: #fff !important;
	font-size: 20px;
	text-decoration: none !important;
	box-shadow: 0 8px 20px rgba(16, 38, 27, 0.25);
}
.ild-top[hidden] {
	display: none;
}

/* موبایل: فهرست مطالب نوار چسبان بالای صفحه است؛ باز که شود تا نیمه‌ی صفحه با اسکرول خودش */
@media (max-width: 900px) {
	.ild-aside {
		position: sticky;
		top: 0;
		z-index: 30;
		max-height: none;
		overflow: visible;
		margin: 0 -4px;
	}
	.ild-toc {
		box-shadow: 0 6px 18px rgba(16, 38, 27, 0.08);
	}
	.ild-toc[open] nav {
		max-height: 55vh;
		overflow: auto;
		overscroll-behavior: contain;
	}
	.ild-paper p {
		text-align: start;
	}
	.ild-top {
		bottom: 84px;
	}
}
@media print {
	.ild-aside,
	.ild-top,
	.ild-crumbs {
		display: none !important;
	}
	.ild-wrap {
		display: block;
	}
	.ild-paper {
		border: 0;
		box-shadow: none;
		padding: 0;
	}
}
