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

%titlebar,
headerbar {
  transition: none;
  padding: 0px 6px;
  border-width: 0px 0px 1px 0px;
  border-radius: 3px 3px 0px 0px;
  border-style: solid;
  border-color: s_color(normal);
  color: t_color(text);
  background-image: linear-gradient(to bottom,change-color(t_color(background),$lightness: min(lightness(t_color(background))*1.2,100%)),t_color(background));
  &:backdrop {
    border-color: transparent;
    background-image: none;
    background-color: t_color(backdrop-background);
    color: t_color(backdrop-text);
    box-shadow: none;
  }
  label {
    font-weight: normal;
    &:backdrop { color: t_color(backdrop-text); }
  }
  .path-bar button {
    color: t_color(text);
    font-weight: normal;
    &:backdrop { color: t_color(backdrop-text)}
    }
  button {
    transition: none;
    @include button(undecorated, $tc: t_color(text));

    &.flat {
      @include button(undecorated,$tc: t_color(text));
    }
    &:hover {
      @include button(hover, $tc: t_color(text));
      &:backdrop { border-color: t_color(backdrop-background); }
    }
    &:active, &:checked {
      @include button(active);
      &:hover {
  	  @include button(active-hover);
      }
      &:backdrop {
        background-image: none;
        background-color: t_color(backdrop-background);
        border-color: t_color(backdrop-background);
        color: t_color(backdrop-text);
      }
    }

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

    &:backdrop {
      border-color: transparent;
      background-image: none;
      background-color: t_color(backdrop-background);
      color: t_color(backdrop-text);
      }

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

  .title {
    font-weight: normal;
    padding: 0px 12px;
    &:backdrop { color: t_color(backdrop-text)}
  }

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

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

  &.selection-mode {

    @extend .info;

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

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

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

      GtkArrow { -GtkArrow-arrow-scaling: 1; }

      .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: b_color(active);
  &:hover {
    background-color: b_color(hover);
    color: b_color(text)
    }
  &:disabled {
    background-color: transparent;
    background-image: none;
    color: insensitive(t_color(text));
    &:active, &:checked {
      @include button(insensitive-active);
      }
    }
  &:backdrop {
    background-color: t_color(backdrop-background);
    border-color: transparent;
    color: t_color(backdrop-text);
    &:disabled {
      color: insensitive(t_color(backdrop-text));
    }
  }
}
