/* Kodza — Table
   A data table that sorts when you click a column title: the rows glide to their new place,
   the sorted column gets a soft band and an arrow that turns with the order. Numbers are
   right-aligned in tabular figures. The header stays put when the table scrolls
   (--kz-table-max sets a height), and the edges fade while there is more to scroll sideways.
   A status is told by a shape: a full dot, a ring, an ink pill, or struck through.
   Everything is tuned with the --kz-table-* variables. */
.kodza-table {
  --kz-table-bg: #ffffff;
  --kz-table-fg: #0a0a0a;
  --kz-table-muted: rgba(10, 10, 10, 0.6);
  --kz-table-line: rgba(10, 10, 10, 0.09);
  --kz-table-border: rgba(10, 10, 10, 0.1);
  --kz-table-soft: rgba(10, 10, 10, 0.035);
  --kz-table-ink: #0a0a0a;
  --kz-table-on-ink: #ffffff;
  --kz-table-max: none;
  --kz-table-fade-l: 0px;
  --kz-table-fade-r: 0px;
  --kz-table-ease: cubic-bezier(0.22, 1, 0.36, 1);

  max-height: var(--kz-table-max);
  overflow: auto;
  border-radius: 16px;
  background: var(--kz-table-bg);
  box-shadow: inset 0 0 0 1px var(--kz-table-border);
  color: var(--kz-table-fg);
  font-size: 14px;
  -webkit-mask: linear-gradient(to right, transparent, #000 var(--kz-table-fade-l), #000 calc(100% - var(--kz-table-fade-r)), transparent);
  mask: linear-gradient(to right, transparent, #000 var(--kz-table-fade-l), #000 calc(100% - var(--kz-table-fade-r)), transparent);
}

.kodza-table:focus-visible {
  outline: 2px solid var(--kz-table-fg);
  outline-offset: 3px;
}

.kodza-table table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.kodza-table th,
.kodza-table td {
  height: 52px;
  padding: 0 18px;
  text-align: left;
}

.kodza-table th:first-child,
.kodza-table td:first-child {
  padding-left: 24px;
}

.kodza-table th:last-child,
.kodza-table td:last-child {
  padding-right: 24px;
}

/* The header: stays on top when the table scrolls */
.kodza-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 46px;
  background: var(--kz-table-bg);
  box-shadow: inset 0 -1px 0 var(--kz-table-border);
  color: var(--kz-table-muted);
  font-size: 13px;
  font-weight: 500;
}

.kodza-table__sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 -8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.kodza-table__sort:hover {
  background: var(--kz-table-soft);
  color: var(--kz-table-fg);
}

.kodza-table__sort:focus-visible {
  outline: 2px solid var(--kz-table-fg);
  outline-offset: 1px;
}

.kodza-table__sort svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.45s var(--kz-table-ease);
}

.kodza-table__sort:hover svg {
  opacity: 0.4;
  transform: none;
}

.kodza-table th[aria-sort] {
  color: var(--kz-table-fg);
}

.kodza-table th[aria-sort] svg {
  opacity: 1;
  transform: none;
}

.kodza-table th[aria-sort="ascending"] svg {
  transform: rotate(180deg);
}

/* The sorted column: a soft band */
.kodza-table td.is-sorted {
  background: var(--kz-table-soft);
}

.kodza-table th.kodza-table__num,
.kodza-table td.kodza-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.kodza-table th.kodza-table__num .kodza-table__sort {
  flex-direction: row-reverse;
}

/* Rows have a body: two rows crossing while they glide never mix their words */
.kodza-table tbody tr {
  position: relative;
  background: var(--kz-table-bg);
}

.kodza-table tbody td {
  transition: background-color 0.2s ease;
}

.kodza-table tbody tr + tr td {
  border-top: 1px solid var(--kz-table-line);
}

.kodza-table tbody tr:hover td {
  background-image: linear-gradient(var(--kz-table-soft), var(--kz-table-soft));
}

.kodza-table__name {
  display: block;
  font-weight: 500;
}

.kodza-table__slug {
  display: block;
  margin-top: 1px;
  color: var(--kz-table-muted);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
}

.kodza-table tbody td:has(.kodza-table__name) {
  height: 60px;
}

/* Status: a shape says it, not a color */
.kodza-table__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kodza-table__status::before {
  content: "";
  width: 7px;
  height: 7px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--kz-table-ink);
}

.kodza-table__status[data-status="beta"]::before {
  background: none;
  border: 1.5px solid var(--kz-table-ink);
}

.kodza-table__status[data-status="new"] {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--kz-table-ink);
  color: var(--kz-table-on-ink);
  font-size: 12px;
  font-weight: 500;
}

.kodza-table__status[data-status="new"]::before {
  display: none;
}

.kodza-table__status[data-status="deprecated"] {
  color: var(--kz-table-muted);
  text-decoration: line-through;
}

.kodza-table__status[data-status="deprecated"]::before {
  width: 8px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--kz-table-muted);
}

@media (prefers-reduced-motion: reduce) {
  .kodza-table__sort,
  .kodza-table__sort svg,
  .kodza-table tbody td {
    transition-duration: 0.01ms !important;
  }
}

/* Theming example — on a dark background:
.dark-section .kodza-table {
  --kz-table-bg: #161616;
  --kz-table-fg: #f2f2f0;
  --kz-table-muted: rgba(242, 242, 240, 0.6);
  --kz-table-line: rgba(255, 255, 255, 0.08);
  --kz-table-border: rgba(255, 255, 255, 0.12);
  --kz-table-soft: rgba(255, 255, 255, 0.04);
  --kz-table-ink: #f2f2f0;
  --kz-table-on-ink: #0a0a0a;
}
*/
