/* ============================================
   BLOG PAGE STYLES
   Наследует переменные и базу из style.css
   ============================================ */

/* ============================================
   BLOG HERO
   ============================================ */
.blog-hero {
    padding: 60px 0 60px;
    background: var(--c-dark);
    text-align: center;
}

/* ============================================
   BLOG PAGE HEADER FIXES
   ============================================ */

/* Спейсер компенсирует высоту fixed-шапки + top-bar */
.blog-page .header-spacer {
    height: calc(80px + 36px);
}

/* Top-bar остается фиксированным на десктопе */
.blog-page .top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    height: 36px;
}

/* Header смещается под top-bar */
.blog-page .header {
    position: fixed;
    top: 36px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
    transition: background .4s ease, border-color .4s ease, box-shadow .4s ease;
    overflow: visible;
}

.blog-page .header__inner {
    height: 80px;
}

.blog-page .header__sitename { color: var(--c-dark); }
.blog-page .header__nav a { color: var(--c-body); }
.blog-page .header__nav a:hover { color: var(--c-dark); }
.blog-page .header__phone-btn { border-color: var(--c-border); color: var(--c-dark); }
.blog-page .header__burger span { background: var(--c-dark); }
.blog-page .header__logo { background: var(--c-dark); color: var(--c-white); border-color: var(--c-dark); }

.blog-hero__title {
    font-family: var(--ff-serif);
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 600;
    color: var(--c-white);
    margin-bottom: 12px;
    line-height: 1.15;
}

.blog-hero__subtitle {
    font-size: 17px;
    color: rgba(255, 255, 255, .6);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ============================================
   BLOG TOOLBAR — поиск, сортировка, вид
   ============================================ */
.blog-toolbar {
    padding: 24px 0;
    background: var(--c-lighter);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 116px;
    z-index: 100;
    transition: box-shadow var(--t-fast);
}

.blog-toolbar.stuck {
    box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
}

.blog-toolbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* --- Поиск --- */
.blog-toolbar__search {
    position: relative;
    flex: 0 1 360px;
}

.blog-toolbar__search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--c-muted);
    pointer-events: none;
}

.blog-toolbar__search input {
    padding: 12px 18px 12px 42px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-pill);
    font-size: 14px;
    background: var(--c-white);
    width: 100%;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.blog-toolbar__search input:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(212, 133, 10, .1);
}

/* --- Контролы --- */
.blog-toolbar__controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.blog-toolbar__sort,
.blog-toolbar__view {
    display: flex;
    padding: 3px;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-pill);
    gap: 2px;
}

.blog-toolbar__sort-btn,
.blog-toolbar__view-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-muted);
    border-radius: var(--r-pill);
    transition: all var(--t-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.blog-toolbar__sort-btn.active,
.blog-toolbar__view-btn.active {
    background: var(--c-dark);
    color: var(--c-white);
}

.blog-toolbar__sort-btn:hover:not(.active),
.blog-toolbar__view-btn:hover:not(.active) {
    color: var(--c-dark);
    background: var(--c-lighter);
}

/* ============================================
   BLOG GRID
   ============================================ */
.blog-content {
    padding: 48px 0 var(--section-py);
    background: var(--c-white);
    min-height: 50vh;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

/* ============================================
   BLOG GRID — LIST VIEW
   ============================================ */
.blog-grid.blog-grid--list {
    grid-template-columns: 1fr;
    gap: 20px;
}

.blog-grid--list .blog-card__link {
    flex-direction: row;
}

.blog-grid--list .blog-card__thumb {
    width: 280px;
    min-width: 280px;
    height: auto;
    aspect-ratio: auto;
    min-height: 200px;
}

.blog-grid--list .blog-card__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-grid--list .blog-card__excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   BLOG CARD
   ============================================ */
.blog-card {
    background: var(--c-white);
    border-radius: var(--r-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--t-mid), transform var(--t-mid);
}

.blog-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.blog-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* --- Миниатюра --- */
.blog-card__thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: var(--c-lighter);
}

.blog-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--t-slow);
}

