/* Redwood table — header, rows, and the row states that make a record table
 * usable: hover, selection and click-through.
 *
 * Every value is a token, read out of the JET 19.0.0 Redwood theme (oj-table,
 * --oj-table-*) and mapped onto the --rw-* names. One reading is rounded onto a
 * token: Oracle draws the header rule at neutral-190 / .10, and this uses
 * --rw-divider at .12 rather than invent a thirteenth alpha.
 *
 * Load after redwood-tokens.css (and redwood-dark.css if you use it).
 *
 *   <table class="rw-table">
 *     <thead><tr><th>Customer</th><th class="rw-num">Amount</th></tr></thead>
 *     <tbody>
 *       <tr class="rw-row-action" tabindex="0">…</tr>
 *       <tr class="rw-row-action rw-selected" aria-selected="true">…</tr>
 *     </tbody>
 *   </table>
 *
 * What people get wrong:
 *
 *   A row that stands for a record acts as a whole. .rw-row-action makes the
 *   entire row the target, with the hover overlay and a pointer, and the row
 *   takes the keyboard (tabindex 0, Enter opens). A small "View" link inside
 *   the row is not a substitute.
 *
 *   Hover and selection are layers, as on a card: hover is an alpha overlay
 *   drawn with background-image over the row, and a selected row under the
 *   pointer shows both.
 *
 *   Numbers align on the end edge and use tabular figures (.rw-num). Oracle
 *   Sans digits are proportional until told otherwise.
 *
 *   The header is weight 600 on the content surface, not a shaded band and not
 *   uppercase.
 *
 * (c) Oracle. Internal brand asset — see NOTICE. */

.rw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--rw-body-md-size);
  line-height: var(--rw-body-md-lh);
  color: var(--rw-text-primary);
}

.rw-table th {
  height: var(--rw-space-12x);
  padding: var(--rw-space-3x) var(--rw-space-4x);
  background: var(--rw-bg-content);
  border-bottom: 1px solid var(--rw-divider);
  color: var(--rw-text-secondary);
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}

.rw-table td {
  height: var(--rw-space-12x);
  padding: var(--rw-space-3x) var(--rw-space-4x);
  border-bottom: 1px solid var(--rw-divider);
  vertical-align: middle;
}

.rw-table .rw-num {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.rw-table tr.rw-row-action {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rw-table tr.rw-row-action:hover > td {
  background-image: linear-gradient(var(--rw-bg-hover), var(--rw-bg-hover));
}

.rw-table tr.rw-row-action:active > td {
  background-image: linear-gradient(var(--rw-bg-active), var(--rw-bg-active));
}

.rw-table tr.rw-selected > td {
  background-color: var(--rw-bg-selected);
}

.rw-table tr.rw-selected > td {
  box-shadow: inset 0 1px 0 var(--rw-border-selected), inset 0 -1px 0 var(--rw-border-selected);
}

/* Rows stack edge to edge, so the ring goes inside, as on a card. */
.rw-table tr.rw-row-action:focus-visible { outline: dotted 1px var(--rw-focus-ring); outline-offset: -2px; }

.rw-density-compact .rw-table th,
.rw-density-compact .rw-table td {
  height: var(--rw-space-10x);
  padding-block: var(--rw-space-2x);
}

@media (forced-colors: active) {
  .rw-table tr.rw-selected > td { box-shadow: inset 0 2px 0 Highlight, inset 0 -2px 0 Highlight; }
  .rw-table tr.rw-row-action:focus-visible { outline-color: Highlight; }
}
