body {
    margin: 0;
    padding: 20px 0;
    overflow-y: hidden;
    overflow-x: auto;
    background-color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    cursor: grab; /* Курсор "рука" */
}

body.grabbing {
    cursor: grabbing; /* Курсор "сжатая рука" при перетаскивании */
}

html {
    height: 100%;
    width: 100%;
}


body::-webkit-scrollbar { height: 8px; }
body::-webkit-scrollbar-track { background: #222; }
body::-webkit-scrollbar-thumb { background-color: #8b0000; border-radius: 20px; }

/* Динамический фон */
#dynamic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    /* Делаю фон светлее */
    filter: brightness(1.2) opacity(0.6); 
    transition: background-image 1.0s ease-in-out;
    pointer-events: none;
    background-color: #333; /* Темный резервный фон */
}

#timeline-container {
    display: flex;
    align-items: center;
    padding: 0 50vw;
    height: 100%;
    position: relative;
}

/* Центральная линия */
.timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 6px;
    background: #8b0000;
    z-index: 0;
    border-radius: 2px;
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.8);
}

/* Линия периода */
.period-line {
    position: absolute;
    top: 50%;
    height: 14px;
    background-color: #fff;
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    opacity: 0.9;
}

/* Штрихи */
.tick {
    position: absolute;
    top: 0;
    width: 2px;
    height: 14px;
    background-color: rgba(255,255,255,0.7);
    transform: translateY(-4px);
}

.tick-major {
    height: 24px;
    background-color: rgba(255,255,255,0.8);
    transform: translateY(-9px);
    width: 3px;
}

.tick-label {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 1px 1px 2px #000;
}

