/* ===============================
   BLOG + SINGLE BLOG
   Підключається тільки на blog.html та single-blog.html
   Усі селектори під префіксами .blog-* / .post-*,
   щоб не перетинатись зі style.css
=============================== */

:root {
    --blog-header-h: 90px;
}


/* ===============================
   БЛОК №2. ШАПКА СПИСКУ. START
=============================== */

.blog-list {
    padding: clamp(40px, 7vw, 72px) 0 clamp(48px, 8vw, 80px);
    background-color: var(--color-bg);
}

.blog-list__header {
    max-width: 860px;
    margin: 0 auto clamp(28px, 4vw, 44px);
    text-align: center;
}

.blog-list__title {
    margin: 0 0 16px;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: clamp(26px, 4.2vw, 52px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.blog-list__lead {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(15px, 1.6vw, 17px);
    line-height: 1.65;
    color: var(--color-text-second);
}

/* ===============================
   БЛОК №2. ШАПКА СПИСКУ. END
=============================== */


/* ===============================
   БЛОК №3. ФІЛЬТРИ ЗА РУБРИКАМИ. START
=============================== */

.blog-filters {
    margin-bottom: clamp(28px, 4vw, 44px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.blog-filters::-webkit-scrollbar {
    display: none;
}

/* Смужка ширша за екран — правий край розмивається,
   щоб було видно, що є продовження.
   Класи .has-overflow / .is-at-end ставить blog.js */
.blog-filters.has-overflow {
    -webkit-mask-image: linear-gradient(
        to right,
        #000 calc(100% - 56px),
        transparent 100%
    );
            mask-image: linear-gradient(
        to right,
        #000 calc(100% - 56px),
        transparent 100%
    );
}

.blog-filters.has-overflow.is-at-end {
    -webkit-mask-image: none;
            mask-image: none;
}

.blog-filters__list {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0;
    /* padding: 2px; */
    padding: 10px;
    list-style: none;
    white-space: nowrap;
}

.blog-filters__btn {
    padding: 9px 18px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: transparent;
    font-family: var(--font-heading);
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-second);
    transition: color var(--transition-fast),
                border-color var(--transition-fast),
                background-color var(--transition-fast);
}

@media (hover: hover) {
    .blog-filters__btn:hover {
        color: var(--color-text);
        border-color: var(--color-secondary);
    }
}

.blog-filters__btn.is-active {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-text-white);
}

/* ===============================
   БЛОК №3. ФІЛЬТРИ ЗА РУБРИКАМИ. END
=============================== */


/* ===============================
   БЛОК №4. СІТКА ПОСТІВ. START
=============================== */

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(24px, 3vw, 40px) clamp(20px, 2.4vw, 32px);
}

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

.blog-card[hidden] {
    display: none;
}

.blog-card__image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    background: var(--color-bg-second);
}

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

@media (hover: hover) {
    .blog-card:hover .blog-card__image img {
        transform: scale(1.06);
    }
}

.blog-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 10px;
    font-family: var(--font-heading);
    font-size: 13px;
    line-height: 1;
    color: var(--color-text-second);
}

.blog-card__tag {
    color: var(--color-secondary);
    letter-spacing: 0.01em;
}

.blog-card__title {
    margin: 0 0 10px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: clamp(17px, 1.4vw, 19px);
    line-height: 1.4;
}

.blog-card__title a {
    color: var(--color-text);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.blog-card__title a:hover,
.blog-card__title a:focus-visible {
    color: var(--color-secondary);
    text-decoration: none;
}

.blog-card__excerpt {
    margin: 0 0 16px;
    font-family: var(--font-heading);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-second);
}

.blog-card__more {
    margin-top: auto;
    align-self: flex-start;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 14px;
    color: var(--color-secondary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.blog-card__more:hover,
.blog-card__more:focus-visible {
    text-decoration: underline;
}

/* ===============================
   БЛОК №4. СІТКА ПОСТІВ. END
=============================== */


/* ===============================
   БЛОК №5. ПАГІНАЦІЯ. START
=============================== */

.blog-pagination {
    margin-top: clamp(36px, 5vw, 56px);
}

.blog-pagination__list {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-pagination__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg-second);
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--color-text-second);
    text-decoration: none;
    transition: background-color var(--transition-fast),
                color var(--transition-fast);
}

.blog-pagination__link:hover,
.blog-pagination__link:focus-visible {
    background: var(--color-border);
    color: var(--color-text);
    text-decoration: none;
}

.blog-pagination__link.is-active {
    background: var(--color-secondary);
    color: var(--color-text-white);
}

.blog-pagination__gap {
    width: 20px;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--color-text-second);
}

