/**
 * Стили для блока новостей
 *
 * @package Empty_Theme
 */

.news-section {
    padding: 70px 0;
    background-color: transparent;
    position: relative;
    overflow: hidden;
    margin-top: 100px;
}

.news-title {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, #0071CE, #004b96, #0090ff, #00a1ff, #0071CE);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #0071CE; /* Запасной цвет */
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
    width: 100%;
    animation: gradient-animation 5s ease infinite;
    text-shadow: 0 2px 10px rgba(0, 113, 206, 0.15);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.news-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Добавляем максимальную ширину и убеждаемся, что содержимое не выходит за пределы */
    width: 100%;
    max-width: 100%;
    position: relative;
    box-sizing: border-box;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 113, 206, 0.15);
}

.news-card-image {
    height: 200px;
    overflow: hidden;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    filter: brightness(0.95);
    border-bottom: 3px solid #0071CE;
}

.news-card:hover .news-card-image img {
    transform: scale(1.05);
    filter: brightness(1.05);
}

.news-card:hover .news-card-image img {
    transform: scale(1.05);
}

.news-card-content {
    padding: 25px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.news-card-date {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.news-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
    /* Улучшаем отображение длинных заголовков */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.8em; /* примерно 2 строки */
    word-wrap: break-word;
    word-break: break-word;
}

.news-card-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.news-card-title a:hover {
    color: #0071CE;
}

.news-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
    font-family: 'Roboto', sans-serif;
    flex-grow: 1;
    /* Добавляем ограничения для текста */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.8em; /* примерно 3 строки текста */
    word-wrap: break-word;
}

.news-read-more {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: #0071CE;
    text-decoration: none;
    position: relative;
    padding-bottom: 2px;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    margin-top: auto;
}

.news-read-more::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #0071CE;
    transition: width 0.3s ease;
}

.news-read-more:hover {
    color: #005da7;
}

.news-read-more:hover::after {
    width: 100%;
}

.all-news-link-container {
    text-align: center;
    margin-top: 20px;
}

.all-news-link {
    display: inline-block;
    background-color: #0071CE;
    color: #fff;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 113, 206, 0.3);
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.5px;
}

.all-news-link:hover {
    background-color: #005da7;
    box-shadow: 0 8px 20px rgba(0, 113, 206, 0.4);
    transform: translateY(-2px);
}

.no-news {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Добавляем анимацию появления для карточек новостей */
@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card {
    animation: cardAppear 0.8s ease forwards;
}

.news-card:nth-child(1) {
    animation-delay: 0.1s;
}

.news-card:nth-child(2) {
    animation-delay: 0.3s;
}

.news-card:nth-child(3) {
    animation-delay: 0.5s;
}

/* Анимация для даты при наведении */
.news-card-date {
    transition: color 0.3s ease, transform 0.3s ease;
}

.date-hover {
    color: #0071CE !important;
    transform: translateX(5px);
}

/* Адаптивные стили */
@media (max-width: 992px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .news-title {
        font-size: 30px;
    }
}

@media (max-width: 768px) {
    .news-section {
        padding: 50px 0;
        margin-top: 120px;
    }

    .news-title {
        font-size: 28px;
        margin-bottom: 30px;
    }
}

@media (max-width: 576px) {
    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-card-image {
        height: 180px;
    }

    .news-card-content {
        padding: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .news-card-title {
        font-size: 16px;
        /* Улучшаем отображение на мобильных */
        -webkit-line-clamp: 2;
        max-height: 2.6em;
    }

    .news-card-excerpt {
        font-size: 14px;
        /* Уменьшаем количество строк для мобильных */
        -webkit-line-clamp: 2;
        max-height: 3.2em;
        margin-bottom: 12px;
    }

    .all-news-link {
        padding: 10px 25px;
        font-size: 15px;
    }

    /* Убедимся, что все элементы имеют правильное поведение переполнения */
    .news-card * {
        max-width: 100%;
        box-sizing: border-box;
    }
}
