/* Raw dataset view (/labs/data).
   Part of the /labs stylesheet, split out of one 3,400-line labs.css.

   THE NUMBER IN THE FILENAME IS LOAD-BEARING. stylesheet_link_tag :app
   collects every stylesheet under app/assets and serves them sorted by
   path, so the ordinal prefix is the only thing holding the cascade order
   these rules were written in — and several classes are shared across labs
   (.lp-head, .lab-entry, .lab-block, .dt-table). Renaming a file without
   renumbering it, or inserting one out of sequence, reorders the cascade
   silently.

   Nothing in this comment may contain the two characters that close a CSS
   comment. The first version of it wrote a shell glob here, which closed
   the comment early; the leaked text then parsed as a selector and ate the
   first real rule in all nine files. There is a test for that now.
   ============================================================ */

/* ============================================================
   Raw dataset view (Labs · /labs/data)
   A spreadsheet-like grid rendered in the house type system —
   monospace, hairline rules, no colour. It should read, at a
   glance, as data.
   ============================================================ */

.dt-stats {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin-top: 22px;
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.dt-stat b { color: var(--ink); font-weight: 500; }
.dt-stat-sep { color: var(--ink-faint); }

.dt-block { margin-top: 56px; }
.dt-block:first-of-type { margin-top: 40px; }

/* caption row above each table */
.dt-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 10px;
}
.dt-caption-name { color: var(--ink); }

/* scroll frame — clips the grid and gives it a bounded, viewport-like feel */
.dt-scroll {
  border: 1px solid var(--line);
  overflow: auto;
  max-height: 72vh;
}

.dt-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}
.dt-table th,
.dt-table td {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

/* sticky column headers */
.dt-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  font-weight: 500;
  /* 12px is the system's floor and applies inside a data table too. */
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

/* row-number gutter, pinned left */
.dt-gutter {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg);
  color: var(--ink-faint);
  text-align: right;
  width: 1%;
  font-size: 12px;
  user-select: none;
  border-right: 1px solid var(--line);
}
.dt-table thead .dt-gutter { z-index: 3; }

/* zebra + hover for scanability (kept strictly monochrome) */
/* ZEBRA AND HOVER MIX AGAINST --ink, NOT AGAINST BLACK. As flat rgba blacks
   these stepped the row the wrong way in dark mode — a black tint on a near-
   black ground moves a row further from the ink instead of toward it, so the
   banding read as damage rather than as rhythm. The two gutter rules were hard
   literals (#FAFAFA, #F2F2F2) of the same kind that made .sl-code unreadable;
   they are latent only because no table on the site currently draws a gutter. */
.dt-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.dt-table tbody tr:nth-child(even) .dt-gutter { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.dt-table tbody tr:hover td { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.dt-table tbody tr:hover .dt-gutter { background: color-mix(in srgb, var(--ink) 9%, transparent); }

.dt-mono { color: var(--ink-muted); }
.dt-nowrap { white-space: nowrap; }
/* QUALIFIED, BECAUSE `.dt-table td` ALREADY SETS text-align: left. That rule is
   (0,1,1) and a bare `.dt-num` is (0,1,0), so the numeric column silently kept
   the default alignment and the tabular figures lined up against nothing. */
.dt-table td.dt-num,
.dt-table th.dt-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dt-neg { font-weight: 500; }

/* segment pill */
/* 12px, and no radius. At 10px this was the smallest type on the site, four
   sizes under the floor; the 2px corner was a radius on something that is
   neither an action nor a photograph of a person. */
.dt-tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--line-soft);
  padding: 1px 7px;
}

/* sentiment — signalled by a monochrome glyph, not colour */
.dt-sent {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
}
/* The mark is DRAWN, not set. It used to be an 8px glyph — the smallest rendered
   text on the site, and a type size the design system's 12px floor forbids. A box
   with a border is the same three states (filled, hollow, a bar) at a size the
   floor has no opinion about, because it is not type. */
.dt-sent::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  vertical-align: 0;
  border: 1px solid var(--ink-faint);
  border-radius: 50%;
  background: var(--ink-faint);
}
.dt-sent--negative { color: var(--ink); }
.dt-sent--negative::before { border-color: var(--ink); background: var(--ink); }
.dt-sent--positive::before { background: transparent; }
.dt-sent--neutral::before {
  height: 0;
  border-radius: 0;
  border-width: 1px 0 0;
  background: none;
  vertical-align: 4px;
}

/* body verbatim — the human voice; readable sans, allowed to wrap.
   Table auto-layout ignores max-width on the <td>, so the width is
   pinned on an inner <div> to force wrapping instead of column bleed. */
.dt-body-col { white-space: normal; }
.dt-body {
  width: 480px;
  white-space: normal;
  overflow-wrap: break-word;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}
@media (max-width: 680px) {
  .dt-body { width: 260px; }
}

.dt-link { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.dt-link:hover { color: var(--ink-faint); }

@media (max-width: 680px) {
  .dt-scroll { max-height: 68vh; }
  .dt-body-col { min-width: 240px; }
}

/* ---- filter and the clamped verbatim ---- */

.dt-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}
.dt-filter-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.dt-filter-input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 460px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 10px 14px;
}
.dt-filter-input::placeholder { color: var(--ink-faint); }
.dt-filter-input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.dt-empty {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink-muted);
  margin: 16px 0 0;
}

/* The verbatim clamps to three lines and opens on click or Enter. `summary` carries
   the text itself rather than duplicating it, so there is exactly one copy of every
   verbatim in the document and find-in-page still works on all of it. The marker is
   removed in both syntaxes: Safari needs the pseudo-element, everything else reads
   `list-style`. */
.dt-body-wrap { min-width: 0; }
.dt-body-wrap > summary {
  list-style: none;
  cursor: pointer;
}
.dt-body-wrap > summary::-webkit-details-marker { display: none; }
.dt-body-wrap > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.dt-body-wrap:not([open]) > .dt-body {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
