/* ============================================================
   URDU TYPOGRAPHY SYSTEM — Professional Book-Style Reading
   (v2 — sizes reduced after "too big / overlapping" feedback;
   the nowrap trick is now scoped ONLY to the Learning Outcomes
   heading — that was the actual cause of headings overflowing
   into the content below on laptop screens)
   ============================================================ */

/* ---------- READING CONTAINER WIDTH ---------- */
.up-single-chapter,
.up-single-quiz-page {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding-inline: 24px;
    box-sizing: border-box;
}

/* ---------- HEADING HIERARCHY (reduced, comfortable sizes) ---------- */

/* 1. Chapter Title */
.up-chapter-hero h1 {
    font-size: 34px !important;
    font-weight: 700 !important;
    text-align: center !important;
    margin-bottom: 18px !important;
    line-height: 1.4;
}

/* 2. Section Headings (خلاصہ, الفاظ و معانی, اہم سوالات, etc.) */
.up-chapter-block h2,
.up-chapter-video h2,
.up-chapter-pdf h2 {
    font-size: 24px !important;
    font-weight: 700 !important;
    text-align: center !important;
    margin-bottom: 18px !important;
    line-height: 1.4;
    white-space: normal; /* headings wrap normally — nowrap was the overlap bug */
}

/* 3. Sub Headings (if any h3 used within a block) */
.up-chapter-block h3 {
    font-size: 20px !important;
    font-weight: 700 !important;
    text-align: center !important;
    margin-bottom: 16px !important;
    line-height: 1.4;
}

/* ---------- PARAGRAPH TYPOGRAPHY ---------- */
.up-chapter-content p,
.up-chapter-block p,
.up-chapter-review-answers,
.up-short-description p {
    font-size: 18px !important;
    line-height: 1.9 !important;
    font-weight: 400 !important;
    text-align: justify !important;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- LISTS — right-aligned, never justified ---------- */
.up-chapter-block ul,
.up-chapter-block ol {
    text-align: right !important;
    font-size: 18px;
    line-height: 1.9;
}
.up-chapter-block li {
    margin-bottom: 8px;
}

/* ---------- SECTION SPACING (reduced to match smaller fonts) ---------- */
.up-chapter-hero {
    margin-bottom: 32px;
}
.up-chapter-content {
    margin-bottom: 32px;
}
.up-chapter-block,
.up-chapter-video,
.up-chapter-pdf {
    margin-bottom: 40px !important;
}
.up-chapter-block h2 + p,
.up-chapter-block h2 + div {
    margin-top: 0;
}

/* ---------- "Learning Outcomes" heading: nowrap ONLY here, not globally ---------- */
.up-learning-objectives h2 {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: keep-all;
}

.up-chapter-block {
    text-align: center;
}

/* ---------- MOBILE RESPONSIVE (covers 320 / 360 / 390 / 412 / 768) ---------- */
@media (max-width: 768px) {
    .up-single-chapter,
    .up-single-quiz-page {
        padding-inline: 16px;
    }

    .up-chapter-hero h1 {
        font-size: 26px !important;
        margin-bottom: 16px !important;
    }

    .up-chapter-block h2,
    .up-chapter-video h2,
    .up-chapter-pdf h2 {
        font-size: 20px !important;
        margin-bottom: 16px !important;
    }

    .up-chapter-block h3 {
        font-size: 17px !important;
        margin-bottom: 14px !important;
    }

    .up-chapter-content p,
    .up-chapter-block p,
    .up-short-description p {
        font-size: 16.5px !important;
        line-height: 1.85 !important;
    }

    .up-chapter-block ul,
    .up-chapter-block ol {
        font-size: 16.5px;
        line-height: 1.85;
    }

    .up-chapter-block,
    .up-chapter-video,
    .up-chapter-pdf {
        margin-bottom: 28px !important;
    }
}

/* Extra safety for the smallest common phones (320-412px) —
   keeps the Learning Outcomes heading on one line without clipping */
@media (max-width: 400px) {
    .up-learning-objectives h2 {
        font-size: 16px !important;
    }
}

/* ---------- NEVER MIX CENTER + JUSTIFY IN THE SAME BLOCK ---------- */
.up-chapter-block table,
.up-chapter-block td,
.up-chapter-block th {
    text-align: right !important;
}

.up-teacher-notes,
.up-student-notes,
.up-keywords-block,
.up-quiz-block {
    text-align: center;
}
.up-teacher-notes p,
.up-student-notes p {
    text-align: justify !important;
}

/* ---------- ISSUE 3 FIX: spacing between heading and PDF viewer (mobile) ---------- */
.up-pdf-viewer-wrap {
    margin-top: 24px;
}
@media (max-width: 768px) {
    .up-chapter-hero + .up-pdf-viewer-wrap,
    .up-chapter-content + .up-pdf-viewer-wrap {
        margin-top: 20px;
    }
    .up-pdf-viewer-wrap {
        margin-bottom: 16px;
    }
}
