/* Стили страницы «history». Вынесены из templates/main/history.html без изменений:
   каскад тот же — <link> стоит там же, где стоял <style>. */
/* Заголовок истории — точь-в-точь site2 (слева: надзаголовок + h2 + подзаголовок) */
.hist-head { margin: 104px 0 40px; }
.hist-head .he-eyebrow { display: inline-flex; align-items: center; gap: 11px; font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #000b73; }
.hist-head .he-eyebrow::before { content: ""; width: 30px; height: 1.5px; background: #000f9f; display: inline-block; }
.hist-head .he-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: clamp(28px, 3.6vw, 38px); line-height: 1.08; letter-spacing: -.01em; color: #14161d; margin: 14px 0 0; }
.hist-head .he-sub { font-family: 'Montserrat', sans-serif; font-size: 15px; line-height: 1.55; color: #474b58; margin: 10px 0 0; max-width: 60ch; }
/* main.css сужает <main> до 65/80/90% — из-за этого контент не 1200 и разной
   ширины. На этой странице фиксируем: контент ровно по контейнеру 1200. */
/* main на всю ширину (max-width 1200) на всех ширинах: на десктопе всё равно 1200
   (вид не меняется), а на узких перестаёт быть 65/80/90% из main.css, чтобы контент
   шёл по .container (20px), а не с большим отступом. */
main { width: 100%; max-width: 1200px; margin: 0 auto; }
/* Все .container на странице — border-box и ровно 1200 (у истории был
   content-box: 1200 + 30px padding = 1230, отсюда разнобой справа). */
.container { box-sizing: border-box; max-width: 1200px; width: 100%; }
.history-main-container { max-width: 100%; }
.history-content { min-width: 0; }
:root {
    --primary-blue: #000f9f;
    --primary-blue-light: rgba(0, 15, 159, 0.1);
    --primary-blue-dark: #000c7a;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --background: #ffffff;
    --surface: #f8fafc;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
}

body {
    margin-top: 124px;
    background: transparent;   /* прозрачно — под контентом видно световое поле */
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;              /* контент ровно 1200 без боковых полей */
}
@media (max-width: 1240px) { .container { padding-inline: 20px; } }  /* на узких — чтобы не липло к краю */

/* Основной контейнер истории */
.history-main-container {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 30px;
}

/* Боковая панель навигации */
.history-sidebar {
    width: 100px;
    flex-shrink: 0;
    margin: 10px 0 30px 0;
    position: relative;
}

.years-navigation {
    position: sticky;
    top: 140px;
    background: transparent;   /* прозрачно — под кнопками видно световое поле страницы */
    border-radius: var(--radius-lg);
}

.year-nav-item {
    position: relative;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.year-nav-item:last-child {
    margin-bottom: 0;
}

.year-button {
    width: 100%;
    padding: 0.65rem 1rem;   /* компактнее, как в site2 (.tlx-year) */
    background: #ffffff;   /* сами кнопки белые; прозрачна только панель-контейнер */
    border: 1px solid var(--border);   /* тонкая обводка, как на фото из site2 */
    border-radius: 12px;
    color: var(--text-light);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.year-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.year-button:hover {
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.year-button:hover::before {
    opacity: 0.05;
}

.year-button.active {
    color: white;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-color: var(--primary-blue);
    box-shadow: 0 6px 20px rgba(0, 15, 159, 0.15);
    transform: translateX(8px);
}

.year-button.active::before {
    opacity: 0;
}

/* Индикатор - ПУЛЬСИРУЮЩАЯ ТОЧКА */
.year-indicator {
    width: 12px;
    height: 12px;
    background: var(--primary-blue);
    border-radius: 50%;
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 0 0 0 rgba(0, 15, 159, 0);
}

.year-nav-item.active .year-indicator {
    opacity: 1;
    animation: pulse 2s infinite;
}

/* Стиль для активного года - ИНДИКАТОР СЛЕВА + БОКОВАЯ ЛИНИЯ */
.year-nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 70%;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        var(--primary-blue) 20%, 
        var(--primary-blue) 80%, 
        transparent 100%);
    border-radius: 1px;
}

/* Контентная область */
.history-content {
    flex-grow: 1;
    position: relative;
}

/* Шапка страницы */
.page-header {
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-blue);
    border-radius: 2px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* Верхний блок - продолжение истории */
.continuation-block {
    margin-bottom: 4rem;
    position: relative;
    padding-left: 2.5rem;
    animation: fadeInUp 0.8s ease;
}

.continuation-block::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(0, 15, 159, 0.1);
    animation: pulse 2s infinite;
}

.continuation-block::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 2rem;
    bottom: -4rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-blue) 0%, var(--border) 100%);
}

.continuation-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.continuation-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.continuation-text {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    max-width: 90%;
}

/* События (правая колонка) */
.events-column {
    position: relative;
}

.event-item {
    margin-bottom: 3rem;
    position: relative;
    padding-left: 2.5rem;
    /* Без выцветания: события всегда полной насыщенности. Анимация появления
       (сдвиг) сохранена. */
    opacity: 1;
    transition: all 0.4s ease;
}

