/*
 * TechPortal article content
 *
 * Общие стили:
 *   - опубликованная статья
 *   - Preview
 *   - WYSIWYG
 */

/* ---------------------------------------------------------
   Blockquote
   --------------------------------------------------------- */

.article-content blockquote {
    margin: 1.25rem 0;
    padding: .85rem 1.1rem;

    border-left: 4px solid var(--bs-secondary);
    border-radius: 0 .375rem .375rem 0;

    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.article-content blockquote p {
    margin-top: 0;
    margin-bottom: 0;
}

.article-content blockquote p + p {
    margin-top: .75rem;
}


/* ---------------------------------------------------------
   Code
   --------------------------------------------------------- */

.article-content code {
    font-size: .9em;
}

.article-content pre {
    margin: 1rem 0;
    padding: 1rem;

    overflow-x: auto;

    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;

    background: var(--bs-tertiary-bg);
}

.article-content pre code {
    padding: 0;
    border: 0;
    background: transparent;
}


/* ---------------------------------------------------------
   Images
   --------------------------------------------------------- */

.article-content img {
    max-width: 100%;
    height: auto;
}


/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */

.article-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.article-content th,
.article-content td {
    padding: .5rem .75rem;
    border: 1px solid var(--bs-border-color);
}

.article-content th {
    background: var(--bs-tertiary-bg);
}


/* ---------------------------------------------------------
   Headings
   --------------------------------------------------------- */

.article-content h2 {
    margin-top: 2rem;
}

.article-content h3 {
    margin-top: 1.6rem;
}

.article-content h4,
.article-content h5,
.article-content h6 {
    margin-top: 1.3rem;
}


/* =========================================================
   TechPortal tables — v0.4.2
   ========================================================= */

.article-content table {
    width: 100%;
    margin: 1.25rem 0;
    border-collapse: collapse;
}

.article-content th,
.article-content td {
    min-width: 4rem;
    padding: .55rem .75rem;
    vertical-align: top;
    border: 1px solid var(--bs-border-color);
}

.article-content th {
    font-weight: 600;
    background: var(--bs-tertiary-bg);
}

.article-content tr:nth-child(even) td {
    background: rgba(var(--bs-secondary-bg-rgb), .35);
}

/* Tiptap selection */

.techportal-tiptap .selectedCell {
    position: relative;
}

.techportal-tiptap .selectedCell::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    content: "";
    background: rgba(var(--bs-primary-rgb), .12);
}

/* Не позволяем широкой таблице ломать редактор */

#visualEditor,
#preview,
.article-content {
    overflow-x: auto;
}

.article-content table p {
    margin-bottom: 0;
}


/* =========================================================
   TechPortal images — v0.4.3
   ========================================================= */

.article-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
}

.techportal-tiptap img.ProseMirror-selectednode {
    outline: 3px solid rgba(var(--bs-primary-rgb), .35);
    outline-offset: 2px;
}
