/* Reading styles for rich-text bodies: `.rich-text-content` wherever a body
   renders (portal pages, CRM detail pages, the editor's own preview) and the
   `.article-body` reading page. The editor's chrome lives in
   rich-text-editor.css, which only the CRM and the admin load. */

.rich-text-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  max-width: 76ch;
  overflow-wrap: break-word;
  word-break: normal;
}

.rich-text-content > :last-child {
  margin-bottom: 0;
}

.rich-text-content :is(h2, h3) {
  margin-bottom: 0.75rem;
  margin-top: 2rem;
}

.rich-text-content h2 {
  font-size: 1.5rem;
}

.rich-text-content h3 {
  font-size: 1.25rem;
}

.rich-text-content :is(ul, ol) {
  padding-inline-start: 1.5rem;
}

.rich-text-content blockquote {
  border-inline-start: 0.25rem solid var(--accent-secondary);
  color: var(--text-muted);
  margin-inline: 0;
  padding-inline-start: 1rem;
}

.rich-text-content a {
  color: var(--accent-primary);
}

.rich-text-content figure,
.rich-text-editor .ql-editor figure {
  margin: 1.5rem 0;
}

.rich-text-content figure img,
.rich-text-editor .ql-editor figure img {
  display: block;
  height: auto;
  max-width: 100%;
}

.rich-text-embed iframe {
  border: 0;
  display: block;
  width: 100%;
}

.rich-text-embed[data-embed^="youtube:"] iframe {
  aspect-ratio: 16 / 9;
}

.rich-text-embed[data-embed^="instagram:"] iframe {
  margin-inline: auto;
  max-width: 540px;
  min-height: 30rem;
}

.rich-text-embed[data-embed^="telegram:"] iframe {
  min-height: 8rem;
}

/* Public reading pages (`portal.css` owns the page). Declared after the
   `.rich-text-content` rules above so it wins at equal specificity; the CRM
   and other rich-text surfaces keep the plain rules. */
.article-body {
  font-size: var(--text-lg);
  line-height: 1.8;
  margin-inline: auto;
  max-width: 46rem;
}

.article-body > p {
  margin-bottom: 1.25rem;
}

.article-body h2 {
  font-size: clamp(1.5rem, 1.25rem + 0.8vw, 1.875rem);
  line-height: 1.25;
  margin-bottom: 1rem;
  margin-top: 2.75rem;
}

.article-body h3 {
  font-size: 1.3125rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  margin-top: 2rem;
}

.article-body :is(ul, ol) {
  margin-bottom: 1.25rem;
}

.article-body li {
  margin-bottom: 0.5rem;
  padding-inline-start: 0.25rem;
}

.article-body li::marker {
  color: var(--accent-primary);
  font-weight: 700;
}

.article-body a {
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

/* A quote is a callout: the "short answer" box of a guide. Quill writes one
   <blockquote> per line, so consecutive ones join into a single panel. */
.article-body blockquote {
  background: var(--color-brand-soft);
  border-inline-start: 0.25rem solid var(--accent-primary);
  border-radius: var(--radius-md);
  color: var(--text);
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
}

.article-body blockquote:has(+ blockquote) {
  border-end-end-radius: 0;
  border-end-start-radius: 0;
  margin-bottom: 0;
  padding-bottom: 0.5rem;
}

.article-body blockquote + blockquote {
  border-start-end-radius: 0;
  border-start-start-radius: 0;
  margin-top: 0;
  padding-top: 0;
}

.article-body figure {
  margin-block: 2.25rem;
}

.article-body figure img {
  border-radius: var(--radius-md);
  margin-inline: auto;
}

/* Pictures and embeds step out of the text column on a wide screen. */
@media (min-width: 992px) {
  .article-body > figure {
    margin-inline: -5rem;
  }
}

/* A post has no title field, so its first paragraph is set as one. */
.post-page-body > :first-child {
  font-family: var(--font-heading);
  font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  font-variant-numeric: lining-nums;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1.25rem;
}
