@font-face {
    font-family: 'HelveticaNeueCyr Thin';
    src: url('../fonts/helveticaneuecyr_thin.otf') format('opentype');
    font-weight: 300; /* Тонкое начертание */
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HelveticaNeueCyr Roman';
    src: url('../fonts/helveticaneuecyr_roman.otf') format('opentype');
    font-weight: normal; /* Обычное начертание */
    font-style: normal;
    font-display: swap;
}

/* Стили для блока новостей */
.news-section {
    background-color: #FAFAFA;
    padding: 60px 0;
    width: 100%;
}

.news-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 15px;
}

.news-heading-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 0 15px;
}

.news-heading {
    font-family: 'Roboto', sans-serif;
    font-size: 40px !important;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
    margin-left: 90px; 
    margin-top: 30px
}

@media (min-width: 1280px) and (max-width: 1536px) {
  .news-heading {
    margin-left: 105px;
  }
}

.news-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#news-page-indicator {
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    color: #333;
}

.news-nav {
    width: 48px;
    height: 48px;
    border: 2px solid #999;
    background: white;
    font-size: 22px;
    color: #00a9ce;
    cursor: pointer;
    clip-path: polygon(0 0, 85% 0, 100% 15%, 100% 100%, 15% 100%, 0 85%);
    transition: border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-nav:hover {
    border-color: #00a9ce;
}

/* Анимации и контейнер для новостей */
.news-pages-container {
    position: relative;
    min-height: 500px;
    overflow: hidden;
}

.news-grid {
    transition: all 0.5s ease;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.news-page {
    transition: transform 0.5s ease, opacity 0.5s ease;
    width: 100%;
}

.news-page-1 {
    position: relative;
    opacity: 1;
    transform: translateX(0);
}

.news-page-2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateX(100%);
}

.news-page-2.active {
    position: relative;
    opacity: 1;
    transform: translateX(0);
    display: flex;
}

.news-page-1:not(.active) {
    position: absolute;
    opacity: 0;
    transform: translateX(-100%);
}

/* Стили карточек новостей */
.news-card {
    flex: 1 1 calc(33.333% - 20px);
    min-width: 300px;
    background: white;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.news-image-container {
    height: auto; /* Высота по содержимому (картинке) */
    overflow: hidden; /* Скрываем содержимое, выходящее за границы */
    flex-shrink: 0; /* Запрещаем сжиматься */
}


.news-image {
    width: 100%; /* Ширина по контейнеру */
    height: auto; /* Высота автоматически по пропорциям */
    object-fit: contain; /* Вмещаем изображение без обрезки */
    display: block;
}

.news-content {
    padding: 25px;
}

.news-title {
    font-family: 'Roboto', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

@media (min-width: 1280px) and (max-width: 1536px) {
  .news-card .news-title {
    line-height: 1.3;          /* зафиксируй межстрочный */
    margin-bottom: 8px;        /* чтобы описание не «улетало» вниз */
    height: calc(1.3em * 3);   /* РОВНО две строки по высоте */
    overflow: hidden;          /* скрыть лишнее */
    display: -webkit-box;      
    -webkit-line-clamp: 3;     /* обрезать до 2 строк */
    -webkit-box-orient: vertical;
  }
}

.news-text {
    font-family: 'HelveticaNeueCyr Roman', Arial, sans-serif;
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.news-read-more {
    font-family: 'HelveticaNeueCyr Roman', Arial, sans-serif;
    font-size: 16px;
    color: #00a9ce;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.news-read-more:hover {
    color: #007c9b;
}

.news-read-more::after {
    content: "→";
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.news-read-more:hover::after {
    transform: translateX(3px);
}

/* Анимации направления */
.news-pages-container.animating-next .news-page-1:not(.active) {
    transform: translateX(-100%);
    opacity: 0;
}

.news-pages-container.animating-next .news-page-2.active {
    animation: slideInFromRight 0.5s ease forwards;
}

.news-pages-container.animating-prev .news-page-2:not(.active) {
    transform: translateX(100%);
    opacity: 0;
}

.news-pages-container.animating-prev .news-page-1.active {
    animation: slideInFromLeft 0.5s ease forwards;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Адаптация для мобильных устройств */
@media (max-width: 992px) {
    .news-grid {
        justify-content: center;
    }
    
    .news-card {
        flex: 1 1 calc(50% - 15px);
        max-width: calc(50% - 15px);
    }
}

@media (max-width: 768px) {
    /* Сохраняем существующие стили карточек */
    .news-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
    
    /* Модифицируем только блок с заголовком и переключателями */
    .news-heading-wrapper {
        flex-direction: row !important; /* Оставляем в одной строке */
        align-items: center !important;
        justify-content: space-between !important;
        padding-left: 1px !important; /* Отступ слева 15px */
        padding-right: 15px !important;
        gap: 15px !important;
        margin-bottom: 30px !important;
    }
    
    .news-heading {
        font-size: 28px !important;
        margin: 0 !important; /* Убираем все отступы */
        text-align: left !important; /* Выравниваем по левому краю */
        flex-grow: 1 !important; /* Занимает доступное пространство */
    }
    
    .news-controls {
        margin: 0 !important;
        flex-shrink: 0 !important; /* Предотвращает сжатие */
    }
}

/* Специальные стили для iPhone 12 Pro и аналогичных (390px) */
@media (max-width: 390px) {
    .news-heading-wrapper {
        padding-left: 10px !important;
        padding-right: 10px !important;
        gap: 10px !important;
        margin-bottom: 20px !important;
    }
    
    .news-heading {
        font-size: 22px !important; /* Уменьшаем размер шрифта */
        line-height: 1.3 !important; /* Оптимизируем межстрочный интервал */
    }
    
    .news-controls {
        gap: 5px !important; /* Уменьшаем промежутки между элементами */
    }
    
    /* Стили для кнопок переключения */
    .news-nav {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    /* Стили для индикатора страниц */
    .news-page-indicator {
        font-size: 12px !important;
    }
    
    /* Дополнительные стили для карточек новостей */
    .news-card {
        margin-bottom: 15px !important;
    }
    
    .news-card-content {
        padding: 15px !important;
    }
    
    .news-card-title {
        font-size: 16px !important;
    }
    
    .news-card-date {
        font-size: 12px !important;
    }
}

.news-pages-container {
    display: flex;
    flex-direction: column;
}

/* Отключаем влияние скрытых страниц */
.news-grid:not(.active) {
    display: none !important;
}


/* Адаптация для планшетов */
@media (max-width: 992px) {
    .news-grid {
        justify-content: center;
        gap: 15px;
    }
    
    .news-card {
        flex: 1 1 calc(50% - 15px);
        max-width: calc(50% - 15px);
    }
    
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
    
    .news-heading {
        margin-left: 50px;
        font-size: 32px !important;
    }
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    .news-section {
        padding: 40px 0;
    }
    
    .news-grid {
        flex-direction: column;
        gap: 20px;
    }
    
    .news-card {
        flex: 1 1 100%;
        max-width: 100%;
        min-width: unset; /* Убираем фиксированную минимальную ширину */
    }
    
    /* АДАПТИВНЫЕ ИЗОБРАЖЕНИЯ ДЛЯ МОБИЛЬНЫХ */
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
    
    .news-content {
        padding: 20px;
    }
    
    .news-title {
        font-size: 18px;
        line-height: 1.3;
    }
    
    .news-text {
        font-size: 14px;
    }
    
    /* Заголовок и контролы */
    .news-heading-wrapper {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 10px;
        margin-bottom: 30px;
    }
    
    .news-heading {
        font-size: 24px !important;
        margin: 0 !important;
        text-align: left;
        flex-grow: 1;
    }
}

/* Специальные стили для маленьких экранов (iPhone 12 Pro и аналогичные) */
@media (max-width: 480px) {
    .news-container {
        padding: 0 10px;
    }
    
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
    
    .news-content {
        padding: 15px;
    }
    
    .news-title {
        font-size: 16px;
        height: auto; /* Убираем фиксированную высоту */
        -webkit-line-clamp: 3; /* Ограничиваем 3 строками */
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .news-heading {
        font-size: 20px !important;
    }
    
    .news-controls {
        gap: 8px;
    }
    
    .news-nav {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    #news-page-indicator {
        font-size: 14px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .news-image-container {
        height: 180px;
    }
    
    .news-heading {
        font-size: 18px !important;
    }
    
    .news-nav {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Убедимся, что изображения всегда responsive */
.news-image {
    max-width: 100%;
    height: auto; /* Добавляем auto для сохранения пропорций */
}

/* Дополнительные улучшения для производительности */
.news-image {
    transition: transform 0.3s ease;
}

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

/* Убедимся, что контейнеры адаптируются по высоте изображений */
.news-image-container {
    height: auto; /* Высота по содержимому (картинке) */
    overflow: hidden; /* Скрываем содержимое, выходящее за границы */
    flex-shrink: 0;
    position: relative;
}

/* Дополнительные стили для изображений */
.news-image {
    width: 100%; /* Ширина по контейнеру */
    height: auto; /* Высота автоматически по пропорциям */
    object-fit: contain; /* Вмещаем изображение без обрезки */
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

/* Адаптация для планшетов */
@media (max-width: 992px) {
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
}

/* Адаптация для маленьких мобильных */
@media (max-width: 480px) {
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .news-image-container {
        height: auto; /* Высота по содержимому */
    }
}