.event-wrapper {
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.event-dot {
    width: 24px;
    height: 24px;
    background-color: #8b0000;
    border: 4px solid white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.event-wrapper:hover .event-dot {
    transform: translateY(-50%) scale(1.3);
    background-color: #ff0000;
}

/* Карточка события */
.event-card {
    width: 420px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    position: absolute;
    transition: all 0.3s ease;
    border-left: 6px solid #8b0000;
    z-index: 5;
    
    /* Grid Layout */
    display: grid;
    grid-template-areas: 
        "img year"
        "img title"
        "img desc";
    grid-template-columns: 140px 1fr;
    column-gap: 15px;
    align-items: start;
}

/* Стили для кликабельной темной карточки */
.event-card.clickable-dark {
    background: linear-gradient(145deg, #1a1a1a, #2c2c2c);
    border-left: 6px solid #ff3333;
    cursor: pointer;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
}

.event-card.clickable-dark:hover {
    transform: scale(1.05);
    background: linear-gradient(145deg, #252525, #383838);
    box-shadow: 0 0 35px rgba(255, 0, 0, 0.3);
    z-index: 100;
}

.event-card.clickable-dark .event-title {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.event-card.clickable-dark .event-desc {
    color: #ccc;
}

.event-card.clickable-dark .event-year {
    color: #ff3333;
    border-bottom: 1px solid #555;
}

/* Стиль для карточки Максимы (черная рамка) */
.event-card.black-border {
    border: 4px solid #000;
    border-left: 10px solid #000;
    background: #333;
    color: #fff;
    cursor: pointer;
}

.event-card.black-border:hover {
    background: #000;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0,0,0,1);
    z-index: 100;
}

.event-card.black-border .event-year {
    color: #fff;
    border-bottom: 1px solid #555;
}

.event-card.black-border .event-title {
    color: #fff;
}

.event-card.black-border .event-desc {
    color: #ccc;
}

.event-wrapper.top .event-card {
    bottom: 45px;
    transform-origin: bottom center;
}

.event-wrapper.bottom .event-card {
    top: 45px;
    transform-origin: top center;
}

.event-wrapper:hover .event-card {
    transform: scale(1.02);
    z-index: 20;
}

.connector {
    position: absolute;
    width: 2px;
    height: 35px;
    background-color: rgba(255,255,255,0.8);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.event-wrapper.top .connector { 
    bottom: 0; 
    top: auto; 
    margin-bottom: 10px;
}
.event-wrapper.bottom .connector { 
    top: 0; 
    bottom: auto;
    margin-top: 10px;
}

.event-year {
    grid-area: year;
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #8b0000;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 2px;
}

.event-title {
    grid-area: title;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #111;
    line-height: 1.2;
}

.event-desc {
    grid-area: desc;
    font-size: 0.85rem;
    color: #444;
    line-height: 1.4;
}

.event-img {
    grid-area: img;
    width: 100%;
    height: 100%;
    min-height: 100px;
    max-height: 140px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 0;
    background-color: #f0f0f0;
    display: block;
    border: 1px solid #ccc;
    filter: grayscale(0%);
    transition: filter 0.5s ease;
}

.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-select {
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(139, 0, 0, 0.4);
    color: white;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

.lang-select:hover {
    background: rgba(139, 0, 0, 0.6);
}

.email-link {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    backdrop-filter: blur(2px);
}

.email-link a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    font-weight: normal;
    transition: color 0.3s ease;
}

.email-link a:hover {
    color: #fff;
}

/* Scroll Hint Arrows */
.scroll-hint {
    position: fixed;
    bottom: 30px; /* Позиция снизу */
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(139, 0, 0, 0.4); /* Полупрозрачный темно-красный */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 2rem;
    color: white;
    z-index: 999;
    opacity: 0.8;
    animation: fadePulse 2s infinite ease-in-out; /* Плавная анимация */
    pointer-events: none; /* Пропускать клики */
    transition: opacity 0.5s ease-in-out;
}

.scroll-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.scroll-hint.left-arrow {
    left: 20px;
}

.scroll-hint.right-arrow {
    right: 20px;
}

.scroll-hint.left-arrow::before {
    content: '←';
}

.scroll-hint.right-arrow::before {
    content: '→';
}

@keyframes fadePulse {
    0% { transform: translateY(-50%) scale(1); opacity: 0.6; }
    50% { transform: translateY(-50%) scale(1.05); opacity: 1; }
    100% { transform: translateY(-50%) scale(1); opacity: 0.6; }
}

/* --- Медиа-запросы для мобильных устройств --- */
@media (max-width: 768px) {
    #timeline-container {
        padding-top: 0; 
        padding-bottom: 0;
    }

    .event-card {
        width: 260px;
        padding: 10px;
        border-left-width: 4px;
        display: block; /* Вертикальная верстка на мобильных */
    }

    .event-year {
        font-size: 1.1rem;
        margin-bottom: 3px;
    }

    .event-title {
        font-size: 1rem;
    }

    .event-desc {
        font-size: 0.8rem;
    }

    .event-img {
        width: 100%;
        height: 90px;
        margin-top: 5px;
        max-height: none;
    }

    .connector {
        height: 25px;
    }

    .event-wrapper.top .event-card {
        bottom: 35px;
    }

    .event-wrapper.bottom .event-card {
        top: 35px;
    }

    .lang-switcher {
        top: 15px;
        bottom: auto;
        right: 15px;
        left: auto;
    }
    
    .lang-select {
        padding: 5px 10px;
        font-size: 0.8rem;
        background: rgba(139, 0, 0, 0.3);
        border: 1px solid rgba(255,255,255,0.4);
    }

    .email-link {
        bottom: 15px;
        padding: 6px 12px;
    }
    .email-link a {
        font-size: 0.8rem;
    }

    .scroll-hint.left-arrow,
    .scroll-hint.right-arrow {
        display: none; /* Скрываем стрелки на мобильных */
    }

    .scroll-hint-text {
        font-size: 0.9rem; /* Уменьшаем размер текста подсказки */
        padding: 8px 15px;
    }
}