/* Data table component, markup from lib/DataTable.php.
 *
 * Copied from ~/projects/artificiallystupid.com (quark2 theme, css/data-table.css)
 * on 2026-11-19. Two changes from that copy: the --q2-* tokens the rules use
 * are defined here, because this site has no theme that supplies them, and the
 * .visually-hidden rule is dropped, because Bootstrap 5 provides it.
 * A page that uses the table links this file itself; head.html does not.
 */
.dt, .dt-stamp, .dt-error, .dt-notes {
  --q2-accent: #563d7c;
  --q2-focus-ring: rgba(86, 61, 124, 0.25);
  --q2-link: var(--bs-link-color);
  --q2-text: #212529;
  --q2-text-strong: #000;
  --q2-text-muted: #595f66;
  --q2-bg-elev: #fff;
  --q2-bg-muted: #f4f5f6;
  --q2-divider: #dee2e6;
  --q2-border-strong: #adb5bd;
  --q2-radius-sm: 4px;
  --q2-radius-md: 6px;
}

/* ------------------------------------------------------------------ datestamp */
.dt-stamp {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--q2-accent);
  background: var(--q2-bg-muted);
  border-radius: var(--q2-radius-sm);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--q2-text-muted);
}
.dt-stamp strong { color: var(--q2-text-strong); }

.dt-error {
  padding: 1rem;
  border: 1px solid var(--q2-border-strong);
  border-radius: var(--q2-radius-sm);
  background: var(--q2-bg-muted);
}

/* ------------------------------------------------------------------- controls */
.dt-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 1.25rem 0 0.75rem;
}
.dt-control { display: flex; flex-direction: column; gap: 0.25rem; }
.dt-control label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--q2-text-muted);
}
.dt-control--search { flex: 1 1 16rem; }
.dt-controls input[type='search'],
.dt-controls select {
  /* Explicit box-sizing + height: the theme styles inputs and selects with
     different intrinsic heights, which left the search box taller than the
     facet dropdowns sitting beside it. */
  box-sizing: border-box;
  height: 2.5rem;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--q2-text);
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-border-strong);
  border-radius: var(--q2-radius-sm);
}
.dt-reset { box-sizing: border-box; height: 2.5rem; }
.dt-controls input[type='search']:focus-visible,
.dt-controls select:focus-visible,
.dt-scroll:focus-visible,
.dt-sort:focus-visible,
.dt-toggle:focus-visible,
.dt-reset:focus-visible {
  outline: 2px solid var(--q2-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--q2-focus-ring);
}
.dt-reset {
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--q2-text);
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-border-strong);
  border-radius: var(--q2-radius-sm);
  cursor: pointer;
}
.dt-reset:hover { background: var(--q2-bg-muted); }
.dt-count {
  margin: 0 0 0 auto;
  font-size: 0.85rem;
  color: var(--q2-text-muted);
  font-variant-numeric: tabular-nums;
}
.dt-caption { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--q2-text-muted); }

/* ---------------------------------------------------------------------- table */
/* The table scrolls inside its own box; the page body never scrolls sideways. */
.dt-scroll {
  overflow-x: auto;
  border: 1px solid var(--q2-divider);
  border-radius: var(--q2-radius-md);
  background: var(--q2-bg-elev);
}
.dt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.45;
}
.dt-table th,
.dt-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--q2-divider);
}
.dt-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  background: var(--q2-bg-muted);
  border-bottom: 2px solid var(--q2-border-strong);
  white-space: nowrap;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--q2-text-muted);
}
/* No-JS: the plain label shows. With JS, data-table.js hides the label and
   unhides the sort button in its place (done in JS rather than with :has() so
   the fallback does not depend on selector support). */
.dt-th-label { display: block; padding: 0.6rem 0.75rem; }
.dt-sort {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--q2-text-muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.dt-sort:hover { color: var(--q2-text-strong); }
.dt-arrow {
  width: 0.6em;
  opacity: 0.35;
  transition: opacity 0.12s ease;
}
.dt-arrow::after { content: '\2195'; }                  /* neutral up-down */
.dt-sort.is-asc .dt-arrow,
.dt-sort.is-desc .dt-arrow { opacity: 1; color: var(--q2-accent); }
.dt-sort.is-asc .dt-arrow::after { content: '\2191'; }
.dt-sort.is-desc .dt-arrow::after { content: '\2193'; }

.dt-row:hover > td { background: var(--q2-bg-muted); }
.dt-table td a { color: var(--q2-link); }
/* First column carries the identifier — keep it on one line and prominent. */
.dt-row > td:first-child { white-space: nowrap; font-weight: 600; }
/* Dates are meaningless broken across lines ("2019-" / "02-11"). */
.dt-table td[data-t='date'] { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- row details */
.dt-col-more { width: 2.5rem; text-align: center !important; }
.dt-toggle {
  padding: 0.15rem 0.35rem;
  color: var(--q2-text-muted);
  background: none;
  border: 0;
  cursor: pointer;
  line-height: 1;
}
.dt-toggle:hover { color: var(--q2-text-strong); }
.dt-chevron::after { content: '\25B8'; display: inline-block; transition: transform 0.15s ease; }
.dt-toggle[aria-expanded='true'] .dt-chevron::after { transform: rotate(90deg); }

.dt-detail > td { background: var(--q2-bg-muted); padding: 0.9rem 1.1rem; }
.dt-dl { display: grid; gap: 0.5rem 1.5rem; margin: 0; grid-template-columns: 1fr; }
@media (min-width: 45rem) { .dt-dl { grid-template-columns: 1fr 1fr; } }
.dt-dl-pair { display: grid; grid-template-columns: 9rem 1fr; gap: 0.75rem; align-items: baseline; }
.dt-dl-pair--wide { grid-column: 1 / -1; }
.dt-dl dt {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--q2-text-muted);
}
.dt-dl dd { margin: 0; overflow-wrap: anywhere; }

/* Method/scope prose that the page template moved below the table. The rule
   marks it as commentary on the data rather than a continuation of the lede. */
.dt-notes {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--q2-divider);
}
.dt-notes > h2:first-child { margin-top: 0; }

.dt-empty {
  margin: 1rem 0 0;
  padding: 1.5rem;
  text-align: center;
  color: var(--q2-text-muted);
  background: var(--q2-bg-muted);
  border-radius: var(--q2-radius-sm);
}

/* ----------------------------------------------------------------- responsive */
/* Shed the lowest-priority columns before resorting to horizontal scroll. */
@media (max-width: 60rem) {
  .dt-table [data-p='3'] { display: none; }
}
@media (max-width: 42rem) {
  .dt-table [data-p='2'] { display: none; }
  /* Added for this site: a cell holding two case numbers is too wide for a phone. */
  .dt-row > td:first-child { white-space: normal; }
  .dt-table th, .dt-table td { padding-left: 0.5rem; padding-right: 0.5rem; }
  .dt-count { margin-left: 0; }
  .dt-dl-pair { grid-template-columns: 1fr; gap: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .dt-chevron::after, .dt-arrow { transition: none; }
}

@media print {
  .dt-controls, .dt-col-more { display: none; }
  .dt-scroll { overflow: visible; border: 0; }
  .dt-detail { display: none; }
}
