/* Trix (report comments WYSIWYG) — theme-token overrides on top of the
   vendored trix.css, mirroring the codemirror_overrides.css approach.
   Comments accept formatted text only: the attachment tools are hidden
   here and file drops are rejected in application.js. */

trix-editor {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  min-height: 5rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}

trix-editor:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}

trix-editor:empty::before {
  color: var(--text-tertiary);
}

/* Tailwind's preflight strips list markers globally; restore them
   INSIDE the editor so bullets/numbers show while typing, not only
   after save (UAT: "bullets don't show, but do on save"). Mirrors the
   rendered .comment-body styles below. */
trix-editor ul {
  list-style: disc;
  padding-left: 1.125rem;
}

trix-editor ol {
  list-style: decimal;
  padding-left: 1.125rem;
}

trix-editor blockquote {
  border-left: 2px solid var(--accent-dim);
  padding-left: 0.625rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Reply composers are deliberately shorter than the main one. */
.comment-reply-form trix-editor {
  min-height: 3.5rem;
}

trix-toolbar {
  margin-bottom: 0.375rem;
}

trix-toolbar .trix-button-group {
  background: var(--surface-elevated);
  border-color: var(--border-subtle);
  border-radius: var(--radius-sm);
}

trix-toolbar .trix-button {
  border-color: var(--border-subtle);
}

/* Trix draws glyphs with background-image masks that assume a light
   theme; invert them from the token so both themes read. */
trix-toolbar .trix-button::before {
  filter: var(--trix-icon-filter, none);
}

:root[data-theme="dark"] trix-toolbar .trix-button::before,
:root[data-theme="dark"] trix-toolbar .trix-button.trix-active::before {
  filter: invert(0.85);
}

trix-toolbar .trix-button.trix-active {
  background: var(--accent-bg);
}

trix-toolbar .trix-button:not(:disabled):hover {
  background: var(--surface-hover);
}

/* No attachments on comments (see application.js trix-file-accept). */
trix-toolbar .trix-button-group--file-tools {
  display: none;
}

/* History (undo/redo) group adds noise on a 3-line comment box. */
trix-toolbar .trix-button-group--history-tools {
  display: none;
}

/* Rendered comment bodies (.comment-body wraps action-text content). */
.comment-body .trix-content h1 {
  font-size: 1rem;
  font-weight: 600;
}

.comment-body .trix-content blockquote {
  border-left: 2px solid var(--accent-dim);
  padding-left: 0.625rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0.375rem 0;
}

.comment-body .trix-content pre {
  background: var(--editor-code-bg);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.8em;
  overflow-x: auto;
}

.comment-body .trix-content ul { list-style: disc; padding-left: 1.125rem; }
.comment-body .trix-content ol { list-style: decimal; padding-left: 1.125rem; }
