/* --- Общие переменные и сброс стилей --- */
:root {
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-family-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    --font-size: 16px;
    --line-height: 1.6;
    --text-color: #333;
    --bg-color: #fff;
    --accent-color: #007bff;
    --border-color: #eaeaea;
    --max-width: 800px;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text-color);
    background-color: var(--bg-color);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.2em; }
h2 { font-size: 1.8em; }
h3 { font-size: 1.4em; }

p {
    margin-bottom: 1em;
}

/* --- Шапка --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
}

.logo:hover {
    text-decoration: none;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.nav a {
    color: var(--text-color);
    font-weight: 500;
}
.nav a.active {
    color: var(--accent-color);
    font-weight: 700;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* --- Основной контент --- */
.main-content {
    min-height: calc(100vh - 180px); /* Adjust based on header/footer height */
}

/* --- Список постов --- */
.post-preview {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.post-preview:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.post-title-only {
    margin-bottom: 0.5rem;
}

.post-title-only:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}


.post-preview .post-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-preview a {
    text-decoration: none;
    color: var(--text-color);
}

.post-preview a:hover .post-title {
    color: var(--accent-color);
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-summary p:last-child {
    margin-bottom: 0;
}

.read-more {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Страница поста --- */
.post-header {
    margin-bottom: 2rem;
}

.post-header .post-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 2em;
}

.post-content p,
.post-content ul,
.post-content ol {
    margin-bottom: 1.2em;
}

.post-content pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: var(--font-family-monospace);
    font-size: 0.9em;
}

.post-content code {
    font-family: var(--font-family-monospace);
}

/* --- Подвал --- */
.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #666;
}

/* --- Пагинация --- */
.pagination {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 3rem 0 0;
}
.pagination a {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.pagination a:hover {
    background-color: #f5f5f5;
    text-decoration: none;
}
.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}


/* --- Адаптивность --- */
@media (max-width: 768px) {
    .header {
        position: relative;
    }
    
    .nav ul {
        display: flex; /* Changed from none to flex */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-color);
        /* border: 1px solid var(--border-color); */ /* Removed border */
        border-radius: 4px;
        padding: 1rem;
        z-index: 10;
        
        /* Animation properties */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, visibility 0.3s;
    }

    .nav ul.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav ul li {
        margin-bottom: 1rem;
    }

    .menu-toggle {
        display: block; /* Make it visible on mobile */
        width: 2rem;
        height: 2rem;
        position: relative;
        z-index: 20;
    }

    .menu-toggle span {
        display: block;
        width: 100%;
        height: 3px;
        background: var(--text-color);
        border-radius: 3px;
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
        position: absolute;
        left: 0;
    }

    /* Hamburger State */
    .menu-toggle span:nth-child(1) {
        transform: translateY(-8px);
    }
    .menu-toggle span:nth-child(3) {
        transform: translateY(8px);
    }

    /* Active (Cross) State */
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg);
    }
    .menu-toggle.active span:nth-child(2) {
        transform: rotate(-45deg);
    }
    .menu-toggle.active span:nth-child(3) {
        opacity: 0;
    }

    h1 { font-size: 1.8em; }
    h2 { font-size: 1.5em; }

    .homepage-layout {
        flex-direction: column;
    }
}

/* --- Homepage Layout --- */
.homepage-layout {
    display: flex;
    gap: 2rem;
}

.sidebar {
    flex: 1;
}

.sidebar-menu h3 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.main-feed {
    flex: 2;
}
