/*
 * Типографские стили для wiki-контента.
 * Применяется к .ck-content (просмотр) и .ck-editor__editable (редактор).
 * Восстанавливает отступы/стили после глобального CSS-ресета (* { margin:0; padding:0 }).
 */

.ck-content,
.ck-editor__editable {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--color-text);
}

/* Заголовки */
.ck-content h1,
.ck-editor__editable h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-heading);
    line-height: 1.3;
}

.ck-content h2,
.ck-editor__editable h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
    color: var(--color-text-heading);
    line-height: 1.35;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--color-border);
}

.ck-content h3,
.ck-editor__editable h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-heading);
    line-height: 1.4;
}

.ck-content h4,
.ck-editor__editable h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
    color: var(--color-text-heading);
}

/* Первый элемент — без верхнего отступа */
.ck-content > :first-child,
.ck-editor__editable > :first-child {
    margin-top: 0;
}

/* Параграфы */
.ck-content p,
.ck-editor__editable p {
    margin-bottom: 0.75rem;
}

.ck-content p:last-child,
.ck-editor__editable p:last-child {
    margin-bottom: 0;
}

/* Списки */
.ck-content ul,
.ck-editor__editable ul {
    list-style: disc;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
}

.ck-content ol,
.ck-editor__editable ol {
    list-style: decimal;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
}

.ck-content li,
.ck-editor__editable li {
    display: list-item;
    margin-bottom: 0.25rem;
}

.ck-content ul ul,
.ck-editor__editable ul ul {
    list-style: circle;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.ck-content ul ul ul,
.ck-editor__editable ul ul ul {
    list-style: square;
}

/* Blockquote */
.ck-content blockquote,
.ck-editor__editable blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 0.75rem 1.25rem;
    margin: 1rem 0;
    background: var(--color-bg-elevated);
    border-radius: 0 6px 6px 0;
    color: var(--color-text);
    font-style: italic;
}

.ck-content blockquote p:last-child,
.ck-editor__editable blockquote p:last-child {
    margin-bottom: 0;
}

/* Код (инлайн) */
.ck-content code,
.ck-editor__editable code {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Код (блок) */
.ck-content pre,
.ck-editor__editable pre {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.ck-content pre code,
.ck-editor__editable pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* Таблицы */
.ck-content table,
.ck-editor__editable table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.ck-content th,
.ck-editor__editable th {
    background: var(--color-bg-elevated);
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    color: var(--color-text-heading);
}

.ck-content td,
.ck-editor__editable td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    vertical-align: top;
}

/* HR */
.ck-content hr,
.ck-editor__editable hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5rem 0;
}

/* Ссылки */
.ck-content a,
.ck-editor__editable a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.4);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s;
}

.ck-content a:hover,
.ck-editor__editable a:hover {
    text-decoration-color: var(--color-primary);
}

/* Изображения */
.ck-content img,
.ck-editor__editable img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.ck-content figure,
.ck-editor__editable figure {
    margin: 1rem 0;
}

.ck-content figcaption,
.ck-editor__editable figcaption {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.4rem;
}

/* Strong / Bold */
.ck-content strong,
.ck-content b,
.ck-editor__editable strong,
.ck-editor__editable b {
    font-weight: 600;
    color: var(--color-text-heading);
}

/* Italic */
.ck-content em,
.ck-content i,
.ck-editor__editable em,
.ck-editor__editable i {
    font-style: italic;
}

/* Mark (highlight) */
.ck-content mark,
.ck-editor__editable mark {
    background: rgba(234, 179, 8, 0.25);
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}
