/* EntryListComponent and EntryComponent (app/components/entry_list_component.rb, entry_component.rb): the card each item of a queue, a caseload, a list of requests or of notices is.

   WHY CARDS. These lists were written four times (requests, incidents, the caseload, the consultation agenda), each a title and a state over a `dl` of four facts, ruled by hairlines on the bare
   canvas, and each padded by `--density-row`, which is 0.25rem: the room a one-line table row gets, given to an entry of three lines. The entries ran into each other and the page looked
   thrown together. The density tokens are for the rows of a table or a fact list, and are not touched; an entry is a card, padded by the space scale (10-globals.css, "Space").

   THE PARTS. The title line: the title, its badges, and the aside at the end. Under it one quiet line, then the facts as a grid that wraps (labels in the small tracked capitals the person page uses,
   values in the working size) under a hairline, so the head of the entry and its facts read as two things. Then the words a person wrote, and the actions. The whole entry is not a link: each control in
   it is its own target, and the title link keeps the 24px floor (the 44px floor on touch).

   Tokens only and logical properties only, both enforced (test/styles/tokens_test.rb, test/styles/components_test.rb), so it reads on the light shell and the console, in light and in dark, and mirrors in a
   right-to-left language. Nothing pinned to an edge, no height in vh, and everything that holds words may shrink and wrap, so a language 40% longer never widens the page (WCAG 1.4.10). */

.entry-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  overflow-wrap: anywhere;
}

/* An entry that needs a person: a bar at its start in the tone's strong color, with the same fact in a badge or a word beside it (never color alone, WCAG 1.4.1). */
.entry[data-tone] {
  border-inline-start: 3px solid var(--entry-tone);
  /* The bar is 2px thicker than the hairline, so the padding gives it back: the words of a toned entry line up with those of the entries around it. */
  padding-inline-start: calc(var(--space-4) - 2px);
}
.entry[data-tone="warn"] { --entry-tone: var(--tone-warn-fg); }
.entry[data-tone="bad"] { --entry-tone: var(--tone-bad-fg); }
.entry[data-tone="info"] { --entry-tone: var(--tone-info-fg); }
.entry[data-tone="good"] { --entry-tone: var(--tone-good-fg); }

/* ── The title line ────────────────────────────────────────────────────── */
.entry__line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  min-inline-size: 0;
}

.entry__title {
  min-inline-size: 0;
  font-size: var(--text-base);
  font-weight: 650;
  line-height: 1.35;
}

/* A title that is a link: the accent, underlined on hover and focus (it is the entry's own name, and the position says it is a link; the underline is the confirmation). */
.entry__title a {
  display: inline-block;
  min-block-size: 24px;
  text-decoration: none;
}
.entry__title a:is(:hover, :focus-visible) {
  text-decoration: underline;
}

.entry__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  min-inline-size: 0;
}

.entry__aside {
  min-inline-size: 0;
  margin-inline-start: auto;
  color: var(--fg2);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.entry__meta {
  min-inline-size: 0;
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.4;
}
/* A quiet line of two or more facts (who owes it, by when) puts them side by side where there is room, so a long first one never pushes the second to a line of its own. */
.entry__meta:has(> :is(span, time) ~ :is(span, time)) {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

/* ── The facts ─────────────────────────────────────────────────────────── */
.entry__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
  gap: var(--space-2) var(--space-4);
  min-inline-size: 0;
  margin: 0;
  padding-block-start: var(--space-2);
  border-block-start: 1px solid var(--rule);
}

.entry__fact {
  min-inline-size: 0;
}

.entry__fact dt {
  color: var(--fg2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Scripts whose letters join (Arabic and its neighbours) are not put in capitals or spaced apart: tracking breaks the joining (the form-labels decision, Asana 1219147360719970). */
.entry__fact dt:is(:lang(ar), :lang(fa), :lang(ur), :lang(ps), :lang(sd), :lang(ug), :lang(ku)) {
  letter-spacing: normal;
  text-transform: none;
}

.entry__fact dd {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  /* A date or a moment that has to wrap breaks in the middle and not before its last word ("2:35 / AM"). */
  text-wrap: balance;
}

/* ── What a person wrote, and what can be done ─────────────────────────── */
.entry__body {
  min-inline-size: 0;
}

/* Their words, set apart from the facts by a rule at the start, kept as they were written (line breaks and all). */
.entry__quote {
  margin: 0;
  padding-inline-start: var(--space-3);
  border-inline-start: 3px solid var(--rule-strong);
  white-space: pre-line;
}

.entry__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
}

.entry__actions form {
  margin: 0;
}

@media (pointer: coarse) {
  .entry__title a {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--target-min);
  }
}
