/* College CMS — Mobile Content Fix v3
   File: public/css/mobile-content-fix.css
   REPLACE existing file */

/* ======= GLOBAL ======= */
html, body { overflow-x: hidden; max-width: 100vw; }
article, main, .prose, .ac {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ======= FIX 3: White background, no side gaps on mobile ======= */
@media (max-width: 768px) {
    body { background: #fff !important; }
    main { background: #fff !important; }
    main > div, main > section,
    main > div > div {
        background: #fff !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    /* Remove card-style borders on mobile */
    main .rounded-lg, main .rounded-xl, main .rounded-2xl,
    main .shadow, main .shadow-sm, main .shadow-md {
        border-radius: 0 !important;
        box-shadow: none !important;
    }
}

/* ======= FIX 2: Heading spacing — before and after ======= */
main h2, article h2 {
    margin-top: 2em !important;
    margin-bottom: 0.7em !important;
    padding-top: 1.2em !important;
    border-top: 1px solid #e2e8f0;
    line-height: 1.35;
}

main h2:first-child, article h2:first-child {
    border-top: none;
    margin-top: 0.5em !important;
    padding-top: 0 !important;
}

main h3, article h3 {
    margin-top: 1.8em !important;
    margin-bottom: 0.5em !important;
    line-height: 1.38;
}

main h4, article h4 {
    margin-top: 1.3em !important;
    margin-bottom: 0.4em !important;
}

/* ======= FIX 1: FAQ styling — Q&A clearly separated ======= */
/* Target FAQ headings (h3 starting with Q.) */
main h3[id*="q"], article h3[id*="q"],
main h3[id*="faq"], article h3[id*="faq"] {
    margin-top: 1.5em !important;
    padding-top: 1em !important;
    border-top: 1px solid #e2e8f0;
}

/* FAQ section header */
main h2:last-of-type, article h2:last-of-type {
    margin-top: 2.5em !important;
}

/* Style all Q. and A. patterns in content */
main p, article p {
    margin-bottom: 1em;
}

/* Questions: bold, blue-left-border, background */
main p:has(> strong:first-child),
main p > strong:first-child {
    color: #1e293b;
}

/* Target Q. lines specifically */
main h3:has(+ p), article h3:has(+ p) {
    background: #f8fafc;
    padding: 12px 16px !important;
    border-radius: 8px;
    border-left: 4px solid #2563eb;
    margin-top: 1.5em !important;
    margin-bottom: 0.3em !important;
    font-size: 1.05em;
}

/* Answer paragraph right after Q heading */
main h3 + p, article h3 + p {
    padding-left: 20px;
    margin-top: 0.4em !important;
    margin-bottom: 1.5em !important;
    color: #374151;
    border-left: 2px solid #e2e8f0;
}

/* ======= TABLES ======= */
.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.2em 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

main table, article table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.5;
    min-width: 560px;
}

main table th, article table th {
    background: #f1f5f9;
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #cbd5e1;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #334155;
    white-space: nowrap;
}

main table td, article table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

main table tr:last-child td { border-bottom: none; }
main table tr:nth-child(even) { background: #f8fafc; }
main table a, article table a { word-break: break-all; font-size: 13px; }

/* ======= IMAGES ======= */
main img, article img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 1em auto;
    border-radius: 8px;
}

/* ======= LONG URLs ======= */
main a[href*="http"], article a[href*="http"] {
    word-break: break-all;
}

/* ======= BLOCKQUOTES ======= */
main blockquote, article blockquote {
    margin: 1.2em 0;
    padding: 1em 1.2em;
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
    border-radius: 0 8px 8px 0;
    color: #1e3a5f;
}

/* ======= SCROLL HINT ======= */
.scroll-hint::after {
    content: '← Scroll table →';
    display: block;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    padding: 6px 0;
}

/* ============================================
   TABLET (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5em !important;
        line-height: 1.3 !important;
        word-break: break-word;
    }
    main h2, article h2 {
        font-size: 1.28em !important;
    }
    main h3, article h3 {
        font-size: 1.12em !important;
    }
    main p, article p {
        font-size: 16px !important;
        line-height: 1.75 !important;
    }
    main li, article li {
        font-size: 16px !important;
        line-height: 1.65 !important;
        margin-bottom: 0.35em;
    }
    main ul, article ul, main ol, article ol {
        padding-left: 1.3em;
    }
    main table, article table { font-size: 14px; }
    main table th, article table th,
    main table td, article table td { padding: 8px 10px; }
    main img, article img { margin: 0.8em auto; border-radius: 6px; }
}

/* ============================================
   MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    h1 {
        font-size: 1.3em !important;
        line-height: 1.28 !important;
    }
    main h2, article h2 {
        font-size: 1.18em !important;
        word-break: break-word;
    }
    main h3, article h3 {
        font-size: 1.04em !important;
    }
    main p, article p {
        font-size: 15.5px !important;
        line-height: 1.72 !important;
    }
    main li, article li {
        font-size: 15px !important;
    }
    main ul, article ul, main ol, article ol {
        padding-left: 1.1em;
    }
    main table, article table { font-size: 13px; min-width: 480px; }
    main table th, article table th { font-size: 12px; padding: 7px 8px; }
    main table td, article table td { padding: 7px 8px; }
    main img, article img { margin: 0.5em 0; border-radius: 4px; }

    /* FAQ tighter on small screens */
    main h3:has(+ p) {
        padding: 10px 12px !important;
        font-size: 1em;
    }
    main h3 + p {
        padding-left: 12px;
    }

    nav {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media (min-width: 769px) {
    .scroll-hint::after { display: none; }
}
