/* Copyright 2025 Peter Mack, Oliver Smith
 * SPDX-License-Identifier: MPL-2.0 */

@media (max-width: 700px) {
    /* Increase tab width, to have more space for displaying the title of the
     * website, supporting uidensity=touch - FF 144+ will no longer need
     * specific values for uidensity=touch.
     * Note that -94px/-124px would be enough for current (136), but ESR 128
     * requires more (-102px/-132px) */
    #tabbrowser-tabs {
        border-inline-start: 0 !important;
        --tab-min-width-pref: calc(100vw - 86px) !important;

        :root[uidensity=touch] & {
            --tab-min-width-pref: calc(100vw - 102px) !important;
        }
    }

    /* Smaller tab width to allow for private browsing indicator */
    :root[privatebrowsingmode="temporary"] #tabbrowser-tabs {
        --tab-min-width-pref: calc(100vw - 116px) !important; /* width */

        :root[uidensity=touch] & {
            --tab-min-width-pref: calc(100vw - 132px) !important;
        }
    }

    /* Fix private browsing mode for current Firefox >= 133 */
    hbox.private-browsing-indicator-with-label label {
        display: none;
    }

    /* Hide firefox-view tab, as none of the options in about:config hides it on FF 123 */
    #firefox-view-button {
        display: none;
    }

    /* Option to show multiple tabs in tab bar */
    @media not (-moz-pref("mcf.tabs.showFocusedTabOnly.enabled")) {
        /* Set small tabs width for small screens */
        #tabbrowser-tabs,
        :root[privatebrowsingmode="temporary"] #tabbrowser-tabs {
            --tab-min-width: 75px !important;
            --tab-min-width-pref: 75px !important;
            --tab-max-width: 150px !important;
            --tab-max-width-pref: 150px !important;
        }

        /* Remove empty space at start/end */
        .titlebar-spacer[type="pre-tabs"], .titlebar-spacer[type="post-tabs"] {
            width: 0px !important;
        }

        #private-browsing-indicator-with-label {
            width: 22px;
        }

        /* Optionally show close button on all tabs */
        @media -moz-pref("mcf.tabs.alwaysShowCloseButton") {
            .tab-close-button, .close-icon, #tabbrowser-tabs[closebuttons="activetab"][orient="horizontal"] &:not([selected]) {
                display: block !important;
            }
        }
    }

    @media not (-moz-pref("mcf.toolbar.positionOnTop")) {
        /* Rotate the arrow on the "all tabs" button to point upwards, since the
         * tabs and searchbar were moved to the bottom. */
        @media not -moz-pref("mcf.toolbar.tabCounter.enabled") {
            #alltabs-button {
                transform: rotate(180deg) !important;
            }
        }
    }

    /* All tabs menu: hide scroll buttons */
    #scrollbutton-up, #scrollbutton-down {
        display: none !important;
    }

    /* All tabs menu: hide the search and the separator below it. */
    #allTabsMenu-searchTabs,
    #allTabsMenu-tabsSeparator {
        display: none;
    }
}
