/* --- ФОН С КЛЕТКОЙ --- */
.blog-hero-bg {
    background-image: linear-gradient(to right, rgba(45, 41, 38, 0.04) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(45, 41, 38, 0.04) 1px, transparent 1px);
    background-size: 64px 64px;
    padding: 1rem 0 4rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 3rem;
}

.article-page-bg {
    background-image: linear-gradient(to right, rgba(45, 41, 38, 0.03) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(45, 41, 38, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    background-position: top center;
    background-attachment: fixed;
    padding: 1rem 0;
}

/* --- СТРАНИЦА БЛОГА (СПИСОК) --- */
.blog-intro { max-width: 600px; font-size: 1.1rem; margin-top: 1.5rem; }
.blog-grid-header { display: flex; justify-content: space-between; margin-bottom: 2rem; font-size: 0.9rem; }

.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-bottom: 3rem;
    align-items: stretch;
}
@media (min-width: 1024px) {
    .blog-grid { 
        grid-template-columns: repeat(3, 1fr); 
    }
    
    /* ШАХМАТНЫЙ ПОРЯДОК: сдвигаем каждую четную карточку */
    .blog-card:nth-child(even) { transform: translateY(3rem); }
    .blog-grid { padding-bottom: 3rem; }
    .blog-card:nth-child(even):hover { transform: translateY(calc(3rem - 4px)); }
}
.blog-card {
    display: flex;
    flex-direction: column;
    background: var(--color-prise);
    border: 1px solid var(--color-border);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-box); }

.blog-card-image-wrapper { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.blog-card-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.blog-card:hover .blog-card-image { transform: scale(1.05); }

.blog-card-badge {
    position: absolute; top: 1rem; left: 1rem;
    background: color-mix(in oklab, var(--color-bg) 90%, transparent);
    padding: 0.3rem 0.8rem; border-radius: 2rem; font-size: 0.65rem; color: var(--color-fg);
}

.blog-card-content { 
    padding: 1.5rem; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    min-height: 250px; /* Подгони под свой дизайн, чтобы текст помещался */
}
.blog-card-meta { font-size: 0.7rem; color: var(--color-muted); margin-bottom: 1rem; text-transform: uppercase; }
.blog-card-title { font-size: 1.5rem; margin-bottom: 0.75rem; line-height: 1.3; }
.blog-card-desc { flex-grow: 1; }
.blog-card-link-text { font-size: 0.9rem; font-weight: 500; color: var(--color-primary); margin-top: auto; padding-top: 3rem; }

.blog-cta-box {
    background: var(--color-secondary);
    border-radius: 1.5rem;
    padding: 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}
.blog-cta-box h3 { font-size: 1.75rem; }

/* --- СТРАНИЦА СТАТЬИ --- */
.article-back { margin-bottom: 2rem; }
.article-header { max-width: 80%; margin: auto; margin-bottom: 3rem; }
.article-title {
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 1.1;
  margin-bottom: 1.5rem; 
  border-top: 2px solid var(--color-border);
  padding-top: 1.5rem;
}
.article-intro { font-size: 1.25rem; line-height: 1.6; margin-bottom: 2rem; }

.article-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--color-muted); }
.author-avatar {
    width: 32px; height: 32px; background: var(--color-primary); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold;
}

.article-cover { margin-bottom: 4rem; }
.article-cover img { width: 100%; border-radius: 1.5rem; }
.article-caption { font-size: 0.8rem; margin-top: 1rem; }

.article-body { max-width: 800px; margin: 0 auto; }
.article-text { font-size: 1.15rem; line-height: 1.8; margin-bottom: 1.5rem; color: var(--color-fg); }
.article-text p { margin: 1rem 0; }
.article-text ol { margin: 1rem; }
.article-text a { text-decoration: underline; color: var(--color-primary); }

.article-quote {
    border-left: 4px solid var(--color-primary);
    padding-left: 2rem;
    margin: 3rem 0;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    line-height: 1.5;
    color: var(--color-muted);
}

.article-image-block { margin: 3rem 0; }
.article-image-block img { width: 100%; border-radius: 1rem; }

.article-checklist ul { list-style: none; padding: 0; }
.article-checklist li { position: relative; margin-bottom: 0.75rem; font-size: 1.1rem; }

/* --- БЛОК "ПОДЕЛИТЬСЯ" --- */
.article-share {
    max-width: 800px;
    margin: 4rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
    
    /* Выстраиваем текст и кнопки в одну линию по краям */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap; /* Для мобилок */
}

.article-share-label {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--color-fg);
}

