/* ============================================================
 * sport-hub.css — mobile responsiveness for /posts/
 *   live-betting-guide, best-bookmaker-2026,
 *   read-odds-value-bets, bankroll-management-strategies,
 *   single-vs-accumulator, calendar-2026
 *
 * Loaded AFTER the per-page inline <style> block, so wins the
 * cascade on equal specificity. Uses !important liberally
 * because mobile breakage from oversized intrinsic content is
 * the #1 issue we are fixing — defensive > pretty here.
 *
 * Header / footer untouched.
 * ============================================================ */

/* ============================================================
 * 1. Hard horizontal-overflow lock under 1024px
 *    (sticky TOC stays alive on desktop because we don't touch
 *    overflow there).
 * ============================================================ */
@media (max-width: 1023px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative;
    }
}

/* ============================================================
 * 2. Force every grid / flex inside the article body to be
 *    *shrinkable*. The default `1fr` is `minmax(auto, 1fr)`,
 *    which refuses to shrink below the intrinsic content min
 *    — that is what was pushing cards past the viewport edge.
 * ============================================================ */
@media (max-width: 1023px) {
    .tp-cal-layout {
        grid-template-columns: minmax(0, 1fr) !important;
        padding: 0 0.85rem !important;
        gap: 1rem !important;
    }
    .tp-cal-layout > div { min-width: 0 !important; max-width: 100% !important; }

    .tp-cal-aside { display: none !important; }

    .tp-book-grid,
    .tp-rel-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Article-column children: shrinkable + clipped to column width */
    .tp-cal-layout > div > * { min-width: 0; max-width: 100%; }
    .tp-sec > *,
    .tp-sec-body > *,
    .tp-tldr > *,
    .tp-toc > * { min-width: 0; max-width: 100%; }

    /* The table itself is allowed to be wider than its wrapper
       — its own wrapper handles the horizontal scroll. */
    .tp-cal-layout .tp-yt-wrap {
        max-width: 100% !important;
        overflow-x: auto !important;
    }
    .tp-cal-layout .tp-yt-wrap .tp-yt-table {
        max-width: none !important;
        min-width: 580px !important;
    }
}

/* ============================================================
 * 3. Tables (.tp-yt-wrap) — let them scroll horizontally
 *    *inside* their wrapper (same UX as the home compare
 *    table). Custom slim scrollbar so the swipe affordance
 *    is visible.
 * ============================================================ */
.tp-yt-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.55) rgba(15, 23, 42, 0.45);
}
.tp-yt-wrap::-webkit-scrollbar { height: 6px; }
.tp-yt-wrap::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.45);
    border-radius: 9999px;
}
.tp-yt-wrap::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.55);
    border-radius: 9999px;
}
.tp-yt-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.85);
}

/* ============================================================
 * 4. Hero — tighten everything on phones
 * ============================================================ */
