/* Copyright 2022 Oliver Smith
 * SPDX-License-Identifier: MPL-2.0 */

@media (max-width: 700px) {
    @media not (-moz-bool-pref: "mcf.addressbarontop"),
        not (-moz-pref("mcf.addressbarontop")) {
        /* Spawn the menu above the navigation bar (now that we've moved it to the
         * bottom). Without this, it still spawns above, but only with a small
         * height. This is due to the position="bottomcenter topright" attribute in
         * the HTML, which we can't override via CSS. */
        #appMenu-popup {
            margin-top: -410px !important;
        }

        #appMenu-protonMainView vbox.panel-subview-body, #appMenu-mainView vbox.panel-subview-body {
            height: 330px !important;
            max-height: 330px !important;
        }
    }

    #appMenu-popup {
        height: 330px;
        max-height: 330px;
    }

    #appMenu-multiView box.panel-viewstack:first-child {
        /* Use the whole space in the menu, instead of slowly increasing the
         * height via animation. This animation is broken anyway due to the
         * above menu size hack */
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
    }

    /* Menu content
     * - configure it to have most important functions for mobile
     *   on one page, without scrolling. (Scrolling was only possible with the
     *   scrollbar on the right anyway, which is awkward when expecting to be
     *   able to scroll with fingers.)
     * - submenus are hidden, because attempting to scroll inside them with the
     *   finger causes firefox to segfault. This is likely due to the menu
     *   positioning hack above, looks like FF can't determine the height
     *   properly. Help with fixing this is appreciated, the bookmarks and
     *   history submenus would be useful. However even without the submenus,
     *   the history and saved bookmarks can at least be accessed conveniently
     *   through the navigation search.
     * - fullscreen is hidden: not available in FF for android either, the
     *   screen is almost used completely already, causes problems with UIs
     *   that don't expect apps to go fullscreen (i.e. in Phosh, as soon as
     *   the on screen keyboard is triggered, the top and bottom bars of Phosh
     *   are over the FF in fullscreen) */
    #appMenu-fxa-status2, /* FF login */
    #appMenu-fxa-separator, /* FF login */
    #appMenu-new-window-button2,
    #appMenu-protonMainView toolbarseparator, /* all separators, FF <= 126 */
    #appMenu-mainView toolbarseparator, /* all separators, FF 127++ */
    #appMenu-save-file-button2, /* Save file can be done from Print too */
    #appMenu-fullscreen-button2,
    #appMenu-passwords-button, /* accessible from settings */
    #appMenu-extensions-themes-button, /* accessible from settings */
    #appMenu-bookmarks-button, /* submenu */
    #appMenu-history-button, /* submenu */
    #appMenu-more-button2, /* submenu */
    #appMenu-help-button2, /* submenu */
    .subviewbutton[shortcut]::after { /* menu shortcuts ("Ctrl+T" etc.) */
        display: none !important;
    }
}
