/* 全局变量 */
:root {
    --primary-color: #ff6b81;
    --secondary-color: #ff9a9e;
    --text-color: #4a4a4a;
    --bg-color: #fff0f3;
    --card-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: 'Georgia', serif;
}

/* 背景 Canvas */
#heartCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* 音乐控制 */
.music-control {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    animation: rotate 3s linear infinite;
    animation-play-state: paused;
}

.music-control.playing {
    animation-play-state: running;
    color: var(--primary-color);
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 头部 */
.hero-section {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    position: relative;
    /* 如果有本地图片，可以替换下面的 url */
    /* background-image: url('../images/bg.jpg'); */
    background-size: cover;
    background-position: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3); /* 遮罩层 */
}

.hero-section .content {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.8);
    padding: 2rem 4rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    animation: fadeInUp 1s ease-out;
}

.title {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.5rem;
    color: #555;
    min-height: 1.6em;
}

.scroll-down {
    margin-top: 2rem;
    font-size: 2rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
    cursor: pointer;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 计时器 */
.timer-section {
    padding: 4rem 2rem;
    text-align: center;
    background-color: var(--bg-color);
}

.timer-section h2 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.timer-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.time-box {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    min-width: 100px;
    transition: transform 0.3s;
}

.time-box:hover {
    transform: translateY(-5px);
}

.time-box span {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.time-box label {
    font-size: 1rem;
    color: #666;
}

.love-message {
    margin-top: 2rem;
    font-size: 1.2rem;
    font-style: italic;
    color: #777;
}

/* 画廊 */
.gallery-section {
    padding: 4rem 2rem;
    text-align: center;
}

.gallery-section h2 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 3rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: var(--shadow);
    aspect-ratio: 1;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.5s ease;
    /* 自动美颜滤镜：提亮、增加对比度、提升色彩饱和度 */
    filter: brightness(1.1) contrast(1.05) saturate(1.1);
}

.gallery-item:hover img {
    transform: scale(1.1);
    /* 悬停时稍微更亮一点 */
    filter: brightness(1.15) contrast(1.1) saturate(1.2);
}

.gallery-item .overlay {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    background: rgba(255, 107, 129, 0.8);
    color: white;
    padding: 1rem;
    transition: bottom 0.3s ease;
    font-size: 1.2rem;
}

.gallery-item:hover .overlay {
    bottom: 0;
}

/* 时间轴 */
.timeline-section {
    padding: 4rem 2rem;
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

.timeline-section h2 {
    text-align: center;
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 4rem;
}

.timeline {
    position: relative;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 6px;
    background-color: var(--secondary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
    border-radius: 3px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    box-sizing: border-box;
    opacity: 0; /* 初始隐藏，JS控制显示 */
    transform: translateY(20px);
    transition: all 0.6s ease;
}

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

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    right: -10px;
    background-color: white;
    border: 4px solid var(--primary-color);
    top: 20px;
    border-radius: 50%;
    z-index: 1;
}

.left {
    left: 0;
}

.right {
    left: 50%;
}

.left::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    right: 30px;
    border: medium solid white;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent white;
}

.right::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    left: 30px;
    border: medium solid white;
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
}

.right::after {
    left: -10px;
}

.timeline-content {
    padding: 20px 30px;
    background-color: white;
    position: relative;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.timeline-content .date {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

.timeline-content h3 {
    margin-top: 5px;
    color: #333;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--text-color);
    color: white;
}

/* 响应式适配 */
@media screen and (max-width: 600px) {
    .title {
        font-size: 2.5rem;
    }

    .hero-section .content {
        padding: 1.5rem;
    }

    .timer-container {
        gap: 1rem;
    }

    .time-box {
        min-width: 70px;
        padding: 1rem;
    }

    .time-box span {
        font-size: 1.5rem;
    }

    .timeline::after {
        left: 31px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .timeline-item::before {
        left: 60px;
        border: medium solid white;
        border-width: 10px 10px 10px 0;
        border-color: transparent white transparent transparent;
    }

    .left::after, .right::after {
        left: 21px;
    }

    .right {
        left: 0%;
    }
}
