/* ==========================================================================
   1. ОБЩИЕ НАСТРОЙКИ И СЕТКА
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background-color: #f4f7f6; 
    color: #333; 
    line-height: 1.6; 
}

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

main { 
    padding: 40px 0; 
    min-height: 75vh; 
}

/* ==========================================================================
   2. ШАПКА И НАВИГАЦИЯ
   ========================================================================== */
.main-header { 
    background: #1e4520; 
    color: #fff; 
    padding: 20px 0; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.05); 
}

.main-header .container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.main-nav ul { 
    display: flex; 
    list-style: none; 
}

.main-nav li { 
    margin-left: 20px; 
}

.main-nav a { 
    color: #cbd5e1; 
    text-decoration: none; 
    font-weight: 500; 
    transition: color 0.3s; 
}

.main-nav a:hover { 
    color: #fff; 
}

/* Логотип */
.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: bold;
}

.logo-img {
    width: 35px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
    background: #fff;
}

/* ==========================================================================
   3. ГЛАВНАЯ СТРАНИЦА И КАРТОЧКИ
   ========================================================================== */
.hero { 
    background: #fff; 
    padding: 40px; 
    border-radius: 8px; 
    margin-bottom: 40px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); 
}

.hero h1 { 
    margin-bottom: 10px; 
    color: #1e293b; 
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 20px; 
    margin-top: 20px; 
}

