.theme-noxen {
    --noxen-code-comment: #a9b8b0;
    --noxen-code-keyword: #91caff;
    --noxen-code-string: #b0dfa2;
    --noxen-code-number: #ebc782;
    --noxen-code-function: #dbb9fb;
    --noxen-code-tag: #f4a8c4;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) :not(pre) > code {
    display: inline;
    padding: 0.12em 0.35em;
    border-radius: 0.35rem;
    white-space: break-spaces;
    overflow-wrap: anywhere;
}

/* Style rendered code blocks without touching CodeMirror's editable line elements. */
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) pre {
    max-width: 100%;
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid var(--noxen-border);
    border-radius: var(--noxen-radius-sm);
    background: var(--noxen-panel-strong);
    color: var(--noxen-text);
    overflow: auto;
    tab-size: 4;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) pre > code {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-family: var(--noxen-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) pre:focus-visible {
    outline: 2px solid var(--noxen-accent);
    outline-offset: 2px;
}

.theme-noxen .EasyMDEContainer :is(.CodeMirror, .editor-preview, .editor-preview-side, .editor-toolbar) {
    border-color: var(--noxen-border-strong);
    background: var(--noxen-panel);
    color: var(--noxen-text);
}

.theme-noxen .EasyMDEContainer .CodeMirror-cursor {
    border-left-color: var(--noxen-text);
}

.theme-noxen .EasyMDEContainer .CodeMirror {
    font-family: var(--noxen-mono);
}

.theme-noxen .EasyMDEContainer .CodeMirror-fullscreen {
    z-index: 1040;
}

.theme-noxen .EasyMDEContainer :is(.editor-toolbar.fullscreen, .editor-preview-side) {
    z-index: 1041;
}

.theme-noxen .EasyMDEContainer .CodeMirror-selected {
    background: color-mix(in srgb, var(--noxen-accent) 28%, transparent);
}

.theme-noxen .EasyMDEContainer .editor-toolbar button {
    color: var(--noxen-text);
}

.theme-noxen .EasyMDEContainer .editor-toolbar button:is(:hover, :focus-visible, .active) {
    border-color: var(--noxen-border-strong);
    background: var(--noxen-panel-strong);
    color: var(--noxen-text);
}

.theme-noxen .EasyMDEContainer .editor-toolbar i.separator {
    border-color: var(--noxen-border-strong);
}

.theme-noxen pre code .token:is(.comment, .prolog, .doctype, .cdata),
.theme-noxen .EasyMDEContainer .cm-comment {
    color: var(--noxen-code-comment);
}

.theme-noxen pre code .token:is(.keyword, .atrule, .attr-name, .builtin),
.theme-noxen .EasyMDEContainer :is(.cm-keyword, .cm-atom, .cm-link, .cm-url) {
    color: var(--noxen-code-keyword);
}

.theme-noxen pre code .token:is(.string, .char, .attr-value, .inserted),
.theme-noxen .EasyMDEContainer :is(.cm-string, .cm-string-2) {
    color: var(--noxen-code-string);
}

.theme-noxen pre code .token:is(.number, .boolean, .constant),
.theme-noxen .EasyMDEContainer .cm-number {
    color: var(--noxen-code-number);
}

.theme-noxen pre code .token:is(.function, .class-name),
.theme-noxen .EasyMDEContainer :is(.cm-def, .cm-variable-2, .cm-variable-3) {
    color: var(--noxen-code-function);
}

.theme-noxen pre code .token:is(.tag, .property, .selector, .deleted, .regex),
.theme-noxen .EasyMDEContainer :is(.cm-tag, .cm-attribute, .cm-error) {
    color: var(--noxen-code-tag);
}

.theme-noxen pre code .token:is(.operator, .punctuation) {
    color: var(--noxen-text);
}

/* Rendered Markdown tables have no .table class; give them borders, padding and local scrolling. */
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0 0 1rem;
    overflow-x: auto;
    border: 1px solid var(--noxen-border);
    border-radius: var(--noxen-radius-sm, 10px);
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    -webkit-overflow-scrolling: touch;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td) {
    padding: 0.5rem 0.75rem;
    border: 0;
    border-right: 1px solid var(--noxen-border);
    border-bottom: 1px solid var(--noxen-border);
    background: transparent;
    color: var(--noxen-text);
    text-align: left;
    vertical-align: top;
    min-width: 8rem;
    overflow-wrap: anywhere;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table td {
    max-width: 28rem;
}

@media (max-width: 575.98px) {
    .theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td) {
        min-width: 6rem;
    }
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td):last-child {
    border-right: 0;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table tr:last-child > td {
    border-bottom: 0;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table th {
    background: rgba(255, 255, 255, 0.055);
    font-weight: 700;
    white-space: nowrap;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table tbody tr:nth-child(even) > td {
    background: rgba(255, 255, 255, 0.02);
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td)[align="center"],
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td)[style*="center"] {
    text-align: center;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td)[align="right"],
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table :is(th, td)[style*="right"] {
    text-align: right;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) table:focus-visible {
    outline: 2px solid var(--noxen-accent, #2fb072);
    outline-offset: 2px;
}

/* Headings: keep in-post headings below the discussion title (clamp(1.5rem, 3vw, 2rem)) and space them from preceding content. */
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) :is(h1, h2, h3, h4, h5, h6) {
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) :is(h1, h2, h3, h4, h5, h6):first-child {
    margin-top: 0;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) h1 { font-size: clamp(1.375rem, 1.15rem + 1vw, 1.75rem); }
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) h2 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem); }
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) h3 { font-size: 1.125rem; }
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) h4 { font-size: 1rem; }
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) h5 { font-size: 0.9375rem; }
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) h6 { font-size: 0.875rem; color: var(--noxen-muted); }

/* Blockquotes (Markdown and BBCode) had no border, background or padding. */
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) blockquote {
    margin: 0 0 1rem;
    padding: 0.625rem 1rem;
    border-left: 3px solid color-mix(in srgb, var(--noxen-accent) 60%, var(--noxen-border));
    border-radius: 0 var(--noxen-radius-sm) var(--noxen-radius-sm) 0;
    background: color-mix(in srgb, var(--noxen-text) 4%, transparent);
    color: color-mix(in srgb, var(--noxen-text) 85%, var(--noxen-muted));
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) blockquote blockquote {
    border-left-color: var(--noxen-border-strong);
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) :is(blockquote, li) > :last-child,
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) > :last-child {
    margin-bottom: 0;
}

/* GFM task lists: drop the bullet next to the checkbox and theme the checkbox. */
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) li:has(> input[type="checkbox"]:first-child) {
    list-style: none;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) :is(ul, ol):has(> li > input[type="checkbox"]:first-child) {
    padding-left: 1.5rem;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) li > input[type="checkbox"]:first-child {
    width: 1em;
    height: 1em;
    margin: 0 0.25rem 0 -1.5rem;
    vertical-align: -0.15em;
}

/* Links in prose were distinguished by colour only (1.95:1 against body text). */
.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 0.18em;
}

.theme-noxen :is(.markdown-body, .editor-preview, .editor-preview-side) a:hover {
    text-decoration-color: currentColor;
}
