/* ══════════════════════════════════════════════════════════
   Блог: категории, метки, карточки, популярное, CTA, крошки
   Подключается после blog.css (см. layouts/app.blade.php)
   ══════════════════════════════════════════════════════════ */

:root {
    --blog-accent: #fa821d;
    --blog-ink: #0c0c0c;
    --blog-muted: #777;
    --blog-line: #e0e0e0;
    --blog-surface: #fff;
    --blog-gutter: 60px;
}

.blog-section {
    padding: 0 var(--blog-gutter) 70px;
}

.blog-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--blog-line);
}

.blog-section__title {
    font-size: clamp(20px, 2.4vw, 30px);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: var(--blog-ink);
}

.blog-section__note {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blog-muted);
    white-space: nowrap;
}

/* ─── Хлебные крошки ─────────────────────────────────────── */
.blog-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0 var(--blog-gutter) 24px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

.blog-breadcrumbs a {
    color: var(--blog-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

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

.blog-breadcrumbs__sep {
    opacity: 0.45;
}

.blog-breadcrumbs__current {
    color: var(--blog-ink);
}

/* ─── Плитка категорий ───────────────────────────────────── */
.blog-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.blog-category-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--blog-line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--blog-surface);
    color: var(--blog-ink);
    text-decoration: none;
    transition: border-color 0.25s ease;
}

.blog-category-card:hover {
    border-color: var(--blog-accent);
}

.blog-category-card__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e9e9e9;
}

.blog-category-card__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.blog-category-card:hover .blog-category-card__bg {
    transform: scale(1.05);
}

.blog-category-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 18px 20px 20px;
}

/* Категория без изображения — карточка только с текстом */
.blog-category-card.is-plain .blog-category-card__body {
    padding-top: 24px;
}

.blog-category-card__name {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 6px;
    color: var(--blog-ink);
}

.blog-category-card__desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--blog-muted);
    margin: 0 0 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-category-card__count {
    margin-top: auto;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

/* ─── Метки ──────────────────────────────────────────────── */
.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.blog-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--blog-line);
    border-radius: 100px;
    background: var(--blog-surface);
    font-size: 13px;
    line-height: 1;
    color: #444;
    text-decoration: none;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.blog-tag:hover,
.blog-tag.is-active {
    border-color: var(--blog-accent);
    color: var(--blog-accent);
}

.blog-tag.is-active {
    background: rgba(250, 130, 29, 0.08);
}

.blog-tag__count {
    font-size: 11px;
    opacity: 0.55;
}

/* Метки внутри статьи и карточек */
.blog-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ─── Карточка статьи ────────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
}

.blog-card {
    display: flex;
    flex-direction: column;
}

.blog-card__media {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 16 / 9;
    margin-bottom: 18px;
    background: #e9e9e9;
}

.blog-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.blog-card:hover .blog-card__media img {
    transform: scale(1.04);
}

.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

.blog-card__meta a {
    color: var(--blog-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

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

.blog-card__meta .sep {
    opacity: 0.4;
}

.blog-card__title {
    font-size: clamp(18px, 2vw, 22px);
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 10px;
}

.blog-card__title a {
    color: inherit;
    text-decoration: none;
}

.blog-card__excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--blog-muted);
    margin: 0 0 18px;
    flex: 1;
}

.blog-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.blog-card__read {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.blog-card__time {
    font-size: 12px;
    color: var(--blog-muted);
    white-space: nowrap;
}

/* ─── Популярные статьи ──────────────────────────────────── */
.blog-popular {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    counter-reset: popular;
}

.blog-popular__item {
    display: flex;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    padding-top: 14px;
    border-top: 1px solid var(--blog-line);
}

.blog-popular__num {
    counter-increment: popular;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: var(--blog-accent);
    line-height: 1.5;
    flex-shrink: 0;
}

.blog-popular__num::before {
    content: '0' counter(popular);
}

.blog-popular__title {
    display: block;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
    margin: 0 0 6px;
    transition: color 0.25s ease;
}

.blog-popular__item:hover .blog-popular__title {
    color: var(--blog-accent);
}

.blog-popular__meta {
    display: block;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

/* ─── Карточка автора ────────────────────────────────────── */
.blog-author-card {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    padding: 30px;
    border: 1px solid var(--blog-line);
    border-radius: 8px;
    background: var(--blog-surface);
}

.blog-author-card__photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #e9e9e9;
}

.blog-author-card__name {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--blog-ink);
}

.blog-author-card__position {
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blog-accent);
    margin: 0 0 14px;
}

.blog-author-card__bio {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
    margin: 0 0 16px;
    white-space: pre-line;
}

.blog-author-card__socials {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
}

.blog-author-card__socials a {
    color: var(--blog-muted);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    transition: color 0.25s ease;
}

.blog-author-card__socials a:hover {
    color: var(--blog-accent);
}

