/* ==========================================================================
   responsive-home.css
   Loaded ONLY by FrontPageLayout.master (default.aspx).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Announce bar — override main.css min-width:765px and nowrap for mobile
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .rsp-fp-main .announce {
        min-width: 0 !important;
        height: auto !important;
    }
    .rsp-fp-main .announceTxt {
        white-space: normal !important;
        line-height: 1.4 !important;
        padding: 6px 8px;
    }
}

/* Category toggle button — hidden on desktop */
.rsp-cat-toggle {
    display: none;
    margin: 8px 0 4px 8px;
    padding: 6px 12px;
    background: #223F7F;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    border-radius: 3px;
}

@media (max-width: 900px) {
    .rsp-cat-toggle { display: inline-block; }

    /* Sidebar: collapse until toggled */
    #ctl00_CatMenu {
        float: none !important;
        width: 100% !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-sizing: border-box;
    }
    #ctl00_CatMenu.rsp-catmenu--open { max-height: 2000px; }

    /* Remove the 220px left margin from main.css .mainContent */
    .mainContent { margin-left: 0 !important; }

    /* FrontPage outer left margin — reduce on narrow screens */
    .rsp-fp-main .ml20 {
        margin-left: 0 !important;
    }
}

/* Remove min-width that prevents columns from collapsing */
.rsp-fp-main .minfcw { min-width: 0; }

/* --------------------------------------------------------------------------
   Three home-page columns stack at 900px (sidebar is gone at this point)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .rsp-fp-main .pl1,
    .rsp-fp-main .pl2,
    .rsp-fp-main .pl3 {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 0 16px 0 !important;
        text-align: left !important;
        box-sizing: border-box;
    }
    .rsp-fp-main .oh { overflow: visible !important; }

    /* Reorder: JI (pl2) above Top Sellers (pl1) on narrow screens */
    .rsp-fp-main .vat.oh.minfcw {
        display: flex;
        flex-direction: column;
    }
    .rsp-fp-main .pl1 { order: 2; }
    .rsp-fp-main .pl2 { order: 1; }
    .rsp-fp-main .pl3 { order: 3; }
}

/* --------------------------------------------------------------------------
   Special Offer grid: 5 columns → 4 → 3 → 2
   The 5-col table needs ~670px (5×134px). Sidebar collapses at 900px, so
   from 900px down the content is full-width minus small margins.
   Start grid conversion at 720px to prevent any cut-off during resize.
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
    .rsp-so-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    .rsp-so-grid .rsp-so-row { display: contents !important; }
    .rsp-so-grid .rsp-so-row > .dTC {
        display: block !important;
        width: auto !important;
        text-align: center !important;
        box-sizing: border-box;
        padding-bottom: 4px;
    }
    .rsp-so-grid .rsp-so-row > .dTC .w134    { width: 100% !important; }
    .rsp-so-grid .rsp-so-row > .dTC .w134 .dT { width: 100% !important; }
    .rsp-so-grid .rsp-so-row > .dTC img { max-width: 100%; height: auto; }
}

@media (max-width: 540px) {
    .rsp-so-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 360px) {
    .rsp-so-grid { grid-template-columns: repeat(2, 1fr); }
}