/* The conversation (docs/decisions.md, 10 Oct 2026, "The conversation on both order pages"): what
   the two sides wrote to each other, in chat order. The reader's own side on the right as an ink
   bubble, the other side on the left outlined; a proof as a small card; a decision as outlined
   chips; the small words under them quiet. A staff note is drawn apart in the staff look, tinted on
   a dashed rule with "Only Ativv sees this" on it, so it can never be taken for a line the customer
   read. */
.chat {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-empty {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.chat-turn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: var(--chat-turn-width);
}

.chat-turn-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  max-width: none;
  color: var(--color-muted);
  font-size: var(--text-label);
}

.chat-who {
  color: var(--color-ink);
  font-weight: var(--weight-medium);
}

.chat-when {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
}

.chat-bubble {
  margin: 0;
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border: var(--hairline) solid var(--color-ink);
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) var(--radius-chip);
  background: var(--color-surface);
  overflow-wrap: anywhere;
}

.chat-turn-mine .chat-bubble {
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-chip) var(--radius-bubble);
  background: var(--color-ink);
  color: var(--color-bg);
}

.chat-turn-mine .chat-bubble a {
  color: inherit;
}

.chat-bubble > :last-child {
  margin-bottom: 0;
}

/* A picture in the words, or beside them, is a click away from full size. */
.chat img {
  cursor: zoom-in;
}

/* **A picture in the conversation is one height**, set before it loads, so the lines under it never
   move as it arrives (the conversation is opened at its newest, and a picture that grew afterwards
   pushed the newest out of view); a click shows it full size. **A small picture is drawn small**
   inside that height (`scale-down`, the conversation's second pass's verification: a 16 px picture
   drew about 190 px square), on the side its turn stands. */
.chat-bubble img,
.chat .attachment-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: var(--chat-picture-height);
  object-fit: scale-down;
  object-position: left center;
}

.chat-turn-mine .chat-bubble img,
.chat-turn-mine .attachment-image {
  object-position: right center;
}

/* The box a small picture is drawn in draws no rim: the picture's own edge is the only one. */
.chat .attachment-image {
  border: 0;
  border-radius: 0;
}

.chat .attachments {
  max-width: 100%;
}

.chat-aside,
.chat-decided-on {
  margin: 0;
  max-width: none;
  color: var(--color-muted);
  font-size: var(--text-label);
}

/* **What a message is about** (docs/decisions.md, 10 Oct 2026, "The conversation, second pass", (3)):
   "on Snapback cap A and B · proof 1", each option a quiet link that opens it. */
.chat-on {
  margin: 0;
  max-width: none;
  color: var(--color-muted);
  font-size: var(--text-label);
}

.chat-on-option {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.chat-on-option:focus-visible {
  outline: var(--focus-width) solid var(--color-accent);
  outline-offset: var(--focus-offset);
}

.chat-decided {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  max-width: none;
}

/* A proof, as the line that sent it carries it: its number and its ask, and the options it
   offered, each a small picture over its name. */
.chat-card {
  padding: var(--space-3);
  border: var(--hairline) solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink);
}

.chat-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  max-width: none;
}

.chat-card-number {
  font-weight: var(--weight-medium);
}

.chat-card-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.chat-card-options:empty {
  display: none;
}

.chat-card-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: var(--chat-card-picture);
  font-size: var(--text-label);
  line-height: 1.3;
}

.chat-card-option img {
  width: var(--chat-card-picture);
  height: var(--chat-card-picture);
  object-fit: contain;
  background: var(--color-paper-lattice);
  border: var(--hairline) solid var(--color-rule);
}

/* Staff's note: tinted, on a dashed rule, and saying whose it is. */
.chat-turn-note .chat-bubble,
.chat-turn-note.chat-turn-mine .chat-bubble {
  border: var(--hairline) dashed var(--color-note-rule);
  border-radius: var(--radius-chip);
  background: var(--color-note-ground);
  color: var(--color-ink);
}

.chat-turn-note .chat-aside {
  color: var(--color-note-ink);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
}

/* Waiting in the tray: drawn as it will read, at half strength, with the words that say so. */
.chat-pending .chat-bubble {
  opacity: 0.6;
}

.chat-pending .chat-when {
  color: var(--color-ink);
}

/* **Files attached to a message** (docs/decisions.md, 10 Oct 2026, "The conversation, second pass",
   (5)): a picture under the words as a pasted one is, a click opening it full size; any other file a
   chip with its kind, for download. */
.chat .attachment-image {
  max-height: 16rem;
  width: auto;
  cursor: zoom-in;
}

.chat .attachment a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  border: var(--hairline) solid var(--color-ink);
  border-radius: var(--radius-chip);
  color: var(--color-ink);
  font-size: var(--text-label);
  text-decoration: none;
}

.chat .attachment a::after {
  content: "↓";
}

/* The files sit on the turn's own side, as its words do. */
.chat-turn-mine .attachments {
  align-items: flex-end;
}

.chat-turn-other .attachments {
  align-items: flex-start;
}