/* Подпись автора в статье */
.blog-author-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.blog-author-inline img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.blog-author-inline span {
    transition: color 0.25s ease;
}

.blog-author-inline:hover span {
    color: var(--blog-accent);
}

/* ─── Метрики статьи (символы / время чтения) ────────────── */
.blog-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

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

.blog-stats i {
    font-size: 11px;
    color: var(--blog-accent);
}

/* ─── CTA блоки ──────────────────────────────────────────── */
.cta-block {
    border-radius: 8px;
    padding: 40px;
    background: #f0f0f0;
    text-align: center;
}

.cta-block--html {
    padding: 0;
    background: transparent;
    text-align: left;
}

.cta-block__title {
    font-size: clamp(20px, 2.6vw, 30px);
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 12px;
    color: var(--blog-ink);
}

.cta-block__desc {
    font-size: 16px;
    line-height: 1.7;
    color: #555;
    margin: 0 auto 24px;
    max-width: 560px;
}

.cta-block__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 100px;
    background: var(--blog-ink);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.cta-block__btn:hover {
    background: var(--blog-accent);
    transform: translateY(-2px);
}

.cta-block__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--blog-accent);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
}

/* ─── Popup для CTA ──────────────────────────────────────── */
#cta-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 24px;
}

#cta-popup.is-open {
    display: flex;
}

.cta-popup__dialog {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    padding: 40px;
}

.cta-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: var(--blog-ink);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.25s ease;
}

.cta-popup__close:hover {
    background: var(--blog-accent);
    color: #fff;
}

/* ─── Пагинация ──────────────────────────────────────────── */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 40px 0 80px;
    font-size: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.blog-pagination a {
    color: inherit;
    text-decoration: none;
}

.blog-pagination .is-disabled {
    opacity: 0.3;
}

.blog-pagination__counter {
    color: var(--blog-muted);
}

.blog-pagination__pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.blog-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 100px;
    color: var(--blog-muted);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.blog-pagination a.blog-pagination__page:hover {
    color: var(--blog-ink);
    background: rgba(0, 0, 0, 0.05);
}

.blog-pagination__page.is-current {
    color: #fff;
    background: var(--blog-ink);
}

.blog-pagination__gap {
    color: var(--blog-muted);
    padding: 0 2px;
}

/* ─── Адаптив ────────────────────────────────────────────── */
@media only screen and (max-width: 1024px) {
    :root {
        --blog-gutter: 40px;
    }
}

@media only screen and (max-width: 767px) {
    :root {
        --blog-gutter: 24px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .blog-categories {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 14px;
    }

    .blog-section__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .blog-author-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px;
    }

    .blog-author-card__socials {
        justify-content: center;
    }

    .cta-block {
        padding: 28px 22px;
    }

    .cta-popup__dialog {
        padding: 28px 20px;
    }
}

@media only screen and (max-width: 479px) {
    .blog-categories {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════════════════════
   Хаб блога: компактный hero, чипсы рубрик, главный материал,
   блоки по рубрикам, плотный архив
   ══════════════════════════════════════════════════════════ */

/* ─── Компактный hero листингов блога ────────────────────── */
.blog-page #hero-caption.blog-hero-compact {
    height: calc(46 * var(--dvh, 1vh));
    min-height: 320px;
}

/* Архивные листинги: заголовок ниже по размеру — оптический сдвиг -0.5vw
   у .hero-title только ломает выравнивание с подзаголовком */
.blog-page #hero-caption.blog-hero-archive .hero-title {
    left: 0;
    margin-bottom: 18px;
}

.blog-page #hero-caption.blog-hero-archive .hero-subtitle {
    max-width: 900px;
}

/* ─── Чипсы рубрик ───────────────────────────────────────── */
.blog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 var(--blog-gutter) 44px;
}

.blog-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--blog-line);
    border-radius: 100px;
    font-size: 13px;
    line-height: 1;
    color: var(--blog-ink);
    text-decoration: none;
    background: var(--blog-surface);
    transition: border-color 0.25s ease, color 0.25s ease;
}

.blog-chip:hover,
.blog-chip.is-active {
    border-color: var(--blog-accent);
    color: var(--blog-accent);
}

.blog-chip__count {
    font-size: 11px;
    color: var(--blog-muted);
}

.blog-chip:hover .blog-chip__count,
.blog-chip.is-active .blog-chip__count {
    color: var(--blog-accent);
}

.blog-chip.is-more {
    background: transparent;
    border-style: dashed;
}

/* ─── Главный материал ───────────────────────────────────── */
.blog-featured {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 44px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--blog-line);
}

.blog-featured__media {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 16 / 10;
    background: #e9e9e9;
}

.blog-featured__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.blog-featured:hover .blog-featured__media img {
    transform: scale(1.04);
}

.blog-featured__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blog-muted);
    margin-bottom: 16px;
}

