/* Writing together, SD6: what suggesting and comments draw inside the live form (docs/editing_plan/05-the-editor.md, "Comments" and "How suggesting works";
   09-every-screen.md). 24-editing.css draws the components (the suggestion list, the comments panel, a thread); this sheet draws what the scripts put into
   the text and beside the fields: a comment's words marked in the editor, a suggested paragraph break, each field's Comment button, a new thread's form beside
   its field, and the thread that is active.

   Never color alone (WCAG 1.4.1): a comment's words are a <mark> with a dotted underline as well as a fill, linked to their thread by aria-details; a suggested
   break is a pilcrow inside the insertion's own underline, and the suggestion list says it in words. Tokens only, logical properties only. */

/* ── A comment's words ───────────────────────────────────────────────────
   The editor draws them as <mark class="editing-comment-mark"> (editing/shared/comments.js). The thread that has the focus, or was last chosen, is
   `--active`: a stronger fill and a solid underline. The text on both fills is the page's own (fg1, 4.5:1 in both modes, config/contrast_pairs.yml). */
.editing-comment-mark {
  background: var(--editing-comment-mark);
  color: var(--fg1);
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--fg2);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
  border-radius: var(--radius-sm);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  cursor: pointer;
}

.editing-comment-mark--active {
  background: var(--editing-comment-mark-active);
  text-decoration-style: solid;
  text-decoration-color: var(--fg1);
}

/* ── A suggested paragraph break ─────────────────────────────────────────
   One zero-width character under the insertion and the break marks (editing/shared/suggestions.js): drawn as a pilcrow, which is decoration (its
   alternative text is empty; the suggestion list says "suggested a new paragraph"). */
.editing-break::after {
  content: "\00b6";
  content: "\00b6" / "";
  padding-inline: 0.1em;
  color: var(--fg1);
  font-weight: 700;
}

/* ── Each field's Comment button, and a new thread's form beside its field ── */
.editing-field-comment {
  justify-self: start;
  align-self: flex-start;
  margin-block-start: var(--space-1);
}

.editing-form__fields .editing-comments__new {
  margin-block: var(--space-2) var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--rule-strong);
  border-inline-start-width: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

/* ── The thread that is active, and a thread taken to by Previous or Next ── */
.editing-thread--active {
  border-color: var(--rule-strong);
  border-inline-start-width: 4px;
}

.editing-thread:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.editing-comments-frame {
  display: block;
  min-inline-size: 0;
}

/* In forced colors the fill is the system's own highlight, and the underline stays. */
@media (forced-colors: active) {
  .editing-comment-mark,
  .editing-comment-mark--active {
    background: Mark;
    color: MarkText;
    forced-color-adjust: none;
  }

  .editing-thread--active {
    border-color: Highlight;
  }
}
