/* timeline.css */

.history-container {
    padding: 60px 20px;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

.history-header {
    text-align: center;
    margin-bottom: 80px;
}

.history-header h2 {
    font-size: 2.8rem;
    color: #2C5E4F;
    font-weight: 800;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.history-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: #D4C5B0;
    border-radius: 2px;
}

.history-intro {
    font-size: 1.8rem;
    /* Increased from 1.25rem */
    color: #2C5E4F;
    /* Changed to dark green from #666 */
    font-weight: 800;
    /* Added bold weight */
    max-width: 600px;
    margin: 0 auto 40px auto;
    /* Added bottom margin */
    line-height: 1.6;
    text-align: center;
    /* Center align the title */
}

/* Timeline Layout */
.timeline-wrapper {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Central Line */
.timeline-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40px;
    width: 4px;
    background: #e0e0e0;
    border-radius: 2px;
}

/* Era Section */
.era-section {
    position: relative;
    margin-bottom: 100px;
}

.era-section:last-child {
    margin-bottom: 0;
}

/* Era Bar Header */
.era-header-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    /* Reduced to look better when collapsed */
    padding-left: 20px;
    cursor: pointer;
    /* Clickable */
    user-select: none;
}

.era-header-bar:hover .era-info {
    background: #f0f5f1;
}

.era-header-bar .era-dot {
    position: absolute;
    left: 20px;
    width: 44px;
    height: 44px;
    background: #fff;
    border: 4px solid #D4C5B0;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.era-section.current-era .era-header-bar .era-dot {
    border-color: #2C5E4F;
    background: #2C5E4F;
    color: white;
    animation: pulse 2s infinite;
}

.era-header-bar .era-info {
    margin-left: 70px;
    background: #f8f9f8;
    padding: 15px 30px;
    border-radius: 12px;
    border-left: 5px solid #D4C5B0;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.02);
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.era-toggle-icon {
    font-size: 1.2rem;
    color: #2C5E4F;
    transition: transform 0.3s ease;
}

.era-section.collapsed .era-toggle-icon {
    transform: rotate(-180deg);
    /* Rotate era icon as well */
}

.era-section.current-era .era-info {
    border-left-color: #2C5E4F;
    background: #f0f5f3;
}

.era-info h3 {
    font-size: 1.8rem;
    color: #2C5E4F;
    margin: 0;
    font-weight: 800;
}

.era-info .period {
    font-size: 1rem;
    color: #888;
    font-weight: 500;
    margin-top: 5px;
}

.current-tag {
    display: inline-block;
    padding: 2px 10px;
    background: #2C5E4F;
    color: white;
    font-size: 0.8rem;
    border-radius: 20px;
    margin-left: 10px;
    vertical-align: middle;
}

/* Event List */
.events-list {
    margin-left: 80px;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    max-height: 5000px;
    /* Large enough for many years */
}

.era-section.collapsed .events-list {
    max-height: 0;
    margin-bottom: 0;
}

.era-section:not(.collapsed) .events-list {
    margin-bottom: 60px;
}

/* Year Group Styles */
.year-group {
    margin-bottom: 20px;
    position: relative;
}

.year-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    padding: 12px 20px;
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.year-header:hover {
    background: #f7f9f8;
    border-color: #2C5E4F;
}

.year-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #2C5E4F;
    margin: 0;
    min-width: 60px;
}

.year-line {
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(to right, #2C5E4F, transparent);
    opacity: 0.2;
}

.year-group-content {
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    max-height: 2000px;
    padding-left: 10px;
}

.year-group.collapsed .year-group-content {
    max-height: 0;
}

.year-group .year-toggle-icon {
    transition: transform 0.3s ease;
}

.year-group.collapsed .year-toggle-icon {
    transform: rotate(-180deg);
}

.year-toggle-icon {
    font-size: 0.9rem;
    color: #888;
}

.event-box {
    position: relative;
    padding: 20px 25px;
    background: white;
    border-radius: 15px;
    border: 1px solid #eee;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.event-box:hover {
    transform: translateX(10px);
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.05);
    border-color: #D4C5B0;
}

.event-box::before {
    content: '';
    position: absolute;
    left: -44px;
    top: 25px;
    width: 20px;
    height: 2px;
    background: #e0e0e0;
}

.event-box .event-date {
    font-weight: 800;
    color: #2C5E4F;
    font-size: 1.1rem;
    white-space: nowrap;
    min-width: 90px;
}

.event-box .event-text {
    color: #444;
    font-size: 1.1rem;
    line-height: 1.6;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(44, 94, 79, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(44, 94, 79, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(44, 94, 79, 0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-wrapper::before {
        left: 20px;
    }

    .era-header-bar .era-dot {
        left: 0;
        width: 36px;
        height: 36px;
    }

    .era-header-bar .era-info {
        margin-left: 45px;
        padding: 10px 20px;
    }

    .era-info h3 {
        font-size: 1.4rem;
    }

    .events-list {
        margin-left: 50px;
    }

    .event-box {
        flex-direction: column;
        gap: 5px;
    }

    .event-box::before {
        left: -34px;
    }
}