/* Threaded comments component. Reusable across any entity that exposes
   /v1/<entity>/<id>/comments — the host page mounts a container and the
   JS does the rest. Indent + thread guide line are sourced from nested
   <ul class="comments-list"> nesting, so raising the server-side maxDepth
   cap needs no stylesheet change. */

.comments {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.comments-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.comments-header h2 {
  margin: 0;
  font-size: 20px;
}

.comments-count {
  font-size: 13px;
}

.comments-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.comments-composer textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  padding: 8px 10px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  box-sizing: border-box;
}

.comments-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.comments-composer-hint {
  font-size: 12px;
}

.comments-composer-actions {
  display: flex;
  gap: 8px;
}

.comments-signin-cta {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* A reply group is a nested .comments-list inside an outer comment's
   <li>. The outer list's `gap` only spaces sibling top-levels, so without
   `margin-top` the first child sits flush against the parent. The
   `border-left` is the thread guide line that visually anchors every
   reply (and sub-reply) to its parent; `margin-left` + `padding-left`
   form the gutter that holds the line. Indent is sourced here (not on
   the article) so the line and the indent stay aligned. */
.comments-list .comments-list {
  margin-top: 12px;
  margin-left: 0.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.comments-list .comments-list:hover {
  border-left-color: var(--muted);
}

.comments-empty {
  font-size: 14px;
  padding: 8px 0;
}

/* Per-comment chrome is intentionally bare — read-only content uses
   no "box" (house guideline: panels are reserved for buttons / CTA
   surfaces like the composer and signin-cta below). Vertical
   separation between siblings comes from the parent .comments-list's
   gap; the thread-guide rule on nested .comments-list anchors
   replies visually. */
.comment {
  /* intentionally empty */
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 600;
}

.comment-date {
  font-size: 12px;
}

.comment-edited {
  font-size: 12px;
  font-style: italic;
}

.comment-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-body.is-deleted {
  color: var(--muted);
  font-style: italic;
}

.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
}

.comment-action {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.comment-action:hover {
  color: var(--text);
}

.comment-reply-form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-reply-form textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  padding: 6px 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  box-sizing: border-box;
}

.comment-reply-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.comment-error {
  color: var(--accent);
  font-size: 12px;
}
