@charset "UTF-8";

/***************
 * Header bars *
 ***************/

%titlebar,
headerbar {

  padding: 0px 6px;
  border-width: 0px 0px 1px 0px;
  border-radius: 3px 3px 0px 0px;
  border-style: solid;
  border-color: gtk("@borders");
  color: gtk("@theme_titlebar_foreground");
  background-image: none;
  background-color: gtk("@theme_titlebar_background");
  &:backdrop {
    border-color: transparent;
    background-image: none;
    background-color: gtk("@theme_titlebar_background_backdrop");
    color: gtk("@theme_titlebar_foreground_backdrop");
    box-shadow: none;
  }
  label {
    font-weight: normal;
    &:backdrop { color: gtk("@theme_titlebar_foreground_backdrop"); }
  }
  .path-bar button {
    color: gtk("@theme_titlebar_foreground");
    font-weight: normal;
    &:backdrop { 
      color: gtk("@theme_titlebar_foreground_backdrop");
    }
    }
  button {

    @include button(undecorated);
    color: gtk("@theme_titlebar_foreground");

    &.flat {
      @include button(undecorated);
      color: gtk("@theme_titlebar_foreground");
    }
    &:hover {
      @include button(hover);
      color: gtk("@theme_titlebar_foreground");
      &:backdrop { 
        @include button(backdrop-hover);
      }
    }
    &:active, &:checked {
      @include button(active);
      &:hover {
  	  @include button(active-hover);
      }
      &:backdrop {
        background-image: none;
        background-color: gtk("@theme_titlebar_background_backdrop");
        border-color: gtk("@theme_titlebar_background_backdrop");
        color: gtk("@theme_titlebar_foreground_backdrop");
        &:hover { 
          @include button(backdrop-hover);
        }
      }
    }

    &.suggested-action {
      @extend %suggested-action;
    }

    &:backdrop {
      border-color: transparent;
      background-image: none;
      background-color: gtk("@theme_titlebar_background_backdrop");
      color: gtk("@theme_titlebar_foreground_backdrop");
      }

    &.flat:backdrop, &.flat:backdrop:disabled, &:disabled:backdrop {
      background-image: none;
      background-color: gtk("@theme_titlebar_background_backdrop");
      color: gtk("@theme_titlebar_foreground_backdrop");
      border-color: transparent;
      }
    &.flat:disabled {
      @extend %undecorated_button;;
      color: gtk("@theme_titlebar_foreground_insensitive");
      }
    &:disabled {
      background-color: transparent;
      background-image: none;
      border-color: transparent;
      color: gtk("@theme_titlebar_foreground_insensitive");
      &:active, &:checked {
        @include button(insensitive-active);
      }
    }
  }

  .title {
    font-weight: normal;
    padding: 0px 12px;
    &:backdrop { 
      color: gtk("@theme_titlebar_foreground_backdrop");
    }
  }

  .subtitle {
    font-size: smaller;
    padding: 0 12px;
    @extend .dim-label;
    &:backdrop { 
      color: gtk("@theme_titlebar_foreground_backdrop");
    }
  }

  separator {
    border-width: 0px;
    background-color: transparent;
    background-image: none;
    border-color: transparent;
  }

  &.selection-mode, &.selection-mode headerbar {
    background-color: gtkmix("@theme_titlebar_background", "@theme_button_decoration_focus", 0.5);
    separator {
      background-color: gtk("@theme_button_decoration_focus");
    }
    button:not(.titlebutton) {
      background-color: gtkalpha(gtk("@theme_button_decoration_focus"), 0.5);
      &:active, &:focus {
        background-color: gtk("@theme_button_decoration_focus");
      }
    }

    &.suggested-action {
      @extend %suggested-action;
    }

    .subtitle:link { @extend *:link:selected;  }

    .selection-menu {
      padding: 4px 6px;

      .arrow {
        -gtk-icon-source: -gtk-icontheme('pan-down-symbolic');
        -gtk-icon-shadow: none;
      }
    }
  }

  .tiled &, .maximized & {
    border-radius: 0; // squared corners when the window is max'd or tiled
  }
}

headerbar {
  // add vertical margins to headerbar entries, buttons and separators to avoid them spanning the whole height
  entry,
  spinbutton,
  separator,
  button {
    margin-top: 3px;
    margin-bottom: 3px;
  }
}

%suggested-action {
  background-image: none;
  background-color: gtk("@theme_button_decoration_focus");
  &:hover {
    background-color: gtk("@theme_button_decoration_hover");
    color: gtk("@theme_button_foreground_normal");
    }
  &:disabled {
    background-color: transparent;
    background-image: none;
    color: gtk("@theme_titlebar_foreground_insensitive");
    &:active, &:checked {
      @include button(insensitive-active);
      }
    }
  &:backdrop {
    background-color: gtk("@theme_titlebar_background_backdrop");
    border-color: transparent;
    color: gtk("@theme_titlebar_foreground_backdrop");
    &:disabled {
      color: gtk("@theme_titlebar_foreground_insensitive_backdrop");
    }
  }
}
