/* Variable browser for the fplida pkgdown site.
   Colours come from Bootstrap 5 variables so the light and dark themes both
   work without a second palette. */

.fp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0 0.5rem;
}

.fp-search {
  flex: 1 1 22rem;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.95rem;
}

.fp-filter {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.95rem;
}

.fp-search:focus,
.fp-filter:focus {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

.fp-count {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}

.fp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.fp-table th {
  text-align: left;
  font-weight: 600;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--bs-border-color);
  white-space: nowrap;
}

.fp-table th:nth-child(1) { width: 22%; }
.fp-table th:nth-child(2) { width: 48%; }
.fp-table th:nth-child(3) { width: 15%; }
.fp-table th:nth-child(4) { width: 15%; }

.fp-row > td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--bs-border-color);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.fp-row { cursor: pointer; }
.fp-row:hover > td { background: var(--bs-tertiary-bg); }
.fp-row:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.fp-row.fp-open > td { background: var(--bs-tertiary-bg); font-weight: 500; }

.fp-name { font-size: 0.85rem; overflow-wrap: anywhere; }
.fp-desc { color: var(--bs-body-color); }
.fp-type { color: var(--bs-secondary-color); font-size: 0.85rem; }

.fp-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.fp-ok    { color: var(--bs-success); }
/* Guessed sits between sourced and unsupported: the values are usable, but
   inferred from the variable name rather than published. */
.fp-guess { color: var(--bs-info-text-emphasis, var(--bs-info)); }
.fp-warn  { color: var(--bs-warning-text-emphasis, var(--bs-warning)); }
.fp-na    { color: var(--bs-secondary-color); }

.fp-detail-tr > td {
  padding: 0 0.6rem 0.9rem 1.6rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
}

/* Label on its own line, content beneath it, at every width. A two-column
   layout has to guess how wide a label can get, and the provenance tag made
   that guess wrong: "Official description" plus its tag wrapped inside an
   11rem column while the shorter labels sat inline, so the rows no longer
   lined up with each other. */
.fp-detail-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem;
  padding: 0.35rem 0;
  font-size: 0.875rem;
}

@media (max-width: 40rem) {
  .fp-table th:nth-child(3), .fp-table td.fp-type { display: none; }
}

.fp-detail-key {
  font-weight: 600;
  color: var(--bs-secondary-color);
}

/* Which text is the custodian's and which was written from official sources.
   `title` carries the full sentence; `cursor: help` says it is worth reading. */
.fp-tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.35rem;
  border: 1px solid currentColor;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: 0.05rem;
  white-space: nowrap;
  cursor: help;
}

/* Strongest to weakest claim: the custodian's own words, a source quoted and
   linked, prose written around several sources. */
.fp-tag-metadata { color: var(--bs-success); }
.fp-tag-official { color: var(--bs-primary); }
.fp-tag-ai { color: var(--bs-info-text-emphasis, var(--bs-info)); }

.fp-detail-source {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

/* One occurrence per point. Run together on one line, a variable in a dozen
   products reads as an unbroken wall of slugs. */
.fp-where {
  margin: 0;
  padding-left: 1.1rem;
}

.fp-where li { margin-bottom: 0.3rem; }

.fp-where-table {
  display: block;
  color: var(--bs-secondary-color);
}

.fp-detail-val { overflow-wrap: anywhere; }

.fp-values {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  max-height: 22rem;
  overflow-y: auto;
}

.fp-values dt {
  font-family: var(--bs-font-monospace);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.fp-values dd { margin: 0; }

.fp-more {
  margin: 0.75rem 0;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.875rem;
  cursor: pointer;
}

.fp-more:hover { background: var(--bs-tertiary-bg); }

.fp-error { color: var(--bs-danger); }

/* Dataset summary block at the top of each dataset article. */
.fp-summary {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}

@media (max-width: 40rem) {
  .fp-summary { grid-template-columns: 1fr; gap: 0.1rem; }
  .fp-summary dt { margin-top: 0.5rem; }
}

.fp-summary dt { font-weight: 600; color: var(--bs-secondary-color); }
.fp-summary dd { margin: 0; overflow-wrap: anywhere; }

/* Dataset index table. */
.fp-index { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.fp-index th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--bs-border-color);
}
.fp-index td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--bs-border-color);
  vertical-align: top;
}
.fp-index td.fp-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Agency grouping rows in the dataset index. */
.fp-index tr.fp-group th {
  padding-top: 1.1rem;
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
}
.fp-index tr.fp-group:first-child th { padding-top: 0.5rem; }
.fp-index tr.fp-group code {
  font-size: 0.85em;
  opacity: 0.75;
}
.fp-index .fp-group-n {
  float: right;
  font-weight: 400;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}
