/* Wevote::Ui::RichTextComponent — a Trix (ActionText) editor skinned to the
   design system. Everything is scoped to `.wv-rt` so it overrides Trix's own
   injected defaults (and actiontext.css, where that is loaded) without touching
   any other Trix instance in the app. Tokens only — dark mode is automatic. */

/* ---- frame (toolbar + body share one card) ---- */
.wv-rt {
  position: relative;
  border: 1.5px solid var(--hairline-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.wv-rt:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wv-rt.is-invalid { border-color: var(--st-unres-dot); }

/* ---- toolbar ---- */
.wv-rt__tools {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px; background: var(--sunken); border-bottom: 1px solid var(--hairline);
}
.wv-rt__group { display: flex; align-items: center; gap: 2px; }
.wv-rt__div { width: 1px; height: 22px; background: var(--hairline-strong); margin: 0 6px; }
.wv-rt__btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}
.wv-rt__btn:hover { background: var(--surface); color: var(--ink); }
.wv-rt__btn:active { transform: scale(.94); }
.wv-rt__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wv-rt__btn.trix-active { background: var(--accent-soft); color: var(--accent-ink); }
.wv-rt__btn svg { width: 18px; height: 18px; }

/* ---- editor body (the <trix-editor> element) ---- */
.wv-rt trix-editor {
  display: block; border: 0; outline: none; margin: 0;
  min-height: 200px; max-height: 360px; overflow-y: auto;
  padding: 14px 16px; background: var(--surface); color: var(--ink);
  font-size: 15px; line-height: 1.65;
}
.wv-rt trix-editor:focus { border: 0; box-shadow: none; }  /* kill actiontext's green ring */
.wv-rt trix-editor:empty:not(:focus)::before { color: var(--faint); }

/* content typography — !important beats actiontext.css's own !important rules */
.wv-rt trix-editor h1 {
  font-family: "Poppins", sans-serif !important; font-weight: 700 !important;
  font-size: 18px !important; line-height: 1.4 !important; margin: 4px 0 8px !important; color: var(--ink) !important;
}
.wv-rt trix-editor p { margin: 0 0 10px; }
.wv-rt trix-editor ul, .wv-rt trix-editor ol { margin: 0 0 10px !important; padding-left: 22px !important; }
.wv-rt trix-editor li { margin: 2px 0; }
.wv-rt trix-editor blockquote {
  margin: 0 0 10px !important; padding: 4px 0 4px 14px !important;
  border-left: 3px solid var(--accent) !important; color: var(--muted) !important; font-style: normal !important;
}
.wv-rt trix-editor a { color: var(--accent-ink); text-decoration: underline; }

/* ---- link dialog (Trix shows/hides via [data-trix-active]) ---- */
.wv-rt [data-trix-dialog] { display: none; }
.wv-rt [data-trix-dialog][data-trix-active] { display: block; }
.wv-rt .trix-dialogs { position: absolute; top: 6px; left: 6px; right: 6px; z-index: 10; }
.wv-rt .trix-dialog {
  padding: 10px; background: var(--surface);
  border: 1px solid var(--hairline-strong); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.wv-rt .trix-dialog__link-fields { display: flex; gap: 8px; align-items: center; }
.wv-rt .trix-input--dialog {
  flex: 1; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1.5px solid var(--hairline-strong); background: var(--surface);
  color: var(--ink); font-size: 14px; outline: none;
}
.wv-rt .trix-input--dialog:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wv-rt .trix-button-group { display: flex; gap: 6px; }
.wv-rt .trix-button--dialog {
  height: 38px; padding: 0 14px; border: 0; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff;
}
.wv-rt .trix-button--dialog:last-child { background: var(--sunken); color: var(--muted); }

/* ---- read-only rendered rich text (ActionText .trix-content) ----
   Mirrors the editor's typography for display surfaces (e.g. the proposal show
   page's Resources tab). List markers are restored explicitly: Tailwind's reset
   strips them, and Trix's CDN CSS isn't loaded on pages without an editor. */
.wv-prose { color: var(--ink); font-size: 14.5px; line-height: 1.7; }
.wv-prose > .trix-content > :last-child { margin-bottom: 0; }
.wv-prose p { margin: 0 0 12px; }
.wv-prose h1 {
  font-family: "Poppins", sans-serif; font-weight: 700; font-size: 19px;
  line-height: 1.35; margin: 18px 0 8px; color: var(--ink);
}
.wv-prose h1:first-child { margin-top: 0; }
.wv-prose ul, .wv-prose ol { margin: 0 0 12px; padding-left: 24px; }
.wv-prose ul { list-style: disc; }
.wv-prose ol { list-style: decimal; }
.wv-prose li { margin: 4px 0; }
.wv-prose blockquote {
  margin: 0 0 12px; padding: 6px 0 6px 16px;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.wv-prose a { color: var(--accent-ink); text-decoration: underline; }
.wv-prose strong { font-weight: 700; }
.wv-prose em { font-style: italic; }
.wv-prose del { text-decoration: line-through; }
