/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


@media (-moz-windows-compositor) {
  #Bluegriffon {
    -moz-appearance: -moz-win-glass;
  }

  @media not all and (-moz-os-version: windows-vista) {
    @media not all and (-moz-os-version: windows-win7) {
      @media not all and (-moz-os-version: windows-win8) {
        @media (-moz-windows-default-theme) {
          #Bluegriffon {
            background-color: hsl(0, 0%, 78%);
          }
        }

        @media not all and (-moz-windows-default-theme) {
          #Bluegriffon {
            background-color: transparent;
          }
        }

        #titlebar-buttonbox,
        .titlebar-button {
          -moz-appearance: none !important;
        }

        .titlebar-button {
          border: none;
          margin: 0 !important;
          padding: 10px 17px;
        }

        #Bluegriffon[sizemode=maximized] .titlebar-button {
          padding-top: 8px;
          padding-bottom: 8px;
        }

        .titlebar-button > .toolbarbutton-icon {
          width: 12px;
          height: 12px;
        }

        #titlebar-min {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#minimize);
        }

        #titlebar-max {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#maximize);
        }

        #Bluegriffon[sizemode="maximized"] #titlebar-max {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#restore);
        }

        #titlebar-close {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#close);
        }
        #titlebar-close:hover {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#close-white);
        }

        #titlebar-min:-moz-lwtheme {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#minimize-themes);
        }
        #titlebar-max:-moz-lwtheme {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#maximize-themes);
        }
        #Bluegriffon[sizemode="maximized"] #titlebar-max:-moz-lwtheme {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#restore-themes);
        }
        #titlebar-close:-moz-lwtheme {
          list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#close-themes);
        }


        /* the 12px image renders a 10px icon, and the 10px upscaled gets rounded to 12.5, which
         * rounds up to 13px, which makes the icon one pixel too big on 1.25dppx. Fix: */
        @media (min-resolution: 1.20dppx) and (max-resolution: 1.45dppx) {
          .titlebar-button > .toolbarbutton-icon {
            width: 11.5px;
            height: 11.5px;
          }
        }

        /* 175% dpi should result in the same device pixel sizes as 150% dpi. */
        @media (min-resolution: 1.70dppx) and (max-resolution: 1.95dppx) {
          .titlebar-button {
            padding-left: 14.1px;
            padding-right: 14.1px;
          }

          .titlebar-button > .toolbarbutton-icon {
            width: 10.8px;
            height: 10.8px;
          }
        }

        /* 225% dpi should result in the same device pixel sizes as 200% dpi. */
        @media (min-resolution: 2.20dppx) and (max-resolution: 2.45dppx) {
          .titlebar-button {
            padding-left: 15.3333px;
            padding-right: 15.3333px;
          }

          .titlebar-button > .toolbarbutton-icon {
            width: 10.8px;
            height: 10.8px;
          }
        }

        /* 275% dpi should result in the same device pixel sizes as 250% dpi. */
        @media (min-resolution: 2.70dppx) and (max-resolution: 2.95dppx) {
          /* NB: todo: this should also change padding on the buttons
           * themselves, but without a device to test this on, it's
           * impossible to know by how much. */
          .titlebar-button > .toolbarbutton-icon {
            width: 10.8px;
            height: 10.8px;
          }
        }

        @media (-moz-windows-default-theme) {
          .titlebar-button:hover {
            background-color: hsla(0, 0%, 0%, .12);
          }

          .titlebar-button:hover:active {
            background-color: hsla(0, 0%, 0%, .22);
          }

          .titlebar-button:not(:hover) > .toolbarbutton-icon:-moz-window-inactive {
            opacity: 0.5;
          }

          #titlebar-close:hover {
            background-color: hsl(355, 86%, 49%);
          }

          #titlebar-close:hover:active {
            background-color: hsl(355, 82%, 69%);
          }
        }
        @media not all and (-moz-windows-default-theme) {
          .titlebar-button {
            background-color: -moz-field;
          }
          .titlebar-button:hover {
            background-color: Highlight;
          }

          #titlebar-min {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#minimize-highcontrast);
          }
          #titlebar-min:hover {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#minimize-highcontrast-hover);
          }

          #titlebar-max {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#maximize-highcontrast);
          }
          #titlebar-max:hover {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#maximize-highcontrast-hover);
          }

          #Bluegriffon[sizemode="maximized"] #titlebar-max {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#restore-highcontrast);
          }
          #Bluegriffon[sizemode="maximized"] #titlebar-max:hover {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#restore-highcontrast-hover);
          }

          #titlebar-close {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#close-highcontrast);
          }
          #titlebar-close:hover {
            list-style-image: url(chrome://bluegriffon/skin/caption-buttons.svg#close-highcontrast-hover);
          }
        }
      }
    }
  }

  @media (-moz-os-version: windows-vista),
         (-moz-os-version: windows-win7),
         (-moz-os-version: windows-win8) {
    #Bluegriffon[sizemode="maximized"] #titlebar-buttonbox {
      -moz-margin-end: 3px;
    }

    #Bluegriffon {
      background-color: transparent;
      -moz-appearance: -moz-win-borderless-glass;
    }

    /* These should be hidden w/ glass enabled. Windows draws its own buttons. */
    .titlebar-button {
      display: none;
    }
  }

  @media (-moz-os-version: windows-win8) {
    /* Artificially draw window borders that are covered by lwtheme, see bug 591930.
     * Borders for vista/win7 are below, win10 doesn't need them. */
    #Bluegriffon[sizemode="normal"] > #tab-view-deck > #browser-panel:-moz-lwtheme {
      border-top: 1px solid @toolbarShadowColor@;
    }
  }

  @media (-moz-windows-default-theme) {
    #toolbar-menubar:not(:-moz-lwtheme),
    #TabsToolbar:not(:-moz-lwtheme) {
      color: black;
    }

    #composer-main-menubar > menu:not(:-moz-lwtheme) {
      color: inherit;
    }

    /* Use a different color only on Windows 8 and higher for inactive windows.
     * On aero, the menubar fog disappears for inactive windows, and renders gray
     * illegible.
     */
    @media not all and (-moz-os-version: windows-vista) {
      @media not all and (-moz-os-version: windows-win7) {
        #toolbar-menubar:not(:-moz-lwtheme):-moz-window-inactive {
          color: ThreeDShadow;
        }
      }
    }
  }

  #Bluegriffon[darkwindowframe="true"] #toolbar-menubar:not(:-moz-lwtheme):not(:-moz-window-inactive),
  #Bluegriffon[darkwindowframe="true"] #TabsToolbar:not(:-moz-lwtheme):not(:-moz-window-inactive) {
    color: white;
  }

  #toolbar-menubar:not(:-moz-lwtheme) {
    text-shadow: 0 0 .5em white, 0 0 .5em white, 0 1px 0 rgba(255,255,255,.4);
  }

  /* Show borders on vista through win8, but not on win10 and later: */
  @media (-moz-os-version: windows-vista),
         (-moz-os-version: windows-win7),
         (-moz-os-version: windows-win8) {
    /* Vertical toolbar border */
    #Bluegriffon:not([customizing])[sizemode=normal] #navigator-toolbox:not(:-moz-lwtheme)::after,
    #Bluegriffon:not([customizing])[sizemode=normal] #navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(:-moz-lwtheme),
    #Bluegriffon:not([customizing])[sizemode=normal] #navigator-toolbox:-moz-lwtheme,
    #Bluegriffon[customizing] #navigator-toolbox::after,
    #Bluegriffon[customizing] #navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar) {
      border-left: 1px solid @toolbarShadowColor@;
      border-right: 1px solid @toolbarShadowColor@;
      background-clip: padding-box;
    }

    #Bluegriffon[sizemode=normal] #browser-border-start,
    #Bluegriffon[sizemode=normal] #browser-border-end {
      display: -moz-box;
      background-color: @toolbarShadowColor@;
      width: 1px;
    }

    #Bluegriffon[sizemode=normal] #browser-bottombox {
      border: 1px solid @toolbarShadowColor@;
      border-top-style: none;
      background-clip: padding-box;
    }

  }

  #Bluegriffon[sizemode=normal] #TabsToolbar {
    padding-left: 1px;
    padding-right: 1px;
  }

  #appcontent:not(:-moz-lwtheme) {
    background-color: -moz-dialog;
  }

  #composer-main-menubar:not(:-moz-lwtheme):not(:-moz-window-inactive) {
    background-color: rgba(255,255,255,.5);
    color: captiontext;
  }

  #composer-main-menubar:not(:-moz-lwtheme):-moz-window-inactive {
    color: inactivecaptiontext;
  }

  @media (-moz-os-version: windows-vista),
         (-moz-os-version: windows-win7) {
    #composer-main-menubar:not(:-moz-lwtheme):not(:-moz-window-inactive) {
      border-radius: 4px;
    }

  }
}

@media (-moz-windows-glass) {
  #Bluegriffon[sizemode=normal] #nav-bar {
    border-top-left-radius: 2.5px;
    border-top-right-radius: 2.5px;
  }

  #Bluegriffon[sizemode=fullscreen]:not(:-moz-lwtheme) {
    -moz-appearance: none;
    background-color: #556;
  }

}

/* Aero Basic */
@media not all and (-moz-windows-compositor) {
  @media (-moz-windows-default-theme) {
    #Bluegriffon {
      background-color: rgb(185,209,234);
    }
    #Bluegriffon:-moz-window-inactive {
      background-color: rgb(215,228,242);
    }
  }

  #print-preview-toolbar:not(:-moz-lwtheme) {
    -moz-appearance: -moz-win-browsertabbar-toolbox;
  }
}

#composer-main-menubar > menu {
  color: var(--bg-main-foreground-color) ! important;
  -moz-appearance: none;
  background-color: transparent;
}
#composer-main-menubar > menu:-moz-window-inactive {
  color: var(--bg-main-foreground-color-inactive) ! important;
}

