/* ============================================
   献给王佳新 — 浪漫主题网站
   ============================================ */

/* --- CSS Variables (Light Theme) --- */
:root {
    --rose: #e8a0b4;
    --rose-dark: #d4788f;
    --rose-light: #fce4ec;
    --blush: #f8d7da;
    --wine: #8b2252;
    --gold: #c9a96e;
    --cream: #fdf6f0;
    --dark: #2d1b2e;
    --text: #4a3040;
    --text-light: #8b6b7a;
    --white: #ffffff;
    --shadow: 0 10px 40px rgba(139, 34, 82, 0.12);
    --shadow-lg: 0 20px 60px rgba(139, 34, 82, 0.18);
    --radius: 20px;
    --transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --bg: #fdf6f0;
    --bg-card: #ffffff;
    --bg-card-trans: rgba(255, 255, 255, 0.7);
    --border: rgba(232, 160, 180, 0.2);
    --nav-bg: rgba(253, 246, 240, 0.85);
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --rose: #d4788f;
    --rose-dark: #e8a0b4;
    --rose-light: #3d2a35;
    --blush: #3d2a35;
    --wine: #f0c0d0;
    --gold: #c9a96e;
    --cream: #1a1018;
    --dark: #0d0a10;
    --text: #d4c0cc;
    --text-light: #a08898;
    --white: #1e1620;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --bg: #1a1018;
    --bg-card: #241c26;
    --bg-card-trans: rgba(36, 28, 38, 0.7);
    --border: rgba(212, 120, 143, 0.2);
    --nav-bg: rgba(26, 16, 24, 0.85);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

body {
    font-family: 'Noto Serif SC', 'Playfair Display', 'STSong', 'SimSun', serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.5s ease, color 0.5s ease;
}

::selection {
    background: var(--rose);
    color: #fff;
}

/* --- Particle Canvas --- */
.particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- Floating Hearts & Petals --- */
.hearts-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.floating-heart {
    position: absolute;
    font-size: 24px;
    animation: floatUp linear forwards;
    opacity: 0;
    pointer-events: none;
}

.floating-petal {
    position: absolute;
    pointer-events: none;
    animation: petalFall linear forwards;
    opacity: 0;
}

@keyframes floatUp {
    0%   { transform: translateY(100vh) scale(0) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.7; }
    90%  { opacity: 0.3; }
    100% { transform: translateY(-10vh) scale(1.2) rotate(360deg); opacity: 0; }
}

@keyframes petalFall {
    0%   { transform: translateY(-5vh) translateX(0) rotate(0deg); opacity: 0; }
    5%   { opacity: 0.8; }
    85%  { opacity: 0.5; }
    100% { transform: translateY(105vh) translateX(80px) rotate(540deg); opacity: 0; }
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--wine);
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 28px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 4px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 0; height: 2px;
    background: var(--rose);
    transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--wine); }
.nav-links a:hover::after { width: 100%; }

.nav-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 38px; height: 38px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: var(--bg-card-trans);
}

.icon-btn:hover {
    transform: scale(1.1);
    border-color: var(--rose);
}

#musicBtn.playing {
    animation: musicPulse 1s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { border-color: var(--rose); }
    50% { border-color: var(--rose-dark); box-shadow: 0 0 12px rgba(232, 160, 180, 0.5); }
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background: linear-gradient(135deg, #fce4ec 0%, #fdf6f0 30%, #f8e8f0 50%, #fce4ec 70%, #fdf6f0 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: 1;
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #2d1a25 0%, #1a1018 30%, #241c26 50%, #2d1a25 70%, #1a1018 100%);
    background-size: 400% 400%;
}

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

.hero-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, var(--bg) 100%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    padding: 40px 20px;
}

.hero-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 32px;
}

.deco-line { width: 60px; height: 1px; background: var(--rose-dark); }

.deco-heart {
    font-size: 1.4rem;
    animation: heartbeat 1.2s ease-in-out infinite;
    color: var(--rose-dark);
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    56% { transform: scale(1); }
}

.hero-title { margin-bottom: 24px; }

.title-line {
    display: block;
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--wine);
    letter-spacing: 12px;
    line-height: 1.3;
    animation: fadeInUp 1s ease forwards;
}