.card { 
    background: #fff; 
    padding: 25px; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); 
    display: flex; 
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.card h3 { margin-bottom: 10px; color: #1e293b; }
.card .date { font-size: 0.85rem; color: #64748b; margin-bottom: 15px; }
.card .excerpt { color: #475569; margin-bottom: 20px; flex-grow: 1; }

.btn { 
    display: inline-block; 
    background: #3498db; 
    color: #fff; 
    padding: 10px 15px; 
    text-decoration: none; 
    border-radius: 5px; 
    font-size: 0.9rem; 
    width: max-content; 
    transition: background 0.2s; 
}

.btn:hover { background: #2980b9; }

/* ==========================================================================
   4. СТРАНИЦА СТАТЬИ И САЙДБАР
   ========================================================================== */
.article-container {
    display: flex;
    gap: 40px;
    margin-top: 20px;
}

.sidebar {
    width: 250px;
    min-width: 250px;
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: none;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.sidebar-box h4 {
    margin-bottom: 15px;
    color: #1e293b;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 5px;
    font-size: 1rem;
}

#toc-nav ul, .all-articles-nav ul { 
    list-style: none; 
    padding-left: 0;
}

#toc-nav li, .all-articles-nav li { 
    margin-bottom: 10px; 
}

#toc-nav a, .all-articles-nav a {
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-block;
}

#toc-nav a:hover, .all-articles-nav a:hover {
    color: #3498db;
    transform: translateX(3px);
}

.all-articles-nav a.active-link {
    color: #2980b9;
    font-weight: bold;
    border-left: 3px solid #3498db;
    padding-left: 8px;
    margin-left: -11px;
}

.article-content,
.post-body {
    flex: 1;
    min-width: 0;
}

.post-body h2 { 
    color: #1a3a1c; 
    margin-top: 40px; 
    margin-bottom: 10px; 
    font-size: 1.7rem; 
    font-weight: 700; 
    border-bottom: 2px solid #e2e8f0; 
    padding-bottom: 5px; 
}

.post-body p { 
    margin-bottom: 22px; 
    color: #334155; 
    font-size: 1.1rem; 
    line-height: 1.3; 
}

/* ==========================================================================
   5. ОФОРМЛЕНИЕ КОДА И ТЕРМИНАЛА
   ========================================================================== */
pre {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e6;
    border-radius: 6px;
    padding: 6px 12px;
    margin: 15px 0;
    width: 90%;
    max-width: 90%;
    box-sizing: border-box;
    white-space: pre;
    overflow-x: auto;
    word-break: normal;
}

.article-content code,
.post-body code {
    font-family: "Consolas", "Courier New", Courier, monospace;
    background-color: #f1f8f5;
    color: #2e6930;
    font-style: italic;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.95em;
    word-break: break-all;
    overflow-wrap: break-word;
}

pre code {
    font-family: "Consolas", "Courier New", Courier, monospace;
    font-size: 1em !important;
    font-weight: normal !important;
    color: #527fac !important;
    background: none !important;
    font-style: normal !important;
    padding: 0 !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

.break-path {
    white-space: normal !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    display: inline !important;
}

/* Терминал */
.terminal-container {
    background-color: #1e1e1e;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-bottom: 40px;
    font-family: "Consolas", "Courier New", Courier, monospace;
    overflow: hidden;
    border: 1px solid #333;
}

.terminal-header {
    background-color: #2d2d2d;
    padding: 10px;
    display: flex;
    align-items: center;
    position: relative;
}

.terminal-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.terminal-btn.close { background-color: #ff5f56; }
.terminal-btn.minimize { background-color: #ffbd2e; }
.terminal-btn.expand { background-color: #27c93f; }

.terminal-title {
    color: #999;
    font-size: 0.85rem;
    position: absolute;
    width: 100%;
    text-align: center;
    left: 0;
    pointer-events: none;
}

.terminal-body {
    padding: 15px;
    color: #f1f1f1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.terminal-prompt { color: #4af626; margin-right: 10px; }
.terminal-command { color: #fff; }
.terminal-output {
    color: #cbd5e1;
    margin: 8px 0 12px 0;
    padding-left: 5px;
    border-left: 2px solid #527fac;
    font-style: italic;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: #fff;
    margin-left: 4px;
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

@keyframes blink {
    from, to { background-color: transparent }
    50% { background-color: #fff; }
}

/* ==========================================================================
   6. СТРАНИЦА 404
   ========================================================================== */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 20px;
}

.error-card {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.error-code {
    font-size: 5rem;
    font-weight: 800;
    color: #1e4520;
    line-height: 1;
    margin-bottom: 10px;
}

.error-card h2 { color: #1e293b; font-size: 1.4rem; margin-bottom: 15px; }
.error-text { color: #64748b; font-size: 1rem; line-height: 1.5; margin-bottom: 25px; }

.error-waiter {
    background: #f4f7f6;
    padding: 15px;
    border-radius: 6px;
    color: #475569;
    font-style: italic;
    font-size: 0.95rem;
    margin-bottom: 30px;
    border-left: 4px solid #1e4520;
}

.btn-home { display: inline-block; width: auto; padding: 12px 25px; }

/* ==========================================================================
   7. ТАБЛИЦА СПИСКОВ (ХАРАКТЕРИСТИКИ)
   ========================================================================== */
.specs-list {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px 20px;
    margin: 20px 0;
    line-height: 1.5;
}

.specs-list dt { font-weight: bold; color: #333; }
.specs-list dd { margin: 0; color: #555; }
.specs-list ul { margin: 5px 0 0 0; padding-left: 20px; }

/* ==========================================================================
   8. ФУТЕР
   ========================================================================== */
.main-footer { 
    background: #1e4520; 
    color: #94a3b8; 
    text-align: center; 
    padding: 20px 0; 
    margin-top: 40px; 
    font-size: 0.9rem; 
}

/* ==========================================================================
   9. АДАПТИВНОСТЬ (МОБИЛЬНЫЕ УСТРОЙСТВА)
   ========================================================================== */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .main-nav ul { padding: 0; }
    .main-nav li { margin: 0 10px; }

    .article-container {
        flex-direction: column;
        gap: 20px;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        position: static; 
        max-height: none;  
        overflow-y: visible; 
    }

    .article-content { padding: 8px; }
    .post-title { font-size: 1.6rem; }

    .post-body h2 {
        font-size: 1.3rem;
        margin-top: 30px;
    }
    
    .post-body p {
        font-size: 1rem;
        line-height: 1.4;
    }

    pre code { font-weight: 600 !important; }
}

@media (max-width: 600px) {
    .specs-list { display: block; }
    .specs-list dt { margin-top: 12px; }
    .specs-list dt:first-child { margin-top: 0; }
    .specs-list dd { margin-top: 2px; margin-bottom: 8px; }
}
