/* Advanced Persian Justify Styles - Version 1.1 */

/* Kashida styling */
[lang="fa"] .justified-text,
[lang="ar"] .justified-text,
.persian-justified {
    text-align: justify;
    text-justify: inter-word;
    line-height: 1.8;
    word-spacing: normal;
}

/* Better text rendering for kashida */
body:lang(fa) *,
body:lang(ar) * {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* RTL support */
.rtl .justified-text,
[dir="rtl"] .justified-text {
    direction: rtl;
    text-align: justify;
}

/* Exclude certain elements */
.no-justify,
h1, h2, h3, h4, h5, h6,
.title, .heading, .caption {
    text-align: inherit !important;
    text-justify: inherit !important;
}

/* Print styles */
@media print {
    .justified-text,
    [lang="fa"], [lang="ar"] {
        text-align: justify !important;
        text-justify: inter-word !important;
    }
}

/* Fix for justified text in containers */
.justified-container {
    overflow-wrap: break-word;
    hyphens: manual;
}

/* Smooth kashida rendering */
@supports (text-justify: inter-word) {
    .persian-justified {
        text-justify: inter-word;
        -moz-text-align-last: justify;
        text-align-last: justify;
    }
}