/* Data table component — partials/data-table.html.twig
 *
 * Built entirely on the theme's existing --q2-* tokens, so light/dark follow
 * theme-toggle.js automatically with no per-mode rules of our own. Loaded at
 * priority 75, i.e. after theme.css (90) and custom.css (80), so these rules
 * win without needing !important.
 */

/* ------------------------------------------------------------------ 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; }
  .dt-count { margin-left: 0; }
  .dt-dl-pair { grid-template-columns: 1fr; gap: 0.15rem; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@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; }
}
