/*
 * The Datasets catalogue (web/datasets/). The Practice Overview convention: no page max-width, so the pages fill the shell's
 * `.content-inner` inside its gutters; grids are `auto-fit` with `minmax(min(100%, N), 1fr)` so a column never overflows; the
 * page is a size container, so the detail page's sidebar follows the width actually available (the navigation open or not),
 * not the viewport. No inline style; wide tables never widen the document.
 */
.ds { container: ds / inline-size; }
.ds p { max-width: 82ch; }
.ds code { overflow-wrap: anywhere; word-break: break-word; }
.ds-defs { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; gap: 8px 18px; margin: 0; }
.ds-defs dt { font-weight: 600; color: var(--hs-ink-muted); }
.ds-defs dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.ds-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.ds-badge.is-verified { color: #0b5d3b; background: #e7f5ee; border-color: #8fcfae; }
.ds-badge.is-pending { color: var(--hs-warn-ink); background: var(--hs-warn-bg); border-color: var(--hs-warn-border); }
.ds-badge.is-verified::before { content: "\2713\00a0"; }

/* ---- Index ---------------------------------------------------------------------------------------------------------- */
.ds-head { margin-bottom: 14px; }
.ds-tools { display: grid; gap: 10px; margin: 0 0 16px; }
.ds-search label { display: block; font-weight: 600; margin-bottom: 6px; }
.ds-search-row { display: flex; flex-wrap: wrap; gap: 8px; max-width: 52rem; }
.ds-search input {
  flex: 1 1 18rem;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--hs-border-strong);
  border-radius: var(--hs-radius-sm);
  font: inherit;
  background: var(--hs-surface);
  color: var(--hs-ink);
}
.ds-search input:focus-visible { outline: 3px solid var(--hs-aqua); outline-offset: 1px; }
.ds-count { color: var(--hs-ink-muted); margin: 0; }
.ds-key {
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  background: var(--hs-surface);
  max-width: 82ch;
}
.ds-key > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--hs-navy); }
.ds-key > summary:focus-visible { outline: 3px solid var(--hs-aqua); outline-offset: 2px; }
.ds-key[open] > summary { border-bottom: 1px solid var(--hs-border); }
.ds-key .ds-defs { padding: 12px 14px 14px; }

.ds-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr));
}
.ds-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  padding: 14px 16px;
  min-width: 0;
}
.ds-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ds-item-title { margin: 0; font-size: 16px; line-height: 1.3; }
.ds-item-pub, .ds-item-summary, .ds-item-uses { margin: 0; }
.ds-item-pub { color: var(--hs-ink-muted); font-size: 13px; }
.ds-item-summary { font-size: 14px; }
.ds-item-uses { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--hs-border); font-size: 13px; }
.ds-empty { padding: 12px 0; }

/* ---- Detail --------------------------------------------------------------------------------------------------------- */
.ds-crumbs { font-size: 14px; margin-bottom: 8px; color: var(--hs-ink-muted); }
.ds-status { margin: 4px 0 10px; }
.ds-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.ds-layout > .card, .ds-aside { margin: 0 0 16px; min-width: 0; }
.ds-layout > .card + .card { margin-top: 0; }
.ds-aside { padding: 16px 18px; }
.ds-aside h2 { font-size: 15px; }
.ds-aside .ds-defs { grid-template-columns: 1fr; gap: 2px; }
.ds-aside .ds-defs dt { color: var(--hs-navy); font-size: 13px; }
.ds-aside .ds-defs dd { margin-bottom: 10px; font-size: 14px; }
.ds-aside .ds-defs dd:last-child { margin-bottom: 0; }
.ds-aside .muted { display: block; font-size: 12px; margin-top: 2px; }

@container ds (min-width: 60rem) {
  /* Wide: the four provenance and freshness dates sit in a compact sidebar beside the sections. */
  .ds-layout { grid-template-columns: minmax(0, 1fr) 19rem; column-gap: 20px; }
  .ds-layout > .card { grid-column: 1; }
  .ds-layout > .ds-aside { grid-column: 2; grid-row: 1 / span 4; align-self: start; position: sticky; top: 16px; }
}

.ds-scroll { position: relative; overflow-x: auto; max-width: 100%; }
.ds-scroll:focus-visible { outline: 3px solid var(--hs-aqua); outline-offset: 2px; }
.ds-table th[scope="row"] { font-weight: 600; }
.ds-file { overflow-wrap: anywhere; }
.ds-assets, .ds-uses {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 14px 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
}
.ds-assets li, .ds-uses li { border-top: 1px solid var(--hs-border); padding-top: 10px; min-width: 0; }
.ds-assets p, .ds-uses p { margin: 4px 0 0; overflow-wrap: anywhere; }
.ds-evidence { margin-top: 14px; }
.ds-evidence summary { cursor: pointer; font-weight: 600; }
.ds-evidence ul { margin: 8px 0 0; padding-left: 20px; }
.ds-evidence li { overflow-wrap: anywhere; }

@container ds (max-width: 40rem) {
  /* Narrow: each loaded file is a short labelled block, so no column is pushed out of sight. */
  .ds-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ds-table, .ds-table tbody, .ds-table tr, .ds-table th, .ds-table td { display: block; width: 100%; }
  .ds-table tr { border-bottom: 1px solid var(--hs-border); padding: 8px 0; }
  .ds-table th, .ds-table td { border: 0; padding: 2px 0; }
  .ds-table td[data-label]::before { content: attr(data-label) ": "; color: var(--hs-ink-muted); font-weight: 600; }
  .ds-defs { grid-template-columns: 1fr; gap: 2px; }
  .ds-defs dd { margin-bottom: 8px; }
}
