/* Zoon Math — تنسيق العرض (v1.0.1) — MathML/RTL */

/* الحاوية: تتبع اتجاه النصّ المحيط؛ الرياضيات نفسها يحكمها dir على <math> */
.zmath {
	display: inline-block;
	line-height: normal;
}
.zmath.zmath-block {
	display: block;
	margin: 0.6em 0;
	text-align: center;
}

/* رياضيات عربية: اعكس الجذر وضع الأس يساراً (يتكفّل به المتصفّح عبر dir) */
.zmath math[dir="rtl"] {
	direction: rtl;
}

/* خطّ MathML: Cambria Math أولاً (يحوي الأرقام العربية ٠-٩) ثم بدائل */
.zmath math {
	/* خطّ رياضي لبناء الجذور/الكسور بشكل سليم (يمنع قطع الجذر) */
	font-family: "Cambria Math", "STIX Two Math", "XITS Math", math, serif;
	font-size: 1.45em;
}

/* الأرقام والحروف والنصّ الظاهر: Times New Roman كما طُلب — لا يؤثّر على بناء الجذر */
.zmath math mn,
.zmath math mi,
.zmath math mtext {
	font-family: "Times New Roman", "Arial", "Cambria Math", serif;
}

/* النصّ البديل قبل اكتمال الرسم (وعند تعطّل JS) — مقروء لا مكسور */
.zmath:not([data-zmath-done="1"]) {
	font-family: "Cambria Math", "Times New Roman", serif;
	background: rgba(26, 95, 168, 0.06);
	border-radius: 4px;
	padding: 0 0.25em;
	direction: ltr;
	unicode-bidi: isolate;
}
.zmath[data-zmath-done="1"] {
	background: none;
	padding: 0;
}

/* الوضع الليلي (Zoon Dark Mode يضبط html[data-theme="dark"]) */
html[data-theme="dark"] .zmath:not([data-zmath-done="1"]) {
	background: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .zmath math { color: inherit; }

/* الكسور أوضح: تباعد رأسي بسيط + حجم مريح */
.zmath math mfrac { font-size: 1.06em; }
.zmath.zmath-block math { font-size: 1.7em; }
