/* Стили для блога */
body {
    font-family: 'TildaSans', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    overflow-x: hidden;
    /* Предотвращаем горизонтальный скролл */
    box-sizing: border-box;
}

/* Заголовки */
h1,
h2,
h3 {
    color: #333;
    margin-top: 30px;
    margin-bottom: 15px;
}

h1 {
    font-size: 28px;
    border-bottom: 2px solid #6c9c02;
    padding-bottom: 10px;
}

h2 {
    font-size: 24px;
    color: #6c9c02;
}

h3 {
    font-size: 20px;
    color: #666;
}

/* Ссылки */
a {
    color: #6c9c02;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Кнопка назад */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 5px;
    color: #666;
    font-size: 14px;
}

.back-link:hover {
    background: #e0e0e0;
    text-decoration: none;
}

/* Список статей */
.posts-list {
    margin-top: 30px;
}

.post-item {
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 30px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.post-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.post-title {
    font-size: 22px;
    margin: 0 0 10px 0;
}

.post-title a {
    color: #333;
}

.post-title a:hover {
    color: #6c9c02;
    text-decoration: none;
}

.post-date {
    color: #999;
    font-size: 14px;
    margin-bottom: 15px;
}

.post-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.read-more {
    color: #6c9c02;
    font-size: 14px;
    font-weight: bold;
}

/* Отдельная статья */
.post-content {
    margin-top: 30px;
}

.post-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.post-header .post-title {
    font-size: 28px;
    color: #333;
    margin: 0 0 15px 0;
    border-bottom: 2px solid #6c9c02;
    padding-bottom: 10px;
}

.post-header .post-date {
    font-size: 16px;
    color: #666;
    margin-bottom: 0;
}

.post-body {
    font-size: 16px;
    line-height: 1.8;
}

/* В теле статьи h1 не должно быть, так как заголовок выводится в header */
.post-body h1 {
    display: none;
}

.post-body p {
    margin-bottom: 20px;
}

.post-body ul,
.post-body ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.post-body li {
    margin-bottom: 8px;
}

/* Изображения */
.blog-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* YouTube видео - улучшенные стили */
.youtube-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    /* 16:9 соотношение сторон */
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: #000;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

/* Fallback для заблокированных видео */
.youtube-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.youtube-fallback p {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
}

.youtube-fallback a {
    color: #fff;
    text-decoration: underline;
    font-weight: bold;
    margin-left: 5px;
}

.youtube-fallback a:hover {
    color: #f0f0f0;
}

/* Показываем fallback если iframe не загрузился */
.youtube-container:not(.loaded) .youtube-fallback {
    opacity: 1;
}

/* Стили для ошибок */
.youtube-error {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    color: #6c757d;
}

.youtube-error p {
    margin: 0;
    font-size: 14px;
}

/* Мобильная адаптивность для YouTube */
@media (max-width: 768px) {
    .youtube-container {
        margin: 15px 0;
        border-radius: 6px;
    }

    .youtube-fallback {
        padding: 15px;
    }

    .youtube-fallback p {
        font-size: 14px;
    }
}

/* Цитаты */
blockquote {
    border-left: 4px solid #6c9c02;
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #666;
}

/* Код */
code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 90%;
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    body {
        padding: 15px;
        font-size: 14px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    .post-item {
        padding: 15px;
        margin-bottom: 20px;
    }

    .post-title {
        font-size: 20px;
    }

    .post-body {
        font-size: 15px;
    }

    /* Изображения на мобильных */
    img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 20px auto;
    }

    /* Блоки кода на мобильных */
    pre {
        overflow-x: auto;
        max-width: 100%;
    }

    /* Списки на мобильных */
    ul,
    ol {
        padding-left: 20px;
    }
}

/* Хлебные крошки */
.breadcrumb {
    margin-bottom: 20px;
    color: #999;
    font-size: 14px;
}

.breadcrumb a {
    color: #6c9c02;
}

/* Пустое состояние */
.no-posts {
    text-align: center;
    padding: 40px;
    color: #999;
}

.no-posts h3 {
    color: #666;
    margin-bottom: 10px;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Ошибка 404 */
.error-404 {
    text-align: center;
    padding: 40px;
}

.error-404 h1 {
    color: #6c9c02;
    margin-bottom: 20px;
}

.error-404 p {
    color: #666;
    margin-bottom: 20px;
}

/* Футер */
footer {
    margin-top: 50px;
    padding: 30px 0;
    border-top: 1px solid #eee;
    color: #999;
    text-align: center;
}

footer p {
    margin: 0;
}

/* Мобильные стили для футера */
@media (max-width: 768px) {
    footer {
        margin-top: 30px;
        padding: 20px 0;
    }
}

/* Внутренние ссылки */
.internal-link {
    color: #6c9c02;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.3s ease;
}

.internal-link:hover {
    color: #5a8a00;
    text-decoration: none;
}

/* Связанные статьи */
.related-posts {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.related-posts h3 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
    font-family: 'TildaSans', Arial, sans-serif;
}

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

.related-post {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #6c9c02;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.related-post h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
}

.related-post h4 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.related-post h4 a:hover {
    color: #6c9c02;
}

.related-post p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 10px 0;
}

.related-post-date {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

@media (max-width: 768px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .related-post {
        padding: 15px;
    }

    .related-posts h3 {
        font-size: 20px;
    }

    .related-post h4 {
        font-size: 16px;
    }
}