/* ================================================================
   MMW-NEWS LAYOUT — mmw-layout.css  v3.0
   1080px container · Rail ads · Fixed grid · No overlap
   ================================================================ */

/* ── 1. VARIABLES ──────────────────────────────────────────────── */
:root {
    --mmw-site-w:    1080px;
    --mmw-sidebar-w: 310px;
    --mmw-col-gap:   6px;
    --mmw-rail-w:    160px;
    --mmw-rail-gap:  12px;
    --mmw-outer-bg:  #dce3eb;
    --mmw-inner-bg:  #ffffff;
    --mmw-border:    #d8dde4;
    --mmw-more-col:  #c0392b;
}
[data-mmw-theme="dark"] {
    --mmw-outer-bg: #0d0f12;
    --mmw-inner-bg: #1a1d21;
    --mmw-border:   #2a2d32;
}

/* ── 2. BODY BACKGROUND ─────────────────────────────────────────── */
html, body { background: var(--mmw-outer-bg) !important; margin: 0; padding: 0; }

/* ── 3. SITE BOX — everything constrained to 1080px ────────────── */
.mmw-site {
    max-width: var(--mmw-site-w);
    width: 100%;
    margin: 0 auto;
    background: var(--mmw-inner-bg);
    box-shadow: 0 0 0 1px var(--mmw-border);
    position: relative;
}
.mmw-wrap {
    max-width: var(--mmw-site-w);
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

/* ── 4. HEADER + TOPBAR + TICKER — full width of .mmw-site ─────── */
.mmw-topbar,
.mmw-header,
.mmw-hdr-ad,
.mmw-breaking,
.mmw-ticker,
.mmw-breaking-bar,
.mmw-breaking-wrap { width: 100%; box-sizing: border-box; }
.mmw-header { background: #040D1F; }
.mmw-topbar { background: #020A15; }

/* ── 5. RAIL ADS — fixed in gutters outside the 1080px box ─────── */
.mmw-rail {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: var(--mmw-rail-w);
    z-index: 100;
    display: none;          /* hidden until viewport is wide enough */
    text-align: center;
}
/* Position: center ± half site width ± rail width ± gap */
.mmw-rail-left  { left:  calc(50% - (var(--mmw-site-w) / 2) - var(--mmw-rail-w) - var(--mmw-rail-gap)); }
.mmw-rail-right { right: calc(50% - (var(--mmw-site-w) / 2) - var(--mmw-rail-w) - var(--mmw-rail-gap)); }

/* Show rails only when gutters are wide enough */
/* 1080 + (160+12)*2 = 1424px minimum, add 20px buffer */
@media (min-width: 1445px) {
    .mmw-rail { display: block; }
}

.mmw-rail-label {
    display: block;
    font-size: 9px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 5px;
}

/* Rail ad inner — default 160×600; grows to 160×900 on very wide */
.mmw-rail-ad-inner {
    display: block;
    width: 160px;
    min-height: 600px;
    background: #f5f5f5;    /* placeholder bg until ad loads */
    border: 1px solid #e8e8e8;
}
@media (min-width: 1600px) {
    .mmw-rail-ad-inner { min-height: 900px; }
}

/* ── 6. HOME GRID — 3 equal columns inside 1080px ──────────────── */
.mmw-home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr var(--mmw-sidebar-w);
    gap: var(--mmw-col-gap);
    width: 100%;
    padding: var(--mmw-col-gap);
    box-sizing: border-box;
    background: var(--mmw-outer-bg);
    align-items: start;         /* CRITICAL: prevents row-stretch overlap */
}

/* Content columns — NEVER set explicit width here, let grid handle it */
.mmw-home-col {
    min-width: 0;               /* CRITICAL: prevents overflow/overlap */
    overflow: hidden;
    box-sizing: border-box;
}

/* Sidebar column */
.mmw-home-grid .mmw-sidebar {
    width: var(--mmw-sidebar-w);
    min-width: 0;
    max-width: var(--mmw-sidebar-w);
    box-sizing: border-box;
}

/* ── 7. CATEGORY BLOCK ──────────────────────────────────────────── */
.mmw-block,
.mmw-cat-block {
    background: var(--mmw-inner-bg);
    border: 1px solid var(--mmw-border);
    margin-bottom: var(--mmw-col-gap);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
}
.mmw-block-body, .mmw-cat-body { flex: 1; padding: 4px 6px; }

/* ── 8. CATEGORY HEADERS ────────────────────────────────────────── */
.mmw-sec-hd,
.mmw-block-head,
.mmw-cat-head,
.mmw-widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #1a3a6b;
    color: #fff;
    margin: 0;
    flex-shrink: 0;
    min-height: 32px;
}
.mmw-sec-title, .mmw-block-title {
    font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .4px;
    color: #fff !important; margin: 0;
}
.mmw-sec-hd::before {
    content: ''; display: inline-block;
    width: 3px; height: 13px;
    background: rgba(255,255,255,.5);
    border-radius: 2px; margin-right: 7px; flex-shrink: 0;
}

/* Color palette */
.mmw-hd-blue   { background: #1a3a6b; }
.mmw-hd-red    { background: #c0392b; }
.mmw-hd-green  { background: #1a7a4a; }
.mmw-hd-orange { background: #d35400; }
.mmw-hd-purple { background: #6c3483; }
.mmw-hd-teal   { background: #0e7c7b; }
.mmw-hd-maroon { background: #7b0d1e; }
.mmw-hd-navy   { background: #0a2342; }

/* Auto-cycle */
.mmw-home-col .mmw-block:nth-child(1) .mmw-sec-hd { background: #1a3a6b; }
.mmw-home-col .mmw-block:nth-child(2) .mmw-sec-hd { background: #c0392b; }
.mmw-home-col .mmw-block:nth-child(3) .mmw-sec-hd { background: #1a7a4a; }
.mmw-home-col .mmw-block:nth-child(4) .mmw-sec-hd { background: #d35400; }
.mmw-home-col .mmw-block:nth-child(5) .mmw-sec-hd { background: #6c3483; }
.mmw-home-col .mmw-block:nth-child(6) .mmw-sec-hd { background: #0e7c7b; }

.mmw-sidebar .mmw-widget-head             { background: #1a3a6b; color: #fff !important; font-size: 11px; }
.mmw-sidebar .mmw-widget:nth-child(2) .mmw-widget-head { background: #c0392b; }
.mmw-sidebar .mmw-widget:nth-child(3) .mmw-widget-head { background: #1a7a4a; }
.mmw-sidebar .mmw-widget:nth-child(4) .mmw-widget-head { background: #d35400; }
.mmw-sidebar .mmw-widget:nth-child(5) .mmw-widget-head { background: #6c3483; }
.mmw-sidebar .mmw-widget:nth-child(6) .mmw-widget-head { background: #0e7c7b; }

/* ── 9. MORE.. LINK ─────────────────────────────────────────────── */
.mmw-block-footer,
.mmw-sec-footer,
.mmw-cat-footer {
    display: flex; justify-content: flex-end; align-items: center;
    padding: 4px 8px 5px;
    border-top: 1px solid var(--mmw-border);
    background: #fafbfc; flex-shrink: 0; margin: 0;
}
[data-mmw-theme="dark"] .mmw-block-footer { background: #1e2024; border-top-color: var(--mmw-border); }

.mmw-read-more, .mmw-more-link,
.mmw-block-footer a, .mmw-sec-footer a {
    font-size: 11px; font-weight: 700;
    color: var(--mmw-more-col) !important;
    text-decoration: none !important;
    text-transform: uppercase; letter-spacing: .2px;
    display: inline-flex; align-items: center; gap: 2px;
    transition: opacity .2s;
}
.mmw-read-more:hover { opacity: .75; }
.mmw-read-more::after { content: '›'; font-size: 13px; line-height: 1; margin-left: 1px; }

/* ── 10. SINGLE + ARCHIVE ───────────────────────────────────────── */
.mmw-single-layout,
.mmw-archive-layout {
    display: grid;
    grid-template-columns: 1fr var(--mmw-sidebar-w);
    gap: var(--mmw-col-gap);
    width: 100%;
    padding: var(--mmw-col-gap);
    box-sizing: border-box;
    align-items: start;
}
.mmw-single-layout main,
.mmw-archive-layout main { background: var(--mmw-inner-bg); min-width: 0; }
.mmw-single-layout .mmw-sidebar,
.mmw-archive-layout .mmw-sidebar { width: var(--mmw-sidebar-w); min-width: 0; max-width: var(--mmw-sidebar-w); }

/* ── 11. SIDEBAR WIDGETS ────────────────────────────────────────── */
.mmw-sidebar .mmw-widget,
.mmw-sidebar .mmw-ad-wrap {
    background: var(--mmw-inner-bg);
    border: 1px solid var(--mmw-border);
    margin-bottom: var(--mmw-col-gap);
    overflow: hidden; padding: 0;
}
.mmw-ad-label { display: block; text-align: center; font-size: 9px; color: #bbb; text-transform: uppercase; letter-spacing: .5px; padding: 3px 0 1px; }

/* ── 12. MOBILE HEADER ORDER ────────────────────────────────────── */
@media (max-width: 768px) {
    .mmw-header-row {
        display: grid !important;
        grid-template-columns: auto auto 1fr auto auto !important;
        align-items: center !important;
        gap: 6px !important;
        height: 54px !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
    }
    .mmw-hamburger   { order: 1 !important; }
    .mmw-mob-home-btn{ order: 2 !important; }
    .mmw-logo        { order: 3 !important; justify-self: center !important; }
    #mmw-dark-toggle { order: 4 !important; }
    #mmw-search-open { order: 5 !important; }
    .mmw-primary-nav { display: none !important; }
    .mmw-sub-btn     { display: none !important; }

    .mmw-mob-home-btn {
        display: none; /* JS sets display:flex */
        background: none; border: none;
        cursor: pointer; color: #fff;
        padding: 6px 4px; line-height: 1;
        text-decoration: none;
    }

    /* Home grid stacks on mobile */
    .mmw-home-grid {
        grid-template-columns: 1fr !important;
        padding: 4px;
    }
    .mmw-home-grid .mmw-sidebar,
    .mmw-home-grid .mmw-home-col { width: 100%; max-width: 100%; min-width: 0; }

    /* Archive/single stack */
    .mmw-archive-layout,
    .mmw-single-layout { grid-template-columns: 1fr; padding: 4px; }
    .mmw-archive-layout .mmw-sidebar,
    .mmw-single-layout  .mmw-sidebar { width: 100%; max-width: 100%; }
}

/* Tablet 769–1079px */
@media (min-width: 769px) and (max-width: 1079px) {
    .mmw-home-grid {
        grid-template-columns: 1fr 1fr;
        padding: var(--mmw-col-gap);
    }
    .mmw-home-grid .mmw-sidebar {
        grid-column: span 2;
        width: 100%; max-width: 100%;
    }
}

/* ── 13. PAGINATION ─────────────────────────────────────────────── */
.mmw-pagination { margin: 20px 6px 10px; }
.mmw-pagination-label {
    display: block; text-align: center;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: #888; margin-bottom: 10px; position: relative;
}
.mmw-pagination-label::before,
.mmw-pagination-label::after {
    content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: #e0e0e0;
}
.mmw-pagination-label::before { left: 0; }
.mmw-pagination-label::after  { right: 0; }
.mmw-pagination .nav-links {
    display: flex; justify-content: center; align-items: center; gap: 4px; flex-wrap: wrap;
}
.mmw-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid #dde3ea; border-radius: 4px;
    font-size: 13px; font-weight: 600; color: #444;
    text-decoration: none; background: #fff; transition: all .2s;
}
.mmw-pagination .page-numbers:hover,
.mmw-pagination .page-numbers.current { background: #c0392b; border-color: #c0392b; color: #fff; }
.mmw-pagination .page-numbers.dots { border-color: transparent; background: none; color: #aaa; }

/* ── 14. TRENDING LIST ──────────────────────────────────────────── */
.mmw-trending-list { list-style: none; margin: 0; padding: 0; }
.mmw-trending-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--mmw-border); }
.mmw-trending-item:last-child { border-bottom: none; }
.mmw-trending-num { font-size: 16px; font-weight: 800; color: #e0e0e0; min-width: 22px; line-height: 1.2; flex-shrink: 0; }
.mmw-trending-item:nth-child(1) .mmw-trending-num { color: #f39c12; }
.mmw-trending-item:nth-child(2) .mmw-trending-num { color: #95a5a6; }
.mmw-trending-item:nth-child(3) .mmw-trending-num { color: #cd7f32; }
.mmw-trending-thumb { width: 50px; height: 40px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.mmw-trending-title { font-size: 12px; font-weight: 600; line-height: 1.4; color: #1d2327; }
.mmw-trending-title a { color: inherit; text-decoration: none; }
.mmw-trending-title a:hover { color: #c0392b; }
.mmw-trending-meta { font-size: 10px; color: #888; margin-top: 2px; }

/* ── 15. POLL ───────────────────────────────────────────────────── */
.mmw-poll-wrap { padding: 12px; }
.mmw-poll-question { font-weight: 700; font-size: 14px; color: #1d2327; margin-bottom: 12px; line-height: 1.4; }
.mmw-poll-options { list-style: none; margin: 0; padding: 0; }
.mmw-poll-option { margin-bottom: 8px; }
.mmw-poll-option label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.mmw-poll-bar-wrap { height: 6px; background: #eee; border-radius: 3px; margin-top: 4px; overflow: hidden; }
.mmw-poll-bar { height: 100%; background: #2271b1; border-radius: 3px; transition: width .4s; }
.mmw-poll-pct { font-size: 11px; color: #888; margin-left: auto; }
.mmw-poll-vote-btn { background: #c0392b; color: #fff; border: none; padding: 7px 18px; border-radius: 4px; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 10px; width: 100%; }
.mmw-poll-vote-btn:hover { background: #a93226; }
.mmw-poll-total { font-size: 11px; color: #888; text-align: right; margin-top: 6px; }

/* ── 16. MOBILE NAV HOME LINK ───────────────────────────────────── */
.mmw-mob-nav-home {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; color: #fff !important;
    font-weight: 700; font-size: 14px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.06);
}
.mmw-mob-nav-home:hover { background: rgba(255,255,255,.12); }
