/* IncidentBodyHistoryComponent (app/components/incident_body_history_component.rb) and the "changed" line on the incident's "What was written" (IncidentDetailComponent; NS5). The versions are a list,
   newest first, each a card: its title and a badge, who wrote it and when, why, and the narrative and the place as two labelled parts. What a change added is underlined in the good tone and what it
   removed is struck through in the bad tone, so color is never the only signal (and a screen reader hears where each starts and ends, from words in the markup).

   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). */

.incident-body-history {
  display: grid;
  gap: var(--density-gap);
  min-inline-size: 0;
}

.incident-body-history__lede,
.incident-body-history__legend {
  margin-block: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.incident-body-history__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}

.incident-body-history__list {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident-version > article {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  min-inline-size: 0;
}

.incident-version--original > article {
  border-inline-start: 4px solid var(--rule-strong);
}

.incident-version__header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.incident-version__title {
  margin: 0;
  font-size: var(--text-md);
}

.incident-version__by,
.incident-version__reason {
  margin: 0;
  overflow-wrap: anywhere;
}

.incident-version__by {
  color: var(--fg2);
  font-size: var(--text-sm);
}

.incident-version__label {
  font-weight: 600;
}

.incident-version__reason--none,
.incident-version__same {
  color: var(--fg2);
  font-style: italic;
}

.incident-version__parts {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.incident-version__part {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
}

.incident-version__part dt {
  color: var(--fg2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.incident-version__part dd {
  margin: 0;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.incident-version__part dd * {
  overflow-wrap: anywhere;
}

/* The words of a change, line breaks kept. */
.word-diff {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.word-diff__added {
  background: var(--tone-good-bg);
  color: var(--tone-good-fg);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
  border-radius: var(--radius-sm);
}

.word-diff__removed {
  background: var(--tone-bad-bg);
  color: var(--tone-bad-fg);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  border-radius: var(--radius-sm);
}

/* The "changed" line and the edit action on the incident's "What was written". */
.incident-body-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
}

.incident-body-changed {
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
