/*
Mansurge Arabic Localization Foundation v1.0
Global RTL typography layer for Core-rendered public UI.
No remote font is loaded by Core. If Noto Sans Arabic or Noto Kufi Arabic
is installed/loaded by the site, it is used; otherwise the stack falls back
cleanly to platform Arabic UI fonts.
*/

:root{
    --ms-font-arabic:"Noto Sans Arabic","Noto Kufi Arabic",system-ui,-apple-system,"Segoe UI",Tahoma,Arial,sans-serif;
}

html[lang^="ar"],
body.rtl{
    --ms-font-primary:var(--ms-font-arabic);
    --ms-font-heading:var(--ms-font-arabic);
    --ms-font-body:var(--ms-font-arabic);
    --ms-letter-tight:0;
    --ms-letter-normal:0;
    --ms-letter-wide:0;
    --ms-lh-heading:1.35;
    --ms-lh-body:1.9;
}

html[lang^="ar"] body,
body.rtl,
[lang="ar"],
[dir="rtl"]{
    font-family:var(--ms-font-arabic);
}

/* Arabic joining and readability should never inherit Latin tracking. */
html[lang^="ar"] :where(
    .ms-homepage,.ms-about-page,.ms-contact-page,.ms-journal-page,
    .ms-single-journal,.ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,
    .ms-my-account,.ms-order-confirmation,.ms-order-tracking,.ms-legal-page,
    .ms-terms-page,.ms-shipping-page,#ms-site-footer,#ms-cookie-consent
),
body.rtl :where(
    .ms-homepage,.ms-about-page,.ms-contact-page,.ms-journal-page,
    .ms-single-journal,.ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,
    .ms-my-account,.ms-order-confirmation,.ms-order-tracking,.ms-legal-page,
    .ms-terms-page,.ms-shipping-page,#ms-site-footer,#ms-cookie-consent
){
    font-family:var(--ms-font-arabic);
}

html[lang^="ar"] :where(
    .ms-homepage,.ms-about-page,.ms-contact-page,.ms-journal-page,
    .ms-single-journal,.ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,
    .ms-my-account,.ms-order-confirmation,.ms-order-tracking,.ms-legal-page,
    .ms-terms-page,.ms-shipping-page,#ms-site-footer,#ms-cookie-consent
) :where(h1,h2,h3,h4,p,a,button,label,input,textarea,select,li,span,strong),
body.rtl :where(
    .ms-homepage,.ms-about-page,.ms-contact-page,.ms-journal-page,
    .ms-single-journal,.ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,
    .ms-my-account,.ms-order-confirmation,.ms-order-tracking,.ms-legal-page,
    .ms-terms-page,.ms-shipping-page,#ms-site-footer,#ms-cookie-consent
) :where(h1,h2,h3,h4,p,a,button,label,input,textarea,select,li,span,strong){
    letter-spacing:0;
}

/* Keep editorial text naturally RTL while preserving explicitly centered UI. */
html[lang^="ar"] :where(
    .ms-about-page,.ms-contact-page,.ms-journal-page,.ms-single-journal,
    .ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,.ms-my-account,
    .ms-order-confirmation,.ms-order-tracking,.ms-legal-page,.ms-terms-page,
    .ms-shipping-page
),
body.rtl :where(
    .ms-about-page,.ms-contact-page,.ms-journal-page,.ms-single-journal,
    .ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,.ms-my-account,
    .ms-order-confirmation,.ms-order-tracking,.ms-legal-page,.ms-terms-page,
    .ms-shipping-page
){
    direction:rtl;
}

/* Mixed Latin brand/system names remain readable inside Arabic copy. */
html[lang^="ar"] :where(.ms-eight-word,.ms-eight-letter,.ms-home-eight-word),
body.rtl :where(.ms-eight-word,.ms-eight-letter,.ms-home-eight-word){
    font-family:"Inter",Arial,sans-serif;
    direction:ltr;
    unicode-bidi:isolate;
}

/* Form fields should begin on the correct edge in Arabic. */
html[lang^="ar"] :where(input:not([type="checkbox"]):not([type="radio"]),textarea,select),
body.rtl :where(input:not([type="checkbox"]):not([type="radio"]),textarea,select){
    text-align:right;
}

/* Numerals, prices and URLs should not be visually reversed. */
html[lang^="ar"] :where(.price,.amount,.woocommerce-Price-amount,.ms-legal-number,.ms-terms-number,.ms-shipping-number),
body.rtl :where(.price,.amount,.woocommerce-Price-amount,.ms-legal-number,.ms-terms-number,.ms-shipping-number){
    unicode-bidi:isolate;
}


