/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 时间轴主线 */
.timeline {
    position: relative;
    padding: 50px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: linear-gradient(to bottom, #ff6f61, #3a7bd5);
    margin-left: -2px;
    z-index: 1;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* 时间轴事件 */
.timeline-event {
    position: relative;
    margin-bottom: 80px;
    width: 100%;
    clear: both;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-event.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-content {
    position: relative;
    width: 46%;
    padding: 20px;
    box-sizing: border-box;
}

.timeline-event:nth-child(odd) .timeline-content {
    float: left;
}

.timeline-event:nth-child(even) .timeline-content {
    float: right;
}

/* 日历翻页效果 */
.calendar-flip {
    position: absolute;
    top: 20px;
    width: 80px;
    height: 80px;
    perspective: 1000px;
    z-index: 3;
}

.timeline-event:nth-child(odd) .calendar-flip {
    right: -40px;
}

.timeline-event:nth-child(even) .calendar-flip {
    left: -40px;
}

.calendar-top, .calendar-bottom {
    width: 100%;
    overflow: hidden;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition: all 0.6s ease;
    border-radius: 5px 5px 0 0;
}

.calendar-top {
    top: 0;
    background: #ff6f61;
    color: white;
    transform-origin: bottom;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.calendar-bottom {
    bottom: 0;
    background: white;
    color: #333;
    border-radius: 0 0 5px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.calendar-bottom .day {
    font-size: 24px;
    font-weight: bold;
    color: #ff6f61;
}

.calendar-bottom .weekday {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

.timeline-event:hover .calendar-top {
    transform: rotateX(-180deg);
}

/* 信封效果 */
.envelope {
    position: relative;
    background: #fff9f0;
    border-radius: 5px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: #fff5e5;
    border-radius: 5px 5px 0 0;
    transform-origin: top;
    transform: rotateX(0deg);
    transition: transform 0.3s ease;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.timeline-event:hover .envelope-flap {
    transform: rotateX(180deg);
}

.letter {
    position: relative;
    background: white;
    padding: 25px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-family: 'Poppins', sans-serif;
}

.letter-header {
    border-bottom: 1px dashed #ddd;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.event-title {
    font-size: 22px;
    color: #333;
    margin: 0 0 5px 0;
    font-weight: 600;
}

.event-year {
    font-size: 14px;
    color: #888;
}

.letter-content {
    position: relative;
}

.event-image-wrap {
    float: left;
    margin: 0 20px 15px 0;
    max-width: 19%;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.timeline-event:nth-child(even) .event-image-wrap {
    float: right;
    margin: 0 0 15px 20px;
}

.event-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.event-image:hover {
    transform: scale(1.03);
}

.event-description {
    color: #555;
    line-height: 1.7;
    font-size: 15px;
    text-align: justify;
}

.letter-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
    text-align: right;
}

.signature {
    font-family: 'Dancing Script', cursive;
    font-size: 24px;
    color: #666;
}

/* 特殊事件样式 */
.timeline-event.special .envelope {
    background: #fff0f0;
    border-left: 5px solid #ff6f61;
}

.timeline-event.special .calendar-top {
    background: #e74c3c;
}

.timeline-event.special .calendar-bottom .day {
    color: #e74c3c;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .timeline::before {
        left: 40px;
    }
    
    .timeline-content {
        width: calc(100% - 80px);
        float: none !important;
        margin-left: 80px;
        padding: 15px;
    }
    
    .calendar-flip {
        left: -40px !important;
        right: auto !important;
    }
    
    .event-image-wrap {
        float: none !important;
        margin: 0 0 15px 0 !important;
        max-width: 100%;
    }
    
    .timeline-title {
        font-size: 2.5em;
    }
    
    .envelope {
        padding: 20px;
    }
    
    .letter {
        padding: 20px;
    }
    
    .event-title {
        font-size: 20px;
    }
}