/**
 * Стили для кастомного вывода постов на главной странице
 */

/* Общие стили для всех карточек */
.custom-posts-layout {
    margin-bottom: 60px;
}

.posts-row {
    margin-bottom: 40px;
}

.post-card {
    background: #251a56;
    overflow: hidden;
    transition: transform 0.3s ease;
    position: relative;
    border-radius: 24px;
    padding: 24px;
}

.post-card a {
    color: #fff;
}

/* Ссылка на всю карточку */
.post-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
}

/* Категории поверх карточки */
.post-categories-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.post-categories a,
.post-categories-overlay a {
    display: inline-block;
    background: linear-gradient(180deg, #1A1A1F 0%, rgba(25, 25, 31, 0.8) 100%);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 12px 24px;
    border-radius: 999px;
    text-decoration: none;
    transition: background-color 0.3s ease;
    backdrop-filter: blur(4px);
    font-size: 18px;
    line-height: 28px;
    font-weight: 400;
}

.blog-hero-title {
    text-align: center;
    background: linear-gradient(270deg, #4785FF 25.54%, #B8A1E6 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-size: 60px;
    font-weight: 700;
    line-height: 105%;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.2s forwards;
}

.blog-hero-description {
    font-size: 18px;
    font-weight: 300;
    line-height: 145%;
    color: #fff;
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
}

.post-thumbnail-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100% !important;
}

.post-thumbnail-background:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 1;
}

.post-thumbnail-background .post-categories {
    top: 44px !important;
}

.post-card-style-3 .post-categories {
    left: 32px !important;
}

.post-card-style-2 .post-categories {
    left: 12px !important;
}

.post-card-grid h2 {
    font-size: 24px;
    line-height: 140%;
    margin-bottom: 0;
}

.post-card-grid .post-meta {
    margin-top: 20px;
}

.post-card-style-3 {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.post-card-style-3 .post-card-background-link {
    display: block;
    height: 100%;
    width: 100%;
    color: #fff;
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.post-card-style-3 .post-content-overlay {
    margin-top: 320px;
    padding: 20px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.post-card-grid.post-card-style-3 .post-content-overlay {
    margin-top: 220px;
}

.post-card-grid.post-card-style-3 .post-categories, .post-card-grid.post-card-style-2 .post-categories {
    position: absolute;
    top: 36px !important;
    left: 24px !important;
}

.post-card-grid.post-card-style-1 .post-categories {
    top: 12px !important;
    left: 12px !important;
}

.post-card-grid.post-card-style-2 .post-content {
    margin-top: 215px;
}

.post-thumbnail-background img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    position: relative;
    z-index: 0;
    transition: transform 0.5s ease;
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    transition: transform 0.5s ease;
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-card:hover .post-thumbnail-background img {
    transform: scale(1.05);
}

.post-content {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
}

.post-content a {
    color: #fff;
}

.post-title {
    font-size: 32px;
    color: #fff;
    line-height: 120%;
    font-weight: 500;
    margin-bottom: 20px;
}

.post-excerpt {
    font-size: 18px;
    color: #fff;
    line-height: 145%;
    font-weight: 300;
}

.post-excerpt p {
    margin: 0;
}

.post-meta {
    font-size: 14px;
    line-height: 145%;
    font-weight: 300;
    margin-top: 40px;
    color: #CABFD9;
}

.posts-column {
    border-radius: 24px;
}

.post-preview {
    display: flex;
    flex-direction: column;
}

.post-preview h2 {
    width: 100%;
}

/* Первая линия - карточка на всю ширину */
.posts-row-featured {
    max-width: 1296px;
    margin: 0 auto 32px;
}

.post-card-featured {
    display: flex;
    flex-direction: column;
    background-color: transparent;
    min-height: 500px;
    justify-content: center;
}

.post-card-featured .post-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.post-card-featured .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-featured .post-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 2;
}

.post-card-featured .post-content {
    position: relative;
    z-index: 3;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    height: 100%;
    color: #fff;
}

.post-card-featured .post-title {
    font-size: 48px;
    line-height: 120%;
    margin-bottom: 8px;
}

.post-card-featured .post-meta {
    color: rgba(255, 255, 255, 0.8);
}

/* Вторая линия - 2 блока с разными стилями */
.posts-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    max-width: 1296px;
    margin: 0 auto 32px;
}

/* Левый блок - стандартный */
.post-card-standard {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-thumbnail {
    border-radius: 24px;
}

.post-card-standard .post-thumbnail {
    height: 400px;
}

.post-categories {
    z-index: 999;
}

.post-thumbnail .post-categories {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 999;
}

.post-card-standard .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-standard .post-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Правый блок - минимальный */
.post-card-minimal {
    height: 100%;
    display: flex;
    align-items: flex-start;
}

.post-card-minimal .post-content {
    padding: 20px;
    color: #fff;
    gap: 44px;
}

.post-card-minimal .post-excerpt {
    color: rgba(255, 255, 255, 0.8);
}

/* Третья линия - 3 карточки */
.posts-row-triple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1296px;
    margin: 0 auto 40px;
}

.post-card-compact {
    display: flex;
    flex-direction: column;
}

.post-card-compact .post-thumbnail {
    height: 300px;
}

.post-card-compact .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Остальные посты в сетке */
.posts-row-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1296px;
    margin: 0 auto;
}

.post-card-grid {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Стандартная карточка */
.post-card-grid.post-card-style-1 .post-thumbnail {
    height: 200px;
}

.post-card-grid.post-card-style-1 .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Карточка без превью */
.post-card-grid.post-card-style-2 {
    background-color: #251a56;
    padding: 24px;
}

/* Карточка с превью на весь фон */
.post-card-grid.post-card-style-3 {
    padding: 0;
}

/* Адаптивность */
@media (max-width: 992px) {
    .posts-row-featured {
        margin-bottom: 30px;
    }

    .post-card-featured .post-title {
        font-size: 28px;
    }

    .blog-hero-title {
        font-size: 36px;
    }

    .blog-hero-description {
        font-size: 14px;
    }

    .posts-row-split {
        gap: 20px;
    }

    .posts-row-triple {
        grid-template-columns: repeat(2, 1fr);
    }

    .posts-row-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .posts-row-split {
        grid-template-columns: 1fr;
    }

    .post-card-featured .post-title {
        font-size: 24px;
        max-width: 90%;
    }

    .post-card-featured .post-excerpt {
        max-width: 90%;
    }

    .posts-row-triple {
        grid-template-columns: 1fr;
    }

    .posts-row-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .post-card-featured .post-title {
        font-size: 20px;
    }

    .post-card-featured .post-content {
        padding: 20px;
        padding-top: 80px;
    }

    .post-card-minimal .post-content {
        padding: 25px;
    }

    .post-card-minimal .post-title {
        font-size: 20px;
    }

    .post-card-featured .post-content {
        margin-top: 0;
        overflow: hidden;
    }

    .post-card-featured .post-content h2 {
        max-width: unset;
        font-size: 24px;
    }

    .post-card-featured .post-content .post-excerpt {
        max-width: unset;
    }
}

.posts-row-featured .post-categories-overlay {
    left: 50%;
    transform: translate(-50%, 0);
    display: flex;
    flex-wrap: wrap;

    a {
        white-space: nowrap;
    }
}

.posts-row-split .post-categories-overlay, .posts-row-triple .post-categories-overlay {
    left: 40px;
    top: 40px;
}
