% 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/.

%include ../shared/compacttheme.inc.css

/* The window background is white due to no accentcolor in the lightweight
   theme. It can't be changed to transparent when there is no compositor
   (Win 7 in classic / basic theme), or else dragging and focus become
   broken. So instead just show the normal titlebar in that case, and override
   the window color as transparent when the compositor is available. */
@media (-moz-windows-compositor: 0) {
  :root[tabsintitlebar]:not([inDOMFullscreen]) #titlebar:-moz-lwtheme {
    visibility: visible;
  }

  /* Prevent accent color overriding the window background for
   * light and dark theme on Aero Basic. This is copied from browser-aero.css. */
  @media (-moz-windows-default-theme) {
    :root {
      background-color: rgb(185,209,234) !important;
    }
    :root:-moz-window-inactive {
      background-color: rgb(215,228,242) !important;
    }
  }
}

@supports -moz-bool-pref("browser.proton.tabs.enabled") {
/* Add a fog for background tabs to be visible on Windows 7 glass window background */
@media (-moz-os-version: windows-win7) {
  @media (-moz-windows-default-theme) {
    #TabsToolbar {
      background-image: radial-gradient(ellipse at bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.5) 80%, transparent);
      color: black;
      --lwt-toolbarbutton-icon-fill: currentColor;
    }
  }
}
} /*** END proton ***/

@supports not -moz-bool-pref("browser.proton.tabs.enabled") {
@media (-moz-os-version: windows-win7) {
  @media (-moz-windows-default-theme) {
    /* Always show light toolbar elements on aero surface. */
    #TabsToolbar {
      color: hsl(240,9%,98%);
    }

    /* Because we're forcing the tabs toolbar to be [brighttext] to
     * get white toolbar button icons, we need to manually set the
     * correct color for the tab hover state for the light theme. */
    .tabbrowser-tab:hover > .tab-stack > .tab-background > .tab-line:not([selected=true], [multiselected]):-moz-lwtheme-darktext {
      background-color: rgba(0,0,0,.2) !important;
    }
  }
}
} /*** END !proton ***/

@media (-moz-windows-glass) {
  @supports not -moz-bool-pref("browser.proton.tabs.enabled") {
  /* Use opaque white icons on Aero Glass. */
  #TabsToolbar {
    --lwt-toolbarbutton-icon-fill: white;
  }
  } /*** END !proton ***/

  /* Make the menubar text readable on aero glass (copied from browser-aero.css). */
  #toolbar-menubar {
    text-shadow: 0 0 .5em white, 0 0 .5em white, 0 1px 0 rgba(255,255,255,.4);
  }

  #main-menubar:not(:-moz-window-inactive) {
    background-color: rgba(255,255,255,.5);
    color: black;
    border-radius: 4px;
  }
}

@media (-moz-os-version: windows-win7),
       (-moz-os-version: windows-win8) {
  @media (-moz-windows-compositor) {
    :root {
      background: transparent !important;
    }

    /* Remove lwtheme borders from toolbars in non-maximized windows. */
    #toolbar-menubar,
    #TabsToolbar {
      border-inline-style: none !important;
    }
  }

  @supports not -moz-bool-pref("browser.proton.tabs.enabled") {
  /* Always show full-height tab separators on tabs with borders. */
  .tabbrowser-tab::before,
  .tabbrowser-tab::after {
    border-image: none !important;
  }

  /* Show border on tabs with background colors and
   * show the tabs toolbar background color inside tabs. */
  .tabbrowser-tab {
    background-color: var(--lwt-accent-color) !important;
    color: var(--lwt-text-color) !important;
    border-top: 1px solid var(--tabs-border-color);
    background-clip: padding-box;
  }

  /* The top border on top of the tab background is replaced
   * by the slightly transparent outside tabs-border-color. */
  .tab-background {
    border-top-style: none !important;
  }

  /* The border at the end of the tab strip is replaced
   * by the slightly transparent outside tabs-border-color. */
  .tabbrowser-tab[last-visible-tab] {
    border-inline-end: 1px solid var(--tabs-border-color);
  }

  .tabbrowser-tab[last-visible-tab]::after {
    display: none !important;
  }
  } /*** END !proton ***/

  /* Use proper menu text styling in Win7 classic mode (copied from browser.css) */
  @media (-moz-windows-compositor: 0),
         (-moz-windows-default-theme: 0) {
    :root[tabsintitlebar]:not([inFullscreen]) {
      color: CaptionText;
    }

    :root[tabsintitlebar]:not([inFullscreen]):-moz-window-inactive {
      color: InactiveCaptionText;
    }

    :root[tabsintitlebar] #main-menubar > menu {
      color: inherit;
    }
  }
}

/* Restored windows get an artificial border on windows, because the lwtheme background
 * overlaps the regular window border. That isn't the case for us, so we avoid painting
 * over the native border with our custom borders: */
#navigator-toolbox {
  /* These are !important to avoid specificity-wars with the selectors that add borders here. */
  background-image: none !important;
  border-top: none !important;
  box-shadow: none !important;
  padding-top: 0 !important;
}
