/***** Button *****/

#VimFxButton {
  list-style-image: url(icon16.png);
}

#main-window[vimfx-mode="ignore"] #VimFxButton {
  list-style-image: url(icon16-red.png);
}

#VimFxButton[cui-areatype="menu-panel"],
toolbarpaletteitem[place="palette"] > #VimFxButton {
  list-style-image: url(icon32.png);
}

#main-window[vimfx-mode="ignore"] #VimFxButton[cui-areatype="menu-panel"],
#main-window[vimfx-mode="ignore"] toolbarpaletteitem[place="palette"] > #VimFxButton {
  list-style-image: url(icon32-red.png);
}

@media (min-resolution: 2dppx) {
  #VimFxButton {
    list-style-image: url(icon32.png);
  }

  #main-window[vimfx-mode="ignore"] #VimFxButton {
    list-style-image: url(icon32-red.png);
  }

  #VimFxButton[cui-areatype="menu-panel"],
  toolbarpaletteitem[place="palette"] > #VimFxButton {
    list-style-image: url(icon64.png);
  }

  #main-window[vimfx-mode="ignore"] #VimFxButton[cui-areatype="menu-panel"],
  #main-window[vimfx-mode="ignore"] toolbarpaletteitem[place="palette"] > #VimFxButton {
    list-style-image: url(icon64-red.png);
  }
}

#main-window:-moz-any(
      [vimfx-mode="normal"][vimfx-focus-type="editable"],
      [vimfx-mode="find"][vimfx-focus-type="findbar"]
    ) #VimFxButton image {
  filter: grayscale(100%) brightness(150%);
}



/* All styles below are intentionally very generic to fit with the user’s system
 * and preferences. */



/***** Markers *****/

#VimFxMarkersContainer {
  display: -moz-box;
  position: relative;
  pointer-events: none;
  font: menu;
}

  #VimFxMarkersContainer.ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
  }

/* Marker styles should be kept simple for performance. */
#VimFxMarkersContainer .marker {
  position: absolute;
  --padding: 0.2em;
  padding: var(--padding);
  --border-color: rgba(0, 0, 0, 0.4);
  --border-width: 1px;
  border: solid var(--border-width) var(--border-color);
  background-color: #ffd76e;
  color: black;
  font-size: 0.8em;
  line-height: 1;
  font-weight: bold;
  white-space: nowrap;
  /* Some light-weight themes set a `text-shadow` that the hint markers inherit,
   * making them almost unreadable. */
  text-shadow: none;
}

#VimFxMarkersContainer:not(.has-mixedcase) .marker {
  text-transform: uppercase;
}

#VimFxMarkersContainer .marker-char {} /* Keep as documentation. */

#VimFxMarkersContainer .marker--matched,
#VimFxMarkersContainer .marker-char--matched {
  color: rgba(0, 0, 0, 0.3);
}

#VimFxMarkersContainer .marker--highlighted {
  background-color: lime;
}

#VimFxMarkersContainer .marker--hidden {
  display: none;
}

/* alt, ctrl, meta and shift can be targeted. */
#main-window[vimfx-held-modifiers~="ctrl"][vimfx-held-modifiers~="shift"]
    #VimFxMarkersContainer {
  opacity: 0.2;
}

#VimFxMarkersContainer .marker[data-type="scrollable"] {
  --width: 0.17em;
  padding-right: calc(var(--padding) + var(--border-width) + var(--width));
}

  #VimFxMarkersContainer .marker[data-type="scrollable"]::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: var(--width);
    border-left: inherit;
    background-image: linear-gradient(
      to bottom,
      transparent 15%,
      var(--border-color) 0,
      var(--border-color) 75%,
      transparent 0
    );
  }



/***** Help Dialog *****/

#VimFxHelpDialogContainer {
  display: -moz-box;
  position: relative;

  opacity: 0.92;
  background-color: Window;
  color: WindowText;
  font: menu;
  /* Some light-weight themes set a `text-shadow` that the hint markers inherit,
   * making them almost unreadable. */
  text-shadow: none;
  cursor: default;

  --page-padding: 3em;
  --gutter: 1em;
}

  #VimFxHelpDialogContainer .wrapper {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: calc(var(--page-padding) / 2);
    padding-left: calc(var(--page-padding) - var(--gutter));
    padding-right: var(--page-padding);
  }

  #VimFxHelpDialogContainer .vimfx-box {
    display: block;
  }

  #VimFxHelpDialogContainer :-moz-any(.heading-mode, .heading-category, .key-sequence) {
    font-weight: bold;
    white-space: nowrap;
  }


