/**
 * استایل محتوای مقاله — v1.28.0 (بندهای ۱ و ۲ بازخورد مالک)
 *  ۱) لایت‌باکس تصاویر مقاله (تمام‌صفحه + کپشن)
 *  ۲) جدول ریسپانسیو ar-rtable — موبایل: کارت‌های ردیفی، بدون اسکرول افقی
 * این فایل پس از custom-style.css لود می‌شود (deps) و همان قواعد قدیمی
 * min-width/اسکرول افقی جدول‌ها را برای جدول‌های tفسیرشده بازنویسی می‌کند.
 */

/* ============================== ۱) لایت‌باکس ============================== */
.ar-zoomable { cursor: zoom-in; }

.ar-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(2, 6, 23, .88);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	opacity: 0;
	transition: opacity .2s ease;
}
.ar-lb.is-open { opacity: 1; }
html.ar-lb-lock { overflow: hidden !important; }

.ar-lb-figure {
	margin: 0;
	max-width: min(1100px, 94vw);
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	position: relative;
	transform: scale(.96);
	transition: transform .2s ease;
}
.ar-lb.is-open .ar-lb-figure { transform: scale(1); }

.ar-lb-figure img {
	display: block;
	max-width: 100%;
	max-height: calc(92vh - 96px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 18px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08);
	transition: opacity .25s ease;
}
.ar-lb-figure img.is-ready { opacity: 1; }

.ar-lb-caption {
	max-width: min(720px, 88vw);
	margin: 0;
	text-align: center;
	color: #e2e8f0;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 2;
	background: rgba(15, 23, 42, .55);
	border: 1px solid rgba(255, 255, 255, .10);
	border-radius: 14px;
	padding: 10px 18px;
}

.ar-lb-counter {
	color: #94a3b8;
	font-size: 12px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	letter-spacing: .08em;
}

.ar-lb-close,
.ar-lb-nav {
	position: absolute;
	top: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 1px solid rgba(255, 255, 255, .16);
	border-radius: 14px;
	background: rgba(15, 23, 42, .6);
	color: #f1f5f9;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
	z-index: 3;
	-webkit-tap-highlight-color: transparent;
}
.ar-lb-close { inset-inline-end: 16px; }
.ar-lb-close:hover, .ar-lb-nav:hover { background: rgba(5, 150, 105, .75); }
.ar-lb-close:active, .ar-lb-nav:active { transform: scale(.94); }

.ar-lb-nav {
	top: 50%;
	transform: translateY(-50%);
	border-radius: 16px;
}
.ar-lb-nav:active { transform: translateY(-50%) scale(.94); }
.ar-lb-prev { inset-inline-end: 16px; }   /* RTL: قبلی سمت راست */
.ar-lb-next { inset-inline-start: 16px; }

@media (max-width: 640px) {
	.ar-lb { padding: 10px; }
	.ar-lb-figure img { max-height: calc(100vh - 132px); border-radius: 14px; }
	.ar-lb-caption { font-size: 12.5px; padding: 8px 14px; border-radius: 12px; }
	.ar-lb-close, .ar-lb-nav { width: 40px; height: 40px; }
	.ar-lb-nav { top: auto; bottom: 18px; transform: none; }
	.ar-lb-nav:active { transform: scale(.94); }
	.ar-lb-prev { inset-inline-end: 14px; }
	.ar-lb-next { inset-inline-start: 14px; }
	.ar-lb-counter { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); }
}

