/* Generated documents (Folio 1.1, 1.2, 1.3, PCM minutes, Power Flow output). Global rather than scoped, because the
   same rules style the Markdig view and the editor, whose DOM is created by the editor bundle outside Blazor. */
.markdown-document {
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.markdown-document h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.markdown-document h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

.markdown-document h3,
.markdown-document h4,
.markdown-document h5,
.markdown-document h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.markdown-document p {
    margin: 0 0 0.75rem;
}

.markdown-document ul,
.markdown-document ol {
    margin: 0 0 0.75rem;
    padding-left: 1.5rem;
}

.markdown-document ul {
    list-style: disc;
}

.markdown-document ol {
    list-style: decimal;
}

.markdown-document li {
    margin-bottom: 0.25rem;
}

/* Wide tables wrap their cells instead of scrolling sideways. */
.markdown-document table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1rem;
}

.markdown-document th,
.markdown-document td {
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 0.4rem 0.6rem;
    text-align: left;
    vertical-align: top;
    /* "anywhere" (inherited) shrinks every column's minimum width to one character, which we do not want here */
    overflow-wrap: break-word;
}

.markdown-document th {
    font-weight: 600;
    background-color: rgba(0, 0, 0, 0.04);
}

.markdown-document blockquote {
    border-left: 3px solid rgba(0, 0, 0, 0.2);
    margin: 0 0 0.75rem;
    padding-left: 1rem;
}

.markdown-document code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85em;
}

.markdown-document pre {
    white-space: pre-wrap;
    margin: 0 0 0.75rem;
}

.markdown-document a {
    text-decoration: underline;
}

/* The editor wraps list items and table cells in paragraphs; without this they would gain extra space. */
.markdown-document li > p,
.markdown-document th > p,
.markdown-document td > p {
    margin: 0;
}

.markdown-editor__surface {
    outline: none;
    min-height: 3rem;
}

.markdown-editor__surface[contenteditable="true"] {
    border-radius: 0.5rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0.75rem;
}

.markdown-editor__surface[contenteditable="true"]:focus-visible,
.markdown-editor__surface[contenteditable="true"]:focus {
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.5);
}

.markdown-document .selectedCell {
    background-color: rgba(var(--color-primary-rgb), 0.12);
}

/* Shown, not clickable: a link the AI output pointed at a disallowed address, or an image's alt text. */
.markdown-document .markdown-link--disallowed {
    text-decoration: underline dotted;
}

.markdown-document .markdown-image-alt {
    font-style: italic;
}

/* Change highlighting against the original source. Never colour alone: added text is also underlined and
   removed text struck through, and <ins>/<del> carry the meaning for screen readers. */
.markdown-document .markdown-change--added,
.markdown-document .markdown-change--formatted {
    background-color: rgba(46, 125, 50, 0.14);
    text-decoration: underline;
    text-decoration-color: rgba(46, 125, 50, 0.8);
    text-underline-offset: 0.15em;
}

.markdown-document .markdown-change--formatted {
    text-decoration-style: dashed;
}

.markdown-document .markdown-change--removed {
    background-color: rgba(198, 40, 40, 0.08);
    color: rgba(198, 40, 40, 0.9);
    text-decoration: line-through;
    user-select: none;
}

.markdown-document .markdown-change--block {
    white-space: pre-line;
    display: block;
    margin: 0 0 0.75rem;
    padding: 0.25rem 0.5rem;
    border-left: 3px solid rgba(198, 40, 40, 0.6);
}

/* A bordered frame that sets a generated document apart from the card around it, as Folio's document does. The header
   is optional (run details, the Show changes toggle). */
.markdown-document-box {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.75rem;
}

.markdown-document-box__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem 0.75rem 0 0;
    background-color: rgba(0, 0, 0, 0.02);
}

.markdown-document-box__body {
    padding: 1.25rem 2rem;
}

/* The frame's padding already spaces the first line from the border. */
.markdown-document-box__body .markdown-document > :first-child {
    margin-top: 0;
}

@media (max-width: 600px) {
    .markdown-document-box__body {
        padding: 1rem;
    }
}

/* Explains the change highlighting next to a document that shows it. */
.markdown-document-legend {
    color: var(--color-text-secondary, rgba(0, 0, 0, 0.6));
}
