/* ==================== CSS 变量系统 ==================== */
:root {
    /* Dark theme colors */
    --bg-dark: #0f0c29;
    --bg-mid: #302b63;
    --bg-light: #24243e;
    --bg-card: rgba(36, 36, 62, 0.7);

    /* Gradients */
    --gradient-dark: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;

    /* Glow effects */
    --glow-primary: 0 0 20px rgba(102, 126, 234, 0.5), 0 0 40px rgba(102, 126, 234, 0.3);

    /* Shadow */
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);

    /* Period colors */
    --p1: #fec541;
    --p2: #10b981;
    --p3: #667eea;
    --p4: #f97316;
    --p5: #06b6d4;
    --p6: #3b82f6;
    --p7: #84cc16;
    --p8: #a855f7;
    --p9: #6366f1;
    --p10: #ec4899;
    --p11: #e94560;
}

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Canvas粒子背景容器 */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ==================== 主体样式 ==================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--gradient-dark);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.body-wrap {
    background: rgba(15, 12, 41, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-xl), var(--glow-primary);
    width: 100%;
    padding: 1rem;
    margin: 2rem auto;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

.pres-timeline {
    font-size: 12px;
    color: var(--text-primary);
    width: 100%;
    margin: 30px 0;
}

.pres-timeline > div > div {
    padding: 1em 0;
    box-sizing: border-box;
}

/* ==================== Periods Container ==================== */
.pres-timeline .periods-container,
.pres-timeline .cards-container {
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    min-height: 100px;
    transition: height 0.5s ease-in-out;
    background: rgba(36, 36, 62, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
}

.periods-container:before {
    background-image: linear-gradient(left, rgba(15, 12, 41, 0.8), rgba(48, 43, 99, 0));
    left: 0;
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    height: 100%;
    width: 100px;
    border-radius: 1rem 0 0 1rem;
}

.periods-container:after {
    background-image: linear-gradient(right, rgba(15, 12, 41, 0.8), rgba(48, 43, 99, 0));
    right: 0;
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    height: 100%;
    width: 100px;
    border-radius: 0 1rem 1rem 0;
}

.periods-container .btn-back,
.periods-container .btn-next {
    display: inline-block;
    width: 15%;
    height: 100%;
    position: absolute;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s ease-in-out;
}

.periods-container .btn-back:hover,
.periods-container .btn-next:hover {
    background-color: rgba(102, 126, 234, 0.2);
}

.periods-container .btn-back.hide,
.periods-container .btn-next.hide {
    display: none;
}

.periods-container .btn-back {
    left: 0;
}

.periods-container .btn-next {
    right: 0;
}

.periods-container section {
    width: 90%;
    margin-left: 5%;
    height: 0;
    position: absolute;
    border-bottom: 4px solid;
    padding: 1.5em;
    box-sizing: border-box;
    transition: transform 0.3s ease-in-out, opacity 0.2s ease, height 0.3s ease;
    bottom: 0;
    opacity: 0;
    background: rgba(15, 12, 41, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0 0 1rem 1rem;
}

.periods-container section.active {
    height: auto;
    opacity: 1;
    transform: translateX(0);
    z-index: 5;
}

.periods-container section.active .title,
.periods-container section.active p {
    display: block;
}

.periods-container section.prev {
    height: auto;
    opacity: 0.4;
    transform: translateX(-100%);
    z-index: 0;
}

.periods-container section.prev .year {
    text-align: right;
}

.periods-container section.next {
    height: auto;
    opacity: 0.4;
    transform: translateX(100%);
    z-index: 0;
}

.periods-container section .year {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 400;
}

.periods-container section .title {
    color: var(--text-secondary);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 400;
    display: none;
}

.periods-container section .province {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 700;
}

.periods-container section p {
    display: none;
}

/* ==================== Timeline Container ==================== */
.timeline-container {
    position: relative;
    width: 100%;
    height: 50px;
    overflow: hidden;
    background: rgba(36, 36, 62, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
}

.timeline-container:before {
    background-image: linear-gradient(left, rgba(15, 12, 41, 0.8), rgba(48, 43, 99, 0));
    left: 0;
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    height: 100%;
    width: 100px;
    border-radius: 1rem 0 0 1rem;
}

.timeline-container:after {
    background-image: linear-gradient(right, rgba(15, 12, 41, 0.8), rgba(48, 43, 99, 0));
    right: 0;
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    height: 100%;
    width: 100px;
    border-radius: 0 1rem 1rem 0;
}

.timeline-container .timeline {
    position: absolute;
    display: block;
    height: 50px;
    transition: left 0.3s ease-in-out;
}

.timeline-container .timeline ol {
    display: block;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--p1) 0%, var(--p11) 100%);
    list-style: none;
    padding-left: 20px;
    padding-right: 20px;
}

.timeline-container .timeline ol li {
    display: inline-block;
    padding: 5px;
    margin-top: -11px;
    margin-left: 30px;
    border-radius: 50%;
    border: 4px solid;
    background-color: rgba(15, 12, 41, 0.8);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--node-color), 0 0 20px var(--node-color);
}

.timeline-container .timeline ol li.active {
    box-shadow: 0 0 20px var(--node-color), 0 0 40px var(--node-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.timeline-container .timeline ol li.active:before {
    content: "";
    display: block;
    height: 25px;
    width: 1px;
    position: absolute;
    top: -25px;
    background: var(--node-color);
    box-shadow: 0 0 10px var(--node-color);
    transition: opacity 0.3s ease-in-out;
}

.timeline-container .timeline ol li.active:after {
    content: "";
    display: block;
    height: 25px;
    width: 1px;
    position: absolute;
    bottom: -25px;
    background: var(--node-color);
    box-shadow: 0 0 10px var(--node-color);
    transition: opacity 0.3s ease-in-out;
}

.timeline-container .btn-back,
.timeline-container .btn-next {
    display: inline-block;
    position: absolute;
    cursor: pointer;
    margin-top: -2px;
    z-index: 11;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
}

.timeline-container .btn-back:hover,
.timeline-container .btn-next:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.1);
}

.timeline-container .btn-back.hide,
.timeline-container .btn-next.hide {
    display: none;
}

.timeline-container .btn-back {
    left: 1em;
}

.timeline-container .btn-next {
    right: 1em;
}

/* ==================== Cards Container ==================== */
.cards-container:before {
    background-image: linear-gradient(left, rgba(15, 12, 41, 0.8), rgba(48, 43, 99, 0));
    left: 0;
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    height: 100%;
    width: 100px;
    border-radius: 1rem;
}

.cards-container:after {
    background-image: linear-gradient(right, rgba(15, 12, 41, 0.8), rgba(48, 43, 99, 0));
    right: 0;
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    height: 100%;
    width: 100px;
    border-radius: 1rem;
}

.cards-container section {
    width: 90%;
    position: absolute;
    margin-left: 5%;
    margin-bottom: 2em;
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 1.5em;
    box-sizing: border-box;
    transition: transform 0.3s ease-in-out;
    top: 0;
    opacity: 0;
    border-radius: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glow-primary);
}

