/* ================================================================
   blog.css — Стили для раздела «Статьи» (SEO-блог под Яндекс)
   ================================================================
   Файл подключается ТОЛЬКО на страницах:
     - /blog                (хаб)
     - /blog/{slug}         (статья)
     - /blog/tag/{tag}      (страница тега)

   Все классы имеют префиксы, чтобы не пересекаться с style.css:
     .blog-*    — общие элементы блога (hero, крошки, layout)
     .topic-*   — тематические плитки-кластеры
     .article-* — карточки и контент статьи

   Зависимости:
     - style.css (переменные --accent-emerald и т. д.)
     - Bootstrap Icons (bi-*)
   ================================================================ */


/* ================================================================
   1. ХЛЕБНЫЕ КРОШКИ
   ================================================================ */
.blog-breadcrumbs {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.blog-breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.blog-breadcrumbs li:not(:last-child)::after {
    content: '›';
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
}

.blog-breadcrumbs a {
    color: var(--text-secondary);
}

.blog-breadcrumbs a:hover {
    color: var(--accent-emerald);
}

.blog-breadcrumbs li:last-child {
    color: var(--text-muted);
}

.blog-breadcrumbs-wrap {
    padding-top: 24px;
    padding-bottom: 4px;
}


/* ================================================================
   2. HERO — используется на /blog и /blog/tag/{tag}
   ================================================================ */
.blog-hero {
    padding: 48px 0 32px;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 184, 148, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.blog-hero::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -15%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(253, 203, 110, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.blog-hero .container {
    position: relative;
    z-index: 1;
}

.blog-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 30px;
    margin-bottom: 16px;
}

.blog-hero h1 {
    font-weight: 800;
    font-size: 2.8rem;
    letter-spacing: -1px;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.blog-hero h1 .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto;
}

/* Компактный вариант — для страницы тега */
.blog-hero--compact {
    padding: 24px 0 24px;
    text-align: left;
}

.blog-hero--compact h1 {
    font-size: 2rem;
}

.blog-hero--compact p {
    margin: 0;
    font-size: 1rem;
}

.blog-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 10px;
}

.blog-hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-hero__meta i {
    color: var(--accent-emerald);
}

@media (max-width: 768px) {
    .blog-hero { padding: 32px 0 24px; }
    .blog-hero h1 { font-size: 2.1rem; }
    .blog-hero p { font-size: 1rem; }
    .blog-hero--compact h1 { font-size: 1.6rem; }
}


/* ================================================================
   3. ТЕМАТИЧЕСКИЕ ПЛИТКИ (topic hubs) — только на /blog
   ================================================================ */
.blog-topics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 56px;
}

@media (max-width: 992px) {
    .blog-topics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    .blog-topics-grid { grid-template-columns: 1fr; }
}

.topic-tile {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: 26px 22px 20px;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    color: #fff;
    cursor: pointer;
    background: var(--accent-gradient);
    box-shadow: var(--shadow-card);
    transition: all 0.35s ease;
}

.topic-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    color: #fff;
}

/* Оттенки — через ::before, чтобы не плодить градиенты в HTML */
.topic-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    background: radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.15), transparent 60%);
}

.topic-tile:hover::before {
    opacity: 1;
}

/* ================================================================
   Варианты фона плиток — 4 разные палитры
   ================================================================
   Цвета согласованы с coverGradient статей:
     pokupka    → emerald  (основной бренд)
     nalogi     → синий    (финансы, налоги, доверие)
     analitika  → фиолетовый (данные, аналитика, графики)
     dom        → teal     (инфраструктура, дом)
   ================================================================ */

