/*
 * Rich text typography: rendered Action Text bodies (.lexxy-content) and static pages (.prose).
 * The same rules apply inside the Lexxy editor, so writing looks like the published article.
 * Lexxy scopes its own rules with :where(), so plain class selectors here always win.
 */

.lexxy-content,
.prose {
  --lexxy-content-margin: 1.25rem;

  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.lexxy-content :is(h1, h2, h3, h4, h5, h6),
.prose :is(h1, h2, h3, h4) {
  margin-block: 2.5rem 1rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

/* The page title is the only real h1; headings inside a body start one step lower. */
.lexxy-content h1,
.prose h2 { font-size: 1.625rem; }

.lexxy-content h2,
.prose h3 { font-size: 1.375rem; }

.lexxy-content h3 { font-size: 1.1875rem; }

.lexxy-content :is(h4, h5, h6) { font-size: 1.0625rem; }

.lexxy-content > :first-child,
.prose > :first-child {
  margin-top: 0;
}

.lexxy-content a,
.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.lexxy-content a:hover,
.prose a:hover {
  color: var(--accent);
}

.lexxy-content :is(ul, ol),
.prose :is(ul, ol) {
  padding-left: 1.5rem;
}

.lexxy-content :is(ul, ol) {
  margin-inline-start: 0;
}

.lexxy-content li,
.prose li {
  margin-block: .375rem;
}

.lexxy-content li::marker,
.prose li::marker {
  color: var(--muted);
}

.lexxy-content blockquote {
  margin-inline: 0;
  padding: .125rem 0 .125rem 1.125rem;
  border-inline-start: 3px solid var(--accent);
  color: var(--ink-2);
}

.lexxy-content hr {
  inline-size: 100%;
  margin-block: 2.5rem;
  border-block-end-color: var(--line);
}

/* Code */

.lexxy-content :is(code, pre) {
  border: 1px solid var(--line);
  background-color: var(--surface-2);
  font-size: .875em;
  font-variant-ligatures: none;
}

.lexxy-content code:not([data-language]) {
  padding: .125em .375em;
  border-radius: 5px;
}

.lexxy-content :is(pre, code[data-language]) {
  padding: 1rem 1.125rem;
  border-radius: var(--radius);
  font-size: .8438rem;
  line-height: 1.7;
}

.lexxy-content pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

/* Images and attachments */

.lexxy-content figure {
  margin-block: 2rem;
}

.lexxy-content .attachment--preview img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.lexxy-content .attachment__caption {
  margin-top: .625rem;
  color: var(--muted);
  font-size: .8125rem;
  text-align: center;
}

/* Lexxy lays galleries out as inline figures (2 or 3 per row); only the spacing is ours. */
.lexxy-content .attachment-gallery {
  margin-block: 2rem;
}

.lexxy-content .attachment-gallery figure {
  margin-block: 0 .5rem;
}

/* Tables */

.lexxy-content table {
  font-size: .9375rem;
  line-height: 1.5;
}

.lexxy-content :is(th, td) {
  padding: .5rem .75rem;
}

.lexxy-content th {
  font-weight: 600;
}

@media (max-width: 40rem) {
  .lexxy-content,
  .prose {
    font-size: 1rem;
    line-height: 1.7;
  }

  /* Let code blocks and tables use the full screen width on phones. */
  .article .lexxy-content :is(pre, code[data-language]) {
    margin-inline: -1.25rem;
    border-inline: 0;
    border-radius: 0;
  }
}