.event-item.active {
    opacity: 1;
}

/* Точка события */
.event-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 16px;
    height: 16px;
    background: var(--border);
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 2;
    box-shadow: 0 0 0 0 rgba(0, 15, 159, 0);
}

/* Линия между событиями */
.event-item::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 2rem;
    bottom: -3rem;
    width: 2px;
    background: var(--border);
    transition: all 0.3s ease;
}

.event-item:last-child::after {
    display: none;
}

/* Активное событие */
.event-item.active::before {
    background: var(--primary-blue);
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(0, 15, 159, 0.1);
    animation: pulse 2s infinite;
}

.event-item.active::after {
    background: linear-gradient(to bottom, var(--primary-blue) 0%, var(--border) 100%);
}

.event-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

.event-item.active .event-date {
    color: var(--primary-blue);
}

.event-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.event-item.active .event-title {
    color: var(--primary-blue);
}

.event-description {
    font-size: 13.5px;
    color: var(--text-light);
    line-height: 1.6;
    max-width: 90%;
}

/* Фото события (из админки) — вписываем в колонку таймлайна, не ломая раскладку */
.event-photo {
    margin-top: 14px;
    max-width: 90%;
}
.event-photo img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 340px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px rgba(9, 13, 48, .10);
}

/* Блок роста активов */
.growth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-blue);
    background: rgba(0, 15, 159, 0.08);
    padding: 6px 12px;
    border-radius: 999px;
    margin-top: 0.75rem;
    animation: slideIn 0.5s ease;
}

.growth-badge svg {
    width: 12px;
    height: 12px;
    flex: none;
}

/* Анимации */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 15, 159, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(0, 15, 159, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 15, 159, 0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 1000px) {
    .history-main-container {
        flex-direction: column;
    }
    
    /* Панель годов липнет под шапкой: иначе после перехода к событию
       (например, 2016) фильтр уезжал вверх и вернуться к другому году
       можно было только прокруткой обратно. */
    .history-sidebar {
        width: 100%;
        margin: 10px 0 0 0;
        position: sticky;
        top: 64px;               /* высота фиксированной шапки на мобильных */
        z-index: 30;
        /* Фон во всю ширину экрана, а не только по контенту, — под лентой
           не должен просвечивать текст хронологии. */
        margin-inline: -20px;
        padding: 10px 20px;
        background: transparent;   /* фон прозрачный — под годами видно световое поле */
    }
    
    /* Годы — одной строкой с горизонтальной прокруткой: липкая панель
       занимает одну строку, а не три, и не съедает пол-экрана. */
    .years-navigation {
        position: static;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        cursor: grab;
        gap: 8px;
        padding: 0;
        justify-content: flex-start;
        margin: 0;
    }
    
    .years-navigation::-webkit-scrollbar { display: none; }
    
    .years-navigation.dragging { cursor: grabbing; user-select: none; }
    
    .year-nav-item {
        margin-bottom: 0;
        flex: 0 0 auto; /* Убираем гибкое растяжение */
        min-width: unset; /* Убираем минимальную ширину */
    }
    
    /* Пилюли как у фильтра в новостях: ширина по содержимому, без min-width —
       ряды получаются плотными, а не разреженными. */
    .year-button {
        padding: 8px 16px;
        font-size: 13px;
        width: auto;
        min-width: 0;
        border-radius: 999px;
        white-space: nowrap;
    }
    
    /* На тач-устройствах сдвиг вправо (translateX) при наведении/выборе
       выглядел как случайное смещение кнопки — убираем. */
    .year-button:hover,
    .year-button.active {
        transform: none;
    }
    
    .year-button:hover {
        box-shadow: none;
    }
    
    .year-button.active {
        box-shadow: 0 2px 10px rgba(0, 15, 159, .18);
    }
    
    .year-indicator,
    .year-nav-item.active::before {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        margin-top: 120px;
    }

    .container {
        padding: 0 20px;
    }
    
    .continuation-block {
        padding-left: 2rem;
        margin-bottom: 3rem;
    }
    
    .event-item {
        padding-left: 2rem;
        margin-bottom: 2.5rem;
    }
    
    .event-item::before {
        left: 0; /* Исправляем позицию точки */
    }
    
    .event-item::after {
        left: 7px; /* Возвращаем нормальную позицию */
    }
    
    .continuation-block::before {
        left: 0;
    }
    
    .continuation-block::after {
        left: 7px;
    }
    
    /* Исправляем отступ для years-navigation в мобильном виде */
    .years-navigation {
        padding: 0; /* Убираем все отступы */
        margin: 0; /* Убираем внешние отступы */
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 22px;
    }
    
    .continuation-title {
        font-size: 16px;
    }
    
    .continuation-text {
        font-size: 14px;
    }
    
    .event-title {
        font-size: 15px;
    }
    
    .event-description {
        font-size: 14px;
    }
    
    .year-button {
        font-size: 12.5px;
        padding: 7px 14px;
        min-width: 0;
    }
    
    /* Еще больше уменьшаем отступы в самом маленьком разрешении */
    .years-navigation {
        gap: 6px;
    }
}