/* Покупка и проверка — emerald */
.topic-tile--deals {
    background: linear-gradient(135deg, #00b894, #00a381);
}

/* Налоги и стоимость — синий */
.topic-tile--taxes {
    background: linear-gradient(135deg, #4a90e2, #357abd);
}

/* Аналитика рынка — фиолетовый */
.topic-tile--analytics {
    background: linear-gradient(135deg, #8e44ad, #6c3483);
}

/* Дом и ГИС ЖКХ — оранжевый / янтарный */
.topic-tile--building {
    background: linear-gradient(135deg, #f39c12, #d68910);
}

.topic-tile__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.topic-tile__icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.20);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.topic-tile__arrow {
    font-size: 1.1rem;
    opacity: 0.7;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.topic-tile:hover .topic-tile__arrow {
    transform: translate(3px, -3px);
    opacity: 1;
}

.topic-tile__title {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.4px;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-tile__count {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.topic-tile__preview {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.topic-tile__preview li {
    font-size: 0.82rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.92);
    display: flex;
    gap: 6px;
    align-items: flex-start;
    transition: color 0.2s;
}

.topic-tile__preview li i {
    flex-shrink: 0;
    margin-top: 3px;
    font-size: 0.7rem;
    opacity: 0.7;
}

.topic-tile:hover .topic-tile__preview li {
    color: #fff;
}

.topic-tile__preview-more {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}


/* ================================================================
   4. ЗАГОЛОВОК СЕКЦИИ («Свежие статьи», «Все статьи» и т. п.)
   ================================================================ */
.blog-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.blog-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin: 0;
}

.blog-section-title::before {
    content: '';
    width: 5px;
    height: 22px;
    background: var(--accent-gradient);
    border-radius: 4px;
}

.blog-section-link {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent-emerald);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-section-link:hover {
    color: var(--accent-emerald-dark);
}


/* ================================================================
   5. СЕТКА КАРТОЧЕК СТАТЕЙ (используется на /blog и /blog/tag)
   ================================================================ */
.blog-articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 992px) {
    .blog-articles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .blog-articles-grid { grid-template-columns: 1fr; }
}


/* ================================================================
   6. КАРТОЧКА СТАТЬИ
   ================================================================ */
.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all 0.35s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-active);
    box-shadow: var(--shadow-hover);
}

.article-card__cover {
    height: 150px;
    background: var(--accent-gradient);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-card__cover i {
    font-size: 52px;
    color: rgba(255, 255, 255, 0.35);
}

.article-card__tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent-emerald-dark);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.article-card__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.article-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.article-card__title a {
    color: inherit;
}

.article-card__title a:hover {
    color: var(--accent-emerald);
}

.article-card__excerpt {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
    flex: 1;
    margin-bottom: 14px;
}

.article-card__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
}

.article-card__meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.article-card__meta i {
    color: var(--accent-emerald);
}

/* Плавное появление карточек */
@keyframes blogFadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.article-card {
    animation: blogFadeInUp 0.5s ease both;
}

.article-card:nth-child(1) { animation-delay: 0.05s; }
.article-card:nth-child(2) { animation-delay: 0.10s; }
.article-card:nth-child(3) { animation-delay: 0.15s; }
.article-card:nth-child(4) { animation-delay: 0.20s; }
.article-card:nth-child(5) { animation-delay: 0.25s; }
.article-card:nth-child(6) { animation-delay: 0.30s; }


/* ================================================================
   7. ПАГИНАЦИЯ
   ================================================================ */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
}

.blog-pagination a,
.blog-pagination span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.blog-pagination a:hover,
.blog-pagination a.active,
.blog-pagination span.active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
}

.blog-pagination span.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ================================================================
   8. СТРАНИЦА СТАТЬИ
   ================================================================ */

/* Hero статьи */
.article-hero {
    padding: 32px 0 24px;
    position: relative;
    overflow: hidden;
}

.article-hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 184, 148, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.article-hero .container {
    position: relative;
    z-index: 1;
}

.article-hero__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 30px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.article-hero h1 {
    font-weight: 800;
    font-size: 2.4rem;
    letter-spacing: -0.8px;
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.article-hero__lead {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

.article-hero__meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

.article-hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-hero__meta i {
    color: var(--accent-emerald);
}

@media (max-width: 768px) {
    .article-hero h1 { font-size: 1.8rem; }
}

/* Прогресс-бар чтения */
.article-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--accent-gradient);
    z-index: 2000;
    transition: width 0.1s linear;
}

/* Обёртка контента статьи */
.article-content-wrap {
    padding-bottom: 40px;
}

.article-content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.75;
}

.article-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.4px;
}

.article-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.8rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    margin-bottom: 1.1rem;
}

