/* The unit pages (docs/rules/hunt-data.md § Unit pages): site.css's page, tables and
   sidebar, with the parts a list of units and a unit's hunts add. */

.unit-asof {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

/* Every unit: its number, its name, and how many hunts are open in it. */
.unit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.unit-list a {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--body);
  text-decoration: none;
}

.unit-list a:hover {
  background: var(--surface);
  color: var(--bone);
}

.unit-no,
.unit-count {
  color: var(--muted);
  white-space: nowrap;
}

.unit-name {
  overflow: hidden;
  color: var(--bone);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-units a {
  grid-template-columns: 20px minmax(0, 1fr) auto;
}

/* A unit's hunts: a species, then its general season and controlled hunts. Each row leads
   with the hunt's name, its number a quiet gutter beside it and what it takes and where under
   it; the figures sit right, in tabular digits. */
.unit-bag {
  margin: -4px 0 8px;
}

.unit-draw {
  margin: 28px 0 2px;
  color: var(--muted);
  font: 400 13px/1.4 var(--label);
}

.hunt-table th,
.hunt-table td {
  padding: 14px 12px;
}

.hunt-table th:first-child,
.hunt-table td:first-child {
  padding-left: 0;
}

.hunt-table th:last-child,
.hunt-table td:last-child {
  padding-right: 0;
}

.hunt-table thead th {
  padding-top: 8px;
  padding-bottom: 8px;
}

.hunt-table tbody th {
  width: 100%;
  min-width: 240px;
}

.hunt-cell.is-coded {
  display: grid;
  grid-template-columns: 8ch minmax(0, 1fr);
  column-gap: 10px;
}

.hunt-no {
  padding-top: 2px;
  color: var(--muted);
  white-space: nowrap;
}

.hunt-table .row-title {
  font-size: 15px;
  line-height: 1.35;
}

.hunt-table .row-meta {
  margin-top: 2px;
  line-height: 1.45;
}

.hunt-where {
  color: var(--body);
}

.hunt-table td {
  color: var(--body);
}

.hunt-table td > span {
  display: block;
}

.hunt-figure {
  color: var(--bone);
  font-size: 13px;
}

.hunt-figure.muted {
  color: var(--muted);
}

.hunt-dates,
.hunt-applicants,
.hunt-draw,
.hunt-success {
  white-space: nowrap;
}

/* Success: a bar for each season beside the seasons together, and the span under them. */
.hunt-rate {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
}

.hunt-strip {
  flex: none;
}

.hunt-bar {
  fill: var(--muted);
}

.hunt-bar.is-counts,
.hunt-bar.is-missing {
  fill: var(--rule-strong);
}

.hunt-table tr.has-shape {
  cursor: pointer;
}

.hunt-table tr.is-lit th,
.hunt-table tr.is-lit td {
  background: rgba(240, 236, 226, 0.06);
}

/* A table too narrow for its columns (a phone, or a laptop with both sidebars open: the six
   columns of a controlled hunts table need about 790 px): each hunt a block, its name across the
   top and its figures under it, labelled. */
.hunt-wrap {
  container: hunts / inline-size;
}

@container hunts (max-width: 790px) {
  .hunt-table,
  .hunt-table tbody {
    display: block;
  }

  .hunt-table thead {
    display: none;
  }

  .hunt-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
  }

  .hunt-table th,
  .hunt-table td,
  .hunt-table th:last-child,
  .hunt-table td:last-child {
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .hunt-table tbody th,
  .hunt-table td.hunt-success {
    grid-column: 1 / -1;
  }

  .hunt-table td.hunt-draw + td.hunt-success {
    grid-column: 2 / -1;
  }

  .hunt-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font: 11px/16px var(--label);
  }

  .hunt-dates,
  .hunt-applicants,
  .hunt-draw,
  .hunt-success {
    white-space: normal;
  }

  .hunt-rate {
    justify-content: flex-start;
  }

  .hunt-table tr.is-lit {
    background: rgba(240, 236, 226, 0.06);
  }

  .hunt-table tr.is-lit th,
  .hunt-table tr.is-lit td {
    background: none;
  }
}

/* The map's legend: the unit's lit edge and the hunts' faint ones, as lines. */
.swatch-unit,
.swatch-hunt {
  width: 14px;
  height: 0;
  border-radius: 0;
}

.swatch-unit {
  border-top: 3px solid var(--ember-text);
}

.swatch-hunt {
  border-top: 1px solid var(--muted);
}

.unit-source p + p {
  margin-top: 8px;
}
