/* ===========================
   温暖文艺风手账 - 主样式
   =========================== */

/* 字体 */
:root {
    --font-handwriting: 'Ma Shan Zheng', cursive;
    --font-serif: 'Noto Serif SC', serif;
    --font-xiaowei: 'ZCOOL XiaoWei', serif;

    /* 暖色调 */
    --color-cream: #FDF6E3;
    --color-kraft: #D4A574;
    --color-kraft-dark: #B8956A;
    --color-pink: #E8A4B4;
    --color-pink-light: #F5D6DE;
    --color-brown: #6B4423;
    --color-brown-light: #8B5A2B;
    --color-sage: #9CAF88;
    --color-rose: #C48B8F;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    background: var(--color-cream);
    color: var(--color-brown);
    line-height: 1.8;
    overflow-x: hidden;
}

/* 纸张纹理 */
.paper-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(212, 165, 116, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(232, 164, 180, 0.1) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ===========================
   音乐控制
   =========================== */
.music-control {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.music-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--color-pink);
    border-radius: 30px;
    padding: 10px 20px;
    cursor: pointer;
    font-family: var(--font-handwriting);
    font-size: 16px;
    color: var(--color-brown);
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.music-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(212, 165, 116, 0.4);
}

.music-btn.playing {
    background: var(--color-pink);
    color: white;
}

.music-btn.playing .music-icon {
    animation: musicBounce 0.5s infinite alternate;
}

@keyframes musicBounce {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

/* ===========================
   导航
   =========================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    background: linear-gradient(to bottom, rgba(253, 246, 227, 0.98), rgba(253, 246, 227, 0));
    padding: 15px 0;
    transition: all 0.3s ease;
}

.nav-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 30px;
}

.nav-item {
    font-family: var(--font-handwriting);
    font-size: 18px;
    color: var(--color-brown);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-pink);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-item:hover::after,
.nav-item.active::after {
    width: 80%;
}

.nav-item:hover,
.nav-item.active {
    color: var(--color-pink);
}

/* ===========================
   装饰元素
   =========================== */
.decorations {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.deco {
    position: absolute;
    opacity: 0.6;
    animation: floatDecor 6s ease-in-out infinite;
}

.flower.deco-1 { top: 15%; left: 5%; animation-delay: 0s; font-size: 24px; }
.flower.deco-2 { top: 40%; right: 8%; animation-delay: 1s; font-size: 28px; }
.leaf.deco-3 { bottom: 25%; left: 10%; animation-delay: 2s; font-size: 22px; }
.leaf.deco-4 { bottom: 40%; right: 5%; animation-delay: 0.5s; font-size: 20px; }
.heart.deco-5 { top: 60%; left: 3%; animation-delay: 1.5s; font-size: 18px; }

@keyframes floatDecor {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

/* ===========================
   弹幕
   =========================== */
.danmu-container {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: 200px;
    pointer-events: none;
    z-index: 998;
    overflow: hidden;
}

.danmu-item {
    position: absolute;
    white-space: nowrap;
    font-family: var(--font-handwriting);
    font-size: 18px;
    color: var(--color-rose);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    animation: danmuFly linear forwards;
    opacity: 0.8;
}

@keyframes danmuFly {
    0% {
        left: 100%;
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        left: -300px;
        opacity: 0;
    }
}

/* ===========================
   通用 Section
   =========================== */
.section {
    min-height: 100vh;
    position: relative;
    padding: 80px 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 1;
}

.section-header h2 {
    font-family: var(--font-handwriting);
    font-size: 42px;
    color: var(--color-brown);
    margin-bottom: 10px;
}

.section-header .subtitle {
    font-family: var(--font-serif);
    font-size: 16px;
    color: var(--color-brown-light);
    letter-spacing: 2px;
}

/* ===========================
   首页
   =========================== */
.section-home {
    height: 100vh;
    padding: 80px 0 0 0; /* 顶部留出导航栏空间 */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-image: url('../assets/images/bg1.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.home-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(107, 68, 35, 0.3) 0%,
        rgba(107, 68, 35, 0.5) 50%,
        rgba(107, 68, 35, 0.7) 100%
    );
    z-index: 1;
}

.home-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    padding: 20px;
}

.heart-line {
    font-size: 24px;
    letter-spacing: 15px;
    margin-bottom: 30px;
    animation: heartBeat 1.5s ease-in-out infinite;
}

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

.slogan {
    font-family: var(--font-xiaowei);
    font-size: 48px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    line-height: 1.4;
}

.couple-names {
    font-family: var(--font-handwriting);
    font-size: 36px;
    margin-bottom: 20px;
    letter-spacing: 5px;
}

.couple-names .heart {
    color: var(--color-pink);
    animation: heartBeat 1s infinite;
}

.love-duration {
    font-family: var(--font-serif);
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 60px;
}

.scroll-hint {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-handwriting);
    font-size: 16px;
    color: white;
    opacity: 0.8;
    animation: scrollBounce 2s infinite;
}

.scroll-hint .arrow {
    display: block;
    font-size: 24px;
    margin-top: 5px;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

/* ===========================
   我们的故事 - 时间轴
   =========================== */
.section-story {
    background: linear-gradient(to bottom, var(--color-cream), #F5EDD8);
    padding-bottom: 100px;
}

.timeline {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 时间轴中线 */
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--color-pink), var(--color-kraft));
    transform: translateX(-50%);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    width: 100%;
    display: flex;
    margin-bottom: 40px;
}

/* 奇数项：左侧 */
.timeline-item:nth-child(odd) {
    justify-content: flex-start;
    padding-right: calc(50% + 40px);
}

.timeline-item:nth-child(odd) .timeline-content {
    text-align: right;
}

/* 偶数项：右侧 */
.timeline-item:nth-child(even) {
    justify-content: flex-end;
    padding-left: calc(50% + 40px);
}

.timeline-item:nth-child(even) .timeline-content {
    text-align: left;
}

.timeline-marker {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--color-pink);
    border: 4px solid var(--color-cream);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--color-pink);
    z-index: 10;
}