@media (max-width: 640px) {
    .tp-cal-hero { padding: 1rem 0 2rem !important; }
    .tp-hero-h1 {
        font-size: 1.85rem !important;
        line-height: 1.1 !important;
        margin-bottom: 0.85rem !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .tp-hero-eyebrow {
        font-size: 0.65rem !important;
        padding: 0.35rem 0.75rem !important;
        margin-bottom: 1rem !important;
    }
    .tp-hero-sub {
        font-size: 0.95rem !important;
        line-height: 1.55 !important;
        margin-bottom: 1.2rem !important;
    }
    .tp-hero-cta-row {
        gap: 0.5rem !important;
        margin-bottom: 1.4rem !important;
    }
    .tp-hero-cta-prim,
    .tp-hero-cta-sec {
        flex: 1 1 100% !important;
        justify-content: center !important;
        padding: 0.78rem 1rem !important;
        font-size: 0.92rem !important;
    }
    .tp-stat-grid { gap: 0.5rem !important; }
    .tp-stat-cell { padding: 0.7rem 0.45rem !important; border-radius: 0.7rem !important; }
    .tp-stat-value { font-size: 1.2rem !important; }
    .tp-stat-label { font-size: 0.6rem !important; }
    .tp-meta-row { gap: 0.35rem 0.85rem !important; font-size: 0.78rem !important; }
    .tp-bc {
        font-size: 0.75rem !important;
        margin-bottom: 0.7rem !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

/* ============================================================
 * 5. Sections
 * ============================================================ */
@media (max-width: 640px) {
    .tp-sec {
        padding: 1.2rem 1.1rem 1.4rem !important;
        border-radius: 1rem !important;
    }
    .tp-sec-eyebrow {
        font-size: 0.62rem !important;
        padding: 0.26rem 0.6rem !important;
        letter-spacing: 0.1em !important;
    }
    .tp-sec-title {
        font-size: 1.4rem !important;
        line-height: 1.22 !important;
        margin-bottom: 0.6rem !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .tp-sec-intro { font-size: 0.93rem !important; line-height: 1.6 !important; margin-bottom: 1.1rem !important; }
    .tp-sec-body { font-size: 0.93rem !important; line-height: 1.65 !important; }
    .tp-sec-body p { margin: 0.7rem 0 !important; }
    .tp-h3 {
        font-size: 1.05rem !important;
        margin: 1.2rem 0 0.5rem !important;
        padding-left: 0.65rem !important;
    }
    .tp-ul li { font-size: 0.9rem !important; line-height: 1.5 !important; }
    .tp-tldr { padding: 1.1rem 1.1rem !important; }
    .tp-tldr li { font-size: 0.9rem !important; line-height: 1.5 !important; }
    .tp-angle { padding: 0.85rem 0.95rem !important; }
    .tp-angle-body { font-size: 0.88rem !important; line-height: 1.5 !important; }
    .tp-outro { padding: 0.85rem 1rem !important; font-size: 0.9rem !important; }
}

/* ============================================================
 * 6. Bookmaker cards on phones
 *    Layout: small 84-px square logo on the LEFT, body on the
 *    RIGHT. Image stays inside its 84-px column even if the
 *    underlying <img> is larger — width:84px + object-fit:contain.
 *    Body is min-width:0 so it can shrink to fit.
 * ============================================================ */
@media (max-width: 640px) {
    .tp-book-grid { gap: 0.75rem !important; }
    .tp-book {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .tp-book-media {
        flex: 0 0 84px !important;
        width: 84px !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        border-bottom: none !important;
        border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
        padding: 0.4rem !important;
    }
    .tp-book-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        border-radius: 0.3rem !important;
    }
    .tp-book-body {
        padding: 0.6rem 0.75rem 0.7rem !important;
        gap: 0.3rem !important;
        min-width: 0 !important;
        flex: 1 1 0% !important;
    }
    .tp-book-head { gap: 0.4rem !important; }
    .tp-book-name {
        font-size: 1rem !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .tp-book-rating {
        font-size: 0.68rem !important;
        padding: 0.18rem 0.4rem !important;
    }
    .tp-book-tag { font-size: 0.58rem !important; }
    .tp-book-pitch {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .tp-book-cta {
        gap: 0.35rem !important;
        margin-top: 0.25rem !important;
        flex-wrap: wrap !important;
    }
    .tp-book-review {
        padding: 0.4rem 0.55rem !important;
        font-size: 0.74rem !important;
        flex: 1 1 auto !important;
        text-align: center !important;
    }
    .tp-book-play {
        padding: 0.45rem 0.55rem !important;
        font-size: 0.76rem !important;
        flex: 1 1 auto !important;
    }
}

/* ============================================================
 * 7. Related "preview" cards on phones — same horizontal
 *    layout. 96-px square thumb left, two-line clamps right.
 * ============================================================ */
@media (max-width: 639px) {
    .tp-rel-grid { gap: 0.65rem !important; }
    .tp-rel {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .tp-rel-img {
        flex: 0 0 96px !important;
        width: 96px !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
    }
    .tp-rel-body {
        padding: 0.6rem 0.75rem !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 0.2rem !important;
    }
    .tp-rel-title {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .tp-rel-desc {
        font-size: 0.74rem !important;
        line-height: 1.4 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* ============================================================
 * 8. Bankroll splits
 * ============================================================ */
@media (max-width: 640px) {
    .tp-br-bar { height: 12px !important; }
    .tp-br-row {
        padding: 0.6rem 0.7rem !important;
        gap: 0.15rem 0.6rem !important;
    }
    .tp-br-label { font-size: 0.85rem !important; }
    .tp-br-pct { font-size: 0.9rem !important; }
    .tp-br-note { font-size: 0.76rem !important; line-height: 1.4 !important; }
}

/* ============================================================
 * 9. FAQ
 * ============================================================ */
@media (max-width: 640px) {
    .tp-faq summary {
        padding: 0.85rem 0.95rem !important;
        font-size: 0.9rem !important;
        gap: 0.5rem !important;
    }
    .tp-faq-chev {
        width: 24px !important;
        height: 24px !important;
        font-size: 1rem !important;
    }
    .tp-faq-a {
        padding: 0 0.95rem 0.95rem !important;
        font-size: 0.86rem !important;
        line-height: 1.6 !important;
    }
    /* Withdrawal-guides FAQ block — compact 1-column grid on phones */
    .tp-faq-a .grid {
        gap: 0.45rem !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .tp-faq-a .grid > a {
        padding: 0.5rem 0.65rem !important;
        min-width: 0 !important;
    }
}

/* ============================================================
 * 10. Final CTA
 * ============================================================ */
@media (max-width: 640px) {
    .tp-final-cta { padding: 1.4rem 1.1rem 1.6rem !important; }
    .tp-final-cta h2 {
        font-size: 1.35rem !important;
        line-height: 1.25 !important;
        margin-bottom: 0.5rem !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .tp-final-cta p {
        font-size: 0.92rem !important;
        line-height: 1.55 !important;
        margin-bottom: 1.2rem !important;
    }
    .tp-final-cta a.tp-final-btn {
        padding: 0.85rem 1.4rem !important;
        font-size: 0.95rem !important;
        width: 100% !important;
        max-width: 320px !important;
        justify-content: center !important;
    }
}

/* ============================================================
 * 10b. World Cup countdown (calendar-2026 only)
 * ============================================================ */
@media (max-width: 640px) {
    .tp-cd-card {
        padding: 1.1rem 1rem 1.25rem !important;
    }
    .tp-cd-venue {
        font-size: 0.82rem !important;
        line-height: 1.45 !important;
        margin-bottom: 1rem !important;
    }
    .tp-cd-grid {
        max-width: 100% !important;
        gap: 0.4rem !important;
    }
    .tp-cd-cell {
        padding: 0.65rem 0.35rem !important;
    }
    .tp-cd-num {
        font-size: 1.5rem !important;
    }
    .tp-cd-lab {
        font-size: 0.58rem !important;
        margin-top: 0.3rem !important;
    }
}
@media (max-width: 360px) {
    .tp-cd-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ============================================================
 * 11. Defensive — every link/inline element must wrap, never
 *     push the layout. Targets only article-body containers
 *     so it doesn't affect header/footer/nav.
 * ============================================================ */
.tp-cal-layout a,
.tp-cal-layout p,
.tp-cal-layout li,
.tp-cal-layout span,
.tp-cal-layout h1,
.tp-cal-layout h2,
.tp-cal-layout h3,
.tp-cal-layout h4 {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* But: numbers / odds inside the live-windows table must NOT
   break across lines (would look broken). The table is in its
   own scroll container so it's safe to keep them whole. */
.tp-yt-table, .tp-yt-table * {
    word-break: normal !important;
    overflow-wrap: normal !important;
}
