/* =================================================================
   BLOG LAYOUT
   ================================================================= */

/* Основной лейаут блога */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* Хлебные крошки */
.blog-breadcrumbs {
    padding: 1rem 0;
}

.blog-breadcrumbs nav {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.blog-breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.blog-breadcrumbs a:hover {
    color: var(--text-primary);
}

/* =================================================================
   SIDEBAR
   ================================================================= */

.blog-sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-section {
    margin-bottom: 2rem;
}

/* Форма поиска в сайдбаре */
.sidebar-search-form .form-group {
    margin-bottom: 1rem;
}

/* Список категорий в сайдбаре */
.sidebar-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-categories li {
    margin-bottom: 0.5rem;
}

.sidebar-categories a {
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-colors);
}

.sidebar-categories a:hover {
    color: var(--text-primary);
}

/* Популярные статьи в сайдбаре */
.sidebar-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-post {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-post:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-post h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.sidebar-post a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-colors);
}

.sidebar-post a:hover {
    color: var(--primary-light);
}

.sidebar-post-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* =================================================================
   BLOG CONTENT
   ================================================================= */

/* Контент статьи */
.page-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.page-content blockquote {
    border-left: 4px solid var(--primary-light);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-secondary);
}

.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

/* Изображения статей в карточках */
.post-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.post-image--large {
    height: 200px;
}

.post-image--featured {
    max-width: 800px;
    margin: 0 auto;
    display: block;
    box-shadow: var(--shadow);
}

/* Метаинформация статьи */
.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.post-meta-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.post-meta-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-meta-centered {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-meta-centered span {
    display: flex;
    align-items: center;
}

/* Категория статьи */
.post-category {
    margin-bottom: 0.5rem;
}

.post-category a {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-colors);
}

.post-category a:hover {
    color: var(--primary);
}

/* Теги */
.post-tags {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.post-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.post-tag--link {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition-transform);
    display: inline-block;
}

.post-tag--link:hover {
    transform: translateY(-2px);
}

.post-tag--active {
    background: var(--primary-light);
    color: white;
}

/* Заголовок статьи */
.post-header {
    max-width: 800px;
    margin: 0 auto;
}

.post-content-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* =================================================================
   TABLE OF CONTENTS (TOC)
   ================================================================= */

/* Список оглавления */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 0.5rem;
}

/* Уровни вложенности */
.toc-level-2 {
    padding-left: 0;
}

.toc-level-3 {
    padding-left: 1.25rem;
    font-size: 0.9rem;
}

.toc-level-4 {
    padding-left: 2.5rem;
    font-size: 0.85rem;
}

/* Ссылки в оглавлении */
.toc-link {
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    position: relative;
}

.toc-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Активная ссылка */
.toc-link.active {
    color: var(--primary-light);
    font-weight: 500;
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary-light);
    padding-left: calc(0.5rem - 3px);
}

/* Sticky контейнер */
.toc-container {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Скроллбар для TOC */
.toc-container::-webkit-scrollbar {
    width: 4px;
}

.toc-container::-webkit-scrollbar-track {
    background: transparent;
}

.toc-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.toc-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Плавная прокрутка к якорям */
html {
    scroll-behavior: smooth;
}

section[id], h2[id], h3[id] {
 scroll-margin-top: 80px; /* высота вашего header */
}

/* Мобильное оглавление */
.toc-mobile {
    display: none;
}

.toc-mobile .info-card {
    margin-bottom: 0;
}

.toc-mobile h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* =================================================================
   MOBILE ADAPTATION
   ================================================================= */

@media (max-width: 768px) {
    /* Лейаут блога становится одноколоночным */
    .blog-layout {
        grid-template-columns: 1fr;
    }

    /* Сайдбар перемещается наверх */
    .blog-sidebar {
        position: static;
        order: -1;
    }

    /* Хлебные крошки на мобильных */
    .blog-breadcrumbs nav {
        font-size: 0.8rem;
    }

    /* Метаинформация на мобильных */
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .post-meta-centered {
        gap: 1rem;
        font-size: 0.85rem;
    }

    /* Контент статьи на мобильных */
    .page-content {
        font-size: 1rem;
        line-height: 1.7;
    }

    /* Изображения на мобильных */
    .post-image {
        height: 200px;
    }

    .post-image--large {
        height: 220px;
    }

    /* TOC на мобильных */
    .toc-sidebar {
        display: none;
    }

    .toc-mobile {
        display: block;
    }

    /* Упрощенное оглавление на мобильных */
    .toc-mobile .toc-level-3 {
        padding-left: 0.75rem;
        font-size: 0.85rem;
    }

    .toc-mobile .toc-link {
        padding: 0.35rem 0.5rem;
        font-size: 0.9rem;
    }

}

/* =================================================================
   TABLES IN CONTENT
   ================================================================= */

/* Базовые стили таблицы */
.page-content table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 2rem 0;
}

/* Заголовки таблицы */
.page-content table thead {
    background-color: var(--bg-tertiary);
}

.page-content table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

/* Ячейки таблицы */
.page-content table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Убираем border у последней строки */
.page-content table tbody tr:last-child td {
    border-bottom: none;
}

/* Чередующиеся строки для лучшей читаемости */
.page-content table tbody tr:nth-child(even) {
    background-color: var(--bg-tertiary);
}



/* Адаптация для мобильных - вертикальная трансформация */
@media (max-width: 768px) {
    .page-content figure.table {
        margin: 1.5rem 0;
    }

    .page-content table {
        margin: 0;
        background-color: transparent;
        border-radius: 0;
    }

    /* Прячем thead, но сохраняем данные для псевдоэлементов */
    .page-content table thead {
        position: absolute;
        left: -9999px;
    }

    .page-content table tbody {
        display: block;
    }

    /* Каждая строка = карточка */
    .page-content table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 0;
        background-color: var(--bg-secondary);
    }

    .page-content table tbody tr:last-child {
        margin-bottom: 0;
    }

    .page-content table tbody tr:nth-child(even) {
        background-color: var(--bg-secondary);
    }

    /* Ячейки */
    .page-content table td {
        display: flex;
        align-items: baseline;
        padding: 0.75rem 1rem;
        border: none;
        border-bottom: 1px solid var(--border-color);
        text-align: left;
    }

    .page-content table td:last-child {
        border-bottom: none;
    }

    /* Первая ячейка (название сети) */
    .page-content table td:first-child {
        background-color: var(--bg-tertiary);
        font-size: 1.1rem;
        padding: 1rem;
        display: block;
    }

    /* Добавляем label перед каждой ячейкой */
    .page-content table td:nth-child(2)::before {
        content: "Комиссия: ";
        font-weight: 600;
        color: var(--text-secondary);
        min-width: 140px;
        flex-shrink: 0;
    }

    .page-content table td:nth-child(3)::before {
        content: "Скорость: ";
        font-weight: 600;
        color: var(--text-secondary);
        min-width: 140px;
        flex-shrink: 0;
    }

    .page-content table td:nth-child(4)::before {
        content: "Поддержка биржами: ";
        font-weight: 600;
        color: var(--text-secondary);
        min-width: 140px;
        flex-shrink: 0;
    }

    .page-content table td:nth-child(5)::before {
        content: "Децентрализация: ";
        font-weight: 600;
        color: var(--text-secondary);
        min-width: 140px;
        flex-shrink: 0;
    }

    .page-content table td:nth-child(6)::before {
        content: "Удобство для новичков: ";
        font-weight: 600;
        color: var(--text-secondary);
        min-width: 140px;
        flex-shrink: 0;
    }
}

