:where(.lexxy-content) {
  --lexxy-content-margin: 1.25rem;

  ul {
    list-style-position: outside;
    list-style-type: disc;
    padding-inline-start: 1.625em;
    margin-inline-start: 1.25em;

    ul {
      list-style-type: circle;

      ul {
        list-style-type: square;
      }
    }
  }

  ol {
    list-style-position: outside;
    list-style-type: decimal;
    padding-inline-start: 1.625em;
    margin-inline-start: 1.5em;

    ol {
      list-style-type: lower-alpha;

      ol {
        list-style-type: lower-roman;
      }
    }
  }

  li {
    padding-inline-start: 0.375em;
    margin-block: 0.5em;
  }

  a {
    text-decoration: underline;
    font-weight: 500;
  }

  strong, b {
    font-weight: 600;
  }

  h1, h2 {
    font-size: 1.5em;
    line-height: 1.5;
  }

  h3 {
    font-size: 1.25em;
    line-height: 1.5;
  }

  h4 {
    font-size: 1.125em;
    line-height: 1.5;
  }

  h1, h2, h3, h4, h5, h6 {
    text-wrap: wrap;
    hyphens: none;
    margin-block-end: calc(var(--lexxy-content-margin) * 0.75);
  }

  * + h1, * + h2 {
    margin-block-start: calc(var(--lexxy-content-margin) * 1.75);
  }

  * + h3 {
    margin-block-start: calc(var(--lexxy-content-margin) * 1.5);
  }

  * + h4, * + h5, * + h6 {
    margin-block-start: calc(var(--lexxy-content-margin) * 1.25);
  }

  :is(figure, action-text-attachment) + :is(h1, h2, h3, h4, h5, h6) {
    margin-block-start: 0;
  }

  blockquote {
    padding-block: 0.375em;
  }

  /* Legacy Trix content (pre-Lexxy posts use <div> instead of <p>) */
  div + blockquote,
  div + pre {
    margin: calc(var(--lexxy-content-margin) / 2) 0;
  }
  blockquote + pre {
    margin: 0;
  }
  div + :is(ul, ol) {
    margin-block: var(--lexxy-content-margin);
  }

  br + action-text-attachment {
    margin-top: 0;
  }

  action-text-attachment + br {
    display: none;
  }

  pre,
  code[data-language] {
    margin: calc(var(--lexxy-content-margin) * 1.5) 0;
    padding: 1.5ch;
    border-radius: 0.5em;
    font-weight: normal;
    overflow-wrap: break-word;
    overflow-x: auto;
    line-height: 1.5;

    ol, ul {
      padding: 0;
      margin: 0;
    }

    li {
      padding: 0;
      margin: 0;
    }
  }

  img {
    border-radius: 0.5em;
    margin-inline: auto;
    padding-block: 0.5em;
    max-width: 100%;
    display: block;
  }

  @media (max-width: 640px) {
    img {
      width: 100%;
      height: auto;
      max-block-size: none;
    }
  }

  .attachment-gallery {
    display: flex;
    gap: 0.5em;
    justify-content: center;
    align-items: flex-start;

    img {
      margin-block: 0;
      max-width: none;
      left: 0;
      transform: translateX(0);
      width: 100%;
      height: auto;
      object-fit: contain;
    }
  }

  .attachment-gallery--2 img,
  .attachment-gallery--3 img {
    width: 100%;
  }
}