/* =========================================================
   NEWS LAYOUT SWITCHER
   ========================================================= */
.news-wrapper {
    padding: 2rem 0;
}

.news-layout-switcher {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.news-layout-switcher__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    margin-right: 8px;
}

.news-layout-switcher__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.news-layout-switcher__btn:hover {
    background: #f1ecfb;
    color: #401caf;
}

.news-layout-switcher__btn.active {
    background: #401caf;
    color: #ffffff;
}

.news-layout-switcher__btn svg {
    flex-shrink: 0;
}

/* =========================================================
   GRID LAYOUT (Карточки)
   ========================================================= */
.news-grid-wrapper {
    --brand: #401caf;
    --brand-soft: #f1ecfb;
    --text-1: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
    --bg: #ffffff;
    --bg-page: #fafbfc;
    --border: #e2e8f0;
    --radius: 16px;
    --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-2: 0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.news-groups {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.news-group__title {
    display: inline-flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.news-group__month {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
}

.news-group__year {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-3);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.news-card {
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-1);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.news-card:hover {
    box-shadow: var(--shadow-2);
    border-color: #cbd5e1;
}

.news-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* === Медиа (изображение ВНИЗУ карточки) === */
.news-card__media {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    margin-top: auto;
}

/* Изображение заполняет весь блок */
.news-card__media img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    object-position: center;
    transition: transform 0.8s var(--ease);
}

.news-card:hover .news-card__media img {
    transform: scale(1.06);
}



.news-card__body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.news-card__top {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.news-card__date {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-shrink: 0;
    line-height: 1;
    min-width: 70px;
}

.news-card__date-day {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.news-card__date-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    font-weight: 600;
    line-height: 1.2;
}

.news-card__title {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-1);
    margin: 0;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s var(--ease);
    flex: 1;
    min-width: 0;
}

.news-card:hover .news-card__title {
    color: var(--brand);
}

.news-card__desc {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-2);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================
   TIMELINE LAYOUT (Временная шкала)
   ========================================================= */
.news-timeline-wrapper {
    padding: 2rem 0;
}

.news-timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding-left: 60px;
}

.news-timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #401caf 0%, #e2e8f0 100%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.timeline__marker {
    position: absolute;
    left: -48px;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #401caf;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(64, 28, 175, 0.2);
}

.timeline__content {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.timeline__header {
    margin-bottom: 1rem;
}

.timeline__date {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.timeline__day {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.timeline__month {
    font-size: 0.875rem;
    text-transform: lowercase;
    color: #475569;
    font-weight: 500;
}

.timeline__year {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
}

.timeline__title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
    margin: 0 0 1rem 0;
}

.timeline__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.timeline__title a:hover {
    color: #401caf;
}

/* === TIMELINE LAYOUT — Исправление размеров изображений === */
.timeline__image {
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
    max-height: 300px; /* Ограничение высоты */
    max-width: 100%;
    display: flex;
    justify-content: flex-start; /* Выравнивание по левому краю */
}

.timeline__image img {
    max-width: 100%;
    max-height: 300px; /* Ограничение высоты */
    width: auto; /* Автоширина для сохранения пропорций */
    height: auto; /* Автовысота */
    object-fit: contain; /* Вписываем изображение без обрезки */
    object-position: left center; /* Позиционируем слева */
    display: block;
}

/* Для логотипов и маленьких изображений */
.timeline__image img[src*="logo"],
.timeline__image img[alt*="логотип"],
.timeline__image img[alt*="Логотип"] {
    max-height: 150px; /* Ещё меньше для логотипов */
    max-width: 300px; /* Ограничение ширины */
}

.timeline__desc {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #475569;
    margin: 0 0 1rem 0;
}

.timeline__read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #401caf;
    text-decoration: none;
    transition: gap 0.3s ease;
}

.timeline__read-more:hover {
    gap: 12px;
}

/* =========================================================
   LIST LAYOUT (Компактный список)
   ========================================================= */
.news-list-wrapper {
    padding: 2rem 0;
}

.news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-list__item {
    display: flex;
    gap: 1.5rem;
    padding: 1.25rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    opacity: 0;
    transform: translateY(12px);
}

.news-list__item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.news-list__item:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

/* === LIST LAYOUT — Ограничение размеров изображений === */
.news-list__image {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-list__image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

/* Для логотипов и маленьких изображений — ещё меньше */
.news-list__image img[src*="logo"],
.news-list__image img[alt*="логотип"],
.news-list__image img[alt*="Логотип"],
.news-list__image img[width="401"],
.news-list__image img[height="126"] {
    max-width: 80px;
    max-height: 60px;
}

.news-list__content {
    flex: 1;
    min-width: 0;
}

.news-list__date {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #401caf;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.news-list__title {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
}

.news-list__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.news-list__title a:hover {
    color: #401caf;
}

.news-list__desc {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #475569;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================
   АДАПТИВНОСТЬ
   ========================================================= */
@media (max-width: 1100px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }
}

@media (max-width: 768px) {
    .news-layout-switcher {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .news-layout-switcher__btn span {
        display: none;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .news-card__date-day {
        font-size: 2rem;
    }
    
    .news-timeline {
        padding-left: 40px;
    }
    
    .news-timeline::before {
        left: 10px;
    }
    
    .timeline__image {
        max-height: 200px;
    }
    
    .timeline__image img {
        max-height: 200px;
    }
    
    .timeline__image img[src*="logo"],
    .timeline__image img[alt*="логотип"],
    .timeline__image img[alt*="Логотип"] {
        max-height: 100px;
        max-width: 200px;
    }

    .timeline__marker {
        left: -38px;
        width: 12px;
        height: 12px;
    }
    
    .news-list__item {
        flex-direction: column;
        gap: 1rem;
    }
    
    .news-list__image {
        width: 100%;
        height: 180px;
    }

    .news-list__image img {
        max-width: 200px;
        max-height: 150px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-card,
    .timeline-item,
    .news-list__item,
    .news-card__img {
        transition: none !important;
    }
    
    .news-card,
    .timeline-item,
    .news-list__item {
        opacity: 1;
        transform: none;
    }
}