/* ================== ۲) جدول ریسپانسیو ar-rtable ================== */
/* دسکتاپ: استایل شیک‌تر از پیش‌فرض — هدر زمردی، ردیف‌های یک‌درمیان، بدون اسکرول‌بار زشت */
.entry-content table.ar-rtable,
.wp-block-post-content table.ar-rtable {
	width: 100%;
	min-width: 0;
	display: table;
	margin: 2rem 0;
	border-spacing: 0;
	border-collapse: separate;
	border: 1px solid #e2e8f0;
	border-radius: 1.1rem;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.entry-content table.ar-rtable th,
.wp-block-post-content table.ar-rtable th {
	background: linear-gradient(135deg, #047857, #059669);
	color: #fff;
	font-weight: 900;
	font-size: .9em;
	border-bottom: 0;
	border-inline-end: 1px solid rgba(255, 255, 255, .14);
	padding: .9rem 1rem;
	white-space: normal;
}
.entry-content table.ar-rtable th:last-child,
.wp-block-post-content table.ar-rtable th:last-child { border-inline-end: 0; }
.entry-content table.ar-rtable td,
.wp-block-post-content table.ar-rtable td {
	padding: .85rem 1rem;
	font-size: .92em;
	line-height: 1.9;
	border-bottom: 1px solid #eef2f7;
	border-inline-end: 1px solid #f1f5f9;
	color: #334155;
}
.entry-content table.ar-rtable td:last-child,
.wp-block-post-content table.ar-rtable td:last-child { border-inline-end: 0; }
.entry-content table.ar-rtable tbody tr:nth-child(2n) td,
.wp-block-post-content table.ar-rtable tbody tr:nth-child(2n) td { background: #f8fafc; }
.entry-content table.ar-rtable tbody tr:hover td,
.wp-block-post-content table.ar-rtable tbody tr:hover td { background: #f0fdf4; }
.entry-content table.ar-rtable tbody tr:last-child td,
.wp-block-post-content table.ar-rtable tbody tr:last-child td { border-bottom: 0; }

/* موبایل (≤640px): کارت‌های ردیفی — هیچ اسکرول افقی؛ هر ردیف یک کارت با برچسب ستون */
@media (max-width: 640px) {
	.entry-content table.ar-rtable,
	.wp-block-post-content table.ar-rtable,
	.entry-content .wp-block-table table.ar-rtable {
		display: block;
		border: 0;
		background: transparent;
		box-shadow: none;
	}
	.entry-content table.ar-rtable thead,
	.wp-block-post-content table.ar-rtable thead {
		/* هدر ستون‌ها دیگر فضای افقی نمی‌گیرد — برچسب‌ها داخل هر کارت می‌آیند */
		display: block;
		overflow: hidden;
		width: 1px;
		height: 1px;
		margin: -1px;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	.entry-content table.ar-rtable,
	.wp-block-post-content table.ar-rtable { border-spacing: 0; }
	.entry-content table.ar-rtable tbody,
	.wp-block-post-content table.ar-rtable tbody {
		display: block;
		margin: 0 -2px;
	}
	.entry-content table.ar-rtable tr,
	.wp-block-post-content table.ar-rtable tr {
		display: block;
		margin: 12px 0;
		padding: 4px 14px 8px;
		border: 1px solid #e2e8f0;
		border-radius: 1.1rem;
		background: #fff;
		box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
		position: relative;
		overflow: hidden;
	}
	.entry-content table.ar-rtable tr::before,
	.wp-block-post-content table.ar-rtable tr::before {
		content: '';
		position: absolute;
		inset-inline-start: 0;
		top: 0;
		bottom: 0;
		width: 4px;
		background: linear-gradient(180deg, #10b981, #059669);
		border-radius: 0 4px 4px 0;
	}
	[dir="rtl"] .entry-content table.ar-rtable tr::before,
	[dir="rtl"] .wp-block-post-content table.ar-rtable tr::before {
		border-radius: 4px 0 0 4px;
	}
	.entry-content table.ar-rtable td,
	.wp-block-post-content table.ar-rtable td,
	.entry-content table.ar-rtable th,
	.wp-block-post-content table.ar-rtable th {
		display: flex;
		flex-direction: column;
		gap: 2px;
		width: 100%;
		max-width: 100%;
		padding: 10px 2px 8px;
		border: 0;
		border-bottom: 1px dashed #e8edf3;
		background: transparent !important;
		text-align: right;
		font-size: 13.5px;
		white-space: normal;
		overflow-wrap: anywhere;
	}
	.entry-content table.ar-rtable tr > *:last-child,
	.wp-block-post-content table.ar-rtable tr > *:last-child { border-bottom: 0; }
	/* برچسب ستون از data-label — با نقطهٔ زمردی */
	.entry-content table.ar-rtable td::before,
	.wp-block-post-content table.ar-rtable td::before,
	.entry-content table.ar-rtable th::before,
	.wp-block-post-content table.ar-rtable th::before {
		content: attr(data-label);
		display: inline-flex;
		align-items: center;
		font-size: 11px;
		font-weight: 900;
		color: #047857;
		background: #ecfdf5;
		border-radius: 999px;
		padding: 2px 10px;
		width: max-content;
		max-width: 100%;
		margin-bottom: 2px;
	}
	.entry-content table.ar-rtable td[data-label=""]::before,
	.wp-block-post-content table.ar-rtable td[data-label=""]::before { content: none; }
	/* سلول هدری که بدنهٔ کارت است (ردیف th-only): برچسب نمی‌گیرد */
	.entry-content table.ar-rtable tbody tr:first-child th::before,
	.wp-block-post-content table.ar-rtable tbody tr:first-child th::before { content: none; }
	.entry-content table.ar-rtable tbody tr:first-child th,
	.wp-block-post-content table.ar-rtable tbody tr:first-child th {
		font-weight: 900;
		color: #0f172a;
		font-size: 14px;
	}
}

/* دارک‌مود */
html[data-theme="dark"] .entry-content table.ar-rtable,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable { border-color: #273652; box-shadow: none; }
html[data-theme="dark"] .entry-content table.ar-rtable td,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable td { color: #cbd5e1; border-color: #1f2a41; }
html[data-theme="dark"] .entry-content table.ar-rtable tbody tr:nth-child(2n) td,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable tbody tr:nth-child(2n) td { background: #131c30; }
html[data-theme="dark"] .entry-content table.ar-rtable tbody tr:hover td,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable tbody tr:hover td { background: #0f2a26; }
html[data-theme="dark"] .entry-content table.ar-rtable tr,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable tr {
	border-color: #273652;
	background: #111a2e;
	box-shadow: none;
}
html[data-theme="dark"] .entry-content table.ar-rtable td::before,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable td::before { background: rgba(16, 185, 129, .12); color: #34d399; }
html[data-theme="dark"] .entry-content table.ar-rtable td,
html[data-theme="dark"] .wp-block-post-content table.ar-rtable td { border-bottom-color: #22304a; }