.timeline-content {
    width: 100%;
    max-width: 420px;
}

.timeline-date {
    font-family: var(--font-handwriting);
    font-size: 20px;
    color: var(--color-pink);
    margin-bottom: 10px;
}

.timeline-date {
    font-family: var(--font-handwriting);
    font-size: 20px;
    color: var(--color-pink);
    margin-bottom: 10px;
}

.timeline-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow:
        0 10px 30px rgba(107, 68, 35, 0.1),
        0 5px 15px rgba(107, 68, 35, 0.05);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 15px 40px rgba(107, 68, 35, 0.15),
        0 8px 20px rgba(107, 68, 35, 0.08);
}

.card-image {
    position: relative;
    margin-bottom: 15px;
}

.card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-sticker {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 30px;
    background: white;
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.card-text h3 {
    font-family: var(--font-handwriting);
    font-size: 22px;
    color: var(--color-brown);
    margin-bottom: 8px;
}

.card-text p {
    font-size: 14px;
    color: var(--color-brown-light);
    line-height: 1.7;
}

/* 年份标签 */
.timeline-year {
    font-family: var(--font-handwriting);
    font-size: 28px;
    color: var(--color-kraft);
    text-align: center;
    margin: 40px 0 20px;
}

/* ===========================
   照片墙
   =========================== */
.section-photos {
    background: linear-gradient(to bottom, #F5EDD8, var(--color-cream));
}

.photo-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    padding: 0 20px;
}

.photo-item {
    position: relative;
}

.polaroid {
    background: white;
    padding: 15px 15px 50px;
    box-shadow:
        0 10px 30px rgba(107, 68, 35, 0.15),
        0 5px 15px rgba(107, 68, 35, 0.1);
    transform: rotate(var(--rotate, 0deg));
    transition: all 0.3s ease;
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.05) translateY(-10px);
    box-shadow:
        0 20px 50px rgba(107, 68, 35, 0.2),
        0 10px 25px rgba(107, 68, 35, 0.15);
    z-index: 10;
}

.polaroid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 3px;
}

.polaroid-caption {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-handwriting);
    font-size: 16px;
    color: var(--color-brown);
}