.article-content ul,
.article-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.1rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content a {
    color: var(--accent-emerald);
    text-decoration: underline;
    text-decoration-color: rgba(0, 184, 148, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}

.article-content a:hover {
    text-decoration-color: var(--accent-emerald);
}

.article-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.article-content blockquote {
    background: rgba(0, 184, 148, 0.05);
    border-left: 4px solid var(--accent-emerald);
    padding: 16px 20px;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
    font-style: normal;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.article-content th {
    background: rgba(0, 184, 148, 0.08);
    color: var(--text-primary);
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.article-content td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.article-content tr:last-child td {
    border-bottom: none;
}

/* Чек-лист внутри статьи */
.article-content .checklist {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.article-content .checklist li {
    padding: 8px 0 8px 32px;
    position: relative;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.article-content .checklist li:last-child {
    border-bottom: none;
}

.article-content .checklist li::before {
    content: '☐';
    position: absolute;
    left: 0;
    top: 8px;
    color: var(--accent-emerald);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Оглавление (TOC) */
.article-toc {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-card);
}

.article-toc__title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-toc__title i {
    color: var(--accent-emerald);
}

.article-toc ol {
    list-style: none;
    counter-reset: toc-counter;
    padding: 0;
    margin: 0;
}

.article-toc ol li {
    counter-increment: toc-counter;
    padding: 6px 0 6px 32px;
    position: relative;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-subtle);
}

.article-toc ol li:last-child {
    border-bottom: none;
}

.article-toc ol li::before {
    content: counter(toc-counter) '.';
    position: absolute;
    left: 0;
    top: 6px;
    color: var(--accent-emerald);
    font-weight: 700;
    font-size: 0.9rem;
}

.article-toc a {
    color: var(--text-secondary);
}

.article-toc a:hover {
    color: var(--accent-emerald);
}

/* Блок тегов под статьёй */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.article-tags__label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.article-tag {
    background: rgba(0, 184, 148, 0.08);
    color: var(--accent-emerald-dark);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.article-tag:hover {
    background: var(--accent-gradient);
    color: #fff;
}


/* ================================================================
   9. БЛОК «ЧИТАЙТЕ ТАКЖЕ»
   ================================================================ */
.blog-related {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid var(--border-subtle);
}

.blog-related__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: -0.4px;
}

.blog-related .blog-articles-grid {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 992px) {
    .blog-related .blog-articles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .blog-related .blog-articles-grid { grid-template-columns: 1fr; }
}

/* Уменьшенные карточки в блоке «Читайте также» */
.blog-related .article-card__cover {
    height: 120px;
}

.blog-related .article-card__cover i {
    font-size: 44px;
}

.blog-related .article-card__title {
    font-size: 1rem;
}

.blog-related .article-card__excerpt {
    display: none;
}


/* ================================================================
   10. CTA-СЕКЦИЯ ВНУТРИ БЛОГА
   ================================================================ */
.blog-cta {
    margin-top: 40px;
    margin-bottom: 40px;
}

.blog-cta .cta-section {
    padding: 40px 28px;
}

.blog-cta .cta-section h3 {
    font-size: 1.35rem;
}

@media (max-width: 576px) {
    .blog-cta .cta-section {
        padding: 32px 20px;
    }
    .blog-cta .cta-section h3 {
        font-size: 1.15rem;
    }
}


/* ================================================================
   11. АДАПТИВНОСТЬ — общие правки под мобильные
   ================================================================ */
@media (max-width: 768px) {
    .blog-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .article-card__cover {
        height: 140px;
    }

    .article-card__cover i {
        font-size: 46px;
    }

    .article-hero__meta {
        gap: 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .topic-tile {
        padding: 22px 18px 18px;
    }

    .topic-tile__title {
        font-size: 1.05rem;
    }

    .topic-tile__preview {
        padding-top: 12px;
    }

    .topic-tile__preview li {
        font-size: 0.78rem;
    }

    .article-hero h1 {
        font-size: 1.55rem;
    }

    .article-content {
        font-size: 1rem;
    }

    .article-content h2 {
        font-size: 1.3rem;
    }

    .article-toc {
        padding: 16px 18px;
    }
}