/* ============================================================
   دار بسمة — نظام الخطوط الموحّد | Rubik
   تاريخ: سبتمبر 2026
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;700&display=swap');

/* ============================================================
   1. تطبيق Rubik على كامل الموقع
   ============================================================ */
:root {
    --font-primary: 'Rubik', 'Segoe UI', Tahoma, Arial, sans-serif;
}

body,
.primary-font,
header .master-menu ul.navbar-nav,
header .social-barre .search-bar,
header .master-menu .navbar-brand p,
.alert,
.blog-card,
.master-content .contact-form,
section .h2, section h2,
section p,
footer .copyright,
footer .designer,
footer .partenaire,
footer .signature span,
footer .signature ul.submenu,
footer .block-newsletter .title-newsletter .h2,
footer .block-newsletter .title-newsletter h2,
footer .block-newsletter .title-newsletter p,
footer .block-newsletter .newsletter input,
footer .block-newsletter .newsletter select {
    font-family: var(--font-primary) !important;
}

body {
    font-size: 17px;
    font-weight: 400;
    color: #1A1A1A;
    line-height: 1.7;
}

/* ============================================================
   2. المدونة
   ============================================================ */

/* حاوية نص المقالة */
.main-content article,
.main-content .post-body,
.main-content .blog-content,
.main-content .post-content {
    max-width: 750px;
    margin-inline: auto;
}

/* H1 — 34px حاسوب / 26px هاتف */
.main-content article h1,
.main-content .post-body h1,
.post-title-main {
    font-family: var(--font-primary) !important;
    font-size: 34px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.4;
}

