/* The case screens (CaseSheetComponent, CasesPanelComponent and CaseDetailComponent in app/components; docs/data_model/05-interactions-and-cases.md section 5; the sheet is the
   contact sheet's sibling and the section is the Teams section's). Built from the form fields, the data table, the badge, the empty state and the page header, so what is here is only how
   they sit together: the page of a sheet that opens something and the actions that end a "received" page under a hairline, the section on the person page as one column as wide as the facts above it,
   and the case's page as two labelled lists, the facts and the words. (The case's own sheets are `.case-work-sheet`, 62-case-work.css; the forms are the form system's.)

   Linked after the device rules (40-native.css), like 46-sources.css and 48-teams-panel.css, which is why it is numbered 53 and not among the components' 35 to 39: nothing here needs
   to come before them. 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 and declares no token of its own. 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 a long title, a long note, a long type name or a language 40% longer
   never widens the page (WCAG 1.4.10). */

/* ── The sheets that open something, and the pages that say it was received ───────── */

.open-case {
  display: grid;
  gap: 1rem;
  min-inline-size: 0;
}
.case-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--rule);
}

/* ── The Cases section of the person page ─────────────────────────────── */

.cases-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--density-gap);
  max-inline-size: 64rem;
  min-inline-size: 0;
}
.cases-link,
.cases-type {
  display: inline-block;
  min-inline-size: 0;
  max-inline-size: 100%;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.cases-outcome {
  display: block;
  min-inline-size: 0;
  margin-block-start: 0.2rem;
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.cases-panel .pill {
  max-inline-size: 100%;
}
/* The line that says the list is the newest cases and not all of them (the database stops at its limit). */
.cases-cut {
  min-inline-size: 0;
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* ── One case ─────────────────────────────────────────────────────────── */

.case-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  min-inline-size: 0;
  margin-block-start: var(--density-block);
}
.case-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  max-inline-size: 64rem;
  min-inline-size: 0;
}
.case-detail-facts,
.case-detail-content {
  display: grid;
  gap: var(--density-gap);
  min-inline-size: 0;
}
.case-facts {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-inline-size: 0;
  margin: 0;
  border-block-start: 1px solid var(--rule);
}
.case-fact {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem var(--density-block);
  min-inline-size: 0;
  padding-block: var(--density-row);
  border-block-end: 1px solid var(--rule);
}
.case-fact dt {
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.case-fact dd {
  min-inline-size: 0;
  margin: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.case-title {
  font-weight: 650;
}
/* What was written is drawn in an isolate of its own (a `bdi` in the markup), so a direction mark or an override in it cannot reverse the text around it; stated here, so a browser or a native
   web view that does not give `bdi` its own rule still has it. */
.case-title bdi,
.case-note bdi {
  unicode-bidi: isolate;
}
/* What was written keeps the line breaks it was written with, as a contact's words do. */
.case-note {
  white-space: pre-line;
}
.case-note-none {
  color: var(--fg2);
}
.case-source {
  min-inline-size: 0;
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
@container (min-width: 28rem) {
  .case-fact {
    grid-template-columns: minmax(6.5rem, 12rem) minmax(0, 1fr);
    align-items: baseline;
  }
}
