/*
  vg-table-sort.css - the pointer, the caret and the pressed state for
  js/vg-table-sort.js.

  The script marks every sortable header with the class vg-sort-th and keeps
  the sort direction on the header's aria-sort attribute, so the caret and the
  emphasis are driven entirely from the attribute - there is no second piece of
  state to keep in step.

  Loaded after responsive.css, but the rules here are scoped to a single class
  (th.vg-sort-th) and never set width, display or overflow, so they cannot fight
  the responsive table rules whatever the source order.
*/

th.vg-sort-th {
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  white-space: nowrap;
}

/* The resting caret: a small up-down arrow, faint, so an unsorted table does
   not look busy. */
th.vg-sort-th::after {
  content: "\2195";
  margin-left: .35em;
  font-size: .8em;
  opacity: .3;
}

/* An active column is emphasised and pointed the way the rows run. */
th.vg-sort-th[aria-sort="ascending"]::after {
  content: "\2191";
  opacity: 1;
}

th.vg-sort-th[aria-sort="descending"]::after {
  content: "\2193";
  opacity: 1;
}

th.vg-sort-th[aria-sort="ascending"],
th.vg-sort-th[aria-sort="descending"] {
  font-weight: 600;
}

th.vg-sort-th:hover {
  background-color: rgba(0, 0, 0, .05);
}

th.vg-sort-th:focus-visible {
  outline: 2px solid #1f5f99;
  outline-offset: -2px;
}

/* A SERVER-sorted list (the warehouse Open Orders / Invoice Entry, the Sales Order list, the Purchase
   Order list and the AP/AR invoice history) renders its headers as links to the server-side sort the
   templates build (_vg_sort.html). The link must read as the header text, not as a blue anchor, and
   the caret above still shows the order. */
.vg-sort-link {
  color: inherit;
  text-decoration: none;
}

.vg-sort-link:hover,
.vg-sort-link:focus {
  color: inherit;
  text-decoration: underline;
}

th.vg-sort-th.vg-sort-active {
  background-color: rgba(0, 0, 0, .06);
}

/* A report or a printed list must come off the printer exactly as it did before
   the sorter existed: no caret, no hover tint, no pointer. The caret is the only
   thing the script adds to the header, so hiding it here is enough to leave the
   paper output unchanged. */
@media print {
  th.vg-sort-th::after {
    content: none !important;
    display: none !important;
  }
  th.vg-sort-th {
    cursor: auto !important;
    background-color: transparent !important;
  }
}
