/* 字体导入 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Ma+Shan+Zheng&display=swap');

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 颜色定义 */
    --paper-color: #f5e6d3;
    --ink-color: #2b2b2b;
    --ancient-color: #8b6914;
    --medieval-color: #8b2323;
    --modern-color: #1e3a8a;
    --contemporary-color: #0f4c5c;
    --accent-gold: #d4af37;
    --shadow-color: rgba(43, 43, 43, 0.2);
}

body {
    font-family: 'Noto Serif SC', serif;
    background-color: #e8dcc4;
    background-image: 
        linear-gradient(45deg, rgba(240, 230, 215, 0.8) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(240, 230, 215, 0.8) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(240, 230, 215, 0.8) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(240, 230, 215, 0.8) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    color: var(--ink-color);
    overflow-x: hidden;
    position: relative;
}

/* 背景装饰 */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.ink-wash {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    opacity: 0.05;
    filter: blur(80px);
    background: radial-gradient(circle, var(--ink-color) 0%, transparent 70%);
}

.ink-wash.top-left {
    top: -100px;
    left: -100px;
}

.ink-wash.top-right {
    top: -100px;
    right: -100px;
}

.ink-wash.bottom-left {
    bottom: -100px;
    left: -100px;
}

.ink-wash.bottom-right {
    bottom: -100px;
    right: -100px;
}

/* 头部样式 */
.header {
    background: linear-gradient(to bottom, rgba(43, 43, 43, 0.9), rgba(43, 43, 43, 0.7));
    padding: 40px 20px;
    text-align: center;
    position: relative;
    border-bottom: 3px solid var(--accent-gold);
    box-shadow: 0 4px 20px var(--shadow-color);
    animation: scrollUnfold 1s ease-out;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.main-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 4rem;
    color: var(--paper-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 10px;
    position: relative;
    z-index: 2;
}

.dragon-decoration {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    background: var(--accent-gold);
    border-radius: 50%;
    opacity: 0.6;
    box-shadow: 0 0 20px var(--accent-gold);
}

.dragon-decoration.left {
    left: 10px;
}

.dragon-decoration.right {
    right: 10px;
}

.dragon-decoration::before {
    content: '龍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 2rem;
    color: var(--ink-color);
}

/* 移动端菜单按钮 */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--ink-color);
    border: 2px solid var(--accent-gold);
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    flex-direction: column;
    gap: 5px;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background: var(--accent-gold);
    transition: all 0.3s;
}

/* 控制面板 */
.control-panel {
    position: sticky;
    top: 0;
    background: var(--paper-color);
    border: 3px solid var(--ink-color);
    border-left: none;
    border-right: none;
    padding: 30px 20px;
    box-shadow: 0 4px 10px var(--shadow-color);
    z-index: 100;
    animation: slideDown 0.6s ease-out;
}

.control-section {
    max-width: 1200px;
    margin: 0 auto 30px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h3 {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.5rem;
    color: var(--ink-color);
    margin-bottom: 15px;
    text-align: center;
}

/* 筛选按钮 */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--ink-color);
    color: var(--ink-color);
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.filter-btn.active {
    background: var(--ink-color);
    color: var(--paper-color);
    border-color: var(--accent-gold);
}

.filter-btn[data-period="ancient"].active {
    background: var(--ancient-color);
}

.filter-btn[data-period="medieval"].active {
    background: var(--medieval-color);
}

.filter-btn[data-period="modern"].active {
    background: var(--modern-color);
}

.filter-btn[data-period="contemporary"].active {
    background: var(--contemporary-color);
}

/* 搜索框 */
.search-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

#searchInput {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--ink-color);
    border-radius: 5px;
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    background: white;
    transition: all 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

#searchBtn {
    padding: 12px 30px;
    background: var(--ink-color);
    color: var(--paper-color);
    border: 2px solid var(--accent-gold);
    border-radius: 5px;
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#searchBtn:hover {
    background: var(--accent-gold);
    color: var(--ink-color);
    transform: scale(1.05);
}

/* 时间线滑块 */
.timeline-slider {
    max-width: 800px;
    margin: 0 auto;
}

#timelineRange {
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, var(--ancient-color), var(--medieval-color), var(--modern-color), var(--contemporary-color));
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

#timelineRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 25px;
    height: 25px;
    background: var(--accent-gold);
    border: 3px solid var(--ink-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

#timelineRange::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 15px var(--accent-gold);
}

#timelineRange::-moz-range-thumb {
    width: 25px;
    height: 25px;
    background: var(--accent-gold);
    border: 3px solid var(--ink-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--ink-color);
}

/* 时间线容器 */
.timeline-container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    position: relative;
}

.scroll-decoration {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 30px;
    background: var(--accent-gold);
    border-radius: 15px;
    opacity: 0.6;
}

/* 时期区块 */
.period-section {
    margin-bottom: 100px;
    position: relative;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.period-section[data-period="ancient"] {
    animation-delay: 0.2s;
}

.period-section[data-period="medieval"] {
    animation-delay: 0.4s;
}

.period-section[data-period="modern"] {
    animation-delay: 0.6s;
}

.period-section[data-period="contemporary"] {
    animation-delay: 0.8s;
}

.period-section.hidden {
    display: none;
}

.period-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 30px;
    background: white;
    border: 3px solid var(--ink-color);
    border-radius: 10px;
    box-shadow: 0 8px 20px var(--shadow-color);
    position: relative;
}

.period-header::before,
.period-header::after {
    content: '◆';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--accent-gold);
}