/* 随机旋转角度 */
.polaroid-1 { --rotate: -3deg; }
.polaroid-2 { --rotate: 2deg; }
.polaroid-3 { --rotate: -2deg; }
.polaroid-4 { --rotate: 4deg; }
.polaroid-5 { --rotate: -4deg; }
.polaroid-6 { --rotate: 1deg; }
.polaroid-7 { --rotate: 3deg; }
.polaroid-8 { --rotate: -1deg; }

/* ===========================
   给未来的我们 - 情书
   =========================== */
.section-letter {
    background: linear-gradient(to bottom, var(--color-cream), #F5EDD8);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.letter-container {
    position: relative;
    z-index: 1;
    perspective: 1000px;
}

.envelope {
    width: 400px;
    height: 300px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
}

.envelope.open {
    animation: openEnvelope 1s forwards;
}

.envelope.open .envelope-body {
    overflow: visible;
}

@keyframes openEnvelope {
    0% { transform: rotateX(0); }
    100% { transform: rotateX(-30deg); }
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-pink), var(--color-pink-light));
    clip-path: polygon(0 0, 50% 50%, 100% 0);
    transform-origin: top center;
    transition: all 0.5s ease;
    z-index: 3;
}

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

.envelope-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: var(--color-kraft);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(107, 68, 35, 0.3);
}

.letter-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #FFFEF5;
    padding: 30px;
    font-family: var(--font-serif);
    line-height: 2;
    transform: translateY(100%);
    transition: all 0.8s ease 0.3s;
}

.envelope.open .letter-content {
    transform: translateY(-50px);
    z-index: 20;
    position: relative;
}

.letter-page p {
    margin-bottom: 15px;
    font-size: 15px;
    color: var(--color-brown);
}

.letter-page .signed {
    text-align: right;
    margin-top: 30px;
    font-style: italic;
}

.letter-page .date {
    font-size: 13px;
    color: var(--color-brown-light);
}

.letter-controls {
    margin-top: 40px;
    text-align: center;
}

.letter-btn {
    font-family: var(--font-handwriting);
    font-size: 20px;
    background: var(--color-pink);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(232, 164, 180, 0.4);
    transition: all 0.3s ease;
}

.letter-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(232, 164, 180, 0.5);
}

/* ===========================
   页脚
   =========================== */
.footer {
    background: linear-gradient(to bottom, #F5EDD8, var(--color-kraft));
    padding: 60px 20px;
    text-align: center;
    position: relative;
}

.footer-hearts {
    font-size: 30px;
    letter-spacing: 20px;
    margin-bottom: 20px;
}

.footer-text {
    font-family: var(--font-handwriting);
    font-size: 32px;
    color: var(--color-brown);
    margin-bottom: 10px;
}

.footer-text .heart {
    color: var(--color-pink);
}

.footer-date {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--color-brown-light);
    margin-bottom: 20px;
}

.footer-copy {
    font-size: 12px;
    color: var(--color-brown-light);
    opacity: 0.7;
}

/* ===========================
   响应式
   =========================== */
@media (max-width: 768px) {
    .slogan {
        font-size: 28px;
    }

    .couple-names {
        font-size: 24px;
    }

    .nav-inner {
        gap: 15px;
        flex-wrap: wrap;
    }

    .nav-item {
        font-size: 14px;
        padding: 6px 12px;
    }

    /* 时间轴移动端单列 */
    .timeline::before {
        left: 20px;
    }

    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        width: 100%;
        padding: 0 0 30px 50px !important;
        justify-content: flex-start !important;
        margin-bottom: 30px;
    }

    .timeline-marker {
        left: 10px !important;
        transform: none !important;
    }

    .timeline-content,
    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        text-align: left !important;
        max-width: 100%;
    }

    /* 照片墙 */
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .polaroid img {
        height: 150px;
    }

    /* 情书 */
    .envelope {
        width: 300px;
        height: 220px;
    }

    .letter-content {
        padding: 20px;
    }

    .letter-page p {
        font-size: 13px;
    }

    .section-header h2 {
        font-size: 32px;
    }

    .danmu-container {
        display: none;
    }
}

@media (max-width: 480px) {
    .slogan {
        font-size: 22px;
    }

    .photo-grid {
        grid-template-columns: 1fr;
    }

    .polaroid {
        transform: rotate(0deg) !important;
    }
}
