columnview {
  @include focus-ring();

  &.view:disabled {
    color: var(--view-fg-color);
  }

  &:drop(active) {
    box-shadow: none;
  }

  > header > button {
    background-color: transparent;
    padding-top: 3px;
    padding-bottom: 3px;
    padding-left: 6px;
    padding-right: 6px;
    border-radius: 0;
    box-shadow: none;
    line-height: 100%;
    border-left: 1px solid transparent;

    &:first-child {
      border-left-width: 0;
    }

    > box {
      color: color-mix(in srgb, currentColor 40%, transparent);
      @extend .caption-heading;
      border-spacing: 6px;

      @media (prefers-contrast: more) {
        color: color-mix(in srgb, currentColor 60%, transparent);
      }
    }

    &:hover > box {
      color: color-mix(in srgb, currentColor 70%, transparent);
      box-shadow: none;

      @media (prefers-contrast: more) {
        color: color-mix(in srgb, currentColor 90%, transparent);
      }
    }

    &:active > box {
      color: currentColor;
    }

    sort-indicator {
      &.ascending {
        -gtk-icon-source: -gtk-icontheme('pan-up-symbolic');
      }
      &.descending {
        -gtk-icon-source: -gtk-icontheme('pan-down-symbolic');
      }

      min-height: 16px;
      min-width: 16px;
    }
  }

  button.dnd,
  header.button.dnd { // for treeview-like derive widgets
    &:active, &:selected, &:hover, & {
      color: var(--accent-fg-color);
      background-color: var(--accent-bg-color);
      transition: none;
    }
  }

  // Remove the default background of the internal list view
  // since we already apply a background to the column view
  // with the .view class. Doing this will avoid overdraw.
  &.view > listview.view {
    background: none;
    color: inherit;
  }

  // move padding to child cells
  > listview > row {
    padding: 0;

    // align horizontal sizing with header buttons
    > cell {
      padding: 8px 6px;

      &:not(:first-child) {
        border-left: 1px solid transparent;
      }
    }
  }

  // make column separators visible when :show-column-separators is true
  &.column-separators {
    > listview > row > cell,
    > header > button {
      border-left-color: $border_color;
    }
  }

  > listview:not(.horizontal).separators > row:not(.separator) {
    border-top: 1px solid $border_color;
    border-bottom: none;
  }

  // shrink vertically for .data-table
  &.data-table > listview > row > cell {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  @include undershoot(top, true);
}

columnview row:not(:selected) cell editablelabel:not(.editing):focus-within {
  outline: 2px solid $focus_border_color;

  @media (prefers-contrast: more) {
    outline-color: $focus_border_color_hc;
  }
}

columnview row:not(:selected) cell editablelabel.editing:focus-within {
  outline: 2px solid var(--accent-color);
}

treeexpander {
  border-spacing: 4px;
}