.cards-container section.active {
    height: auto;
    opacity: 1;
    transform: translateX(0);
    z-index: 5;
}

.cards-container section.prev {
    height: auto;
    opacity: 0.4;
    transform: translateX(-105%);
    z-index: 0;
}

.cards-container section.next {
    height: auto;
    opacity: 0.4;
    transform: translateX(105%);
    z-index: 0;
}

.cards-container section .year {
    text-align: center;
    font-size: clamp(0.875rem, 2vw, 1rem);
    margin: 0;
    font-weight: 600;
}

.cards-container section .title {
    font-weight: 400;
    font-size: clamp(1rem, 3vw, 1.25rem);
    text-align: center;
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.cards-container section .city {
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin: 0.5rem 0;
    font-weight: 700;
}

.cards-container section p {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.cards-container section img {
    width: 100%;
    border-radius: 0.75rem;
    margin: 0.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ==================== 响应式设计 ==================== */

/* Tablet (768px+) */
@media (min-width: 768px) {
    .body-wrap {
        padding: 2rem;
    }

    .periods-container section,
    .cards-container section {
        width: 70%;
        margin-left: 15%;
    }

    .timeline-container .timeline ol {
        padding-left: 210px;
        padding-right: 300px;
    }

    .timeline-container .timeline ol li {
        margin-left: 80px;
        border-width: 3px;
    }

    .periods-container section .province {
        font-size: 40px;
    }

    .cards-container section .city {
        font-size: 32px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .periods-container section .province {
        font-size: 40px;
    }

    .cards-container section .year {
        font-size: 16px;
    }

    .cards-container section .title {
        font-size: 1.25rem;
    }

    .cards-container section .city {
        font-size: 32px;
    }

    .cards-container section p {
        font-size: 1rem;
    }

    .cards-container section img {
        width: 100%;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .body-wrap {
        padding: 0.75rem;
        margin: 1rem auto;
    }

    .periods-container section {
        padding: 1em;
    }

    .cards-container section {
        padding: 1em;
    }

    .timeline-container {
        height: 40px;
    }

    .timeline-container .timeline ol li {
        margin-left: 25px;
        border-width: 3px;
        padding: 4px;
    }
}
