/* Mobile-overflow fix for legacy orphan pages 2026-06-18 (v2)
   Patches inline-style fixed widths, rigid grids, and padding that
   prevent these pages from rendering inside a 375px viewport. */

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    main, section, article, header, .hero, .wrap, .container,
    div[class], div[style] {
        max-width: 100% !important;
    }

    /* collapse all multi-column grids to single column */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* defeat inline min-width >= 600px on layout containers */
    [style*="min-width:6"], [style*="min-width: 6"],
    [style*="min-width:7"], [style*="min-width: 7"],
    [style*="min-width:8"], [style*="min-width: 8"],
    [style*="min-width:9"], [style*="min-width: 9"],
    [style*="min-width:1000"], [style*="min-width: 1000"],
    [style*="min-width:1100"], [style*="min-width: 1100"],
    [style*="min-width:1200"], [style*="min-width: 1200"] {
        min-width: 0 !important;
    }

    /* HEADINGS — wrap normally between WORDS, never letter-by-letter,
       and clamp inline font-sizes regardless of what the inline style says */
    h1, h2, h3, h4 {
        max-width: 100% !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        hyphens: none !important;
        letter-spacing: normal !important;
    }
    h1 {
        font-size: clamp(28px, 8vw, 42px) !important;
        line-height: 1.12 !important;
    }
    h2 { font-size: clamp(22px, 6vw, 32px) !important; line-height: 1.18 !important; }
    h3 { font-size: clamp(18px, 5vw, 26px) !important; line-height: 1.22 !important; }

    /* Body copy long-word fallback */
    p, li, dd, dt, span, a, blockquote {
        overflow-wrap: break-word;
        word-break: normal;
    }

    /* heroes — soften padding */
    .hero, .cover, .cover-block, [class*="hero"], [class*="Hero"] {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    /* tables, pre, code: scroll horizontally rather than overflow viewport */
    table, pre {
        display: block;
        overflow-x: auto !important;
        max-width: 100vw !important;
        -webkit-overflow-scrolling: touch;
    }
    code, kbd, samp {
        word-break: break-all;
    }

    /* SVGs, images, video stay within column */
    img, svg, canvas, iframe, video {
        max-width: 100% !important;
        height: auto !important;
    }

    /* very wide inline padding shrinks */
    [style*="padding:64"], [style*="padding: 64"],
    [style*="padding:80"], [style*="padding: 80"],
    [style*="padding:96"], [style*="padding: 96"],
    [style*="padding:120"], [style*="padding: 120"] {
        padding: 32px 18px !important;
    }
}
