/* The Sources page: a card for each adapter (Sources::SourceComponent in app/components; docs/phase0_core/06-app-layer.md section 6a), built from the card, the
   badge, the figure strip and the table, so what is here is only how they sit together.

   Linked after the device rules (40-native.css), which is why it is numbered 46 and not among the components' 35 to 39, which are taken: nothing here needs
   to come before them, because every rule is more specific than the one it adjusts, and the one rule about a control's size restates the floor that 40-native.css
   gives, so the order cannot lower it. Tokens only and logical properties only, both enforced (test/styles/tokens_test.rb, test/styles/components_test.rb), so
   all of it reads on the light shell and on the console, in light and in dark, and mirrors in a right-to-left language. It decides no mode and no surface.
   Nothing is pinned to an edge and nothing sets a height in vh.

   Everything that holds words may shrink (`min-inline-size: 0`) and breaks a word that has no room (`overflow-wrap`), so one long adapter name, one long
   count name or a language 40% longer never widens the page (WCAG 1.4.10). A status is its words, in a badge whose tone is a second signal and never the only
   one. */

/* ── The list of cards ────────────────────────────────────────────────────
   One column on a phone, as many as fit from there: a card wants about 24rem for its facts to sit on one line each. */

.sources-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  align-items: start;
  gap: var(--space-4);
  min-inline-size: 0;
  margin-block: var(--space-4);
}
.source {
  min-inline-size: 0;
}
/* The table's cover for the shadow at its edges is the page's color; inside a card the page is the card. */
.source .data-table-region {
  --region-cover: var(--surface-raised);
}
/* A table of two columns, in a card, is as wide as its card. The ported rule that gives every `table.data` 640px under 860px (10-globals.css) is for the dense
   staff tables with many columns, which scroll in their region; here it would make a phone scroll sideways to read a reason and a number. The cells wrap, and
   the region still scrolls if a word will not. */
.source table.data.data-table {
  min-inline-size: 0;
}

/* ── What a card says ─────────────────────────────────────────────────────
   The three badges, then the parts: what the source is, its last run, what is waiting, and the counts. A part has a small heading of its own
   (the eyebrow's look, at the outline's third level) and a block of space above it. */

.source-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-inline-size: 0;
}
.source-section {
  min-inline-size: 0;
  margin-block-start: var(--density-block);
}
.source-subheading {
  margin: 0 0 0.25rem;
}

/* A fact is a row between two hairlines, as the person page's are: the label and the value share a line when there is room (9rem each), and the value
   is under the label when there is not (a phone, a longer language). The value is the heavier of the two. */
.source-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-inline-size: 0;
  margin: 0;
  border-block-start: 1px solid var(--rule);
}
.source-fact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--density-block);
  min-inline-size: 0;
  padding-block: var(--density-row);
  border-block-end: 1px solid var(--rule);
}
.source-fact dt {
  flex: 0 1 9rem;
  min-inline-size: 0;
  color: var(--fg2);
  overflow-wrap: anywhere;
}
.source-fact dd {
  flex: 1 1 9rem;
  min-inline-size: 0;
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.source-none {
  margin: 0;
  color: var(--fg2);
}
/* The four numbers of a run: each a label over its number, in two columns where each cell has room for the longest word of its label, and in one where it has
   not (a phone of 360px or less). A cell is never narrower than 9rem, and never narrower than 45% of the strip, so two always fit and three never do. The strip's
   own columns (as many as fit, at 9rem) gave three and an orphan on a card of one width and four cramped cells on another, and a label such as "Unchanged" was
   broken in the middle of its word at 414, 1024 and 1280px. Stacking the number under its label makes all four cells one shape: the strip's own layout puts a
   short label and its number on one line and a longer label over its number, so the four looked uneven. */
.source-figures {
  margin-block-start: var(--density-gap);
}
.source-figures .figure-strip-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(9rem, 45%)), 1fr));
}
.source-figures .figure {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0;
}

/* An identifier (an adapter's key, a count's name, the code of a reason, a class name) is not prose: it is the same in every language and is set in the
   mono face, and it breaks where it has no room, so a long one wraps in its cell and the page does not widen. */
.identifier {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ── The counts of the last run ───────────────────────────────────────────
   Behind a native disclosure: an adapter can count dozens of things and the page is for the person who asks. The summary is the control, so it is 24px at
   the least for a mouse (WCAG 2.5.8) and the floor on touch (40-native.css names the floor for controls; this one is a control it does not name). */

.source-counts {
  min-inline-size: 0;
  margin-block-start: var(--density-block);
}
.source-counts-summary {
  /* A list item, which is what a summary is by default and what draws its disclosure marker: a flex box would lose the marker and leave the control with
     no sign that it opens. The marker follows the text's direction, so it mirrors in a right-to-left language. */
  display: list-item;
  list-style-position: inside;
  min-block-size: 1.5rem;
  font-weight: 650;
  cursor: pointer;
  overflow-wrap: anywhere;
}
@media (pointer: coarse) {
  .source-counts-summary {
    min-block-size: var(--target-min);
    padding-block: calc((var(--target-min) - 1.55em) / 2);
  }
}
.source-counts[open] .source-counts-summary {
  margin-block-end: var(--density-gap);
}

/* The notes under the cards: a sentence each, in a paragraph of its own, and a step of the space scale between two of them (they ran together as one paragraph). */
.sources-note {
  max-inline-size: 66ch;
  color: var(--fg2);
  font-size: var(--text-sm);
}
.sources-note + .sources-note {
  margin-block-start: var(--space-2);
}