.period-header::before {
    left: 20px;
}

.period-header::after {
    right: 20px;
}

.period-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 3rem;
    color: var(--ink-color);
    margin-bottom: 10px;
    letter-spacing: 15px;
}

.period-range {
    font-size: 1.2rem;
    color: #666;
    letter-spacing: 2px;
}

/* 时间线 */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 200px;
    bottom: 0;
    width: 4px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, transparent, var(--ink-color), transparent);
}

.ancient-line {
    background: linear-gradient(to bottom, transparent, var(--ancient-color), var(--ancient-color));
}

.medieval-line {
    background: linear-gradient(to bottom, var(--medieval-color), var(--medieval-color));
}

.modern-line {
    background: linear-gradient(to bottom, var(--modern-color), var(--modern-color));
}

.contemporary-line {
    background: linear-gradient(to bottom, var(--contemporary-color), var(--contemporary-color), transparent);
}

/* 事件容器 */
.events-container {
    position: relative;
}

/* 事件卡片 */
.event-card {
    position: relative;
    margin-bottom: 80px;
    display: flex;
    align-items: center;
    opacity: 0;
    animation: fadeInScale 0.6s ease-out forwards;
}

.event-card.left {
    justify-content: flex-end;
    padding-right: calc(50% + 40px);
}

.event-card.right {
    justify-content: flex-start;
    padding-left: calc(50% + 40px);
}

.event-content {
    background: white;
    border: 2px solid var(--ink-color);
    border-radius: 10px;
    padding: 25px;
    max-width: 450px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: all 0.3s;
    position: relative;
}

.event-card:hover .event-content {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.event-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 10px 10px 0 0;
}

.event-card[data-period="ancient"] .event-content::before {
    background: var(--ancient-color);
}

.event-card[data-period="medieval"] .event-content::before {
    background: var(--medieval-color);
}

.event-card[data-period="modern"] .event-content::before {
    background: var(--modern-color);
}

.event-card[data-period="contemporary"] .event-content::before {
    background: var(--contemporary-color);
}

.event-time {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.3rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
    font-weight: 700;
}

.event-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink-color);
    margin-bottom: 12px;
    line-height: 1.4;
}

.event-description {
    font-size: 1rem;
    color: #555;
    line-height: 1.8;
}

/* 时间点标记 */
.event-marker {
    position: absolute;
    left: 50%;
    top: 30px;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 4px solid var(--paper-color);
    background: var(--ink-color);
    z-index: 10;
    transition: all 0.3s;
}

.event-card:hover .event-marker {
    transform: translateX(-50%) scale(1.5);
    box-shadow: 0 0 20px currentColor;
}

.event-card[data-period="ancient"] .event-marker {
    background: var(--ancient-color);
    color: var(--ancient-color);
}

.event-card[data-period="medieval"] .event-marker {
    background: var(--medieval-color);
    color: var(--medieval-color);
}

.event-card[data-period="modern"] .event-marker {
    background: var(--modern-color);
    color: var(--modern-color);
}

.event-card[data-period="contemporary"] .event-marker {
    background: var(--contemporary-color);
    color: var(--contemporary-color);
}

/* 连接线 */
.event-card::after {
    content: '';
    position: absolute;
    top: 40px;
    width: 40px;
    height: 2px;
    background: var(--ink-color);
}

.event-card.left::after {
    right: calc(50% + 20px);
}

.event-card.right::after {
    left: calc(50% + 20px);
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 60px;
    height: 60px;
    background: var(--ink-color);
    color: var(--accent-gold);
    border: 3px solid var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px var(--shadow-color);
}

.back-to-top span {
    font-size: 1.5rem;
    font-weight: 700;
}

.back-to-top p {
    font-size: 0.7rem;
    margin-top: 2px;
}

/* 动画 */
@keyframes scrollUnfold {
    from {
        transform: scaleY(0);
        transform-origin: top;
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
        letter-spacing: 5px;
    }

    .dragon-decoration {
        width: 50px;
        height: 50px;
    }

    .dragon-decoration::before {
        font-size: 1.5rem;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .control-panel {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 90%;
        max-width: 400px;
        height: calc(100vh - 100px);
        overflow-y: auto;
        transition: left 0.3s;
        border: 3px solid var(--ink-color);
        border-radius: 0 10px 10px 0;
    }

    .control-panel.active {
        left: 0;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
    }

    .search-box {
        flex-direction: column;
    }

    #searchInput,
    #searchBtn {
        width: 100%;
    }

    .period-title {
        font-size: 2rem;
        letter-spacing: 10px;
    }

    .period-range {
        font-size: 1rem;
    }

    .timeline-line {
        left: 30px;
    }

    .event-card.left,
    .event-card.right {
        justify-content: flex-start;
        padding-left: 60px;
        padding-right: 0;
    }

    .event-marker {
        left: 30px;
    }

    .event-card::after {
        left: 30px;
        right: auto;
        width: 30px;
    }

    .event-card:hover .event-marker {
        transform: scale(1.5);
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .back-to-top span {
        font-size: 1.2rem;
    }

    .back-to-top p {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
        letter-spacing: 3px;
    }

    .period-header::before,
    .period-header::after {
        display: none;
    }

    .period-title {
        font-size: 1.5rem;
        letter-spacing: 5px;
    }

    .event-content {
        padding: 15px;
    }

    .event-title {
        font-size: 1.2rem;
    }

    .event-description {
        font-size: 0.9rem;
    }
}

