/* =============================================================================
   css/mh_phone.css - MarketHive at phone width (S660).

   MEDIA QUERIES ONLY. Nothing in this file may apply above 767px, so desktop is
   untouched by construction (proved in notes/phone-width-s660.md by comparing
   every element's box at 1440px with and without this sheet).

   Loaded LAST: includes/page_header_bar.php links it right after css/mh_ui.css,
   videos.php likewise, and script_header.php / home.php link it in <head> for
   the older pages that load neither. Do not put desktop rules here; the shared
   look lives in css/mh_ui.css (another session owns that file).

   Measured on production at 375x812 and 414x896, 2026-11-19 (S660). The
   members are mostly in India, Bangladesh and Nigeria, on phones.
   ========================================================================== */

@media (max-width: 767px) {

    /* -------------------------------------------------------------------------
       1. Floating A+ / A- and the scroll-to-top chevron: HIDDEN on a phone
       (Chris, S660 - pinch-zoom replaces the text sizer, and the chevron sat in
       the same column over the right edge of the content). Desktop keeps both
       (S429/S584). /friends parks them in its own bottom row - hidden there too.
       ---------------------------------------------------------------------- */
    #gotToTopBtn,
    .mh-text-stepper,
    .friends-page .fh-bottom-controls .mh-text-stepper,
    .friends-page .fh-bottom-controls #gotToTopBtn {
        display: none !important;
    }

    /* -------------------------------------------------------------------------
       2. The page picture beside the page name in the band (Chris, S660:
       "the title already says which page it is"). Hidden on phone only; the
       title column takes the freed width.
       ---------------------------------------------------------------------- */
    .subs-section-header .subs-nav-page-icon,
    .subs-nav-left > .subs-nav-page-icon,
    .ph-nav-left > .ph-nav-page-icon {
        display: none !important;
    }
    .subs-section-header .subs-nav-left,
    .ph-nav-left {
        min-width: 0 !important;
        width: 100%;
    }
    .subs-section-header .subs-nav-page-info,
    .ph-nav-left .ph-nav-page-info {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* -------------------------------------------------------------------------
       3. Tap targets in the band: GO TO, Algorithm / Black Listing, the quick
       panel icons and Subscribe were 24-34px tall. 40px is the floor.
       ---------------------------------------------------------------------- */
    .subs-section-header .bh-dd-toggle,
    .subs-section-header .nf-header-btn,
    .subs-section-header select,
    .ph-nav-bar .bh-dd-toggle,
    .ph-nav-bar select {
        min-height: 40px;
    }
    .nf-nav-panel .nf-nav-btn-icon {
        width: 40px !important;
        height: 40px !important;
    }
    .nf-nav-panel .nf-nav-btn-subscribe {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    /* Subscribe + five 40px icons must still fit one row in the narrowest band
       (/group's is 302px inside): 8px gaps wrapped the Log Out icon. */
    .nf-nav-panel .nf-nav-panel-buttons {
        gap: 3px !important;
        justify-content: center;
    }
    /* Subscribe for Greater Services - 11-12px copy under the panel. */
    .nf-nav-panel .ph-subscribe-title { font-size: 14px !important; }
    .nf-nav-panel .ph-subscribe-text  { font-size: 14px !important; line-height: 1.35; }

    /* The five live icons in the orange bar were 14x14 tap targets. Same
       picture, 40x40 hit box. */
    .ph-orange-right .ph-live-icon > a,
    .ph-orange-right > a {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 40px;
    }

    /* -------------------------------------------------------------------------
       4. Windows that open below the fold. The Algorithm / Black Listing panels
       and the subscription upgrade windows are absolute overlays placed under a
       band that is 500-700px tall on a phone: the member taps the button and
       nothing visible happens. On a phone they open as a full-screen sheet.
       ---------------------------------------------------------------------- */
    #nf-algo-popup-overlay,
    #nf-block-popup-overlay,
    #subs-e1-popup-overlay,
    #subs-vanity-popup-overlay,
    #subs-premium-upgrade-popup-overlay,
    #subs-newsfeed-upgrade-popup-overlay,
    #subs-profile-page-upgrade-popup-overlay {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        height: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        z-index: 100000 !important;
    }
    #nf-algo-popup-overlay > .nf-algo-popup-close,
    #nf-block-popup-overlay > .nf-algo-popup-close,
    .subs-e1-popup-close {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* -------------------------------------------------------------------------
       5. Settings. The panels are inline-styled div tables: value cells carry
       padding-left:100px and the column heads are nowrap, so the General panel
       was 627px wide inside a 344px box (side-scroll inside the panel, the
       DISPLAY PROFILE PAGE / DISPLAY EXTERNALLY ticks off-screen). Keep the
       columns, drop the dead space.
       ---------------------------------------------------------------------- */
    /* Even without the dead space the four columns need ~430px, so on a phone
       each row becomes: the label on its own line, then the value with the two
       tick columns kept at the right under their headings. */
    .settings-page #load_data div[style*="display:table"] {
        display: block !important;
        width: auto !important;
    }
    .settings-page #load_data div[style*="display:table-row"] {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        border-bottom: 1px solid #EFEFEF;
    }
    .settings-page #load_data div[style*="display:table-cell"] {
        display: block !important;
        border-bottom: 0 !important;
        width: auto !important;
        min-width: 0;
        overflow-wrap: break-word; /* NOT word-break: it would squeeze labels to one letter a line */
    }
    /* label (first cell): full line */
    .settings-page #load_data div[style*="display:table-row"] > div[style*="display:table-cell"]:first-child {
        flex: 0 0 100%;
        padding-bottom: 0 !important;
    }
    /* value (second cell): the rest of the line */
    .settings-page #load_data div[style*="display:table-row"] > div[style*="display:table-cell"]:nth-child(2) {
        flex: 1 1 0;
        padding-left: 10px !important;
    }
    /* the two tick columns in five-cell rows (General: Display Profile Page / Display Externally) */
    .settings-page #load_data div[style*="display:table-row"] > div:nth-child(3):nth-last-child(3),
    .settings-page #load_data div[style*="display:table-row"] > div:nth-child(4):nth-last-child(2) {
        flex: 0 0 86px;
        padding-left: 0 !important;
        text-align: center;
        white-space: normal !important;
        overflow-wrap: normal !important;  /* never split EXTERNALLY */
        font-size: 11px;
    }
    /* any later cell (inline error messages, spacers): own line, collapses when empty */
    .settings-page #load_data div[style*="display:table-row"] > div[style*="display:table-cell"]:nth-child(n+5),
    .settings-page #load_data div[style*="display:table-row"] > div[style*="display:table-cell"]:nth-child(3):last-child {
        flex: 0 0 100%;
    }

    /* -------------------------------------------------------------------------
       6. Smart Mail intro window: the three stats overflowed by 14px.
       ---------------------------------------------------------------------- */
    .sm-intro-stats {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .sm-intro-stat {
        min-width: 0 !important;
        flex: 1 1 90px;
    }

    /* -------------------------------------------------------------------------
       7. News Feed post footer (Tip / Like / Dislike / Comment) - 17px tall
       links. Give them a 40px row without moving the words.
       ---------------------------------------------------------------------- */
    .full_width_main_content_newsfeed_post_right_the_content_posted_bottom_bar a {
        display: inline-block;
        padding: 11px 4px;
    }

    /* -------------------------------------------------------------------------
       8. The cookie notice on the front page covered the bottom quarter of the
       screen (180px), including the Join / Login buttons in the sign-up window.
       ---------------------------------------------------------------------- */
    #pjAcceptCookieBar .pjAcceptCookieBarShell {
        display: flex !important;
        align-items: center;
        gap: 10px;
        padding: 8px 10px !important;
    }
    #pjAcceptCookieBar .pjAcceptCookieBarShell form {
        display: flex;
        align-items: center;
        justify-content: space-between !important;
        gap: 10px !important; /* the bar's own sheet sets 80px */
        width: 100%;
    }
    #pjAcceptCookieBar {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }
    #pjAcceptCookieBar .pjAcceptCookieBarShell p {
        flex: 1 1 auto;
        width: auto !important;
        max-width: none !important;
        float: none !important;
        margin: 0 !important;
        font-size: 12px !important;
        line-height: 1.3 !important;
        text-align: left !important;
    }
    #pjAcceptCookieBar .pjAcceptCookieBarActions {
        flex: 0 0 auto;
        width: auto !important;
        padding: 0 !important;
        float: none !important;
    }
    #pjAcceptCookieBar .pjAcceptCookieBarShell input,
    #pjAcceptCookieBar .pjAcceptCookieBarShell button {
        min-height: 40px;
        margin: 0 !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
}

