/*
  Shared table header column boundaries.
  The manual resize handles own the visible column boundaries. Header cells
  intentionally avoid drawing default right-edge separators.
*/

:root {
  --lineage-table-column-separator: color-mix(in srgb, var(--line-strong, #c9c9ce) 94%, transparent 6%);
  --lineage-table-column-separator-active: color-mix(in srgb, var(--ink-1, #60636c) 94%, transparent 6%);
  --lineage-table-header-border: var(--line, #e0e0e2);
}

thead tr:first-child > th[data-col] {
  position: sticky;
  top: 0;
  z-index: 40;
  color: var(--ink-0, #15161a);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: var(--lineage-db-header-height, 30px);
  box-shadow: none;
  border-bottom: 1px solid var(--lineage-table-header-border);
  background-image: none;
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 1px 100%;
}

thead tr:first-child > th[data-col] > button {
  font-weight: inherit;
}

thead tr:first-child > th[data-col].sortable,
thead tr:first-child > th[data-col][aria-sort],
thead tr:first-child > th[data-col]:has(> button[data-sort]) {
  cursor: pointer;
  padding-right: 24px;
  user-select: none;
  white-space: nowrap;
}

thead tr:first-child > th[data-col][data-col],
thead tr:first-child > th[data-col][data-col] > button {
  color: var(--ink-0, #15161a);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

thead tr:first-child > th[data-col].sortable:hover {
  background-color: transparent !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: right center !important;
  background-size: 1px 100% !important;
}

thead tr:first-child > th[data-col].sort-asc,
thead tr:first-child > th[data-col].sort-desc,
thead tr:first-child > th[data-col][aria-sort='ascending'],
thead tr:first-child > th[data-col][aria-sort='descending'] {
  font-weight: 700;
}

thead tr:first-child > th[data-col][data-col].sort-asc,
thead tr:first-child > th[data-col][data-col].sort-desc,
thead tr:first-child > th[data-col][data-col][aria-sort='ascending'],
thead tr:first-child > th[data-col][data-col][aria-sort='descending'],
thead tr:first-child > th[data-col][data-col].sort-asc > button,
thead tr:first-child > th[data-col][data-col].sort-desc > button,
thead tr:first-child > th[data-col][data-col][aria-sort='ascending'] > button,
thead tr:first-child > th[data-col][data-col][aria-sort='descending'] > button {
  font-weight: 700;
}

thead tr:first-child > th[data-col].sort-asc::after,
thead tr:first-child > th[data-col].sort-desc::after,
thead tr:first-child > th[data-col][aria-sort='ascending']::after,
thead tr:first-child > th[data-col][aria-sort='descending']::after {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  font-size: 10px;
  line-height: 1;
}

thead tr:first-child > th[data-col].sort-asc::after,
thead tr:first-child > th[data-col][aria-sort='ascending']::after {
  content: '\2193';
}

thead tr:first-child > th[data-col].sort-desc::after,
thead tr:first-child > th[data-col][aria-sort='descending']::after {
  content: '\2191';
}

thead tr:first-child > th[data-col].is-resizing-column-boundary,
thead tr:first-child > th[data-col]:has(.db-col-resizer:hover),
thead tr:first-child > th[data-col]:has(.db-col-resizer.active),
thead tr:first-child > th[data-col]:has(.imp-col-resizer:hover),
thead tr:first-child > th[data-col]:has(.imp-col-resizer.active),
thead tr:first-child > th[data-col]:has(.col-resizer:hover),
thead tr:first-child > th[data-col]:has(.col-resizer.active) {
  background-image: none;
  background-size: 2px 100%;
}

.db-col-resizer,
.imp-col-resizer,
.col-resizer {
  position: absolute;
  top: 0;
  right: -10px;
  width: 20px;
  height: 100%;
  /* The handle is the wider hitbox and the separator line lights up on its
     hover - that is the affordance. The browser's double-arrow on top of it
     was a second one. */
  cursor: default;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.db-col-resizer {
  z-index: 90;
}

.imp-col-resizer {
  z-index: 20;
}

.col-resizer {
  z-index: 9;
}

.db-col-resizer::after,
.imp-col-resizer::after,
.col-resizer::after {
  content: '';
  position: absolute;
  top: 12%;
  bottom: 12%;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--lineage-table-column-separator);
  pointer-events: none;
}

.db-col-resizer:hover::after,
.db-col-resizer.active::after,
.imp-col-resizer:hover::after,
.imp-col-resizer.active::after,
.col-resizer:hover::after,
.col-resizer.active::after {
  width: 2px;
  background: var(--lineage-table-column-separator-active);
}
