/* ==========================================================================
   RTL Bidirectional Layout & Typography for Arabic Edition (html[lang="ar"])
   Isolated strictly to [lang="ar"] so LTR editions (es, en, zh, pt, fr, gum)
   remain 100% untouched.
   ========================================================================== */

html[lang="ar"] {
  direction: rtl;
  text-align: right;
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", "Tahoma", "Arial", system-ui, sans-serif;
}

html[lang="ar"] body {
  direction: rtl;
  text-align: right;
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", "Tahoma", "Arial", system-ui, sans-serif;
  line-height: 1.8;
  overflow-x: clip;
}

/* Preserve Arabic cursive ligatures: never allow positive letter-spacing */
html[lang="ar"] *,
html[lang="ar"] *::before,
html[lang="ar"] *::after {
  letter-spacing: 0 !important;
}

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6,
html[lang="ar"] .proyecto-title,
html[lang="ar"] .hero-subtitle,
html[lang="ar"] button,
html[lang="ar"] input,
html[lang="ar"] select,
html[lang="ar"] textarea {
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Segoe UI", "Tahoma", "Arial", system-ui, sans-serif;
}

/* Logical borders for callouts, notes, and blockquotes in RTL */
html[lang="ar"] .translation-note,
html[lang="ar"] .historical-map-note,
html[lang="ar"] blockquote,
html[lang="ar"] .callout,
html[lang="ar"] .editorial-note,
html[lang="ar"] .method-note {
  border-left: none !important;
  border-right: 3px solid #a47b37;
}

html[lang="ar"] .historical-map-note {
  border-right-color: #64846b;
}

/* Keep brand wordmark, scientific names, DOIs, URLs, and numeric ranges isolated */
html[lang="ar"] .ad-brand {
  direction: ltr;
}

html[lang="ar"] i[dir="ltr"],
html[lang="ar"] bdi,
html[lang="ar"] [dir="ltr"],
html[lang="ar"] .doi,
html[lang="ar"] code,
html[lang="ar"] a[href^="https://doi.org"],
html[lang="ar"] a[href^="http://"],
html[lang="ar"] a[href^="https://"] {
  unicode-bidi: isolate;
}

/* Never mirror photographs, maps, archaeological drawings, north arrows, or videos */
html[lang="ar"] img,
html[lang="ar"] svg,
html[lang="ar"] video,
html[lang="ar"] canvas,
html[lang="ar"] .visual-map,
html[lang="ar"] .map-stage {
  transform: none;
}

/* Tables and scrollable matrices in RTL */
html[lang="ar"] th,
html[lang="ar"] td {
  text-align: right;
}

/* Citation list entries: keep original bibliographic body readable while notes flow RTL */
html[lang="ar"] .references-list li,
html[lang="ar"] #referencias-lista li,
html[lang="ar"] .bibliography-item {
  text-align: right;
  unicode-bidi: plaintext;
}

@media (max-width: 600px) {
  html[lang="ar"] body {
    font-size: 16px;
    line-height: 1.75;
  }
}