/* H2 — 26px حاسوب / 20px هاتف */
.main-content article h2,
.main-content .post-body h2 {
    font-family: var(--font-primary) !important;
    font-size: 26px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.4;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

/* H3 — 22px حاسوب / 19px هاتف */
.main-content article h3,
.main-content .post-body h3 {
    font-family: var(--font-primary) !important;
    font-size: 22px;
    font-weight: 600;
    color: #2B2B2B;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* نص الفقرة — 17px حاسوب / 16px هاتف */
.main-content article p,
.main-content .post-body p {
    font-family: var(--font-primary) !important;
    font-size: 17px;
    font-weight: 400;
    color: #2B2B2B;
    line-height: 1.8;
    text-align: right !important;
}

/* روابط داخل المقالة */
.main-content article a,
.main-content .post-body a {
    color: #0581bf;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}
.main-content article a:hover,
.main-content .post-body a:hover {
    color: #035f8a;
}

/* ============================================================
   3. صفحات الكتب والإصدارات
   ============================================================ */

/* عنوان الكتاب في صفحته المستقلة — 34px حاسوب / 26px هاتف */
.master-content .edition-details p.title_book {
    font-family: var(--font-primary) !important;
    font-size: 34px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.4;
}

/* العناوين الجانبية — 22px حاسوب / 19px هاتف */
.edition-item__title,
.info-edition h3,
.info-edition .h3 {
    font-family: var(--font-primary) !important;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.4;
}

/* نبذة الكتاب وسيرة الكاتب — 16px حاسوب / 15px هاتف */
.master-content .edition-details p:not(.title_book):not(.link-edition),
.master-content .edition-details .author p,
p.brief-author {
    font-family: var(--font-primary) !important;
    font-size: 16px;
    font-weight: 400;
    color: #2B2B2B;
    line-height: 1.6;
    text-align: right !important;
}

/* ============================================================
   4. شبكة الإصدارات — بطاقات الكتب
   ============================================================ */

/* عنوان الكتاب في البطاقة — 16px حاسوب / 15px هاتف */
.edition-boxes .edition-item .info-edition .edition-item__title,
.edition-boxes .edition-item .info-edition h3,
.edition-boxes .edition-item .info-edition .h3 {
    font-family: var(--font-primary) !important;
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.4;
    text-align: right;
    /* اقتطاع بعد سطرين */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* اسم المؤلف في البطاقة — 14px حاسوب / 13px هاتف */
.edition-boxes .edition-item .info-edition p.writer {
    font-family: var(--font-primary) !important;
    font-size: 14px;
    font-weight: 400;
    color: #555555;
    text-align: right;
}

/* ============================================================
   5. أزرار CTA — 16px Bold
   ============================================================ */
.master-content a.button,
.btn-primary,
.btn-success,
.btn-warning,
.btn-outline-primary {
    font-family: var(--font-primary) !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}

/* ============================================================
   6. Responsive — الهاتف (max-width: 768px) — تقليل ~20%
   ============================================================ */
@media (max-width: 768px) {

    body { font-size: 16px; }

    /* H1 — 26px */
    .main-content article h1,
    .main-content .post-body h1,
    .post-title-main,
    .master-content .edition-details p.title_book {
        font-size: 26px;
    }

    /* H2 — 20px */
    .main-content article h2,
    .main-content .post-body h2 {
        font-size: 20px;
    }

    /* H3 — 19px */
    .main-content article h3,
    .main-content .post-body h3 {
        font-size: 19px;
    }

    /* نص المقالة — 16px */
    .main-content article p,
    .main-content .post-body p {
        font-size: 16px;
        line-height: 1.7;
    }

    /* نبذة الكتاب — 15px */
    .master-content .edition-details p:not(.title_book):not(.link-edition),
    .master-content .edition-details .author p,
    p.brief-author {
        font-size: 15px;
    }

    /* عنوان الكتاب في البطاقة — 15px */
    .edition-boxes .edition-item .info-edition .edition-item__title,
    .edition-boxes .edition-item .info-edition h3,
    .edition-boxes .edition-item .info-edition .h3 {
        font-size: 15px;
    }

    /* اسم المؤلف في البطاقة — 13px */
    .edition-boxes .edition-item .info-edition p.writer {
        font-size: 13px;
    }

    /* حاوية المقالة */
    .main-content article,
    .main-content .post-body,
    .main-content .blog-content,
    .main-content .post-content {
        max-width: 100%;
    }
}

/* شاشات صغيرة جداً — max-width: 400px */
@media (max-width: 400px) {

    /* H1 — 24px */
    .main-content article h1,
    .main-content .post-body h1,
    .post-title-main,
    .master-content .edition-details p.title_book {
        font-size: 24px;
    }

    /* H2 — 19px */
    .main-content article h2,
    .main-content .post-body h2 {
        font-size: 19px;
    }
}

/* ============================================================
   إصلاح justify المُضمَّن في HTML — يُلغي inline style
   ============================================================ */
.main-content article p[dir],
.main-content .post-body p[dir],
div.main-content p[style*="justify"],
article p[style*="justify"],
.main-content p[dir="RTL"],
.main-content p[dir="rtl"] {
    text-align: right !important;
}

/* ============================================================
   ضبط الفقرات — Justify محسَّن للعربية
   يوزع النص بالتساوي بين الهامشين بدون فراغات عشوائية
   ============================================================ */
.main-content article p,
.main-content .post-body p,
.main-content article p[dir],
.main-content .post-body p[dir],
div.main-content p[style*="justify"],
article p[style*="justify"],
.main-content p[dir="RTL"],
.main-content p[dir="rtl"] {
    text-align: justify !important;
    text-justify: inter-word !important;
    hyphens: none !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

/* السطر الأخير من كل فقرة — يبقى لليمين */
.main-content article p::after,
.main-content .post-body p::after {
    content: '';
    display: inline-block;
    width: 100%;
}

/* ============================================================
   إصلاح السطر الأخير — يبقى لليمين بدون تمدد
   ============================================================ */
.main-content article p,
.main-content .post-body p,
.main-content article p[dir],
.main-content .post-body p[dir],
div.main-content p[style*="justify"],
article p[style*="justify"],
.main-content p[dir="RTL"],
.main-content p[dir="rtl"] {
    text-align-last: right !important;
}

/* إلغاء الـ ::after السابق */
.main-content article p::after,
.main-content .post-body p::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
}

/* ============================================================
   محاذاة Justify شاملة — كل الموقع حاسوب وهاتف
   ============================================================ */

/* كل فقرة في الموقع */
p {
    text-align: justify !important;
    text-justify: inter-word !important;
    text-align-last: right !important;
    hyphens: none !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

/* استثناء عناصر لا يناسبها justify */
.navbar p,
.nav p,
footer .copyright p,
.badge p,
.btn p,
.reader-user-info p,
.dropdown p,
.alert p,
.db-toast p,
.edition-item__meta p,
.edition-boxes .edition-item .info-edition p.writer {
    text-align: right !important;
    text-align-last: right !important;
    text-justify: auto !important;
}

/* ============================================================
   تصغير نبذة الكتاب والمؤلف على الهاتف
   ============================================================ */
@media (max-width: 768px) {

    /* نبذة الكتاب */
    .master-content .edition-details p:not(.title_book):not(.link-edition),
    p.brief-author {
        font-size: 14px !important;
        line-height: 1.75 !important;
    }

    /* نبذة المؤلف */
    .master-content .edition-details .author p,
    .master-content .author p,
    .author-bio p {
        font-size: 14px !important;
        line-height: 1.75 !important;
    }
}

@media (max-width: 400px) {

    .master-content .edition-details p:not(.title_book):not(.link-edition),
    p.brief-author,
    .master-content .edition-details .author p {
        font-size: 13px !important;
        line-height: 1.7 !important;
    }
}

/* ============================================================
   إصلاح نبذة الكتاب والمؤلف — هاتف وحاسوب
   ============================================================ */

/* نبذة الكتاب — كل الفقرات داخل edition-details */
.master-content .edition-details *,
.master-content .edition-details p,
.master-content .edition-details div,
.master-content .edition-details span {
    text-align: justify !important;
    text-align-last: right !important;
    text-justify: inter-word !important;
    font-size: 15px !important;
    line-height: 1.75 !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
}

/* نبذة المؤلف — داخل author block */
.master-content .edition-details .author *,
.master-content .edition-details .author p,
.master-content .edition-details .author div {
    text-align: justify !important;
    text-align-last: right !important;
    font-size: 15px !important;
    line-height: 1.75 !important;
}

/* عنوان الكتاب — لا يتأثر بالتغييرات أعلاه */
.master-content .edition-details p.title_book {
    font-size: 28px !important;
    text-align: right !important;
    text-align-last: right !important;
    line-height: 1.4 !important;
}

@media (max-width: 768px) {

    .master-content .edition-details *,
    .master-content .edition-details p,
    .master-content .edition-details div,
    .master-content .edition-details span {
        font-size: 14px !important;
        line-height: 1.75 !important;
    }

    .master-content .edition-details .author *,
    .master-content .edition-details .author p {
        font-size: 14px !important;
    }

    .master-content .edition-details p.title_book {
        font-size: 22px !important;
    }
}

/* ============================================================
   تثبيت 15px لنبذة الكتاب والمؤلف على الهاتف
   ============================================================ */
@media (max-width: 768px) {

    /* نبذة الكتاب */
    .master-content .edition-details *,
    .master-content .edition-details p,
    .master-content .edition-details div,
    .master-content .edition-details span {
        font-size: 15px !important;
        line-height: 1.75 !important;
    }

    /* نبذة المؤلف */
    .master-content .edition-details .author *,
    .master-content .edition-details .author p,
    .master-content .edition-details .author div {
        font-size: 15px !important;
        line-height: 1.75 !important;
    }

    /* عنوان الكتاب — لا يتأثر */
    .master-content .edition-details p.title_book {
        font-size: 22px !important;
    }
}

/* ============================================================
   محاذاة نبذة الكتاب والمؤلف — هاتف وحاسوب
   ============================================================ */
@media (max-width: 768px) {

    .master-content .edition-details *,
    .master-content .edition-details p,
    .master-content .edition-details div,
    .master-content .edition-details span,
    .master-content .edition-details .author *,
    .master-content .edition-details .author p,
    .master-content .edition-details .author div {
        text-align: justify !important;
        text-align-last: right !important;
        text-justify: inter-word !important;
        font-size: 15px !important;
        line-height: 1.75 !important;
    }

    /* عنوان الكتاب — يمين فقط */
    .master-content .edition-details p.title_book {
        font-size: 22px !important;
        text-align: right !important;
        text-align-last: right !important;
    }
}

/* ============================================================
   إصلاح المحاذاة — يتغلب على inline style من قاعدة البيانات
   يستهدف الحاويتين المباشرتين للنص الخام
   ============================================================ */
.book-brief-text p,
.book-brief-text p[style],
.book-brief-text span,
.book-brief-text span[style],
.book-brief-text div,
.book-brief-text div[style] {
    text-align: justify !important;
    text-align-last: right !important;
    text-justify: inter-word !important;
}

/* نبذة المؤلف — السطر 413 */
.master-content .edition-details .author > p,
.master-content .edition-details .author > p[style],
.master-content .edition-details .author p *,
.master-content .edition-details .author p span[style] {
    text-align: justify !important;
    text-align-last: right !important;
    text-justify: inter-word !important;
}

@media (max-width: 768px) {
    .book-brief-text p,
    .book-brief-text p[style],
    .book-brief-text span,
    .book-brief-text div {
        font-size: 15px !important;
        line-height: 1.75 !important;
        text-align: justify !important;
        text-align-last: right !important;
    }

    .master-content .edition-details .author > p,
    .master-content .edition-details .author p * {
        font-size: 15px !important;
        line-height: 1.75 !important;
        text-align: justify !important;
        text-align-last: right !important;
    }
}

/* ============================================================
   نبذة الكتاب — محاذاة Justify شاملة حاسوب وهاتف
   يتغلب على inline style من قاعدة البيانات
   ============================================================ */
.book-brief-text,
.book-brief-text p,
.book-brief-text p[style],
.book-brief-text span,
.book-brief-text span[style],
.book-brief-text div,
.book-brief-text div[style] {
    text-align: justify !important;
    text-align-last: right !important;
    text-justify: inter-word !important;
    hyphens: none !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    font-size: 15px !important;
    line-height: 1.75 !important;
}

/* ============================================================
   نبذة المؤلف — إصلاح النص المختلط عربي/إنجليزي
   وتحسين التفاف النص حول صورة المؤلف
   ============================================================ */
.master-content .edition-details .author {
    overflow: hidden;
}

.master-content .edition-details .author .avatar {
    float: left;
    margin: 0 0 10px 12px;
    shape-outside: circle(50%);
}

.master-content .edition-details .author p,
.master-content .edition-details .author p[style],
.master-content .edition-details .author p span,
.master-content .edition-details .author p span[style] {
    text-align: justify !important;
    text-align-last: right !important;
    text-justify: inter-word !important;
    unicode-bidi: plaintext !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}