/* =============================================================================
   9. THE BAND, STACKED (Chris, S660 follow-up: "stack very nicely").
   Every toolbar band - includes/mh_band.php (default and 'grid' layouts), the
   hand-built bands on /newsfeed, /index_members, /subscriptions, and the
   profile band (includes/profile_band.php) - becomes on a phone:
     row 1   the page title, full width (the page picture is hidden, rule 2)
     row 2   the breadcrumb, full width
     rows 3+ GO TO and every page control in a two-column grid, each cell
             filling its half, all 40px tall; a search box takes a whole row
     last    the quick panel (Subscribe + Hive Chat / Support / Telegram /
             The Key / Log Out) on its own full-width row.
   How: the band's wrappers (.subs-nav-left, .subs-nav-page-info, the control
   wrappers) become display:contents, so the title, breadcrumb and each control
   are direct items of ONE grid on .subs-nav-left - same order as the markup,
   no markup change.
   The quick panel is KEPT, not hidden: GO TO has no Support, Hive Chat,
   Telegram or Log Out entry, and Support / Hive Chat carry live badges (open
   tickets, unread chat). Its two-line description is hidden: it is hover help
   (the quick panel swaps it on mouse-over) and a phone has no hover.
   ========================================================================== */
@media (max-width: 767px) {
    .subs-section-header,
    .ph-nav-bar > .ph-nav-inner {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        height: auto !important;
        padding-right: 12px !important;   /* drops the S411 44px gutter for the old in-band A+/A- */
    }
    .subs-section-header > *,
    .ph-nav-bar > .ph-nav-inner > * {
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        flex: 0 0 auto !important;
    }

    /* the one grid */
    .subs-section-header > .subs-nav-left,
    .ph-nav-inner > .ph-nav-left {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-auto-flow: row dense;   /* a full-row search box leaves no hole before it */
        column-gap: 8px;
        row-gap: 8px;
        align-items: stretch;
        width: 100% !important;
    }
    .subs-section-header .subs-nav-page-info,
    .subs-section-header .mh-band-controls,
    .subs-section-header .mh-band-goto,
    .subs-section-header .nf-header-buttons,
    .ph-nav-bar .ph-nav-page-info,
    .ph-nav-bar .ph-nav-controls {
        display: contents !important;
    }

    /* rows 1-2: title and breadcrumb, full width */
    .subs-section-header .subs-nav-page-title,
    .subs-section-header .subs-nav-breadcrumb,
    .ph-nav-bar .ph-nav-page-title,
    .ph-nav-bar .ph-nav-breadcrumb {
        grid-column: 1 / -1;
        margin: 0 !important;
    }
    .subs-section-header .subs-nav-breadcrumb,
    .ph-nav-bar .ph-nav-breadcrumb { margin-top: -6px !important; }

    /* rows 3+: every control fills its cell, one height */
    .subs-section-header .subs-nav-left .bh-dd,
    .subs-section-header .subs-nav-left > .mh-tb-btn,
    .subs-section-header .subs-nav-left .mh-band-controls > *,
    .subs-section-header .subs-nav-left .nf-header-buttons > *,
    .ph-nav-bar .ph-nav-left .bh-dd,
    .ph-nav-bar .ph-nav-controls > * {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;     /* the wrapper grows to its 40px button (mh_ui pins it at 30) */
        margin: 0 !important;
        position: relative;
        grid-row: auto !important;   /* desktop grid placements (e.g. /hivestudio's credits) */
        grid-column: auto;
        order: 0 !important;
    }
    .subs-section-header .subs-nav-left .bh-dd-toggle,
    .subs-section-header .subs-nav-left .bh-btn,
    .subs-section-header .subs-nav-left .mh-tb-btn,
    .subs-section-header .subs-nav-left .nf-header-btn,
    .subs-section-header .subs-nav-left .bh-search-input,
    .subs-section-header .subs-nav-left select,
    .ph-nav-bar .ph-nav-left .bh-dd-toggle,
    .ph-nav-bar .ph-nav-left .bh-btn,
    .ph-nav-bar .ph-nav-left select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 40px !important;
        min-height: 40px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    /* a label longer than half the screen ("Blogging Tools & Assets") wraps to a
       second line inside the 40px box instead of pushing its caret out */
    .subs-section-header .subs-nav-left .bh-btn,
    .subs-section-header .subs-nav-left .mh-tb-btn,
    .subs-section-header .subs-nav-left .nf-header-btn,
    .ph-nav-bar .ph-nav-left .bh-btn {
        white-space: normal !important;
        line-height: 1.15 !important;
        overflow: hidden;
    }
    .subs-section-header .bh-dd-toggle .bh-caret,
    .ph-nav-bar .bh-dd-toggle .bh-caret { flex: 0 0 auto; margin-left: 4px; }
    /* link-style buttons (Write a New Blog Post, New Message...): label centred in the 40px box */
    .subs-section-header .subs-nav-left a.bh-btn,
    .subs-section-header .subs-nav-left .mh-tb-btn,
    .ph-nav-bar .ph-nav-left a.bh-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    /* a search box is a whole row */
    .subs-section-header .subs-nav-left .bh-search,
    .ph-nav-bar .ph-nav-left .bh-search {
        grid-column: 1 / -1;
        height: 40px;
    }
    .subs-section-header .subs-nav-left .bh-search .bh-search-icon {
        top: 50% !important;
        transform: translateY(-50%);
    }
    /* menus stay inside the screen: same width as their button, scroll if long */
    .subs-section-header .bh-dd-menu,
    .ph-nav-bar .bh-dd-menu {
        left: 0 !important;
        right: 0 !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
    }
    .subs-section-header .bh-dd-sub,
    .ph-nav-bar .bh-dd-sub {
        position: static !important;
        left: auto !important;
        width: auto !important;
        min-width: 0 !important;
        box-shadow: none !important;
        margin-left: 10px !important;
    }

    /* /newsfeed: SHOW NEW MEMBERS lives inside the title - keep it on the title line, right side */
    .nf-section-header .subs-nav-page-title {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px 8px;
        white-space: nowrap;           /* the title stays one line; the switch drops under it if needed */
    }
    .nf-section-header .subs-nav-page-title .mh-show-new-members {
        position: static !important;   /* newsfeed.css pins it absolute at the band's bottom-left */
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        margin: 0 !important;
    }
    .nf-section-header .subs-nav-page-title .mh-snm-label { font-size: 11px; }

    /* profile: the Add Friend / Send Message state buttons take a whole row */
    .ph-nav-bar .ph-nav-controls > .ph-nav-state { grid-column: 1 / -1; }

    /* /subscriptions: the status slider is its own row */
    .subs-section-header > .subs-header-right-area {
        display: flex !important;
        justify-content: center;
    }

    /* last row: the quick panel */
    .subs-section-header > .ph-nav-right.nf-nav-panel,
    .ph-nav-inner > .ph-nav-right.nf-nav-panel {
        width: 100% !important;
        border-top: 1px solid rgba(0, 0, 0, .12);
        padding-top: 10px !important;
        text-align: left;
    }
    .nf-nav-panel .nf-nav-panel-head { margin: 0 0 8px !important; }
    .nf-nav-panel .ph-subscribe-text { display: none !important; }
    .nf-nav-panel .ph-subscribe-title { text-align: left !important; }
    .nf-nav-panel .nf-nav-panel-buttons {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        gap: 3px !important;
        width: 100%;
    }
}

