/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --primary-pink: #FFB6C1;
    --light-pink: #FFF0F5;
    --gold: #FFD700;
    --soft-gold: #F4E4C1;
    --text-dark: #333;
    --text-light: #666;
    --white: #fff;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Crimson Text', 'Georgia', serif;
    color: var(--text-dark);
    background: linear-gradient(135deg, #FFF0F5 0%, #FFE4E1 50%, #FFB6C1 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    line-height: 1.8;
    position: relative;
    max-width: 100vw;
    font-size: 18px;
    letter-spacing: 0.3px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 全局飘落的爱心背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3 {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 全局爱心背景容器 */
#globalHeartsBackground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

/* 确保所有内容在爱心之上 */
section {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
    width: 100%;
    box-sizing: border-box;
}

/* 音乐控制 */
.music-control {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.music-control.playing {
    background: rgba(255, 182, 193, 0.9);
    box-shadow: 0 4px 20px rgba(255, 182, 193, 0.3);
}

.music-control.playing .music-icon {
    stroke: #ffffff;
}

.music-control:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.4);
}

.music-icon {
    width: 24px;
    height: 24px;
    stroke: var(--primary-pink);
    animation: pulse 2s ease-in-out infinite;
    transition: stroke 0.3s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Hero 区 */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: hidden;
}

.hero-overlay {
    display: none;
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    color: var(--text-dark);
}

.hero-title {
    font-size: 4rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-dark);
    text-shadow: 2px 2px 4px rgba(255, 182, 193, 0.3);
    letter-spacing: 2px;
}

.timer-container {
    margin: 3rem 0;
}

.timer-text {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.timer-display {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.timer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(255, 182, 193, 0.2);
    backdrop-filter: blur(10px);
}

.timer-value {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary-pink);
    font-family: 'Cormorant Garamond', serif;
}

.timer-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    text-transform: capitalize;
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.scroll-indicator {
    margin-top: 4rem;
}

.scroll-arrow {
    width: 30px;
    height: 50px;
    border: 2px solid var(--primary-pink);
    border-radius: 25px;
    position: relative;
    margin: 0 auto;
}

.scroll-arrow::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary-pink);
    border-radius: 50%;
    animation: scroll-down 2s infinite;
}

@keyframes scroll-down {
    0% { top: 10px; opacity: 1; }
    100% { top: 30px; opacity: 0; }
}

/* 飘落的爱心背景 */
.hearts-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* Journey 区 */
.journey {
    padding: 8rem 0;
    background: transparent;
}

.section-title {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: 2px;
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 4rem;
    font-style: italic;
    letter-spacing: 0.5px;
}

.timeline {
    position: relative;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-pink), var(--gold));
    transform: translateX(-50%);
}

.timeline-item {
    margin-bottom: 4rem;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* AOS animation states */
.timeline-item[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

.timeline-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.timeline-content.reverse {
    flex-direction: row-reverse;
}

.photo-placeholder {
    flex: 1;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--light-pink), var(--soft-gold));
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* When photo has an image, hide the gradient */
.photo-placeholder.has-image {
    background: none;
    padding: 0;
}

/* Style for timeline photo image */
.timeline-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    display: block;
}

.photo-placeholder:hover {
    transform: scale(1.05);
}

.photo-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.photo-hint {
    font-size: 1.1rem;
    color: var(--text-light);
}

.timeline-text {
    flex: 1;
    padding: 2rem;
}

.timeline-text h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.timeline-text p {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.8;
}

.timeline-date {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--primary-pink);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Journey ending message */
.journey-ending {
    text-align: center;
    padding: 2rem 0;
}

.journey-ending-text {
    font-size: 1.4rem;
    color: var(--text-dark);
    font-style: italic;
    line-height: 1.8;
    letter-spacing: 0.5px;
    max-width: 600px;
    margin: 0 auto;
}

/* Message 区 */
.message {
    padding: 8rem 0;
    background: transparent;
    position: relative;
    overflow: visible;
}

