/* The intake screens (A2): the CARE referral, signed in and anonymous, the report to the Threat Assessment Group, and a team's incoming requests and referrals (FormBuilderComponent, FormAnswersComponent,
   PersonPickerComponent and RequestHistoryComponent in app/components; docs/data_model/10-shared-primitives.md section 5 and docs/phase0_core/03-new-specs.md G4, G8, G13, "As built (A2)").
   Built from the shared components (the page header and its sections, the entry list, the card, the figure strip, the sheet, the form fields, the button, the badge, the callout and the empty state), so what
   is here is only how they sit together: the one column of the referrers' pages and the console's two intake sheets, what a person wrote as a card, the person search as a sheet, a request's or a referral's
   page as its words with what to do about them beside them, the queue's filter as a toolbar, and the history as a log.

   Number 60 is A2's (the simulation build reserves 60 to 64 for its screens). 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 declares no token and decides
   no mode. Nothing is pinned to an edge and nothing sets a height. Everything that holds words may shrink and breaks a long word, so a language 40% longer never widens the page (WCAG 1.4.10). */

/* ── One column: the referrers' pages and the intake sheets ───────────── */

/* The CARE referral (signed in and anonymous), the report to the group, and the two sheets of the console that come out of a request (match it to a sheet's measure) are `.page-flow[data-measure="sheet"]`
   (41-page-structure.css): one column held to the sheet's measure, so the notice, the search and the form line up on one right edge. What is said in it is held to the prose measure (`.page-intro`). */