.title-sub {
    display: block;
    font-size: 1.8rem;
    font-weight: 300;
    color: var(--text-light);
    letter-spacing: 6px;
    margin-top: 12px;
    animation: fadeInUp 1s ease 0.2s forwards;
    opacity: 0;
}

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

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 2;
    animation: fadeInUp 1s ease 0.4s forwards;
    opacity: 0;
}

.hero-scroll {
    margin-top: 48px;
    animation: fadeInUp 1s ease 0.6s forwards;
    opacity: 0;
}

.hero-scroll span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.scroll-arrow {
    font-size: 1.2rem;
    color: var(--rose-dark);
    animation: bounce 2s ease infinite;
}

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

/* --- Section Common --- */
section {
    position: relative;
    z-index: 1;
    padding: 100px 20px;
}

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

.section-header h2 {
    font-size: 2.5rem;
    color: var(--wine);
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 12px;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    letter-spacing: 4px;
    font-weight: 300;
}

/* --- Timer Section --- */
.timer-section {
    background: var(--bg);
    text-align: center;
}

.timer-container {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    max-width: 600px;
    margin: 0 auto;
}

.timer-block {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 20px;
    min-width: 110px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.timer-block:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.timer-number {
    display: block;
    font-size: 3rem;
    font-weight: 900;
    color: var(--wine);
    font-family: 'Playfair Display', serif;
    line-height: 1.1;
}

.timer-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 8px;
    letter-spacing: 2px;
}

.timer-message {
    margin-top: 36px;
    font-size: 1.1rem;
    color: var(--rose-dark);
    font-style: italic;
    letter-spacing: 2px;
}

/* --- Letter / Envelope --- */
.letter-section {
    background: linear-gradient(180deg, var(--bg) 0%, var(--white) 50%, var(--bg) 100%);
}

.envelope-wrapper {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.envelope {
    text-align: center;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: all 0.6s ease;
}

.envelope.opened {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    height: 0;
    overflow: hidden;
}

.envelope-flap {
    width: 0; height: 0;
    border-left: 120px solid transparent;
    border-right: 120px solid transparent;
    border-top: 80px solid var(--rose);
    margin: 0 auto;
    border-radius: 4px;
    transition: transform 0.6s ease;
    transform-origin: top center;
}

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

.envelope-body {
    background: linear-gradient(135deg, var(--rose-light), var(--blush));
    border: 2px solid var(--rose);
    border-radius: 0 0 12px 12px;
    padding: 40px 20px;
    max-width: 260px;
    margin: -2px auto 0;
    transition: var(--transition);
}

.envelope-heart {
    font-size: 2.5rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.envelope-body p {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--wine);
    letter-spacing: 2px;
}

.envelope-letter {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s ease;
    max-height: 0;
    overflow: hidden;
}

.envelope-letter.visible {
    opacity: 1;
    transform: translateY(0);
    max-height: 3000px;
}

.letter-card { perspective: 1000px; }

.letter-paper {
    background: var(--bg-card);
    padding: 60px 50px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    background-image: linear-gradient(var(--rose-light) 1px, transparent 1px);
    background-size: 100% 2.5rem;
    background-position: 0 40px;
    line-height: 2.5rem;
}

.letter-paper::before {
    content: '';
    position: absolute;
    top: 0; left: 40px;
    width: 1px; height: 100%;
    background: rgba(232, 160, 180, 0.3);
}

.letter-stamp {
    position: absolute;
    top: -20px; right: 40px;
    width: 50px; height: 50px;
    background: var(--rose);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(232, 160, 180, 0.4);
    animation: heartbeat 1.5s ease-in-out infinite;
}

.letter-date {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: right;
    margin-bottom: 32px;
    font-style: italic;
}

.letter-body p {
    margin-bottom: 20px;
    font-size: 1.05rem;
    line-height: 2.2;
    color: var(--text);
}

.letter-body p:first-child { font-size: 1.15rem; font-weight: 600; }

.letter-closing {
    text-align: right;
    margin-top: 40px;
    font-style: italic;
    color: var(--wine);
    font-size: 1.1rem;
    line-height: 2;
}

/* --- Reasons Section --- */
.reasons-section {
    background: linear-gradient(135deg, var(--bg) 0%, var(--rose-light) 50%, var(--bg) 100%);
}

.reasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.reason-card {
    background: var(--bg-card-trans);
    backdrop-filter: blur(10px);
    padding: 28px 24px;
    border-radius: 16px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--border);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: var(--delay);
    opacity: 0;
}