#VimFxHelpDialogContainer .header {
  position: relative;
  margin-left: var(--gutter);
  margin-bottom: calc(var(--page-padding) / 4);
  font-weight: bold;
}

  #VimFxHelpDialogContainer .heading-main {
    font-size: 4.2em;
    /* Add space for the close button. */
    margin-right: 0.4em;
  }

    #VimFxHelpDialogContainer .logo {
      display: inline;
      margin-right: 0.5ch;
      color: #349938;
      font-family: Helvetica, Arial, Verdana, sans-serif;
      font-style: italic;
      letter-spacing: -0.035em;
      text-shadow: 0.04em 0.02em black;
    }

      #VimFxHelpDialogContainer .logo::before {
        content: 'ım';
        margin-left: -0.15em;
        padding-left: 1.67ch;
        background: url(icon128.png) no-repeat;
        background-size: contain;
      }

      #VimFxHelpDialogContainer .logo::after {
         content: 'Fx';
         color: #d37826;
      }

    #VimFxHelpDialogContainer .title {
      display: inline-block;
      font-size: 1.4ex;
      line-height: 1.2;
    }

  #VimFxHelpDialogContainer .close-button {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 3em;
    -moz-user-select: none;
  }

    #VimFxHelpDialogContainer .close-button:hover {
      cursor: pointer;
    }

#VimFxHelpDialogContainer .content {
  display: flex;
  flex-wrap: wrap;
}

  #VimFxHelpDialogContainer .category {
    flex: 1 16em;
    margin-left: var(--gutter);
    margin-bottom: calc(var(--page-padding) / 2);
  }

  #VimFxHelpDialogContainer :-moz-any([data-mode="find"], [data-mode="marks"]) {
    display: none;
  }

  #VimFxHelpDialogContainer .heading-mode,
  #VimFxHelpDialogContainer .category:not(.first)::before {
    font-size: 2em;
  }

  #VimFxHelpDialogContainer .category:not(.first)::before {
    /* Insert newline the same size as a `.heading-mode` to vertically align all
     * `.heading-category`s. */
    content: "\A";
    white-space: pre;
  }

  #VimFxHelpDialogContainer .heading-category {
    font-size: 1.5em;
  }

  #VimFxHelpDialogContainer .command {
    float: left;
    clear: left;
    width: 100%;
    margin-top: 0.2em;
  }

    #VimFxHelpDialogContainer .command.has-click {
      cursor: pointer;
    }

    #VimFxHelpDialogContainer .command.has-click:hover * {
      text-decoration: underline;
    }

    #VimFxHelpDialogContainer .key-sequence {
      float: left;
      margin-right: 1.7ch;
    }

      #VimFxHelpDialogContainer .key-sequence:last-of-type {
        margin-right: 0.7ch;
      }

      #VimFxHelpDialogContainer .key-sequence-special-keys {
        /* The special keys are not helpful in the help dialog. If somebody
         * disagrees, they can simply re-show them with custom CSS. */
        display: none;
      }

      #VimFxHelpDialogContainer .key-sequence-rest {
        display: inline;
      }

    #VimFxHelpDialogContainer .description {
      float: right;
      width: calc(100% - 3.7em);
    }

  #VimFxHelpDialogContainer .search-input {
    position: absolute;
    right: 0;
    bottom: 0;
  }

    #VimFxHelpDialogContainer .search-input:not(:focus) {
      opacity: 0;
      pointer-events: none;
    }

  #VimFxHelpDialogContainer .search-match {} /* Keep as documentation. */

  #VimFxHelpDialogContainer .search-non-match {
    opacity: 0.2;
  }

  #VimFxHelpDialogContainer .search-highlight {
    display: inline;
    background-color: Highlight;
    color: HighlightText;
  }
