/* css/style.css */
/*fonts*/

/* css/style.css - Обновленные шрифты */

/* Базовые стили шрифтов */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Заголовки */
h1, h2, h3, h4, h5, h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #2c3e50;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* Навигация */
.nav-links {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
}

/* Карточки статей */
.article-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    line-height: 1.3;
}

.article-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    font-size: 1.1rem;
}
/* Стили как у Medium/Dev.to */
.category {
    display: inline-flex;
    align-items: center;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea !important;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    line-height: 1;
}

.category:hover {
    background: #667eea;
    color: white !important;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.category::before {
    content: "🏷️";
    margin-right: 0.3rem;
    font-size: 0.7rem;
}

/* Read More - Modern Blog Style */
.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50 !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.7rem 1.2rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.read-more:hover {
    background: #667eea;
    color: white !important;
    border-color: #667eea;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.read-more::after {
    content: "→";
    font-weight: bold;
    transition: transform 0.3s ease;
}

.read-more:hover::after {
    transform: translateX(3px);
}
.section-title {
    margin-top: 1rem;
}
/* Футер */
.footer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.footer-links {
    font-weight: 400;
}

/*end fonts*/
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --text-light: #666;
    --background: #fff;
    --background-alt: #f8f9fa;
    --border: #e1e5e9;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Main content */
.main {
    padding: 1rem 0 !important;
    min-height: calc(100vh - 200px);
}

/* Articles grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.article-card {
    background: var(--background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.article-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.article-content {
    padding: 1.5rem;
}

.article-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.article-title a {
    color: var(--text-color);
    text-decoration: none;
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-meta {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.article-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Выравнивание даты по правому краю */
.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.article-meta .date {
    margin-left: auto;
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Для мобильных */
@media (max-width: 768px) {
    .article-meta {
        justify-content: flex-start;
    }

    .article-meta .date {
        margin-left: 0;
        margin-right: auto;
    }
}

/* Single article */
.article-single {
    max-width: 800px;
    margin: 0 auto;
}

.breadcrumbs {
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.article-header {
    margin-bottom: 2rem;
}

.article-hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-body h2 {
    margin: 2rem 0 1rem;
    color: var(--text-color);
}

.article-body p {
    margin-bottom: 1.5rem;
}

/* Related articles */
.related-articles {
    padding: 2rem;
    border-radius: var(--radius);
    margin-top: 3rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Footer Styles */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.footer-section h4 {
    color: #bdc3c7;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.footer-section p {
    line-height: 1.6;
    color: #bdc3c7;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s ease, padding-left 0.3s ease;
    display: block;
    padding: 0.3rem 0;
}

.footer-links a:hover {
    color: #3498db;
    padding-left: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 1.5rem;
    text-align: center;
    color: #95a5a6;
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-links a:hover {
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 1.5rem 0 1rem;
    }

    .footer-section h3 {
        font-size: 1.2rem;
    }

    .footer-section h4 {
        font-size: 1rem;
    }
}

/* Admin link */
.admin-link {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 25px;
    font-size: 0.875rem;
    z-index: 1000;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.admin-link:hover {
    transform: translateY(-2px);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .article-hero-image {
        height: 250px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .admin-link {
        position: static;
        display: block;
        text-align: center;
        margin: 1rem 0;
        border-radius: var(--radius);
    }
}

@media (max-width: 480px) {
    .main {
        padding: 0 0;
    }

    .article-content {
        padding: 1rem;
    }

    .related-articles {
        padding: 1.5rem;
    }
}

/* ===== УНИФИЦИРОВАННЫЕ СТИЛИ ДЛЯ БЛОКОВ КОДА ===== */

/* Инлайн код (в тексте) */
code:not([class*="language-"]) {
    background: #2d3748;
    color: #90cdf4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
    font-weight: 500;
}

/* Блоки кода с подсветкой синтаксиса */
pre code {
    display: block;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: inherit;
    font-size: inherit;
    font-weight: normal;
}

/* Контейнер для блоков кода */
pre[class*="language-"],
pre {
    position: relative;
    background: #2d3748;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow: auto;
    border-left: 4px solid #4299e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Метка языка */
pre[class*="language-"]::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 1rem;
    background: #4299e1;
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0 0 4px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
}

/* Автоматическое определение языка по классу */
pre.language-php::before { content: 'PHP'; background: #777bb4; }
pre.language-javascript::before,
pre.language-js::before { content: 'JavaScript'; background: #f7df1e; color: #2d3748; }
pre.language-typescript::before,
pre.language-ts::before { content: 'TypeScript'; background: #3178c6; }
pre.language-css::before { content: 'CSS'; background: #1572b6; }
pre.language-html::before { content: 'HTML'; background: #e34f26; }
pre.language-json::before { content: 'JSON'; background: #000000; }
pre.language-sql::before { content: 'SQL'; background: #336791; }
pre.language-bash::before,
pre.language-shell::before { content: 'Shell'; background: #4eaa25; }
pre.language-markdown::before { content: 'Markdown'; background: #083fa1; }
pre.language-python::before { content: 'Python'; background: #3776ab; }
pre.language-java::before { content: 'Java'; background: #ed8b00; color: #2d3748; }
pre.language-ruby::before { content: 'Ruby'; background: #cc342d; }
pre.language-go::before { content: 'Go'; background: #00add8; }
pre.language-rust::before { content: 'Rust'; background: #000000; }
pre.language-cpp::before { content: 'C++'; background: #00599c; }
pre.language-csharp::before,
pre.language-cs::before { content: 'C#'; background: #239120; }
pre.language-yaml::before,
pre.language-yml::before { content: 'YAML'; background: #cb171e; }
pre.language-xml::before { content: 'XML'; background: #0066cc; }

/* Кнопка копирования */
.copy-code-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    color: #2d3748;
    backdrop-filter: blur(4px);
}

.copy-code-btn:hover {
    background: #ffffff;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-code-btn:active {
    transform: translateY(0);
}

.copy-code-btn.copied {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

/* Стили для Prism.js */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #a0aec0;
    font-style: italic;
}

.token.punctuation {
    color: #e2e8f0;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #63b3ed;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #68d391;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #f6ad55;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #fbb6ce;
}

.token.function,
.token.class-name {
    color: #faf089;
}

.token.regex,
.token.important,
.token.variable {
    color: #fc8181;
}

/* Темная тема для инлайн кода */
@media (prefers-color-scheme: dark) {
    code:not([class*="language-"]) {
        background: #2d3748;
        color: #90cdf4;
        border-color: #2d3748;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    pre[class*="language-"],
    pre {
        margin: 1rem -1rem;
        border-radius: 0;
        border-left: none;
        padding: 1.25rem 1rem;
    }
    
    pre[class*="language-"]::before {
        right: 1rem;
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
    
    .copy-code-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

/* Улучшенная читаемость для длинных строк */
pre code {
    line-height: 1.5;
    tab-size: 4;
    -moz-tab-size: 4;
}

/* Подсветка строк (опционально) */
.line-highlight {
    background: rgba(66, 153, 225, 0.1);
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
    border-left: 3px solid #4299e1;
}

/* Номера строк (опционально) */
.line-numbers .line-numbers-rows {
    border-right: 1px solid #4a5568;
    padding-right: 1rem;
    margin-right: 1rem;
}

/* Фокус для доступности */
code:focus,
.copy-code-btn:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

/* ===== СТИЛИ ДЛЯ ТАБЛИЦ ИИ-КОНТЕНТА ===== */
/* ===== СВЕТЛЫЕ СТИЛИ ДЛЯ ТАБЛИЦ ===== */

/* Базовая таблица */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2c3e50;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);

    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Заголовки таблицы */
th {
    background: #ffffff;
    color: #2c3e50;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 2px solid #e0e0e0;
}

/* Ячейки таблицы */
td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f5f5f5;
    color: #34495e;
}

/* Чередование строк */
tbody tr:nth-child(even) {
    background: #fafafa;
}

/* Ховер эффект */
tbody tr:hover {
    background: #f8f9fa;
}

/* Последняя строка */
tbody tr:last-child td {
    border-bottom: none;
}

/* Адаптивность */
@media (max-width: 768px) {
    table {
        font-size: 0.875rem;
        border-radius: 4px;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
}


/* Центрирование Mermaid диаграмм */
.mermaid {
    display: block;
    text-align: center;
    margin: 0 auto;
}

.mermaid svg {
    display: block;
    margin: 0 auto;
}

/* ===== СДЕРЖАННЫЕ СТИЛИ ДЛЯ СПИСКОВ В КОНТЕНТЕ ===== */

.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
    color: #2c3e50;
}

.article-content ul {
    list-style-type: disc;
}

.article-content ol {
    list-style-type: decimal;
}

.article-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: #34495e;
}

.article-content ul li {
    padding-left: 0.5rem;
}

.article-content ol li {
    padding-left: 0.5rem;
}

/* Вложенные списки */
.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.article-content ul ul {
    list-style-type: circle;
}

.article-content ul ul ul {
    list-style-type: square;
}

/* Адаптивность */
@media (max-width: 768px) {
    .article-content ul,
    .article-content ol {
        padding-left: 1.25rem;
        margin: 1.25rem 0;
    }
    
    .article-content li {
        margin-bottom: 0.375rem;
    }
}

#scrollToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

#scrollToTop.show {
    opacity: 0.7;
    visibility: visible;
}

#scrollToTop:hover {
    background-color: #0056b3;
    transform: scale(1.1);
}

.mermaid {
    cursor: zoom-in;
    max-width: 100%;
    overflow: auto;
}

.mermaid.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 10000;
    cursor: zoom-out;
    padding: 20px;
    overflow: auto;
}