/* ============================================
   PANDOC CONTENT — Word Style
   ============================================ */

.pandoc-content {
    font-family: "Calibri", "Segoe UI", Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.65;
    color: #1a1a1a;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   HEADINGS
   ============================================ */

.pandoc-content h1 {
    font-size: 22pt;
    color: #1F4E79;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d0d7de;
    scroll-margin-top: 100px;
    font-weight: 700;
    line-height: 1.3;
}

.pandoc-content h2 {
    font-size: 17pt;
    color: #1F4E79;
    margin: 28px 0 14px;
    scroll-margin-top: 100px;
    font-weight: 700;
    line-height: 1.3;
}

.pandoc-content h3 {
    font-size: 14pt;
    color: #2E74B5;
    margin: 24px 0 12px;
    scroll-margin-top: 100px;
    font-weight: 600;
    line-height: 1.3;
}

.pandoc-content h4 {
    font-size: 12pt;
    color: #2E74B5;
    margin: 20px 0 10px;
    scroll-margin-top: 100px;
    font-weight: 600;
    line-height: 1.3;
}

/* ============================================
   PARAGRAPHS
   ============================================ */

.pandoc-content p {
    margin: 12px 0;
    text-align: justify;
    line-height: 1.65;
}

.pandoc-content p:first-child {
    margin-top: 0;
}

/* ============================================
   LISTS
   ============================================ */

.pandoc-content ul,
.pandoc-content ol {
    margin: 12px 0;
    padding-left: 32px;
    line-height: 1.65;
}

.pandoc-content li {
    margin-bottom: 6px;
    line-height: 1.6;
}

/* ============================================
   IMAGES
   ============================================ */

.pandoc-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
}

.pandoc-content figure {
    margin: 20px 0;
    text-align: center;
}

.pandoc-content figcaption {
    margin-top: 8px;
    font-size: 10pt;
    font-style: italic;
    color: #555;
    text-align: center;
    line-height: 1.4;
}

/* ============================================
   TABLES
   ============================================ */

.pandoc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 10.5pt;
}

.pandoc-content table th {
    background-color: #f2f2f2;
    font-weight: 600;
    text-align: left;
    padding: 8px 10px;
    border: 1px solid #bfbfbf;
    color: #1a1a1a;
}

.pandoc-content table td {
    padding: 8px 10px;
    border: 1px solid #bfbfbf;
    vertical-align: top;
    line-height: 1.4;
    text-align: left;
}

.pandoc-content table tr:nth-child(even) td {
    background-color: #fafafa;
}

.pandoc-content table p {
    margin: 0;
    padding: 0;
    text-align: left;
}

/* ============================================
   CODE
   ============================================ */

.pandoc-content code {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 10pt;
    background-color: #f5f5f5;
    padding: 2px 5px;
    border-radius: 3px;
    color: #c7254e;
}

.pandoc-content pre {
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px 15px;
    overflow-x: auto;
    line-height: 1.4;
    margin: 14px 0;
}

.pandoc-content pre code {
    background: none;
    padding: 0;
    color: #333;
}

/* ============================================
   LINKS
   ============================================ */

.pandoc-content a {
    color: #0563C1;
    text-decoration: none;
}

.pandoc-content a:hover {
    text-decoration: underline;
}

/* ============================================
   BOLD / ITALIC
   ============================================ */

.pandoc-content strong,
.pandoc-content b {
    font-weight: 600;
    color: #000;
}

.pandoc-content em,
.pandoc-content i {
    font-style: italic;
}

/* ============================================
   ✅ EQUATIONS — FINAL BULLETPROOF FIX
   ============================================ */

/* MathJax ka overflow scrollbar disable */
.pandoc-content mjx-container,
.pandoc-content mjx-container[jax="CHTML"] {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

.pandoc-content mjx-container::-webkit-scrollbar,
.pandoc-content mjx-container *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* MathJax display equation */
.pandoc-content mjx-container[display="true"] {
    display: block !important;
    text-align: center;
    margin: 20px 0 !important;
}

/* MathJax inline equation */
.pandoc-content mjx-container:not([display="true"]) {
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
}

/* ============================================
   EQUATION BLOCKS — Flex Layout
   ============================================ */

/* ✅ Blockquote wale equations */
.pandoc-content blockquote {
    margin: 20px 0;
    padding: 12px 24px;
    background: #fafbfc;
    border-left: 3px solid #2E74B5;
    border-radius: 6px;
    font-style: normal;
    overflow: visible;
}

.pandoc-content blockquote p {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    gap: 20px;
    overflow: visible;
}

/* ✅ Direct <p> wale equations (jaise 8.3) */
.pandoc-content p.equation-paragraph {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    padding: 12px 24px;
    background: #fafbfc;
    border-left: 3px solid #2E74B5;
    border-radius: 6px;
    flex-wrap: nowrap;
    gap: 20px;
    overflow: visible;
}

/* Equation part */
.pandoc-content blockquote p .eq-part,
.pandoc-content p.equation-paragraph .eq-part {
    flex: 1 1 auto;
    text-align: center;
    padding-right: 20px;
    min-width: 0;
    overflow: visible;
}

/* Equation number */
.pandoc-content blockquote p .eq-number,
.pandoc-content p.equation-paragraph .eq-number {
    flex: 0 0 auto;
    margin-left: 30px;
    padding-left: 15px;
    font-family: "Calibri", "Segoe UI", sans-serif;
    font-size: 11pt;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    font-style: normal;
    border-left: 1px solid #e0e0e0;
}

/* Fallback: agar JS wrapper na lage — direct children se handle */
.pandoc-content blockquote p > span.math.inline,
.pandoc-content blockquote p > mjx-container,
.pandoc-content p.equation-paragraph > span.math.inline,
.pandoc-content p.equation-paragraph > mjx-container {
    flex: 1 1 auto;
    margin: 0 !important;
    display: inline-block !important;
    text-align: center;
    padding-right: 20px;
    min-width: 0;
    overflow: visible;
}

.pandoc-content blockquote p > *:last-child,
.pandoc-content p.equation-paragraph > *:last-child {
    flex: 0 0 auto;
    white-space: nowrap;
    margin-left: 30px;
    padding-left: 15px;
    border-left: 1px solid #e0e0e0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .pandoc-content {
        font-size: 11pt;
    }

    .pandoc-content blockquote p,
    .pandoc-content p.equation-paragraph {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .pandoc-content blockquote p .eq-number,
    .pandoc-content p.equation-paragraph .eq-number,
    .pandoc-content blockquote p > *:last-child,
    .pandoc-content p.equation-paragraph > *:last-child {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        align-self: flex-end;
    }

    .pandoc-content table {
        display: block;
        overflow-x: auto;
    }
}

