/* Стили для страницы отдельной статьи блога */

.article-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.article-header {
    padding-top: 20px;
    margin-bottom: 32px;
}

.article-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    line-height: 1.2;
    text-align: left;
}

.article-category {
    display: inline-block;
    padding: 6px 16px;
    background: #eef2ff;
    color: #4F46E5;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    text-decoration: none;
    transition: background 0.2s;
}

.article-category:hover {
    background: #e0e7ff;
}

.article-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    line-height: 1.2;
    text-align: left;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-top-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    margin-bottom: 40px;
    align-items: start;
    max-width: 1280px;
    /* margin-left: -24px; */
    margin-right: auto;
    padding: 0px 0px 0 0px;
    box-sizing: border-box;
}

.article-left-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.article-right-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 100px;
    align-self: start;
    /* align-items: flex-end; */
}

.article-featured-image {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
}

/* Стили для контента статьи внутри .articles-section */
.articles-section .article-content {
    font-size: 18px;
    line-height: 1.8;
    color: #374151;
    margin-bottom: 48px;
    padding: 0;
}

.articles-section .article-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin: 40px 0 20px 0;
    line-height: 1.3;
    scroll-margin-top: 100px; /* Отступ для фиксированного header */
    position: relative;
    margin-left: 0;
}

.articles-section .article-content h3 {
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
    margin: 32px 0 16px 0;
    line-height: 1.4;
}

.articles-section .article-content p {
    margin-bottom: 20px;
}

.articles-section .article-content ul,
.articles-section .article-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.articles-section .article-content li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.articles-section .article-content a {
    color: #4F46E5;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s;
}

.articles-section .article-content a:hover {
    color: #4338ca;
    text-decoration: none;
}

.articles-section .article-content strong {
    font-weight: 600;
    color: #1f2937;
}

.articles-section .article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
}

.articles-section .article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.articles-section .article-content table th,
.articles-section .article-content table td {
    padding: 12px;
    border: 1px solid #e5e7eb;
    text-align: left;
}

.articles-section .article-content table th {
    background: #f9fafb;
    font-weight: 600;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 48px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}

/* Стили для тегов в правой колонке */
.article-right-column .article-tags {
    /* margin-top: 24px; */
    margin-bottom: 0;
    padding-top: 0;
    border-top: none;
    justify-content: flex-start;
}

.article-tag {
    padding: 6px 14px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.article-tag:hover {
    background: #e5e7eb;
    color: #374151;
}

.related-articles {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 2px solid #e5e7eb;
}

.related-articles-title {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 24px;
}

.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.related-article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.related-article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.related-article-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f3f4f6;
}

.related-article-content {
    padding: 20px;
    flex: 1;
}

.related-article-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-article-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.table-of-contents {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    /* border-left: 3px solid #d1d5db; */
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    align-self: flex-end;
}

.table-of-contents-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.table-of-contents-title svg {
    color: #6b7280;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.table-of-contents-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-of-contents-list li {
    position: relative;
    padding-left: 0;
}

.table-of-contents-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #6b7280;
    text-decoration: none;
    font-size: 16px;
    line-height: 1.5;
    transition: color 0.2s;
    padding: 6px 0;
}

.table-of-contents-link::before {
    content: '•';
    color: #9ca3af;
    flex-shrink: 0;
    margin-top: 2px;
}

.table-of-contents-link:hover {
    color: #4F46E5;
    text-decoration: none;
}

.table-of-contents-link:hover::before {
    color: #4F46E5;
}

.article-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    margin-bottom: 48px;
}

/* .article-main - стили убраны, так как рамка не нужна */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 16px 0;
}

.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.categories-list li {
    margin-bottom: 12px;
}

.categories-list li:last-child {
    margin-bottom: 0;
}

.categories-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
}

.categories-list a:hover {
    background: #f3f4f6;
}

.categories-list a.active {
    background: #eef2ff;
    color: #4F46E5;
    font-weight: 600;
}

.category-count {
    font-size: 12px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 12px;
}

.categories-list a.active .category-count {
    background: #e0e7ff;
    color: #4F46E5;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-link {
    padding: 6px 12px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.tag-link:hover {
    background: #e5e7eb;
    color: #374151;
}

.tag-link.active {
    background: #4F46E5;
    color: white;
}

@media (max-width: 768px) {
    .article-page {
        padding: 0 16px;
    }
    
    .article-title {
        font-size: 28px;
    }
    
    .article-content {
        font-size: 16px;
    }
    
    .article-content h2 {
        font-size: 24px;
    }
    
    .article-content h3 {
        font-size: 20px;
    }
    
    .article-top-section {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-bottom: 32px;
        padding: 0px 0px 0 0px;
        /* margin-left: -16px; */
        margin-right: 0;
        display: flex;
        flex-direction: column;
    }
    
    .article-left-column {
        gap: 24px;
        display: contents; /* Убираем обертку, чтобы дочерние элементы стали прямыми детьми article-top-section */
    }
    
    .article-right-column {
        position: static;
        order: 1; /* Содержание после фото, но перед телом статьи */
    }
    
    .article-image-wrapper {
        order: 0;
        width: 100%;
        max-width: 100%;
        /* margin-left: -16px; */
        /* margin-right: -16px; */
        /* padding: 0 16px; */
        box-sizing: border-box;
    }
    
    .articles-section {
        order: 2; /* Тело статьи последним */
    }
    
    .article-featured-image {
        max-height: 400px;
        width: 100%;
        border-radius: 12px;
    }
    
    .related-articles-grid {
        grid-template-columns: 1fr;
    }
    
    .table-of-contents {
        padding: 16px;
        margin-bottom: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .table-of-contents-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .table-of-contents-link {
        font-size: 15px;
        padding: 4px 0;
    }
    
    .article-right-column {
        width: 100%;
        max-width: 100%;
    }
    
    .article-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: -1;
    }
}

/* Footer на всю ширину для страницы статьи */
/* Переопределяем стили footer для растягивания на всю ширину */
footer.footer .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

footer.footer .footer-content {
    padding: 0 24px !important;
}

footer.footer .footer-bottom {
    padding-left: 24px !important;
    padding-right: 24px !important;
}

