/* The tool grammar in a right-to-left language (copy plan part 7): the tool pages and their hubs, and the feature
 * pages that follow.
 *
 * Loaded after tools.css only on a right-to-left page drawn in the tool grammar (subtitleai/seo/render.py). Grids and
 * flex rows mirror on their own under dir="rtl"; these are the rules that name a side. The text boxes already give
 * each line its own direction (unicode-bidi: plaintext in tools.css), so a time line reads left to right beside an
 * Arabic line.
 */

[dir="rtl"] .seo-body .tool-list { padding-left: 0; padding-right: 1.25rem; }

/* A comparison table keeps its row labels on the start side while its frame scrolls. */
[dir="rtl"] .seo-body .tool-compare .seo-compare :is(th[scope="row"], thead th:first-child) { left: auto; right: 0; }
[dir="rtl"] .seo-body .tool-compare .seo-compare-group th > span { left: auto; right: 14px; }

/* A Latin run keeps to one line, so "vid-hub.com" does not break at its hyphen nor "Vid Hub" between its words. In a
   scrolling comparison it wraps as the cell needs: the cells of a comparison of formats hold whole time lines, and a
   whole "vid-hub.com" is wider than any word of the chooser. On a phone a row's label is as wide as its longest word:
   Arabic names are short, and the chooser's five columns then fit in 375 px. */
[dir="rtl"] .seo-body bdi { white-space: nowrap; }
[dir="rtl"] .seo-body .seo-compare-wrap bdi { white-space: normal; }
@media (max-width: 760px) {
    [dir="rtl"] .seo-body .tool-compare .seo-compare tbody th[scope="row"] { min-width: 0; }
}

/* A card's arrow points the way the page reads. */
[dir="rtl"] .seo-body .tool-card > svg:last-child { transform: scaleX(-1); }

/* An empty box's hint takes each line's own direction too, as the box's text does, so an Arabic hint reads right to
   left and its example time line left to right. */
[dir="rtl"] .seo-body .tool-text::placeholder { unicode-bidi: plaintext; }

/* Latin monospace faces first, one for each system, so the time lines stay aligned; they have no Arabic letters, which
   fall to a face drawn for them. */
[dir="rtl"] .seo-body .tool-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Roboto Mono", "Noto Sans Mono", "Droid Sans Mono",
        "Liberation Mono", Tahoma, "Geeza Pro", "Noto Sans Arabic", monospace;
}
[dir="rtl"] .seo-body .tool-step-label { font-family: inherit; }

/* The subtitle editor (copy plan part 8): a row's buttons sit at its end and the chosen row's bar at its start; a time
   or a shift in seconds reads left to right ("-3.5"); find and replace take the direction of what is typed. */
[dir="rtl"] .seo-body .editor-row-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .seo-body .editor-row[data-selected="true"] { box-shadow: inset -3px 0 0 var(--accent); }
[dir="rtl"] .seo-body :is(.editor-time input, [data-editor-shift-by]) { direction: ltr; }
[dir="rtl"] .seo-body :is([data-editor-find], [data-editor-with]) { unicode-bidi: plaintext; }

/* A feature page (copy plan part 9): the plan table reads from the right; in the fan of example phones the next one
   leans in on the left and the last on the right, and the playing phone's sign sits in its top left corner. */
[dir="rtl"] .seo-body .plan-table :is(th, td) { text-align: right; }
[dir="rtl"] .seo-body .tool-example-state { right: auto; left: 14px; }
@media (min-width: 1024px) {
    [dir="rtl"] .seo-body .tool-example[data-place="next"] { transform: translateX(-64%) scale(0.8) rotate(-7deg); }
    [dir="rtl"] .seo-body .tool-example[data-place="prev"] { transform: translateX(64%) scale(0.8) rotate(7deg); }
}
