/* ==========================================================================
   Prose — CoachOS Design System · SINGLE SOURCE
   ──────────────────────────────────────────────────────────────────────
   THE one prose rule set, consumed by every formatted-prose surface so they
   can never diverge (WYSIWYG by construction, DRY):
     • .rich-text                      — coach Content display (Element)
     • .ds-lexxy-editor .lexxy-editor__content — the Lexxy authoring body
     • .participation-text-answers__rich       — member RICH answer render
   Pre-soul typography: sans/inherit body, no reading measure cap. The Study
   voice is NOT routed through html[data-soul] — it lives only on participation
   Content elements that opt in via .rich-text--reading (step.css).

   Replaces the duplicated prose blocks previously hand-synced in
   components/rich-text.css and components/lexxy.css — those files now
   @import or rely on this (delete their duplicated heading/list/quote/
   table/code rules). Email-inliner + PDF (report.css) stay co-dependents,
   kept in lockstep with this file.

   Load order: after base/souls/*.css, before page styles.
   ========================================================================== */

:where(.rich-text,
       .ds-lexxy-editor .lexxy-editor__content,
       .participation-text-answers__rich) {
  color: var(--text-primary);
  line-height: 1.7;
}

/* Headings
   ========================================================================== */
:where(.rich-text,
       .ds-lexxy-editor .lexxy-editor__content,
       .participation-text-answers__rich) :is(h1, h2, h3, h4) {
  color: var(--text-primary);
}

.rich-text h1, .ds-lexxy-editor .lexxy-editor__content h1, .participation-text-answers__rich h1 {
  font-size: var(--text-3xl); font-weight: 700; margin-top: var(--space-8); margin-bottom: var(--space-4); line-height: 1.2;
}
.rich-text h2, .ds-lexxy-editor .lexxy-editor__content h2, .participation-text-answers__rich h2 {
  font-size: var(--text-2xl); font-weight: 700; margin-top: var(--space-6); margin-bottom: var(--space-3); line-height: 1.25;
}
.rich-text h3, .ds-lexxy-editor .lexxy-editor__content h3, .participation-text-answers__rich h3 {
  font-size: var(--text-xl); font-weight: 600; margin-top: var(--space-5); margin-bottom: var(--space-2); line-height: 1.3;
}
.rich-text h4, .ds-lexxy-editor .lexxy-editor__content h4, .participation-text-answers__rich h4 {
  font-size: var(--text-lg); font-weight: 600; margin-top: var(--space-4); margin-bottom: var(--space-2);
}

/* Paragraph
   ========================================================================== */
.rich-text p, .ds-lexxy-editor .lexxy-editor__content p, .participation-text-answers__rich p { margin-bottom: var(--space-4); }
.rich-text p:last-child, .ds-lexxy-editor .lexxy-editor__content p:last-child, .participation-text-answers__rich p:last-child { margin-bottom: 0; }

/* Lists
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) :is(ul, ol) {
  margin-bottom: var(--space-4); padding-left: var(--space-6);
}
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) ul { list-style-type: disc; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) ol { list-style-type: decimal; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) li { margin-bottom: var(--space-1); }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) ul li::marker { color: var(--accent-primary); }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) ol li::marker { color: var(--text-secondary); font-weight: 600; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) li > :is(ul, ol) { margin-top: var(--space-1); margin-bottom: var(--space-1); }

/* Links
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) a {
  color: var(--accent-primary); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; transition: color var(--duration-fast);
}
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) a:hover { color: var(--accent-hover); }

/* Blockquote
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) blockquote {
  border-left: 3px solid var(--border-strong);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  background-color: var(--surface-neutral);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
  font-style: italic;
}
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) blockquote p:last-child { margin-bottom: 0; }

/* Code
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) pre {
  background-color: var(--surface-neutral); padding: var(--space-4); border-radius: var(--radius-lg);
  overflow-x: auto; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.6;
  margin-bottom: var(--space-4); border: 1px solid var(--border-subtle);
}
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) code {
  background-color: var(--surface-neutral); padding: var(--space-0-5) var(--space-1); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.9em;
}
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }

/* Images / HR
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) img { max-width: 100%; height: auto; border-radius: var(--radius-lg); margin: var(--space-4) 0; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) hr { border: none; border-top: 1px solid var(--border-subtle); margin: var(--space-8) 0; }

/* Tables
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin: var(--space-4) 0; font-size: var(--text-sm);
  border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-default);
}
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) :is(th, td) { padding: var(--space-2) var(--space-3); text-align: left; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) th { background-color: var(--surface-neutral); font-weight: 600; color: var(--text-primary); border-bottom: 1px solid var(--border-default); }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) td { color: var(--text-primary); border-bottom: 1px solid var(--border-default); }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) tr:last-child :is(td, th) { border-bottom: none; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) :is(th, td) + :is(th, td) { border-left: 1px solid var(--border-default); }

/* Inline marks
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) strong { font-weight: 700; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) em { font-style: italic; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) :is(del, s) { text-decoration: line-through; color: var(--text-tertiary); }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) u { text-decoration: underline; text-underline-offset: 2px; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) mark { background-color: var(--status-warning-bg); color: var(--text-primary); padding: 1px 3px; border-radius: var(--radius-sm); }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) :is(sub, sup) { font-size: 0.75em; line-height: 0; position: relative; vertical-align: baseline; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) sup { top: -0.5em; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) sub { bottom: -0.25em; }

/* Edge spacing cleanup
   ========================================================================== */
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) > *:first-child { margin-top: 0; }
:where(.rich-text, .ds-lexxy-editor .lexxy-editor__content, .participation-text-answers__rich) > *:last-child { margin-bottom: 0; }