/* ===============================
   БЛОК №5. ПАГІНАЦІЯ. END
=============================== */


/* ===============================
   БЛОК №6. ПРОГРЕС ЧИТАННЯ. START
   Підпис-елемент сторінки статті
=============================== */

.post-progress {
    position: fixed;
    top: var(--blog-header-h);
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    pointer-events: none;
    z-index: 99;
}

.post-progress__bar {
    width: 100%;
    height: 100%;
    background: var(--color-secondary);
    transform: scaleX(0);
    transform-origin: 0 50%;
}

/* ===============================
   БЛОК №6. ПРОГРЕС ЧИТАННЯ. END
=============================== */


/* ===============================
   БЛОК №7. СТАТТЯ. START
=============================== */

.post {
    padding: clamp(40px, 7vw, 72px) 0 clamp(40px, 6vw, 64px);
    background-color: var(--color-bg);
}

.post__header {
    max-width: 980px;
    margin: 0 auto clamp(28px, 4vw, 40px);
    text-align: center;
}

.post__title {
    margin: 0 0 20px;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: clamp(25px, 3.6vw, 46px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.post__meta {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-heading);
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-second);
}

.post__meta li {
    display: flex;
    align-items: center;
    margin: 0;
}

.post__meta li:not(:last-child)::after {
    content: "";
    width: 14px;
    height: 1px;
    margin-left: 14px;
    background: var(--color-border);
}

.post__meta .post__meta-tag {
    color: var(--color-secondary);
}

.post__cover {
    max-width: 1180px;
    margin: 0 auto clamp(32px, 5vw, 56px);
    aspect-ratio: 2 / 1;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    background: var(--color-bg-second);
}

.post__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Прозовий стовпчик ---------- */

.post__body {
    /* max-width: 720px; */
    max-width: 1100px;
    margin: 0 auto;
    font-family: var(--font-heading);
    font-size: clamp(17px, 1.4vw, 19px);
    line-height: 1.75;
    color: var(--color-text);
}

.post__body p {
    margin: 0 0 1.3em;
}

.post__body h2 {
    margin: 2em 0 0.7em;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: clamp(21px, 2.2vw, 28px);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.post__body ul {
    margin: 0 0 1.3em;
    padding-left: 1.1em;
}

.post__body li {
    margin-bottom: 0.5em;
}

.post__body li::marker {
    color: var(--color-secondary);
}

.post__body a {
    color: var(--color-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post__quote {
    margin: 2em 0;
    padding: 4px 0 4px 24px;
    border-left: 2px solid var(--color-secondary);
    font-family: var(--font-main);
    font-weight: 500;
    font-size: clamp(18px, 1.7vw, 21px);
    line-height: 1.5;
    color: var(--color-text);
}

.post__figure {
    margin: 2.2em 0;
}

.post__figure img {
    width: 100%;
    border-radius: var(--border-radius-md);
}

.post__figure figcaption {
    margin-top: 12px;
    font-family: var(--font-heading);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-second);
}

/* ===============================
   БЛОК №7. СТАТТЯ. END
=============================== */


/* ===============================
   БЛОК №8. ПОПУЛЯРНІ ПОСТИ. START
=============================== */

.blog-popular {
    padding: clamp(36px, 6vw, 64px) 0 clamp(48px, 8vw, 80px);
    background-color: var(--color-bg);
}

.blog-popular__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: clamp(24px, 3.5vw, 40px);
}

.blog-popular__title {
    margin: 0;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: clamp(24px, 3.2vw, 42px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.blog-popular__link {
    color: var(--color-text-white);
    text-decoration: none;
}

.blog-popular__link:hover,
.blog-popular__link:focus-visible {
    text-decoration: none;
}

/* ===============================
   БЛОК №8. ПОПУЛЯРНІ ПОСТИ. END
=============================== */


/* ===============================
   АДАПТИВ
=============================== */

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

@media (max-width: 760px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .blog-filters__list {
        justify-content: flex-start;
    }

    .post__meta {
        gap: 6px 10px;
    }

    .post__meta li:not(:last-child)::after {
        width: 10px;
        margin-left: 10px;
    }
}

@media (max-width: 615px) {
    :root {
        --blog-header-h: 60px;
    }
}

@media (max-width: 400px) {
    .blog-pagination__list {
        gap: 6px;
    }

    .blog-pagination__link {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .post__quote {
        padding-left: 16px;
    }
}

/* ===============================
   REDUCED MOTION
=============================== */

@media (prefers-reduced-motion: reduce) {
    .blog-card__image img,
    .blog-filters__btn,
    .blog-pagination__link,
    .blog-card__title a {
        transition: none;
    }

    .blog-card:hover .blog-card__image img {
        transform: none;
    }
}