/* The honeypot of the anonymous form: off-screen for a person, out of the tab order and hidden from assistive technology in the markup, and still in the form a bot reads. */
.referral-trap {
  position: absolute;
  inset-inline-start: -10000px;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.referral-errors ul {
  margin: var(--space-1) 0 0;
  padding-inline-start: var(--space-5);
}
.referral-errors-lead {
  margin: 0;
  font-weight: 650;
}
/* Each line is a link to its field: a target at least 24 CSS px high, with room between them (WCAG 2.5.8), as the assessment form's summary does. */
.referral-errors li {
  margin-block: 0.15rem;
}
.referral-errors a {
  display: inline-block;
  min-block-size: 1.5rem;
  padding-block: 0.2rem;
  color: inherit;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

/* ── What was answered, read back ─────────────────────────────────────── */

/* The answers of a form, as the one reader draws them (FormAnswersComponent): a question over its answer. The CARE case page draws the same list inside its own panels, so these rules are for the list
   and not for a card; a request's page and the sheet that matches it put the list in a card of their own (`.report-card`, below). */
.form-answers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  margin: 0;
  min-inline-size: 0;
}
.form-answer {
  min-inline-size: 0;
}
.form-answer dt {
  color: var(--fg3);
  font-size: var(--text-sm);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.form-answer dd {
  margin: 0.2rem 0 0;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.form-answer-long {
  white-space: pre-line;
}
/* A rich answer (RT6; the HTML copy of a field written in the editor, drawn by RichTextComponent): the last block of the text has no margin under it, so the gap between two answers is the list's own, as for
   any other answer. The display's own rule for that (59-rich-text-content.css, `.rich-text > :last-child`) is beaten by its rule for the margin of every block, which has the same specificity and comes
   after it, so here the margin would collapse out of the answer and add to the gap. */
.form-answer-text > .rich-text > :last-child {
  margin-block-end: 0;
}
.form-answer-list {
  margin: 0;
  padding-inline-start: 1.25rem;
}
.form-answers-none {
  margin: 0;
  color: var(--fg2);
}

/* What a person wrote, on a request's page and on the sheet that matches it: one card, each question and its answer a row under a hairline, and an answer held to the prose measure so a long one is
   readable. The question is the quiet color, which the contrast check measures on every surface. */
.report-card .form-answers {
  gap: var(--space-3);
}
.report-card .form-answer + .form-answer {
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--rule);
}
.report-card .form-answer dt {
  color: var(--fg2);
  font-weight: 600;
}
.report-card .form-answer dd {
  max-inline-size: 66ch;
  margin-block-start: var(--space-1);
}

/* ── Finding a person ─────────────────────────────────────────────────── */

/* The person search is a sheet (45-sheet.css draws the card): the search field and its button on one row, the button on the baseline of the field, and the people found under it, each a name, a quiet detail
   and one way to choose them. It runs the sheet's width, so the search and the form it leads to share an edge; where it is the whole of the sheet it ends in the way back, as a form does. */
.person-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  min-inline-size: 0;
  max-inline-size: 60rem;
}
.person-picker-search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  min-inline-size: 0;
}
.person-picker-search > .field {
  flex: 1 1 18rem;
  min-inline-size: 0;
}
.person-picker-actions {
  flex: 0 0 auto;
}
.person-picker-results {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
}
.person-picker-count {
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
}
.person-picker-count:empty {
  display: none;
}
.person-picker-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-block-start: 1px solid var(--rule);
}
.person-picker-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--rule);
  min-inline-size: 0;
}
.person-picker-name {
  flex: 1 1 12rem;
  min-inline-size: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.person-picker-detail {
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.person-picker-choose {
  margin: 0;
}

/* ── A team's incoming requests and referrals: the list pages ─────────── */

/* A list page is the page's flow (`.page-flow`, 41-page-structure.css) at the page's full width: it capped itself at 64rem, so its list stopped short of the filter above it and the header's actions
   beside it. */
.requests-page {
  min-inline-size: 0;
}

/* The filter of a list is a toolbar: the controls and the button that applies them on one card, side by side, the button on the baseline of the fields and next to them, and not pushed to the far edge. */
.requests-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
  min-inline-size: 0;
  /* A form is held to 60rem (36-form-fields.css); a toolbar runs the width of the list under it, so their edges line up. */
  max-inline-size: none;
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.requests-filter .field {
  flex: 0 1 16rem;
  min-inline-size: 0;
}

/* ── One request, one referral: the words, and what to do about them ──── */

/* The page's sections are `.page-flow`'s; the ones about the words (the cases already open, what was reported or the summary, what happened) stand in a column, and what to do next stands beside them
   when the page has room for both, so a person reads and decides without scrolling past one to reach the other. The room is the page's own (a container, `detail`), not the window's: the console's
   sidebar takes a share of it. Narrow, there is one column, in the order of the markup. A page with nothing to do next has no second column. */
.detail-page {
  container: detail / inline-size;
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--section-gap);
  min-inline-size: 0;
}
@container detail (min-inline-size: 56rem) {
  .detail-layout:has(> .detail-aside) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
    /* The main column's sections are rows one to three; what to do next spans them, and the last row takes what is left. */
    grid-template-rows: auto auto 1fr;
    column-gap: var(--space-6);
    align-items: start;
  }
  .detail-layout:has(> .detail-aside) > * {
    grid-column: 1;
  }
  .detail-layout:has(> .detail-aside) > .detail-aside {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

/* The strip of facts under the header: each label over its value, so a short value and a long moment stand in one line across the strip, and the strip has the room of a page that is not a dense record. */
.detail-page > .figure-strip .figure {
  display: grid;
  gap: 0;
  padding-block: var(--space-2);
  padding-inline: var(--space-3);
}
/* Its values are words, names and moments and not headline numbers, so they are in the working face, which sets a moment in less room than the display face does. */
.detail-page > .figure-strip .figure-value {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
}
.detail-page > .figure-strip .figure-value > a {
  display: inline-flex;
  align-items: center;
  min-block-size: 1.5rem;
}
@media (pointer: coarse) {
  .detail-page > .figure-strip .figure-value > a {
    min-block-size: var(--target-min);
  }
}

/* A thing to do is a card (CardComponent) with its sentence in the small working size and its button in the card's foot. A choice (where it stands, what the team decided) is the form's own fieldset
   in the card, and its button is the foot too. A card that holds more than one thing (the accept sheet's sentence, its choice and its two selects) spaces them as the form's sections are. */
.step-help {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}
.detail-aside .card-body {
  display: grid;
  gap: var(--space-4);
}

/* An office with stages asks one question of a request (RequestQuestionComponent): its answers stack, each as wide as the card, so the one primary and the equal secondary answers line
   up at any width and a long answer wraps in its own button. */
.request-question__actions,
.request-question__close {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
}
.request-question__actions .btn,
.request-question__close .btn {
  inline-size: 100%;
}

/* A summary or a reason in a card is their words, kept as they were written (the quote's own rule, 43-entry-list.css) and held to the prose measure, so a long one is readable in a card that runs the page. */
.detail-layout .card-body > .entry__quote {
  max-inline-size: 66ch;
}

/* The history of a request: a log in one card, each step a row (what happened, then when and by whom at its end), the rows under hairlines. */
.request-history {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.request-history-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  min-inline-size: 0;
}
.request-history-entry + .request-history-entry {
  border-block-start: 1px solid var(--rule);
}
.request-history-line {
  flex: 1 1 14rem;
  min-inline-size: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
.request-history-meta {
  flex: 0 1 auto;
  min-inline-size: 0;
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
