/* =========================
   Блок тега
========================= */
.tag-block {
    max-width: 1400px;
    margin: 24px auto;
    padding: 20px 20px 30px;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

/* Заголовок тега */
.tag-title {
    display: block;
    width: 100%;
    font-size: 24px;
    color: #5a2b7a;
}

.tag-title::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    margin-top: 4px;
    background: linear-gradient(90deg, #0057b7, #ffd700);
    border-radius: 2px;
}

/* =========================
   Сетка постов
========================= */
.tag-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 40px;
    position: relative;
}

/* Карточка */
.tag-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tag-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* Ссылка на всю карточку */
.tag-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* Изображение */
.tag-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0;
}

/* Заголовок поста */
.tag-title-post {
    font-size: 18px;
    font-weight: 500;
    margin: 8px 12px 0;
    color: #333;
    transition: color 0.3s, text-decoration 0.3s;
}

.tag-card-link:hover .tag-title-post {
    color: #5a2b7a;
    text-decoration: underline;
}

/* Дата публикации */
.tag-date {
    font-size: 14px;
    color: #666;
    margin: 4px 12px 12px;
}

/* =========================
   Вертикальные линии
========================= */
.tag-card:not(:nth-child(3n))::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: -20px;
    width: 1px;
    background: linear-gradient(
        to bottom,
        rgba(90,43,122,0),
        rgba(90,43,122,0.2) 50%,
        rgba(90,43,122,0)
    );
    pointer-events: none;
}

/* Горизонтальные линии между рядами */
.tag-card:nth-child(n + 4)::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -20px;
    height: 1px;
    background: linear-gradient(
        to right,
        rgba(90,43,122,0),
        rgba(90,43,122,0.2) 50%,
        rgba(90,43,122,0)
    );
    pointer-events: none;
}

/* =========================
   Пагинация
========================= */
.tag-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    margin-bottom: 20px;
    width: 100%;
}

.tag-pagination ul.page-numbers {
    display: flex;
    gap: 10px;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.tag-pagination ul.page-numbers li {
    display: inline-block;
}

.tag-pagination ul.page-numbers li a,
.tag-pagination ul.page-numbers li span {
    display: block;
    padding: 8px 14px;
    font-size: 16px;
    color: #5a2b7a;
    background: #f0f0f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s;
}

.tag-pagination ul.page-numbers li a:hover {
    background: #5a2b7a;
    color: #fff;
}

.tag-pagination ul.page-numbers li span.current {
    background: #5a2b7a;
    color: #fff;
    pointer-events: none;
}

.tag-pagination ul.page-numbers li span.dots {
    background: transparent;
    color: #999;
}

.tag-pagination ul.page-numbers li a.prev,
.tag-pagination ul.page-numbers li a.next {
    font-weight: 500;
    color: #333;
}

.tag-pagination ul.page-numbers li a.prev:hover,
.tag-pagination ul.page-numbers li a.next:hover {
    color: #5a2b7a;
}

/* =========================
   Адаптив
========================= */
@media (max-width: 992px) {
    .tag-posts {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tag-posts {
        grid-template-columns: 1fr;
    }

    .tag-card:not(:nth-child(3n))::after {
        display: none;
    }

    .tag-card:nth-child(n + 2)::before {
        top: -20px;
    }

    .tag-pagination ul.page-numbers {
        gap: 6px;
    }

    .tag-pagination ul.page-numbers li a,
    .tag-pagination ul.page-numbers li span {
        padding: 6px 10px;
        font-size: 14px;
    }
}
