/* =========================================
   WIKI (SKYLAND STYLE v2)
   ========================================= */

.wiki-section {
    padding-top: 120px;
    /* Отступ от хедера, чтобы текст не залезал под него */
    padding-bottom: 50px;
    background-color: transparent;
    min-height: 100vh;
}

.wiki-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 260px 1fr 240px;
    gap: 60px;
    /* Больше воздуха между колонками */
}

/* =========================================
   ЛЕВАЯ КОЛОНКА (САЙДБАР)
   ========================================= */
.wiki-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 20px;
    /* Убрал бордер справа, чтобы было чисто как на скрине */
}

/* Лого "WIKI" удалено, так как на референсе его нет */
.wiki-logo {
    display: none;
}

/* Навигация */
.wiki-group {
    margin-bottom: 30px;
}

.wiki-group-title {
    font-size: 0.8rem;
    font-weight: 800;
    /* Жирнее */
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.wiki-group-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wiki-group-list li {
    margin-bottom: 2px;
}

.wiki-link {
    display: block;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-decoration: none;
    padding: 8px 0 8px 12px;
    /* Отступ слева под линию */
    border-radius: 0;
    /* Убираем скругления */
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    /* Тонкая линия слева */
    font-weight: 500;
}

.wiki-link:hover {
    color: var(--text-main);
}

.wiki-link.active {
    color: #3b82f6;
    /* Только синий текст */
    background: transparent;
    border-left-color: transparent;
    /* Убираем полоску */
    font-weight: 700;
    /* Делаем жирнее */
}


/* =========================================
   ЦЕНТРАЛЬНАЯ КОЛОНКА (КОНТЕНТ)
   ========================================= */
.wiki-main {
    min-width: 0;
}

.wiki-header {
    margin-bottom: 0px;
    /* Убираем отступ снизу */
}

.wiki-title {
    font-size: 3rem;
    /* Очень крупный заголовок */
    font-weight: 800;
    margin: 0 0 15px 0;
    color: var(--text-main);
    line-height: 1.1;
}

.wiki-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Стиль Markdown контента */
.skyland-wiki-content {
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* Убираем отступ сверху у первого элемента контента */
.skyland-wiki-content>*:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.skyland-wiki-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 50px;
    margin-bottom: 20px;
    color: var(--text-main);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}


.skyland-wiki-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 35px;
    margin-bottom: 15px;
    color: var(--text-main);
}

.skyland-wiki-content p {
    margin-bottom: 24px;
    color: var(--text-muted);
}

.skyland-wiki-content ul {
    list-style: disc inside;
    padding-left: 10px;
    margin-bottom: 24px;
    color: var(--text-muted);
}

.skyland-wiki-content li {
    margin-bottom: 10px;
}

/* Ссылки в тексте */
.skyland-wiki-content a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    /* Скрыто по умолчанию */
    transition: 0.2s;
}

.skyland-wiki-content a:hover {
    border-bottom-color: #3b82f6;
    /* Подчеркивание при наведении */
}

/* Футер статьи удален */

/* =========================================
   ПРАВАЯ КОЛОНКА (ОГЛАВЛЕНИЕ)
   ========================================= */
.wiki-toc {
    display: block;
}

.wiki-toc-sticky {
    position: sticky;
    top: 100px;
    /* Убрал border-left для чистоты */
}

.toc-header-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    border-left: 2px solid var(--border-color);
    /* Линия слева от заголовка TOC */
    padding-left: 15px;
}

.toc-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-main);
    letter-spacing: 0.5px;
    margin: 0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-left: 17px;
    /* Выровнять под заголовок */
}

.toc-item {
    margin-bottom: 12px;
}

.toc-link {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    line-height: 1.4;
    transition: 0.2s;
}

.toc-link:hover {
    color: var(--text-main);
}

.toc-item.active .toc-link {
    color: var(--text-main);
    font-weight: 600;
}

.wiki-toc-footer {
    margin-top: 40px;
    padding-left: 17px;
}

.wiki-toc-footer p {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 5px;
}

.toc-help-link {
    font-size: 0.9rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.toc-help-link:hover {
    text-decoration: underline;
}

/* =========================================
   АДАПТАЦИЯ ВИКИ
   ========================================= */
@media (max-width: 1200px) {
    .wiki-container {
        grid-template-columns: 240px 1fr;
        gap: 40px;
    }

    .wiki-toc {
        display: none;
    }
}

/* =========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (PLASMO STYLE)
   ========================================= */

/* По умолчанию скрываем мобильные элементы */
.wiki-mobile-controls,
.wiki-mobile-overlay {
    display: none;
}

@media (max-width: 850px) {
    .wiki-container {
        grid-template-columns: 1fr;
        padding: 0 20px;
        gap: 30px;
    }

    /* Скрываем обычный сайдбар на мобильных */
    .wiki-sidebar.desktop-only {
        display: none;
    }

    /* Показываем кнопку открытия */
    .wiki-mobile-controls {
        display: block;
        margin-bottom: 25px;
    }

    /* Синяя кнопка "Содержимое Вики" */
    .btn-wiki-content-toggle {
        width: 100%;
        background: #3b82f6;
        color: white;
        border: none;
        padding: 14px;
        border-radius: 12px;
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
        transition: 0.2s;
        box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    }

    .btn-wiki-content-toggle:hover {
        background: #2563eb;
        transform: translateY(-2px);
    }

    /* --- OVERLAY МЕНЮ (Выезжает справа или на весь экран) --- */
    .wiki-mobile-overlay {
        display: block;
        /* Но скрыто через transform/visibility */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #09090b;
        /* Темный фон как на скрине */
        z-index: 9999;
        overflow-y: auto;
        padding: 20px;
        box-sizing: border-box;

        /* Анимация появления */
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%);
        /* Уехало вправо */
        transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .wiki-mobile-overlay.active {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    /* Шапка оверлея */
    .wiki-mobile-header {
        margin-bottom: 30px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 15px;
    }

    .btn-close-wiki {
        background: transparent;
        border: none;
        color: white;
        font-size: 1.2rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 15px;
        cursor: pointer;
        padding: 0;
    }

    /* Список ссылок в мобильном меню */
    .wiki-link-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 10px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-weight: 500;
    }

    .wiki-link-mobile:active {
        background: rgba(255, 255, 255, 0.05);
    }

    .wiki-link-mobile.active {
        color: #3b82f6;
        font-weight: 700;
    }

    .wiki-link-mobile .arrow-right {
        opacity: 0.3;
    }

    .wiki-link-mobile.active .arrow-right {
        opacity: 1;
        color: #3b82f6;
    }
}