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

:root {
    --primary: #c9a86c;
    --primary-light: #e8d5b0;
    --secondary: #f5e6d3;
    --accent: #d4a5a5;
    --text: #5a4a3a;
    --text-light: #8a7a6a;
    --white: #fff;
    --bg-cream: #fdf8f3;
    --bg-pink: #fff5f5;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    color: var(--text);
    background: var(--bg-cream);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
}

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

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

.music-icon {
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.music-icon span {
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
    transition: height 0.3s ease;
}

.music-icon span:nth-child(1) { height: 8px; }
.music-icon span:nth-child(2) { height: 16px; }
.music-icon span:nth-child(3) { height: 12px; }

.music-control.playing .music-icon span:nth-child(1) {
    animation: musicBar 0.5s ease infinite alternate;
}
.music-control.playing .music-icon span:nth-child(2) {
    animation: musicBar 0.5s ease 0.1s infinite alternate;
}
.music-control.playing .music-icon span:nth-child(3) {
    animation: musicBar 0.5s ease 0.2s infinite alternate;
}

@keyframes musicBar {
    to { height: 20px; }
}

/* ===== 封面区域 ===== */
.cover {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.cover-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fdf8f3 0%, #fff5f5 50%, #f5e6d3 100%);
    z-index: -1;
}

/* 封面照片背景 + 渐变遮罩 */
.cover-photo {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: url('photos/cover.jpg') center 30% / cover no-repeat;
}

.cover-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(253, 248, 243, 0.55) 0%,
        rgba(253, 248, 243, 0.35) 40%,
        rgba(253, 248, 243, 0.72) 100%
    );
}

.cover-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a86c' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.cover-content {
    text-align: center;
    padding: 40px 20px;
    animation: fadeInUp 1.5s ease;
}

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

.cover-decoration {
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    margin: 20px auto;
}

.cover-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    letter-spacing: 4px;
    margin-bottom: 30px;
    animation: fadeIn 1s ease 0.5s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cover-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    color: var(--text);
    margin-bottom: 30px;
    animation: fadeIn 1s ease 0.8s both;
}

.cover-title .name {
    display: inline-block;
}

.cover-title .and {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.6em;
    color: var(--primary);
    margin: 0 15px;
    font-style: italic;
}

.cover-date {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 50px;
    animation: fadeIn 1s ease 1s both;
}

.cover-date .lunar {
    color: var(--text-light);
}

.cover-date .divider {
    width: 1px;
    height: 20px;
    background: var(--primary);
}

.cover-date .solar {
    color: var(--text);
    font-weight: 600;
}

/* 倒计时 */
.countdown {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 60px;
    animation: fadeIn 1s ease 1.2s both;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-num {
    font-family: 'ZCOOL XiaoWei', cursive;
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: var(--primary);
    line-height: 1;
}

.countdown-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* 滚动提示 */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
    animation: bounce 2s infinite;
}

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

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(45deg);
}

/* ===== 通用区域样式 ===== */
section {
    padding: 100px 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text);
    margin-bottom: 10px;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--primary);
    letter-spacing: 3px;
}

/* ===== 我们的故事 - 手帐相册式 ===== */
.story {
    background: var(--white);
    overflow: hidden;
}

/* 手帐纸张底纹：浅米色 + 极淡横线 */
.story .section-header {
    position: relative;
}

.story .section-header::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--primary-light);
    border-radius: 1px;
}

.scrapbook {
    max-width: 640px;
    margin: 0 auto;
    padding: 10px 24px 80px;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0 31px,
            rgba(201, 168, 108, 0.06) 31px 32px
        );
}

/* 拍立得相片 */
.polaroid {
    background: #fff;
    padding: 12px 12px 14px;
    border-radius: 2px;
    box-shadow: 0 6px 20px rgba(90, 74, 58, 0.14);
    position: relative;
    transition: transform 0.45s ease, box-shadow 0.45s ease;
    backface-visibility: hidden;
}

/* 照片容器：padding-top 撑高 3:4（兼容所有内核，含微信 X5） */
.photo-wrap {
    position: relative;
    width: 100%;
    padding-top: 133.33%;
    overflow: hidden;
    background: var(--secondary);
}

.photo-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.polaroid .hand-note {
    text-align: center;
    color: var(--text);
    font-size: 0.92rem;
    letter-spacing: 1px;
    padding-top: 10px;
}

/* 倾斜姿态 */
.tilt-left {
    transform: rotate(-2.5deg);
}

.tilt-right {
    transform: rotate(2deg);
}

.tilt-none {
    transform: rotate(0deg);
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow: 0 12px 32px rgba(90, 74, 58, 0.22);
    z-index: 3;
}

/* 纸胶带 */
.tape {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-4deg);
    width: 86px;
    height: 26px;
    background: rgba(232, 213, 176, 0.85);
    box-shadow: 0 1px 3px rgba(90, 74, 58, 0.15);
    z-index: 2;
}

.tape-rev {
    transform: translateX(-50%) rotate(6deg);
    background: rgba(212, 165, 165, 0.55);
}

.tape-center {
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
}

/* 手帐条目：错落排布 */
.scrapbook-item {
    position: relative;
    margin-bottom: 56px;
}

.scrapbook-item .polaroid {
    width: 82%;
}

.scrapbook-item:nth-child(even) {
    margin-left: 14%;
}

