/* Keep Wiki's native typography and layout; give procedures and screenshots room. */
.wiki-content img.screenshot {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2em 0 !important;
}

.wiki-content :is(h2, h3, h4) + p > img.screenshot:first-child {
    margin-top: 0 !important;
}

.wiki-content img.screenshot:has(+ em) {
    margin-bottom: 0 !important;
}

.wiki-content img.screenshot + em,
.wiki-content p:has(> img.screenshot) + p > em:only-child {
    display: block;
    margin: 0.5rem 0 2em !important;
    font-size: 13px;
    line-height: 1.4;
}

.wiki-content table {
    margin: 1.5rem 0 !important;
}

/* Desk preview uses native Wiki article rhythm inside a native Frappe Dialog.
   Scope these rules to this dialog; do not load Wiki's global website bundle. */
.nova-wiki-draft-preview .modal-body {
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    padding: var(--padding-lg);
}

.nova-wiki-draft-preview .nova-wiki-preview-notice {
    margin-bottom: 1.5rem;
}

.nova-wiki-draft-preview .wiki-content {
    max-width: 650px;
    margin-inline: auto;
    color: var(--text-color);
    font-family: inherit;
    font-size: var(--text-base);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.nova-wiki-draft-preview .wiki-content h1 {
    margin: 0 0 1rem;
    font-size: var(--text-3xl);
    line-height: 1.5;
    font-weight: 600;
}

.nova-wiki-draft-preview .wiki-content h2 {
    margin: 3rem 0 1rem;
    font-size: var(--text-2xl);
    line-height: 1.56;
    font-weight: 600;
}

.nova-wiki-draft-preview .wiki-content :is(h3, h4, h5, h6) {
    margin: 2rem 0 1rem;
    font-size: var(--text-xl);
    line-height: 1.56;
    font-weight: 600;
}

.nova-wiki-draft-preview .wiki-content :is(ol, ul) {
    padding-inline-start: 2rem;
}

.nova-wiki-draft-preview .wiki-content blockquote {
    padding: 0.75rem 1rem;
    border-inline-start: 3px solid var(--border-color);
    background: var(--bg-color);
}

.nova-wiki-draft-preview .wiki-content img.screenshot {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.nova-wiki-draft-preview .wiki-content :is(h2, h3, h4) + p > a:first-child > img.screenshot {
    margin-top: 0 !important;
}

.nova-wiki-draft-preview .wiki-content a:has(> img.screenshot):has(+ em) > img.screenshot {
    margin-bottom: 0 !important;
}

.nova-wiki-draft-preview .wiki-content a:has(> img.screenshot) + em,
.nova-wiki-draft-preview .wiki-content p:has(> a > img.screenshot) + p > em:only-child {
    display: block;
    margin: 0.5rem 0 2em;
    font-size: 13px;
    line-height: 1.4;
}

.nova-wiki-draft-preview .wiki-content a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nova-wiki-draft-preview .wiki-content pre {
    overflow-x: auto;
}

@media (max-width: 575.98px) {
    .nova-wiki-draft-preview .modal-body {
        padding: var(--padding-md);
    }
}