.article-share-buttons {
    display: flex;
    gap: 0.75rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 2rem;
    font-size: 0.85rem;
    color: var(--color-fg);
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.share-btn:hover {
    background: var(--color-secondary);
    border-color: var(--color-muted);
}

.share-btn svg {
    color: var(--color-muted);
}

/* --- БУКВИЦА (Drop Cap) --- */
.drop-cap-wrapper {
    float: left;
    width: 110px;
    height: 110px;
    margin-right: 1.25rem;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
    position: relative;
}


/* Этот слой будет вырезаться маской */
.drop-cap-inner {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #050a14; /* Темный фон */
    
    /* Готовим свойства для маски */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}
.drop-cap-inner canvas {
    width: 100%; height: 100%; display: block;
}
/* Красная строка для блоков "Абзац" в статьях */
.article-content p,
.rich-text p,
.blog-body p {
    text-indent: 1.5em; /* Отступ первой строки */
    margin-top: 0;      /* Убираем пустоту между абзацами (по желанию) */
    margin-bottom: 1em; /* Оставляем отступ снизу */
    text-indent: 1.5em !important; 
}
/* Красная строка для статей блога */
.article-text p {
    text-indent: 1.5em !important; /* Сдвигаем первую строку */
}
/* --- БЛОК "ЧИТАЙТЕ ТАКЖЕ" --- */
.related-notes-section {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--color-border);
}

.related-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.related-notes-title {
    font-size: 2rem;
    margin-top: 0.5rem;
}

.related-notes-all {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.related-notes-all:hover {
    text-decoration: underline;
}

.related-notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .related-notes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.related-note-card {
    display: flex;
    flex-direction: column;
    background: var(--color-prise);
    border: 1px solid var(--color-border);
    border-radius: 1.25rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}

.related-note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-box);
}

.related-note-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-secondary);
}

.related-note-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.related-note-card:hover .related-note-image img {
    transform: scale(1.05);
}

.related-note-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.related-note-category {
    font-size: 0.65rem;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.related-note-title {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.related-note-desc {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.related-note-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-primary);
    margin-top: auto;
}

/* --- ПАГИНАЦИЯ --- */
.blog-pagination {
    display: flex;
    justify-content: center; /* Центрируем по горизонтали */
    align-items: center;
    gap: 0.5rem;
    margin: 3rem 0 5rem;
    width: 100%;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-fg);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-btn:hover {
    background: var(--color-secondary);
}

.page-btn.active {
    background: var(--color-primary);
    color: var(--color-primary-fg);
    border-color: var(--color-primary);
}

@media (max-width: 768px) {
    .blog-hero-bg {
        padding-bottom: 1rem;
    }
    .article-header {
        max-width: 100%;
    }
    
}
/* ===== Читабельность статей ===== */
.article-text, .article-text p, .article-content p, .rich-text p, .blog-body p { text-indent: 0 !important; }
.article-body { max-width: 720px; }
.article-text, .article-text p { color: var(--color-fg); font-size: 1.08rem; line-height: 1.75; }
.article-body p { margin-bottom: 1.25rem; }

/* === Типографика статьи: читаемость === */
.article-container .article-body,
.article-container .article-text,
.article-container .article-text p,
.article-container .article-text .rich-text,
.article-container .article-text .rich-text p {
    color: #26251f !important;
    font-size: 1.08rem !important;
    line-height: 1.8 !important;
}
.article-container .article-body p {
    margin-bottom: 1.2rem !important;
    text-indent: 0 !important;
}

/* Маркированные списки в статье: ровные отступы, перенос по тексту */
.rich-text ul, .rich-text ol,
.note-body ul, .note-body ol,
 article ol {
    padding-left: 1.3em !important;
    list-style-position: outside !important;
}
.rich-text li, .note-body li, article li {
    text-indent: 0 !important;
}
.rich-text li::marker, .note-body li::marker, article li::marker {
    color: #145c43;
}

/* Списки внутри текста статьи: ровные отступы, перенос по тексту */
.article-text ul, .article-text ol, .rich-text ul, .rich-text ol {
    margin: 0 0 1.4em !important;
    padding-left: 1.3em !important;
    list-style-position: outside !important;
}
.article-text li, .rich-text li {
    margin: 0 0 0.55em !important;
    padding-left: 0.2em !important;
    text-indent: 0 !important;
}
.article-text li::marker, .rich-text li::marker {
    color: #145c43;
}

/* Ссылка-обёртка тянется на всю карточку — «Читать статью» у нижнего края */
.blog-card-link { display: flex; flex-direction: column; flex-grow: 1; }
.article-checklist {
    ul {
        margin: 1.5rem 0;
    }
    li {
        display: flex;
        gap: 1rem;
    }
    li::before {
        padding-top: 0.25rem;
    }
}
.article-checklist li svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 0.5rem; }