/* Rayvina Gold - Persian (/fa/) global RTL layer
 * Loaded only when the public URL language is Persian.
 */
html[dir="rtl"] body.rv-lang-fa {
    direction: rtl;
    text-align: right;
}

/* Make all normal site copy follow the Persian reading direction. */
html[dir="rtl"] body.rv-lang-fa :where(
    main,
    section,
    article,
    aside,
    nav,
    header,
    footer,
    .page-shell,
    .article-page,
    .article-content,
    .entry-content,
    .woocommerce,
    .woocommerce-page
) {
    direction: rtl;
}

html[dir="rtl"] body.rv-lang-fa :where(
    h1,h2,h3,h4,h5,h6,p,li,dt,dd,
    .entry-title,.entry-content,.page-title,
    .article-header,.article-content,.post-card-body,
    .woocommerce,.woocommerce-page
) {
    text-align: right;
}

/* WordPress/editor lists should indent from the Persian start edge. */
html[dir="rtl"] body.rv-lang-fa :where(.entry-content,.article-content,.page-shell) :where(ul,ol) {
    padding-inline-start: 1.6em;
    padding-inline-end: 0;
}

/* Forms and WooCommerce fields. */
html[dir="rtl"] body.rv-lang-fa :where(input,textarea,select,.select2-selection) {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] body.rv-lang-fa :where(input[type="email"],input[type="url"],input[type="tel"],input[type="number"]) {
    unicode-bidi: plaintext;
}

/* Keep deliberately LTR/visual-only components intact. */
html[dir="rtl"] body.rv-lang-fa :where(
    .brand,
    .brand-name,
    .language-switch,
    .hero-visual,
    .flag,
    .ip-badge,
    code,pre,kbd,samp
) {
    direction: ltr;
}

/* Elements designed to stay centered should remain centered. */
html[dir="rtl"] body.rv-lang-fa :where(
    .feature,
    .service-tile,
    .countries,
    .phone,
    .about-connection-card,
    .text-center,
    .has-text-align-center
) {
    text-align: center;
}

/* Native WordPress alignment classes map correctly in RTL. */
html[dir="rtl"] body.rv-lang-fa .has-text-align-left { text-align: right !important; }
html[dir="rtl"] body.rv-lang-fa .has-text-align-right { text-align: left !important; }

/* Article floated media: mirror desktop editorial alignment. */
@media (min-width: 601px) {
    html[dir="rtl"] body.rv-lang-fa .article-content .alignleft {
        float: right;
        margin: 0 0 18px 22px;
    }
    html[dir="rtl"] body.rv-lang-fa .article-content .alignright {
        float: left;
        margin: 0 22px 18px 0;
    }
}


/* v1.0.22: force every normal WordPress Page below /fa/ to RTL.
 * rv-fa-url comes directly from REQUEST_URI, therefore this also covers
 * custom/static pages that do not rely on translated page metadata.
 */
html[dir="rtl"] body.rv-fa-url.page,
html[dir="rtl"] body.rv-fa-url.page main,
html[dir="rtl"] body.rv-fa-url.page .page-shell,
html[dir="rtl"] body.rv-fa-url.page article,
html[dir="rtl"] body.rv-fa-url.page .prose,
html[dir="rtl"] body.rv-fa-url.page .entry-content,
html[dir="rtl"] body.rv-fa-url.page .page-content {
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] body.rv-fa-url.page :where(
    .prose, .entry-content, .page-content,
    .wp-site-blocks, .wp-block-post-content,
    .elementor, .elementor-section, .elementor-container,
    .elementor-column, .elementor-widget-wrap, .elementor-widget-container,
    .elementor-widget-text-editor, .elementor-heading-title
) {
    direction: rtl !important;
}

html[dir="rtl"] body.rv-fa-url.page :where(
    .prose, .entry-content, .page-content, .wp-block-post-content,
    .elementor-widget-text-editor, .elementor-heading-title
) :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,blockquote,figcaption,label,th,td) {
    direction: rtl !important;
    text-align: right !important;
}

/* Also catch headings/text widgets where the text node is on the widget itself. */
html[dir="rtl"] body.rv-fa-url.page :where(
    .prose h1,.prose h2,.prose h3,.prose h4,.prose h5,.prose h6,.prose p,
    .entry-content h1,.entry-content h2,.entry-content h3,.entry-content h4,.entry-content h5,.entry-content h6,.entry-content p,
    .page-content h1,.page-content h2,.page-content h3,.page-content h4,.page-content h5,.page-content h6,.page-content p,
    .elementor-heading-title,.elementor-widget-text-editor,.elementor-widget-text-editor p
) {
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] body.rv-fa-url.page :where(.prose,.entry-content,.page-content,.wp-block-post-content) :where(ul,ol) {
    direction: rtl !important;
    text-align: right !important;
    padding-right: 1.6em !important;
    padding-left: 0 !important;
}

html[dir="rtl"] body.rv-fa-url.page :where(input:not([type="email"]):not([type="url"]),textarea,select) {
    direction: rtl !important;
    text-align: right !important;
}

/* Respect explicit centered content and visual/LTR data. */
html[dir="rtl"] body.rv-fa-url.page :where(.has-text-align-center,.text-center,.elementor-align-center) {
    text-align: center !important;
}
html[dir="rtl"] body.rv-fa-url.page :where(code,pre,kbd,samp,.brand,.brand-name,.language-switch) {
    direction: ltr !important;
}

/* Direct classes emitted by page.php for Persian WordPress Pages. */
.rv-fa-page-shell,
.rv-fa-page-content {
    direction: rtl !important;
    text-align: right !important;
}
.rv-fa-page-content :where(h1,h2,h3,h4,h5,h6,p,li,blockquote,figcaption,th,td) {
    direction: rtl !important;
    text-align: right !important;
}
