/* The discussion page (#701; threads/detail.html).

   On the desk, not the paper (CLAUDE.md rule 12), in the column the
   submissions list uses (home.css `.workspace--list`) and in the note cards'
   vocabulary: a dot, a lowercase badge, `who · when`, cards lifted with --e3.
   A discussion is --focus, as it is in the margin. The two voices hold
   (notes.css, #373): what people said is Writ's face (`said`), and the passage
   is the manuscript quoted (`quoted`). Nothing here is a new colour; the one
   wash is mixed from --focus, as notes.css mixes its own. */

.discussion {
  --blue: var(--focus);
  --blue-wash: color-mix(in srgb, var(--focus) 11%, transparent);
  gap: var(--s4);
  /* The reply box is pinned over the desk's foot. Without this, the last
     comment would sit under the box. */
  padding-bottom: var(--s2);
}
.discussion .dot[data-kind="discussion"] { background: var(--blue); }
.discussion .badge[data-state="open"] { background: var(--blue-wash); color: var(--blue); }

/* ------------------------------------------------------ getting around */
.discussion-nav {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s2) var(--s4);
  font-size: var(--t-sm);
}
.discussion-back { color: var(--ink-2); font-weight: 500; }
.discussion-back:hover { color: var(--ink); }
.discussion-step { display: inline-flex; align-items: center; gap: var(--s1); }
.discussion-count { padding: 0 var(--s2); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ the head */
#thread { display: grid; gap: var(--s4); }
.discussion-head { display: grid; gap: var(--s2); padding: 0 var(--s1); }
.discussion-kind {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-size: var(--t-sm); font-weight: 650; color: var(--ink);
}
.discussion-head h1 {
  font-size: 22px; font-weight: 600;
  letter-spacing: -.02em; line-height: 1.25;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.discussion-meta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s3);
}
.discussion-people {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--t-sm); color: var(--ink-2);
}
.discussion-faces { display: inline-flex; gap: 3px; }
.discussion-actions { display: inline-flex; flex-wrap: wrap; gap: var(--s2); }

/* --------------------------------------------------------- the passage

   The paragraph as the document has it, the discussed words marked the way
   the reading surface marks them (notes.css `.anchor`): a hairline under
   them in the discussion's colour, and its wash. */
.passage {
  display: grid; gap: var(--s3);
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--e3);
}
.passage-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--s1) var(--s3);
  font-size: var(--t-xs); color: var(--ink-3);
}
.passage-where { overflow-wrap: anywhere; }
.passage-show { font-size: var(--t-sm); font-weight: 500; }
.passage-text {
  font-size: var(--t-lg); line-height: 1.6;
  color: var(--ink-2);
}
.passage-mark {
  background: var(--blue-wash);
  border-bottom: 1px solid var(--blue);
  color: var(--ink);
}
/* The text moved on under the discussion: said in words, and the passage it
   was about quoted beside a bar, so it is not taken for the current text. */
.passage-note { font-size: var(--t-sm); color: var(--warn); }
.passage[data-state="lost"] .passage-note { color: var(--ink-2); }
.passage-said {
  margin: 0;
  padding-left: var(--s4);
  border-left: 3px solid var(--line);
  font-size: var(--t-md); line-height: 1.6;
  color: var(--ink-2);
}
.passage-said .passage-mark { background: none; border-bottom-style: dashed; color: inherit; }

/* The flag's evidence, when this is a flag. */
.flag-detail {
  display: grid; gap: var(--s2);
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
}
.flag-detail .cv-head { font-size: var(--t-xs); color: var(--ink-3); }
.flag-detail .cv-body { white-space: pre-wrap; }

/* ---------------------------------------------------- the conversation

   A comment is a face, a name, a time and the words; an event is one quiet
   line with no card, set in from the faces so the comments carry the eye. */
.conversation { display: grid; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.comment {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: var(--s3); row-gap: 3px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--e3);
}
.comment .avatar { grid-row: span 2; }
.comment-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2);
  font-size: var(--t-sm); line-height: 22px;
}
.comment-author { font-weight: 650; color: var(--ink); }
.comment-time { font-size: var(--t-2xs); color: var(--ink-3); }
.comment-body {
  font-size: var(--t-md); line-height: 1.55; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.event {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1);
  padding: 0 var(--s4) 0 calc(14px + 22px + var(--s3));
  font-size: var(--t-xs); color: var(--ink-3);
}
.event-who { font-weight: 600; color: var(--ink-2); }
.event-time::before { content: "·"; margin-right: var(--s1); }

/* ------------------------------------------------------- the reply box

   Pinned to the bottom of the desk, so a reply is one reach away however
   long the conversation is. One line at rest; it grows as it is written
   (thread.js), up to a third of the screen, then scrolls. */
.reply-dock {
  position: sticky; bottom: 0; z-index: 2;
  margin: var(--s2) calc(-1 * var(--s2)) 0;
  padding: var(--s3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--e2);
}
.comment-form { display: grid; gap: var(--s2); }
.reply-body {
  width: 100%;
  min-height: 36px; max-height: 33vh;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r2);
  background: var(--canvas);
  color: var(--ink);
  font: var(--t-md)/1.5 var(--ui);
  resize: none;
  overflow-y: auto;
}
.reply-body:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.reply-error { margin: 0; color: var(--danger); font-size: var(--t-sm); }
.reply-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); }
.reply-hint { font-size: var(--t-2xs); color: var(--ink-3); }
.reply-closed { font-size: var(--t-sm); color: var(--ink-2); }

/* A phone (375px): the column is the screen, less the desk's gutter. The
   header's actions drop under the people; the reply box keeps its edge. */
@media (max-width: 640px) {
  .passage, .flag-detail { padding: var(--s3) var(--s4); }
  .passage-text { font-size: var(--t-md); }
  .event { padding-left: var(--s2); }
  .reply-dock { margin-left: 0; margin-right: 0; }
  .reply-hint { display: none; }
}