.scrapbook-item:nth-child(odd) .polaroid {
    margin-left: -8px;
}

.scrapbook-item.wide {
    margin-left: 0;
}

.scrapbook-item.wide .polaroid {
    width: 100%;
}

/* 手写故事文字 */
.scrap-text {
    font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', 'SimKai', cursive;
    font-size: 1.02rem;
    line-height: 2;
    color: var(--text-light);
    margin-top: 18px;
    max-width: 86%;
    padding-left: 6px;
}

.scrapbook-item:nth-child(even) .scrap-text {
    margin-left: 8%;
    max-width: 80%;
}

/* 手写批注字体 */
.hand-note {
    font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', 'SimKai', cursive;
}

/* 结尾贴纸 */
.scrapbook-end {
    text-align: center;
    padding: 30px 0 10px;
}

.sticker-heart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-pink);
    border: 1.5px dashed var(--accent);
    color: var(--accent);
    font-size: 1.4rem;
    margin-bottom: 16px;
    transform: rotate(-6deg);
}

.hand-big {
    font-size: 1.35rem;
    color: var(--text);
    letter-spacing: 4px;
}

/* 手帐相片滚动入场（初始隐藏由 JS 设置，JS 未执行时内容保持可见） */
.scrapbook-item {
    transition: opacity 0.7s ease, transform 0.7s ease;
}

@media (prefers-reduced-motion: reduce) {
    .scrapbook-item {
        transition: none;
    }
}

/* 桌面端：摊开的相册，双列错落 */
@media (min-width: 900px) {
    .scrapbook {
        max-width: 980px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 40px;
        padding: 10px 40px 90px;
    }

    .scrapbook-item {
        margin-bottom: 64px;
    }

    .scrapbook-item:nth-child(even) {
        margin-left: 0;
        margin-top: 80px;
    }

    .scrapbook-item .polaroid {
        width: 100%;
    }

    .scrapbook-item:nth-child(odd) .polaroid {
        margin-left: 0;
    }

    .scrapbook-item.wide {
        grid-column: 1 / -1;
    }

    .scrapbook-item.wide .polaroid {
        width: 72%;
        margin: 0 auto;
    }

    .scrapbook-item.wide .scrap-text {
        text-align: center;
        margin: 18px auto 0;
    }

    .scrapbook-end {
        grid-column: 1 / -1;
    }
}

/* ===== 婚纱照画廊 ===== */
.gallery {
    background: var(--bg-pink);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-item.large {
    grid-column: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* 灯箱 */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.show {
    display: flex;
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 5px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    top: calc(20px + env(safe-area-inset-top));
    right: calc(20px + env(safe-area-inset-right));
    font-size: 2.5rem;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== 婚礼信息 ===== */
.info {
    background: var(--white);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto 50px;
}

.info-card {
    background: var(--bg-cream);
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.info-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.info-card h3 {
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 15px;
}

.info-main {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.info-sub {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* 地图 */
.map-container {
    max-width: 800px;
    margin: 0 auto;
}

.map-placeholder {
    background: var(--bg-cream);
    padding: 60px 30px;
    border-radius: 20px;
    text-align: center;
    border: 2px dashed var(--primary-light);
}

.map-placeholder p:first-of-type {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 10px;
}

.map-placeholder p:nth-of-type(2) {
    color: var(--text-light);
    margin-bottom: 25px;
}

.map-btn {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.map-btn:hover {
    background: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ===== 祝福留言 ===== */
.blessing {
    background: var(--bg-cream);
}

.blessing-form {
    max-width: 600px;
    margin: 0 auto 50px;
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.blessing-form input,
.blessing-form textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--secondary);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    margin-bottom: 20px;
}

.blessing-form input:focus,
.blessing-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.blessing-form textarea {
    min-height: 120px;
    resize: vertical;
}

.blessing-form button {
    width: 100%;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 15px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.blessing-form button:hover {
    background: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.blessing-list {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    gap: 20px;
}

.blessing-item {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    animation: fadeInUp 0.5s ease;
}

.blessing-item .blessing-name {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
}

.blessing-item .blessing-content {
    color: var(--text);
    line-height: 1.8;
}

.blessing-item .blessing-time {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 10px;
}

/* ===== 页脚 ===== */
.footer {
    background: linear-gradient(135deg, var(--text) 0%, #3a2a1a 100%);
    color: var(--white);
    padding: 80px 20px 40px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
    text-align: center;
    position: relative;
}

.footer-content {
    position: relative;
    z-index: 1;
}

.couple-names {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--primary-light);
}

.footer-date {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

.footer-invitation {
    font-size: 1rem;
    color: var(--primary-light);
    opacity: 0.8;
}

.footer-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.icp-info {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.icp-info a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
}

.icp-info a:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* ===== 响应式设计 ===== */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    section {
        padding: 60px 15px;
    }
    
    .countdown {
        gap: 15px;
    }
    
    .countdown-num {
        font-size: 2rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-item.large {
        grid-column: span 1;
    }
    
    .gallery-grid {
        grid-auto-rows: 200px;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
    }
    
    .blessing-form {
        padding: 25px;
    }

    .music-control {
        width: 45px;
        height: 45px;
        top: 15px;
        right: 15px;
        top: calc(15px + env(safe-area-inset-top));
        right: calc(15px + env(safe-area-inset-right));
    }
}

/* ===== 滚动动画 ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}
