/* The Abuse tab of the operator's area (js/admin-abuse.js,
   js/admin-abuse-sheet.js, js/admin-abuse-moves.js,
   js/admin-abuse-takedown.js). Loaded by index.html after admin-tickets.css,
   whose list and sheet it follows. The table is app.css's shared one (.list,
   .list-head, .list-row, .cell-num, .tag[data-tone]); this file adds the
   column widths, how a row folds into a card, the row's one click target,
   and the sheet's facts, the reporter's words and the moves. Colours,
   spaces and type sizes are tokens from app.css's :root or from the block
   below. The confirmation sheet is delivery-deletion.css's
   (.sheet.deletion).

   A report row, wide:
     [ #17 ][ category ][ reference ......... ][ received ][ resolved ][ state ]
   and folded into a card, when the table gets less than about 840px:
     [ reference                                                         ]
     [ #17   Child safety   1 hr ago   Resolved: Yes   Received          ]

   The whole row opens the report, but only the reference is a button: its
   ::after covers the row, so a keyboard has one stop per report and a
   pointer can press anywhere on it. Nothing the reporter wrote is in a row. */

:root {
  --abuse-column-ref: 64px;
  --abuse-column-category: 148px;   /* the "Child safety" tag with room for "Illegal content" */
  --abuse-column-since: 124px;      /* "Yesterday, 14:05" is the widest */
  --abuse-column-resolved: 88px;
  --abuse-column-state: 108px;
}

/* --- the list ----------------------------------------------------- */

/* The table asks how wide it is, not how wide the window is (same reason as
   the tickets table in admin-tickets.css). */
.abuse-body { container: abuse / inline-size; }

.abuse-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* On the rows themselves: app.css sets --cols on any row with three or more
   cells, which beats a value inherited from the list. */
.abuse-list .list-head,
.abuse-list .list-row {
  --cols:
    var(--abuse-column-ref) var(--abuse-column-category) minmax(0, 1fr)
    var(--abuse-column-since) var(--abuse-column-resolved) var(--abuse-column-state);
}
.abuse-row { position: relative; }
.abuse-row:hover { background: var(--hover); }

.abuse-open {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.abuse-open::after { content: ""; position: absolute; inset: 0; }
/* The ring is drawn inside the row: the list clips (overflow: hidden). */
.abuse-open:focus-visible { outline: none; }
.abuse-open:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
.abuse-row .who .t { max-width: 100%; font-family: var(--font-mono); letter-spacing: .02em; }
.abuse-row .c-category { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.abuse-foot { margin-top: var(--space-3); }

/* 840px: below it the six columns leave the reference too little room.
   (A container query cannot read a custom property, so it is a literal.) */
@container abuse (max-width: 840px) {
  .abuse-list .list-head { display: none; }
  .abuse-list .list-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
  }
  .abuse-row .who { flex: 1 0 100%; order: -1; }
  .abuse-row .cell-num { text-align: left; }
  .abuse-row .c-resolved::before { content: "Resolved: "; color: var(--mute); }
}

/* --- the sheet ---------------------------------------------------- */

#abuse-sheet .body > * + * { margin-top: var(--space-4); }
#abuse-sheet h3 {
  margin-bottom: calc(-1 * var(--space-2));
  font: 500 var(--text-m)/18px var(--font-sans);
  color: var(--ink2);
}
#abuse-sheet .sheet-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-1); }

.abuse-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  margin: 0;
}
.abuse-facts dt { color: var(--mute); font-size: var(--text-m); line-height: 20px; }
.abuse-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; unicode-bidi: isolate; }

/* A reporter's words, exactly as sent: plain text, wrapped, never markup.
   unicode-bidi: isolate (with dir="auto" in the markup) keeps a
   right-to-left text from reordering the page around it, whatever
   characters it holds. */
.abuse-text {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--sunken);
  color: var(--ink);
  font: 400 var(--text-m)/18px var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: isolate;
}

.abuse-deleted { color: var(--mute); }
.abuse-result { margin: 0; }   /* a .callout.teal: the accent's one place for "just done" */
.abuse-result:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.abuse-moves { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.abuse-moves form,
.abuse-moves > .err { flex: 1 0 100%; }
.abuse-moves > .err { margin: 0; }
.abuse-move-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

@media (max-width: 820px) {
  .abuse-moves .btn { flex: 1 0 100%; }
  .abuse-move-actions .btn { flex: 1; }
  #abuse-sheet .body > .btn { width: 100%; }
}
