/*
 * Область редактирования в админке = вид текста на сайте.
 *
 * Подключается глобально через config/adminlte.php (плагин MgEditor), рядом с admin-editor.js.
 *
 * Зачем: .note-editable наследовала шрифт и размеры заголовков от AdminLTE (Source Sans Pro
 * плюс бутстрапная типографика), а сайт свёрстан на Inter со своей. Поэтому в админке текст
 * выглядел одним образом, а после публикации другим, и редакторы форматировали тексты
 * в Word и Google Docs, а потом вставляли готовую разметку.
 *
 * Значения ниже — тот же набор, который получает класс .rich-text на фронте
 * (mg-front/app/assets/css/rich-text.scss). Менять их нужно в двух местах сразу,
 * иначе предпросмотр снова начнёт врать. Размеры заголовков заданы в em, чтобы на сайте
 * они считались от размера того блока, в который вставлен текст.
 *
 * Прокрутка широких таблиц (display: block + width: max-content) здесь сознательно
 * не повторяется: в редакторе таблица должна оставаться таблицей, её колонки тянут мышкой.
 */
@import url("https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100..900;1,100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");

.note-editable {
    padding: 16px 18px;
    background: #fbfaf8;
    color: #28001e;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

.note-editable p {
    margin: 0 0 0.9em;
}

.note-editable h1,
.note-editable h2,
.note-editable h3,
.note-editable h4,
.note-editable h5,
.note-editable h6 {
    margin: 1.5em 0 0.5em;
    color: #28001e;
    font-weight: 600;
    line-height: 1.25;
}

/* Первый элемент текста не отодвигается от верхнего края, последний — от нижнего */
.note-editable > :first-child {
    margin-top: 0;
}

.note-editable > :last-child {
    margin-bottom: 0;
}

.note-editable h1 {
    font-size: 2em;
}

.note-editable h2 {
    font-size: 1.5em;
}

.note-editable h3 {
    font-size: 1.25em;
}

.note-editable h4 {
    font-size: 1.125em;
}

.note-editable h5,
.note-editable h6 {
    font-size: 1em;
}

.note-editable ul,
.note-editable ol {
    margin: 0 0 0.9em;
    padding-left: 1.5em;
}

.note-editable ul {
    list-style: disc;
}

.note-editable ol {
    list-style: decimal;
}

.note-editable li {
    margin-bottom: 0.35em;
}

.note-editable li > ul,
.note-editable li > ol {
    margin: 0.35em 0 0;
}

.note-editable a {
    color: #a00022;
    text-decoration: underline;
}

.note-editable strong,
.note-editable b {
    font-weight: 600;
}

.note-editable blockquote {
    margin: 1.25em 0;
    padding: 0 0 0 1rem;
    border-left: 3px solid #a00022;
    color: #8c8c8c;
}

.note-editable hr {
    margin: 1.5em 0;
    border: 0;
    border-top: 1px solid #e1e0e0;
}

.note-editable img {
    max-width: 100%;
    height: auto;
}

/* Таблицы — те же рамки и заливки, что у .rich-text на сайте */
.note-editable table {
    width: 100%;
    margin: 1.25em 0;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.9375em;
    line-height: 1.45;
}

.note-editable th,
.note-editable td {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e1e0e0;
    text-align: left;
    vertical-align: top;
}

.note-editable th {
    background: #f1efed;
    color: #28001e;
    font-weight: 600;
}

.note-editable tbody tr:nth-child(even) td {
    background: #fbfaf8;
}

.note-editable caption {
    margin-bottom: 0.5rem;
    color: #8c8c8c;
    font-size: 0.875em;
    text-align: left;
}

/* Выпадающие списки «Шрифт» и «Размер»: без ограничения по высоте список уезжает за экран */
.note-editor .note-dropdown-menu.dropdown-fontname,
.note-editor .note-dropdown-menu.dropdown-fontsize {
    max-height: 320px;
    overflow-y: auto;
}
