/* ============================
   📐 MathJax & LaTeX Responsiveness Fix
   ============================ */

/* Make MathJax containers responsive */
mjx-container {
    overflow-x: auto;         /* allow scroll on small screens if content is wide */
    display: block;           /* make sure it's a block element */
    white-space: normal;      /* allow wrapping */
    max-width: 100%;          /* don't exceed container width */
    box-sizing: border-box;   /* consistent sizing */
    padding-bottom: 0.5rem;   /* spacing for mobile readability */
}

/* Avoid inline-block overflow from MathJax */
mjx-container[display="block"] {
    text-align: left !important;
}

/* For LaTeX arrays/tables */
mjx-mtable {
    max-width: 100% !important;
    display: block !important;
    overflow-x: auto !important;
}

/* Adjust font size on smaller devices */
@media (max-width: 768px) {
    mjx-container {
        font-size: 0.9rem !important; /* reduce font size slightly */
    }
}

@media (max-width: 480px) {
    mjx-container {
        font-size: 0.8rem !important; /* further reduce on very small screens */
    }
}