.message .section-title {
    color: var(--text-dark);
}

.message-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.letter-container {
    max-width: 800px;
    width: 100%;
    margin: 3rem auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.letter-paper {
    background: rgba(255, 255, 255, 0.95);
    padding: 4rem;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.letter-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-pink), var(--gold));
}

.typewriter {
    font-size: 1.3rem;
    line-height: 2;
    color: var(--text-dark);
    min-height: 300px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.signature {
    text-align: right;
    font-size: 1.2rem;
    margin-top: 3rem;
    color: var(--primary-pink);
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Gallery 区 */
.gallery {
    background: transparent;
    position: relative;
}

.gallery-slider {
    position: relative;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.gallery-track {
    position: relative;
    width: 100%;
    height: auto;
}

.gallery-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.gallery-item.active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

.gallery-placeholder {
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, var(--soft-gold), var(--primary-pink));
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 100%;
}

.gallery-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.gallery-placeholder p {
    font-size: 1.5rem;
    color: var(--white);
}

/* Memory photo styling */
.gallery-placeholder.has-memory-image {
    padding: 0;
    background: none;
    position: relative;
}

.memory-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    display: block;
}

/* Memory caption overlay */
.memory-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.6) 70%, transparent 100%);
    color: white;
    padding: 3rem 2rem 2rem;
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: center;
    border-radius: 0 0 20px 20px;
}

.loading-message {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.gallery-controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.gallery-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    color: var(--primary-pink);
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.gallery-btn:hover {
    background: var(--primary-pink);
    color: var(--white);
    transform: scale(1.1);
}

/* Ending */
.ending {
    text-align: center;
    padding: 4rem 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.play-again-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary-pink), var(--gold));
    color: var(--white);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 182, 193, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    letter-spacing: 1px;
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(255, 182, 193, 0.6);
}

.btn-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.play-again-btn:hover .btn-icon {
    transform: translateY(-5px);
}

/* Fireworks Canvas */
#fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* 响应式设计 */
@media (max-width: 968px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .timer-display {
        gap: 0.8rem;
        max-width: 100%;
    }
    
    .timer-item {
        min-width: 70px;
        padding: 0.8rem 1rem;
    }
    
    .timer-value {
        font-size: 1.8rem;
    }
    
    .timer-label {
        font-size: 0.7rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: 50px;
    }
    
    /* Add a dot marker on the timeline for mobile */
    .timeline-item::before {
        content: '';
        position: absolute;
        left: 13px;
        top: 0;
        width: 14px;
        height: 14px;
        background: var(--primary-pink);
        border: 3px solid var(--white);
        border-radius: 50%;
        box-shadow: 0 0 0 2px var(--primary-pink);
        z-index: 1;
    }
    
    .timeline-content,
    .timeline-content.reverse {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .timeline-text {
        padding: 1rem;
    }
    
    .photo-placeholder {
        width: 100%;
    }
    
    .letter-paper {
        padding: 2rem;
    }
    
    .typewriter {
        font-size: 1.1rem;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .timer-display {
        gap: 0.5rem;
    }
    
    .timer-item {
        min-width: 55px;
        padding: 0.6rem 0.8rem;
    }
    
    .timer-value {
        font-size: 1.3rem;
    }
    
    .timer-label {
        font-size: 0.6rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .letter-paper {
        padding: 1.5rem;
    }
    
    .letter-container {
        padding: 0 10px;
    }
    
    .timeline {
        padding: 0 10px;
    }
    
    .timeline-item {
        padding-left: 45px;
        margin-bottom: 3rem;
    }
    
    .timeline-content {
        gap: 1rem;
    }
    
    .timeline-text {
        padding: 0.5rem;
    }
    
    .photo-placeholder {
        min-height: 200px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    /* Mobile caption styling */
    .memory-caption {
        font-size: 1rem;
        padding: 2rem 1rem 1rem;
        line-height: 1.4;
    }
}

