/* RTL fixes on top of reveal.js's built-in `rtl: true` support.
   reveal.js 6 flips direction and navigation, but its themes still hard-code left-side
   margins and alignment, and it forces `font-family: sans-serif` on RTL slides. */

/* Bundled Vazirmatn (OFL, fonts/OFL.txt): works offline, no Google Fonts needed. A locally
   installed Vazirmatn wins via local(). */
@font-face {
	font-family: 'Vazirmatn';
	src: local('Vazirmatn'), url('../fonts/Vazirmatn-Variable.woff2') format('woff2');
	font-weight: 100 900;
	font-display: swap;
}

/* Same font limited to Arabic-script ranges: listed before the monospace code font, Persian/Arabic
   letters in code use Vazirmatn (properly joined) while Latin keeps the monospace font. */
@font-face {
	font-family: 'reveal-rtl-code-script';
	src: local('Vazirmatn'), url('../fonts/Vazirmatn-Variable.woff2') format('woff2');
	font-weight: 100 900;
	unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

.reveal.rtl {
	--rtl-font: 'Vazirmatn', 'Sahel', Tahoma, sans-serif;
}

.reveal.rtl code {
	font-family: 'reveal-rtl-code-script', var(--r-code-font, monospace);
}

.reveal.rtl .slides,
.reveal.rtl .slides h1,
.reveal.rtl .slides h2,
.reveal.rtl .slides h3,
.reveal.rtl .slides h4,
.reveal.rtl .slides h5,
.reveal.rtl .slides h6 {
	font-family: var(--rtl-font);
	letter-spacing: normal; /* letter-spacing breaks Persian/Arabic joining */
}

/* Lists: themes use `margin: 0 0 0 1em` and nested `margin-left: 40px`. */
.reveal.rtl ol,
.reveal.rtl dl,
.reveal.rtl ul {
	text-align: start;
	margin: 0;
	margin-inline-start: 1em;
}

.reveal.rtl ul ul,
.reveal.rtl ul ol,
.reveal.rtl ol ol,
.reveal.rtl ol ul,
.reveal.rtl dd {
	margin: 0;
	margin-inline-start: 40px;
}

/* Ordered list numbers follow rtlOptions.digits (data-rtl-digits set by plugin/rtl.js). */
.reveal.rtl ol {
	list-style-type: persian;
}

.reveal.rtl[data-rtl-digits="arabic"] ol {
	list-style-type: arabic-indic;
}

.reveal.rtl[data-rtl-digits="latin"] ol {
	list-style-type: decimal;
}

.reveal.rtl table th,
.reveal.rtl table td {
	text-align: start;
}

/* Code, math and anything marked LTR stay left-to-right. */
.reveal.rtl pre,
.reveal.rtl pre code,
.reveal.rtl [dir="ltr"] {
	direction: ltr;
	text-align: left;
}

.reveal.rtl [dir="ltr"]:not(code) {
	font-family: revert;
}

.reveal.rtl pre,
.reveal.rtl pre code {
	font-family: 'reveal-rtl-code-script', var(--r-code-font, monospace);
}

/* Inline code inside Persian text: isolate so surrounding punctuation stays in place. */
.reveal.rtl :not(pre) > code {
	direction: ltr;
	unicode-bidi: isolate;
}

.reveal.rtl .slide-number {
	font-family: var(--rtl-font);
}

/* Keyboard help overlay (? key), localized by core/help.js. */
.reveal.rtl .r-overlay-help-content {
	font-family: var(--rtl-font);
}

.reveal.rtl .r-overlay-help-content th,
.reveal.rtl .r-overlay-help-content td {
	text-align: start;
}

.reveal.rtl .r-overlay-help-content td[dir="ltr"] {
	text-align: end;
	unicode-bidi: isolate;
}

/* Directional icons and images (arrows, "next", "back"): add class="rtl-mirror" and they point the
   reading direction in RTL decks. `scale` composes with fragment and transition transforms. */
.reveal.rtl .rtl-mirror {
	scale: -1 1;
}

/* Jump to slide (G key). */
.reveal.rtl .jump-to-slide-input {
	font-family: var(--rtl-font);
	text-align: start;
}

/* Notes shown on the slide (showNotes: true). */
.reveal.rtl .speaker-notes {
	direction: rtl;
	text-align: start;
	font-family: var(--rtl-font);
}

.reveal.rtl .speaker-notes::before {
	/* Set by plugin/rtl.js from the chosen language. */
	content: var(--rtl-notes-label, 'یادداشت‌ها');
}