.blog-featured__meta a {
    color: var(--blog-muted);
    text-decoration: none;
}

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

.blog-featured__label {
    color: var(--blog-accent);
}

.blog-featured__title {
    font-size: clamp(24px, 3.2vw, 42px);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 18px;
}

.blog-featured__title a {
    color: var(--blog-ink);
    text-decoration: none;
}

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

.blog-featured__excerpt {
    font-size: 16px;
    line-height: 1.6;
    color: var(--blog-muted);
    margin: 0 0 24px;
}

.blog-featured__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.blog-featured__time {
    font-size: 12px;
    color: var(--blog-muted);
    white-space: nowrap;
}

/* Круг курсора считает позицию от левого края текста (common.js) —
   16px держат его по центру стрелки при icon-wrap 28px */
.blog-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ─── Блок рубрики на хабе ───────────────────────────────── */
.blog-cat-block__link {
    color: inherit;
    text-decoration: none;
}

.blog-cat-block__link:hover {
    color: var(--blog-accent);
}

.blog-section__more {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blog-muted);
    text-decoration: none;
    white-space: nowrap;
}

.blog-section__more:hover {
    color: var(--blog-accent);
}

.blog-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 28px;
}

/* ─── Плотный архив ──────────────────────────────────────── */
.blog-rows {
    border-top: 1px solid var(--blog-line);
}

.blog-row {
    display: grid;
    grid-template-columns: 92px 168px 1fr auto;
    align-items: baseline;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--blog-line);
    text-decoration: none;
    color: var(--blog-ink);
    transition: color 0.2s ease;
}

.blog-row:hover {
    color: var(--blog-accent);
}

.blog-row__date,
.blog-row__cat,
.blog-row__time {
    font-size: 12px;
    color: var(--blog-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-row__cat {
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.blog-row__title {
    font-size: 17px;
    line-height: 1.35;
}

/* ─── Ссылка в полный архив ──────────────────────────────── */
.blog-archive-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.blog-archive-cta__note {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blog-muted);
}

@media only screen and (max-width: 1024px) {
    .blog-page #hero-caption.blog-hero-compact {
        height: auto;
        min-height: 0;
    }

    .blog-featured {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media only screen and (max-width: 767px) {
    .blog-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 12px;
        padding: 18px 0;
    }

    .blog-row__title {
        order: -1;
        width: 100%;
        font-size: 16px;
    }

    .blog-archive-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media only screen and (max-width: 767px) {
    .blog-pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .blog-pagination__page {
        min-width: 30px;
        height: 30px;
        padding: 0 6px;
    }
}

/* ══════════════════════════════════════════════════════════
   Колонки сеток на широких экранах
   auto-fill плодил пустые треки справа: в блоке рубрики всего
   4 карточки, а на ~2400px создавалось ~9 колонок по 240px
   ══════════════════════════════════════════════════════════ */

/* Блоки с фиксированным числом карточек (до 4) — растягиваем по ширине */
.blog-grid--compact,
.blog-popular {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Длинные списки — детерминированное число колонок вместо auto-fill,
   иначе на широком экране получалось 7 узких карточек */
.blog-grid:not(.blog-grid--compact):not(.blog-grid--related) {
    grid-template-columns: repeat(4, 1fr);
}

/* Похожие статьи: широкие карточки, две в строку */
.blog-grid--related {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 60px;
}

@media only screen and (max-width: 1599px) {
    .blog-grid:not(.blog-grid--compact):not(.blog-grid--related) {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media only screen and (max-width: 1199px) {
    .blog-grid:not(.blog-grid--compact):not(.blog-grid--related) {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media only screen and (max-width: 767px) {
    .blog-grid:not(.blog-grid--compact),
    .blog-grid--related {
        grid-template-columns: 1fr;
    }
}

/* ─── Страница авторов ───────────────────────────────────── */
.blog-authors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.blog-author-card__name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.25s ease;
}

.blog-author-card__name a:hover {
    color: var(--blog-accent);
}

.blog-authors__all {
    margin: 18px 0 0;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.blog-authors__all a {
    color: var(--blog-muted);
    text-decoration: none;
    transition: color 0.25s ease;
}

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

@media only screen and (max-width: 767px) {
    .blog-authors {
        grid-template-columns: 1fr;
    }
}


/* Блок «Услуги по теме» в конце статьи.
   Ссылки крупные, но не как заголовки: это навигация, а не акцент. */
.post-services__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
}

.post-services__item a {
    display: inline-block;
    font-size: 18px;
    line-height: 1.4;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    transition: border-color 0.3s ease, opacity 0.3s ease;
}

.post-services__item a:hover {
    border-bottom-color: rgba(0, 0, 0, 0.6);
    opacity: 0.75;
}

@media only screen and (max-width: 767px) {
    .post-services__list { gap: 10px 20px; }
    .post-services__item a { font-size: 16px; }
}
