/*
 * Content shown in English on a page in another language (brief, Part 51.7).
 * - Views mark English fields with lang="en" dir="ltr" (ContentLocalizationService.FieldLang/FieldDir): they read
 *   left to right, isolated from the Arabic or Urdu around them, in the Latin type.
 * - When a page's content is not (fully) translated, <main data-content-fallback="en"> lets every text block take its
 *   direction from its own first strong letter, so English paragraphs read left to right while the translated
 *   interface labels beside them stay right to left.
 */
html:not([lang="en"]) [lang="en"][dir="ltr"] {
    unicode-bidi: isolate;
    text-align: start;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Centred blocks stay centred. */
html:not([lang="en"]) .text-center [lang="en"][dir="ltr"],
html:not([lang="en"]) [lang="en"][dir="ltr"].text-center {
    text-align: center;
}

html:not([lang="en"]) [lang="en"][dir="ltr"] :is(h1, h2, h3, h4, h5, h6) {
    font-family: "Inter", system-ui, sans-serif;
}

html[dir="rtl"] main[data-content-fallback] :is(p, li, dt, dd, blockquote, figcaption, summary, td, th, h1, h2, h3, h4, h5, h6) {
    unicode-bidi: plaintext;
    text-align: start;
}

html[dir="rtl"] main[data-content-fallback] .text-center :is(p, li, dt, dd, blockquote, figcaption, summary, td, th, h1, h2, h3, h4, h5, h6),
html[dir="rtl"] main[data-content-fallback] :is(p, h1, h2, h3, h4, h5, h6).text-center {
    text-align: center;
}

/* Part 47: translated pages still show some stored records in English (a lesson title, a city name, a scenario). Every
 * text block on an Arabic or Urdu page takes its direction from its own first strong letter, so an English title reads
 * left to right in place, while the translated text around it stays right to left. The alignment is left to each
 * feature (a centred hero stays centred). Interface text in Arabic or Urdu that begins with a Latin name starts with
 * an invisible right-to-left mark (U+200F), so it keeps the page's direction (TextKeyParityTests checks this). */
html[dir="rtl"] main :is(p, li, dt, dd, blockquote, figcaption, summary, td, th, h1, h2, h3, h4, h5, h6) {
    unicode-bidi: plaintext;
}

/* Lists in English keep their markers on the left. */
html[dir="rtl"] [lang="en"][dir="ltr"] :is(ul, ol) {
    padding-inline-start: 1.4em;
}

/* Related guides under the SEO topic pages (Views/Shared/_RelatedTopics.cshtml). */
.ip-related-topics {
    padding-block: clamp(2rem, 5vw, 3.5rem);
    border-top: 1px solid var(--ip-line);
    background: var(--ip-surface-2, var(--ip-bg));
}

.ip-related-topics__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 1rem;
}

.ip-related-topics a.ip-related-topics__card {
    display: flex;
    align-items: center;
    gap: .9rem;
    height: 100%;
    padding: 1rem 1.1rem;
    color: var(--ip-ink);
    text-decoration: none;
}

.ip-related-topics__card:hover {
    color: var(--ip-ink);
}

.ip-related-topics__card:focus-visible {
    outline: 3px solid var(--ip-primary);
    outline-offset: 3px;
}

.ip-related-topics__icon {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 12px;
    background: var(--ip-primary-soft);
    color: var(--ip-primary-ink);
    font-size: 1.2rem;
}

.ip-related-topics__text {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.ip-related-topics__text strong {
    font-weight: 700;
    line-height: 1.35;
}

.ip-related-topics__text span {
    color: var(--ip-muted);
    font-size: .9rem;
    line-height: 1.45;
}

.ip-related-topics__go {
    margin-inline-start: auto;
    color: var(--ip-muted);
}

html[lang="ur"] .ip-related-topics__text strong,
html[lang="ur"] .ip-related-topics__text span {
    line-height: 2;
}

[data-theme="dark"] .ip-related-topics__icon {
    color: var(--ip-saffron-300);
}

html[dir="rtl"] .ip-related-topics__go {
    transform: scaleX(-1);
}
