/* Catalogue page.
 *
 * Uses the site's own tokens (--ink, --ink-2, --ink-3, --line, --line-soft,
 * --panel, --accent) so it inherits both themes without restating either. An
 * earlier version of this page invented --hair and --fs-xs, which do not exist
 * here, and shipped with no styling at all because the CSS was also passed as a
 * stylesheet href rather than as a file. Both are why this is a real file.
 */

.catalogue .tiers {
  display: grid;
  gap: 1rem;
  margin: 2.5rem 0;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.catalogue .tier-card {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  padding: 1.25rem;
}

.catalogue .tier-card p {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.catalogue .tier-card p:last-child { margin-bottom: 0; }

.catalogue .tier-count {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* The tier chip. Three states, distinguished by more than colour alone, because
 * the distinction between reviewed and not reviewed has to survive a greyscale
 * print and a colour-blind reader. Solid, plain, dashed. */
.tier {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.2em 0.55em;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.tier-reviewed { color: var(--accent); border-width: 2px; }
.tier-indexed { color: var(--ink-3); }
.tier-display { color: var(--ink-3); border-style: dashed; }

.catalogue .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin: 2.5rem 0 1rem;
}

.catalogue .filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.catalogue .filters input,
.catalogue .filters select {
  padding: 0.5em 0.6em;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  min-width: 12rem;
  max-width: 100%;
}

.catalogue .filter-count {
  margin: 0 0 0.6em;
  color: var(--ink-3);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Wide content scrolls inside its own container. The page body never scrolls
 * sideways; a catalogue you have to drag horizontally on a phone is not a
 * catalogue anyone will read. */
.catalogue .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cat-table { width: 100%; border-collapse: collapse; min-width: 34rem; }

.cat-table caption {
  caption-side: top;
  text-align: left;
  color: var(--ink-3);
  font-size: 0.9rem;
  padding-bottom: 0.75rem;
}

.cat-table th,
.cat-table td {
  padding: 0.7rem 0.6rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.9rem;
}

.cat-table thead th { color: var(--ink-3); font-weight: 400; }
.cat-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cat-table .src small { display: block; color: var(--ink-3); font-size: 0.8rem; }

.cat-table .src-open {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cat-table .src-open:hover { color: var(--accent-ink); }
.cat-table .src-open[aria-expanded="true"] { font-weight: 600; }
.cat-table .src-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.detail-body { padding: 0.5rem 0 1.25rem; }

.m-table { width: 100%; border-collapse: collapse; margin-top: 0.9rem; min-width: 40rem; }

.m-table th,
.m-table td {
  padding: 0.45em 0.6em;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.8rem;
  vertical-align: top;
}

.m-table thead th { color: var(--ink-3); font-weight: 400; }
.m-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.m-table small { color: var(--ink-3); }

.m-search {
  padding: 0.45em 0.6em;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  width: min(100%, 22rem);
}

.m-more { margin-top: 0.9rem; font-size: 0.9rem; color: var(--ink-2); }

.m-showmore {
  font: inherit;
  padding: 0.4em 0.9em;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.m-showmore:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 44rem) {
  .catalogue .filters input,
  .catalogue .filters select { min-width: 0; width: 100%; }
  .catalogue .filters label { flex: 1 1 100%; }
}
