/* Markdown bodies in article comments, guestbook messages and moderation. */
.comment-markdown {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.comment-markdown p,
.comment-markdown ul,
.comment-markdown ol,
.comment-markdown blockquote,
.comment-markdown pre,
.comment-markdown .markdown-table-wrapper {
    margin: 0 0 12px;
}

.comment-markdown > :first-child { margin-top: 0; }
.comment-markdown > :last-child { margin-bottom: 0; }

.comment-markdown :is(h1, h2, h3, h4, h5, h6) {
    margin: 16px 0 8px;
    font-size: 1.1em;
    line-height: 1.5;
    color: var(--text-color);
}

.comment-markdown :is(h1, h2) { font-size: 1.25em; }
.comment-markdown :is(ul, ol) { padding-left: 1.5em; }
.comment-markdown li + li { margin-top: 4px; }

.comment-markdown blockquote {
    padding: 8px 12px;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--bg-subtle);
    color: var(--text-light);
}

.comment-markdown blockquote > :last-child { margin-bottom: 0; }

.comment-markdown code {
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--bg-subtle);
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.comment-markdown pre {
    max-width: 100%;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--code-bg, var(--bg-subtle));
    color: var(--code-color, var(--text-color));
    overflow-x: auto;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
}

.comment-markdown pre code {
    padding: 0;
    background: none;
    color: inherit;
    white-space: inherit;
}

.comment-markdown a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.comment-markdown img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: var(--radius-sm);
}

.comment-markdown hr {
    margin: 16px 0;
    border: 0;
    border-top: 1px solid var(--border-subtle);
}

.comment-markdown .markdown-table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.comment-markdown table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.9em;
}

.comment-markdown :is(th, td) {
    min-width: 7rem;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    vertical-align: top;
}

.comment-markdown th { background: var(--bg-subtle); }
.comment-markdown tr:last-child td { border-bottom: 0; }

/* Keep long comments and images bounded inside the moderation table. */
.comment-markdown-preview {
    max-height: 10rem;
    overflow: auto;
}
