/* ASF Berlin — RTL overrides (spec §4.3).
   Most layout adapts automatically via logical properties; this file only
   mirrors what logical properties cannot: directional icons, timelines
   with physical positioning, and Arabic typography refinements. */

/* Directional icons */
html[dir="rtl"] .breadcrumbs li + li::before { content: "‹"; }

/* Pagination arrows */
html[dir="rtl"] .pagination a[rel="prev"],
html[dir="rtl"] .pagination .prev { transform: scaleX(-1); display: inline-block; }
html[dir="rtl"] .pagination a[rel="next"],
html[dir="rtl"] .pagination .next { transform: scaleX(-1); display: inline-block; }

/* FAQ marker — keep +/– centered regardless of direction */
html[dir="rtl"] .faq-item summary::after { transform: translateY(-50%); }

/* Search placeholder alignment */
html[dir="rtl"] input::placeholder { text-align: start; }

/* Numbers, dates, phone numbers: keep Latin digits LTR inside RTL text (v4 B1) */
html[dir="rtl"] time,
html[dir="rtl"] .stat__value,
html[dir="rtl"] .chart__value,
html[dir="rtl"] .course-item__date,
html[dir="rtl"] .site-footer__nap a[href^="tel:"] {
  direction: ltr;
  unicode-bidi: embed;
}

/* Numeric, currency, date and code runs must never follow paragraph direction —
   a bare "200–500" inside an RTL paragraph would reorder to "500–200". */
html[dir="rtl"] :is(
  .data-table td, .data-table th,
  .fact-box__value, .fact-box__num, .date-badge, .course-item__date,
  .deadline-banner, .stat, .stat-headline, .chart, .chart__label, .chart__value,
  .arrival, .arrival__badge, .route-legend, .badge, .tag,
  .panel-ledger, .panel-route, .kcard__meta, .course-item__meta,
  .arrival__mins, .arrival__walk, .az-nav, .glossary-rail,
  time, bdi, .mono, .num
) {
  unicode-bidi: isolate;
}
html[dir="rtl"] :is(.data-table td, .data-table th, .fact-box__value, .fact-box__num, .chart__value, .date-badge, .arrival__mins) {
  direction: ltr;
  text-align: end;
}
/* Charts/map SVGs are LTR coordinate spaces even inside RTL documents */
html[dir="rtl"] svg { direction: ltr; }

/* v4.1 D2 safety net: every paragraph decides its own base direction from
   its first strong character, so an LTR numeric run embedded in Arabic prose
   keeps its internal order even without a <bdi>. */
html[dir="rtl"] p,
html[dir="rtl"] li,
html[dir="rtl"] dd {
  unicode-bidi: plaintext;
}

/* Section sign § and German legal citations stay LTR */
html[dir="rtl"] .article__body p { text-align: start; }

/* Form controls align to the inline start (right) — explicit for older WebKit */
html[dir="rtl"] .filter-form select,
html[dir="rtl"] .tool-box input[type="date"] { direction: rtl; }

/* Sticky CTA close button stays inline-end — already logical via flex */

/* Hero eyebrow uses Latin uppercase styling in LTR; neutralise for Arabic */
html[dir="rtl"] .hero__eyebrow { text-transform: none; }
