/* Rich text: what people write, and the editor they write it in */

.rich-text { overflow-wrap: anywhere; }
.rich-text > *:first-child { margin-top: 0; }
.rich-text h1 { margin: 1.2em 0 0.5em; font-size: 1.3em; }
.rich-text ul, .rich-text ol { margin: 0 0 0.75em; padding-left: 1.4em; }
.rich-text li { margin: 0.2em 0; }
.rich-text blockquote { margin: 0 0 0.75em; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--ink-soft); }
.rich-text pre { margin: 0 0 0.75em; padding: 12px 14px; overflow-x: auto; border-radius: var(--radius-sm); background: var(--surface-sunken); font: 13px/1.5 var(--font-mono); white-space: pre-wrap; }
.rich-text a { color: var(--accent); }
.rich-text img { height: auto; border-radius: var(--radius-sm); }
.rich-text action-text-attachment { display: block; margin: 0.75em 0; }
.rich-text .attachment { text-align: left; }
.rich-text .attachment__caption { color: var(--muted); font-size: 13px; }

/* Trix editor */

trix-toolbar .trix-button-row { flex-wrap: wrap; gap: 6px; }

trix-toolbar .trix-button-group {
  margin-bottom: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

trix-toolbar .trix-button { border-bottom: 0; border-left-color: var(--line); }
trix-toolbar .trix-button.trix-active { background: var(--accent-soft); }

@media (prefers-color-scheme: dark) {
  trix-toolbar .trix-button--icon::before { filter: invert(1); opacity: 0.75; }
  trix-toolbar .trix-button.trix-active::before { opacity: 1; }
  trix-toolbar .trix-button:disabled::before { opacity: 0.3; }
}

trix-toolbar .trix-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

trix-toolbar .trix-input--dialog { border-color: var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }

trix-editor {
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.55;
  transition: border-color 0.15s, box-shadow 0.15s;
}

trix-editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
trix-editor:empty:not(:focus)::before { color: var(--muted); }
trix-editor .attachment__caption-editor { color: var(--ink); }