.reason-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
    background: var(--bg-card);
    border-color: var(--rose);
}

.reason-num {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--rose);
    font-family: 'Playfair Display', serif;
    margin-bottom: 10px;
}

.reason-card p { font-size: 0.95rem; color: var(--text); line-height: 1.6; }

.reasons-more { text-align: center; margin-top: 48px; }

.reasons-more p {
    font-size: 1.2rem;
    color: var(--wine);
    font-style: italic;
    font-weight: 300;
    letter-spacing: 2px;
}

/* --- Gallery Section --- */
.gallery-section { background: var(--bg); }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    background: linear-gradient(135deg, var(--rose-light), var(--blush));
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: var(--radius);
    transition: var(--transition);
    background: linear-gradient(135deg, var(--rose-light), var(--blush));
}

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

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.active { display: flex; }

.lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.5);
    animation: lightboxIn 0.3s ease;
}

@keyframes lightboxIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox-close {
    position: absolute;
    top: 20px; right: 40px;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    z-index: 10001;
    transition: transform 0.2s;
}

.lightbox-close:hover { transform: rotate(90deg); }

.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    padding: 20px;
    user-select: none;
    transition: opacity 0.2s;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-prev:hover, .lightbox-next:hover { opacity: 0.7; }

.lightbox-caption {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 16px;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* --- Poem Section --- */
.poem-section {
    background: linear-gradient(180deg, var(--bg) 0%, var(--dark) 100%);
    color: #fff;
}

.poem-section .section-header h2 { color: var(--rose-light); }
.poem-section .section-subtitle { color: rgba(255, 255, 255, 0.6); }

.poem-container { max-width: 600px; margin: 0 auto; }

.poem-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 50px 40px;
    text-align: center;
}

.poem-stanza p {
    font-size: 1.2rem;
    line-height: 2.2;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
}

.poem-divider { font-size: 1.5rem; color: var(--rose); margin: 32px 0; }

/* --- Footer --- */
.footer {
    position: relative;
    z-index: 1;
    background: var(--dark);
    color: #fff;
    text-align: center;
    padding: 80px 20px;
}

.footer-hearts {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.footer-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--rose-light);
    letter-spacing: 12px;
    margin-bottom: 12px;
}

.footer-message {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    margin-bottom: 32px;
    letter-spacing: 2px;
}

.footer-copy {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 3px;
}

/* --- Click Heart Effect --- */
.click-heart {
    position: fixed;
    pointer-events: none;
    font-size: 30px;
    z-index: 9999;
    animation: clickHeartBurst 0.8s ease-out forwards;
}

@keyframes clickHeartBurst {
    0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50%  { transform: translate(-50%, -50%) scale(1.5); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2) translateY(-60px); opacity: 0; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar { padding: 10px 16px; }
    .nav-links { gap: 12px; }
    .nav-links a { font-size: 0.75rem; }
    .nav-actions { gap: 4px; }
    .icon-btn { width: 32px; height: 32px; font-size: 0.85rem; }

    .title-line { font-size: 2.8rem; letter-spacing: 6px; }
    .title-sub { font-size: 1.3rem; letter-spacing: 3px; }
    .hero-desc { font-size: 0.9rem; }

    .section-header h2 { font-size: 1.8rem; }

    .timer-block { min-width: 70px; padding: 20px 14px; }
    .timer-number { font-size: 2rem; }

    .envelope-flap { border-left-width: 80px; border-right-width: 80px; border-top-width: 55px; }
    .envelope-body { max-width: 180px; padding: 24px 16px; }

    .letter-paper { padding: 40px 28px; }

    .reasons-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .reason-card { padding: 20px 16px; }

    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

    .poem-stanza p { font-size: 1rem; letter-spacing: 1px; }
    .footer-title { font-size: 2rem; letter-spacing: 6px; }

    .lightbox-prev, .lightbox-next { font-size: 1.8rem; padding: 10px; }
}

@media (max-width: 480px) {
    .nav-links { gap: 8px; }
    .nav-links a { font-size: 0.7rem; }
    .nav-brand { font-size: 1rem; }

    .title-line { font-size: 2.2rem; letter-spacing: 4px; }
    .title-sub { font-size: 1.1rem; }

    .timer-block { min-width: 60px; padding: 16px 10px; }
    .timer-number { font-size: 1.6rem; }

    .reasons-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .gallery-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}