.blog-card:hover .blog-card__thumb img {
    transform: scale(1.06);
}

/* --- Тело карточки --- */
.blog-card__body {
    padding: 22px 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.blog-card__date {
    font-size: 12px;
    font-weight: 500;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.blog-card__title {
    font-family: var(--ff-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--c-dark);
    line-height: 1.3;
    margin-bottom: 8px;
    transition: color var(--t-fast);
}

.blog-card:hover .blog-card__title {
    color: var(--c-accent);
}

.blog-card__excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--c-muted);
    margin-bottom: 16px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Подвал карточки --- */
.blog-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
}

.blog-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.blog-card__tag {
    display: inline-block;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-accent);
    background: rgba(212, 133, 10, .08);
    border-radius: var(--r-pill);
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}

.blog-card__stats {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.blog-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-muted);
}

.blog-card__stat i {
    font-size: 13px;
}

.blog-card__stat[title="Лайки"] i {
    color: #e74c3c;
}

/* ============================================
   BLOG EMPTY STATE
   ============================================ */
.blog-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--c-muted);
}

.blog-empty i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: .3;
}

.blog-empty p {
    font-size: 16px;
    line-height: 1.5;
}

/* ============================================
   CARD ANIMATION ON LOAD
   ============================================ */
.blog-card {
    opacity: 0;
    transform: translateY(24px);
    animation: blogCardIn .5s ease forwards;
}

.blog-card:nth-child(1) { animation-delay: .05s; }
.blog-card:nth-child(2) { animation-delay: .1s; }
.blog-card:nth-child(3) { animation-delay: .15s; }
.blog-card:nth-child(4) { animation-delay: .2s; }
.blog-card:nth-child(5) { animation-delay: .25s; }
.blog-card:nth-child(6) { animation-delay: .3s; }

@keyframes blogCardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE — TABLET
   ============================================ */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .blog-grid--list .blog-card__thumb {
        width: 220px;
        min-width: 220px;
    }

    .blog-toolbar__sort-btn span,
    .blog-toolbar__view-btn span {
        display: none;
    }
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 768px) {
    .blog-page .top-bar {
        display: none;
    }

    .blog-page .header {
        position: fixed;
        top: 0;
        z-index: 1000;
    }

    .blog-page .header-spacer {
        height: 72px;
    }

    .blog-toolbar {
        top: 72px;
        padding: 16px 0;
    }

    .blog-hero {
        padding: 44px 0 44px;
    }

    .blog-toolbar__inner {
        flex-direction: column;
        gap: 12px;
    }

    .blog-toolbar__search {
        flex: 1 1 100%;
        width: 100%;
    }

    .blog-toolbar__controls {
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
    }

    .blog-toolbar__controls::-webkit-scrollbar {
        display: none;
    }

    .blog-toolbar__sort-btn,
    .blog-toolbar__view-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    /* Скрываем текст, оставляем иконки */
    .blog-toolbar__sort-btn {
        font-size: 0;
    }
    .blog-toolbar__sort-btn i {
        font-size: 14px;
    }

    .blog-toolbar__view-btn {
        font-size: 0;
    }
    .blog-toolbar__view-btn i {
        font-size: 14px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* В мобильном листе — вертикальная раскладка */
    .blog-grid--list .blog-card__link {
        flex-direction: column;
    }

    .blog-grid--list .blog-card__thumb {
        width: 100%;
        min-width: 0;
        aspect-ratio: 16 / 10;
        min-height: auto;
    }

    .blog-card__body {
        padding: 18px 18px 20px;
    }

    .blog-card__title {
        font-size: 17px;
    }

    .blog-card__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .blog-hero {
        padding: 44px 0 36px;
    }

    .blog-hero__title {
        font-size: clamp(28px, 8vw, 40px);
    }

    .blog-hero__subtitle {
        font-size: 15px;
    }

    .blog-card__body {
        padding: 16px 14px 18px;
    }

    .blog-card__title {
        font-size: 16px;
    }

    .blog-card__excerpt {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }

    .blog-card__tag {
        font-size: 10px;
        padding: 3px 10px;
    }
}