/* =============================================================================
   10. THE YELLOW "NEW" BAR ON ONE LINE (Chris, S660).
   Modern pages: .ph-orange-bar (includes/page_header_bar.php) - the member's
   avatar, the rotating admin message, then the live icons. Older pages: the
   legacy .gold-bar (script_nav_main.php). On a phone the message is one line
   with an ellipsis and a "More" button (.mh-bar-more, markup in both files,
   `hidden` on desktop) that expands it in place.
   The live icons (Notifications, Messages, Friend requests, Associates, Coins,
   Log Out) stay as one compact row under that line: they are the only
   Notifications / Messages / Friend-request menus on the modern pages, and six
   40px targets beside the message would leave it about 30px - so they are
   neither hidden nor squeezed into the message line.
   ========================================================================== */
@media (max-width: 767px) {
    .ph-orange-bar .ph-orange-inner {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        column-gap: 8px !important;
        row-gap: 0 !important;
        padding-top: 4px !important;
        padding-bottom: 2px !important;
    }
    .ph-orange-bar .ph-orange-left {
        flex: 0 0 auto !important;
        width: auto !important;
        margin: 0 !important;
    }
    .ph-orange-bar .ph-orange-left .ph-orange-logo { width: 30px !important; height: 30px !important; }
    .ph-orange-bar .ph-orange-center {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: left !important;
        font-size: 15px !important;
        line-height: 1.3 !important;
    }
    .ph-orange-bar .ph-orange-center,
    .ph-orange-bar .ph-orange-center p,
    .ph-orange-bar .ph-orange-center div {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        margin: 0 !important;
    }
    .ph-orange-bar .ph-orange-center * { font-size: 15px !important; line-height: 1.3 !important; }
    .ph-orange-bar .ph-orange-right {
        flex: 0 0 100% !important;
        width: 100% !important;
        margin: 0 !important;
        justify-content: space-between !important;
    }

    /* legacy gold bar: first line only, the subtitle under More. NEVER set the
       bar's own display - several pages hide it with display:none !important
       (homepage.css, subscriptions.css, the modern header) and must keep doing so.
       The More button and the close mark sit at the right; the text reserves room. */
    .gold-bar {
        position: relative !important;
        /* style.css pads it 5px 48px !important. The room for More (52) + close (28)
           is reserved HERE, not on the link: the admin's message carries its own <a>,
           so the parser splits the nested link and the text escapes the link's box. */
        padding: 4px 96px 4px 10px !important;
        min-height: 48px;
    }
    .gold-bar > .mh-bar-more[hidden] {
        position: absolute !important;
        top: 4px;
        right: 38px;
    }
    .gold-bar > #gold-bar-close-btn {
        position: absolute !important;
        top: 4px !important;
        right: 6px !important;
        width: 28px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .gold-bar #gold-bar-advert,
    .gold-bar .gb-first-line,
    .gold-bar .gb-first-line p,
    .gold-bar .gb-first-line div {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        margin: 0 !important;
        font-size: 15px !important;
        line-height: 1.3 !important;
        text-align: left !important;
    }
    .gold-bar .gb-first-line * { font-size: 15px !important; }
    .gold-bar #gold-bar-advert > p { display: none !important; }

    /* the More / Less button */
    .ph-orange-bar .mh-bar-more[hidden],
    .gold-bar .mh-bar-more[hidden] {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        min-width: 52px;
        min-height: 40px;
        padding: 0 8px;
        margin: 0;
        border: 1px solid rgba(0, 0, 0, .25);
        border-radius: 6px;
        background: rgba(255, 255, 255, .55);
        color: #1a1a2e;
        font: bold 13px/1 Tahoma, Geneva, sans-serif;
        cursor: pointer;
    }

    /* expanded in place */
    .ph-orange-bar.mh-bar-open .ph-orange-center,
    .ph-orange-bar.mh-bar-open .ph-orange-center p,
    .ph-orange-bar.mh-bar-open .ph-orange-center div,
    .gold-bar.mh-bar-open #gold-bar-advert,
    .gold-bar.mh-bar-open .gb-first-line,
    .gold-bar.mh-bar-open .gb-first-line p,
    .gold-bar.mh-bar-open .gb-first-line div {
        white-space: normal !important;
        overflow: visible !important;
    }
    .gold-bar.mh-bar-open #gold-bar-advert > p { display: block !important; }
}

/* =============================================================================
   11. THE OLD BLUE MENU BAR (Home, Campaigns, Email, Store Fronts, Groups,
   Pages, Videos, Settings, Log Out) - hidden on a phone (Chris, S660), but ONLY
   on a page that has GO TO (a band's .ph-nav-dd). Every link it carries is in
   GO TO on a phone (the ones GO TO lacked were added as phone-only entries,
   includes/nav_page_select_data.php). Pages with no band (/campaigns, /email,
   /pages) keep the bar: it is their only menu. Never hidden while it carries
   "Back to Admin" (an admin inside a member's account) - nothing else offers
   that link. Browsers without :has() keep the bar (safe side).
   ========================================================================== */
@media (max-width: 767px) {
    body:has(.ph-nav-dd) .navbar.navbar-loggedin:not(:has(a[href*="type=adminreturn"])) {
        display: none !important;
    }
}
