/* MES ARCHITECTURE: SYSTEM CORE v2.7 (FIXED)
   Исправлены конфликты перекрытия мелких элементов и отображения в редакторе.
*/

:root {
    --c-bg: #0e0e0e;
    --c-text: #cfcfcf;
    --c-white: #ffffff;
    --c-black: #111111;
    --c-accent: #DAAD38;
    --c-mes-orange: #ff9d00;
    
    --ff-heading: "Manrope", Inter, system-ui, sans-serif;
    --ff-body-read: "Pangea", "Manrope", sans-serif;
    --ff-system: "Inter", system-ui, sans-serif;
    
    --grid-max-width: 1200px;
    --read-max-width: 700px;
}

/* 1. ГЛОБАЛЬНЫЕ СТИЛИ */
/* Убираем !important с body, чтобы не ломать интерфейс Tilda */
body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: var(--ff-body-read);
    -webkit-font-smoothing: antialiased;
}

/* 2. МОДУЛЬ: ПОТОКИ (EDITORIAL MODE) */

/* Карточки в списке (Главная) */
.t-feed .t-feed__post-title,
.t-feed .js-feed-post-title {
    color: var(--c-white) !important;
    font-family: var(--ff-heading) !important;
    font-weight: 700 !important;
    font-size: 20px !important;
    letter-spacing: -0.02em !important;
}

/* Внутренняя статья (Интерфейс чтения) */
.t-feed__post-popup__container,
.t-feed__post-popup__content,
.t-feed__post-popup__text-wrapper {
    background-color: var(--c-white) !important;
}

/* Главный заголовок статьи */
.t-feed__post-popup .t-feed__post-popup__title {
    color: var(--c-black) !important;
    font-family: var(--ff-heading) !important;
    font-size: 38px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    margin-bottom: 32px !important;
    letter-spacing: -0.03em !important;
}

/* Текст статьи (Pangea) */
/* Убрано прямое перекрытие p через !important, чтобы не гасить вложенные элементы */
.t-feed__post-popup .t-redactor__text,
.t-feed__post-popup .t-feed__post-popup__text-wrapper .t-text {
    color: var(--c-black) !important;
    font-family: var(--ff-body-read) !important;
    font-size: 17px !important;
    line-height: 1.55 !important;
    /* Ограничиваем ширину только для контейнера, а не для каждого параграфа, 
       чтобы не ломать плавающие элементы (кружочки) */
    max-width: var(--read-max-width);
    margin-left: auto;
    margin-right: auto;
}

.t-feed__post-popup .t-redactor__text p {
    margin-bottom: 26px !important;
}

/* ВНУТРЕННИЕ ЗАГОЛОВКИ */
.t-feed__post-popup__text-wrapper h1,
.t-feed__post-popup__text-wrapper h2,
.t-feed__post-popup__text-wrapper h3,
.t-feed__post-popup .t-redactor__h1, 
.t-feed__post-popup .t-redactor__h2,
[field="text"] h1, [field="text"] h2 {
    color: var(--c-black) !important;
    font-family: var(--ff-heading) !important;
    font-weight: 800 !important;
    font-size: 32px !important;
    line-height: 1.2 !important;
    margin-top: 64px !important;
    margin-bottom: 24px !important;
    display: block; /* Убрал !important, чтобы не конфликтовать с inline-иконками */
    letter-spacing: -0.02em !important;
}

/* 3. ФУТЕР И UI */
footer.footer, 
.f-col.brand .tag,
.t-feed__post-popup__category {
    font-family: var(--ff-system) !important;
    font-weight: 500;
    /* Сохраняем видимость категорий */
    display: inline-block !important; 
}

/* Исправление для "кружочков" (тегов/категорий) */
.t-feed__post-popup__category span {
    color: inherit; /* Чтобы не перекрывалось черным цветом из текста */
}

/* 4. МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 640px) {
    .t-feed__post-popup .t-feed__post-popup__title { 
        font-size: 22px !important; 
    }

    .t-feed__post-popup .t-feed__post-popup__text-wrapper .t-text,
    .t-feed__post-popup .t-redactor__text p { 
        font-size: 15px !important; 
    }
    
    .t-feed__post-popup .t-redactor__h1, 
    .t-feed__post-popup .t-redactor__h2 {
        font-size: 19px !important;
        margin-top: 36px !important;
    }
}

/* 5. ФИКС ДЛЯ РЕДАКТОРА (Скрываем стили фона в режиме правки) */
.t-tildalаbеl, .t-edit-mode-is-active {
    background-color: inherit !important;
}