/* v3.1.55 — Arabic optical typography corrections.
   Arabic glyphs need more vertical room than the Latin display system. */
html[lang^="ar"] :where(.ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,.ms-my-account,.ms-order-tracking,.ms-order-confirmation,.ms-about-page,.ms-contact-page) :where(h1,h2,h3),
body.rtl :where(.ms-shop-page,.ms-pc,.ms-cart-page,.ms-checkout-page,.ms-my-account,.ms-order-tracking,.ms-order-confirmation,.ms-about-page,.ms-contact-page) :where(h1,h2,h3){
    line-height:1.28!important;
    letter-spacing:0!important;
    text-wrap:pretty;
    overflow-wrap:normal;
}

html[lang^="ar"] .ms-shop-page h1,
body.rtl .ms-shop-page h1{
    font-size:clamp(40px,4.6vw,64px)!important;
    max-width:780px;
}
html[lang^="ar"] .ms-shop-page h2,
body.rtl .ms-shop-page h2{
    font-size:clamp(30px,3.25vw,46px)!important;
}
html[lang^="ar"] .ms-shop-featured-name,
body.rtl .ms-shop-featured-name{
    line-height:1.35!important;
}

html[lang^="ar"] .ms-pc h1,
body.rtl .ms-pc h1{
    font-size:clamp(36px,4.4vw,60px)!important;
    line-height:1.3!important;
}
html[lang^="ar"] .ms-pc h2,
body.rtl .ms-pc h2{
    font-size:clamp(30px,3.4vw,46px)!important;
    line-height:1.32!important;
}

html[lang^="ar"] .ms-cart-hero h1,
body.rtl .ms-cart-hero h1,
html[lang^="ar"] .ms-checkout-page h1,
body.rtl .ms-checkout-page h1{
    font-size:clamp(38px,4.6vw,62px)!important;
    line-height:1.3!important;
}

html[lang^="ar"] :where(.ms-shop-lead,.ms-shop-featured-text,.ms-cart-page p,.ms-checkout-page p,.ms-pc p),
body.rtl :where(.ms-shop-lead,.ms-shop-featured-text,.ms-cart-page p,.ms-checkout-page p,.ms-pc p){
    line-height:1.9!important;
}

/* Mixed Arabic/Latin product titles and prices remain stable in bidi layout. */
html[lang^="ar"] :where(.product-name,.ms-shop-featured-name,.ms-pc-card h3,.woocommerce-Price-amount),
body.rtl :where(.product-name,.ms-shop-featured-name,.ms-pc-card h3,.woocommerce-Price-amount){
    unicode-bidi:plaintext;
}

@media (max-width:767px){
    html[lang^="ar"] .ms-shop-page h1,
    body.rtl .ms-shop-page h1,
    html[lang^="ar"] .ms-cart-hero h1,
    body.rtl .ms-cart-hero h1{
        font-size:clamp(34px,10.5vw,48px)!important;
        line-height:1.32!important;
    }
    html[lang^="ar"] .ms-shop-page h2,
    body.rtl .ms-shop-page h2{
        font-size:clamp(28px,8vw,40px)!important;
        line-height:1.34!important;
    }
}


/* v3.1.56 — Arabic Journal title optical fix.
   Some theme/browser decoration rules can visually cut through connected
   Arabic glyphs. Force the Core-owned article title to stay undecorated and
   give Arabic display glyphs enough vertical room. */
html[lang^="ar"] .ms-single-journal .ms-article-title,
body.rtl .ms-single-journal .ms-article-title{
    text-decoration:none!important;
    text-decoration-line:none!important;
    -webkit-text-decoration:none!important;
    text-decoration-skip-ink:auto!important;
    font-size:clamp(40px,5.4vw,68px)!important;
    line-height:1.32!important;
    letter-spacing:0!important;
    text-wrap:balance;
}

@media (max-width:767px){
    html[lang^="ar"] .ms-single-journal .ms-article-title,
    body.rtl .ms-single-journal .ms-article-title{
        font-size:clamp(34px,10vw,48px)!important;
        line-height:1.38!important;
    }
}


/* v3.1.60 — AR legal long-form readability. */
html[lang^="ar"] :where(.ms-legal-prose,.ms-terms-prose,.ms-shipping-prose){
    line-height:1.95!important;
    letter-spacing:0!important;
    text-align:start;
}
html[lang^="ar"] :where(.ms-legal-copy h2,.ms-terms-copy h2,.ms-shipping-copy h2){
    line-height:1.42!important;
    letter-spacing:0!important;
}
