/* Global Reset and Variables */
:root {
    --bg-pink: #fdf3f5;
    --dark-pink: #e35b71;
    --text-main: #b84b5c;
    --text-dark: #4a4a4a;
    --cream: #fffdf9;
    --dark-bg: #1a080c;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Force NO scrolling anywhere */
    background: var(--bg-pink);
    font-family: 'Playfair Display', serif;
    color: var(--text-dark);
}

.handwriting {
    font-family: 'Caveat', cursive;
    font-size: 1.25rem; /* Slightly smaller to guarantee fit without scroll */
    line-height: 1.3;
    color: #333;
}
.script-font {
    font-family: 'Great Vibes', cursive;
}

/* Functional Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    gap: 35px;
    z-index: 999;
    background: rgba(253, 243, 245, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(227, 91, 113, 0.05);
}
.nav-item {
    font-family: sans-serif;
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: #888;
    cursor: pointer;
    transition: color 0.3s, text-shadow 0.3s;
    text-transform: uppercase;
    white-space: nowrap;
}
.nav-item:hover, .nav-item.active-nav {
    color: var(--dark-pink);
}


/* Ambient Background */
#ambient-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #fff 0%, var(--bg-pink) 100%);
    z-index: -1;
    transition: opacity 2s ease;
}

/* View Container - Strictly no scrolling */
.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Always vertically centered */
    overflow: hidden; /* STRICT NO SCROLLING */
    padding: 60px 15px 20px 15px; /* Navbar clearance */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, visibility 0.5s;
    z-index: 10;
}
.view.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    z-index: 20;
}

.flex-center-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%; /* Take full available height for perfect centering */
}

/* --- Shared Section Titles --- */
.section-title {
    font-size: 2.2rem;
    color: var(--text-main);
    margin-bottom: 5px;
    text-align: center;
    font-weight: 700;
}
.section-subtitle {
    font-size: 1rem;
    color: var(--dark-pink);
    margin-bottom: 20px;
    text-align: center;
    font-family: sans-serif;
}

/* --- View 1: Welcome --- */
.welcome-decor {
    position: fixed;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}
.decor {
    position: absolute;
    font-size: 2rem;
    opacity: 0.8;
    animation: floatUp 8s infinite alternate ease-in-out;
}
.bow-1 { top: 30%; left: 15%; transform: rotate(-15deg); }
.flower-1 { top: 15%; right: 20%; font-size: 2.5rem; }
.heart-1 { top: 60%; right: 15%; font-size: 1.5rem; animation-delay: 1s; }
.bow-2 { bottom: 25%; left: 20%; font-size: 1.5rem; animation-delay: 2s; }
.flower-2 { bottom: 15%; right: 25%; transform: rotate(20deg); animation-delay: 3s; }

#view-1 .content {
    z-index: 10;
    text-align: center;
    padding: 0 15px;
}
.subtitle {
    font-family: sans-serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: #a3a3a3;
    margin-bottom: 15px;
}
.main-title {
    font-size: 4.5rem;
    line-height: 1.1;
    color: var(--dark-pink);
    font-weight: 700;
}
.script-title {
    font-family: 'Great Vibes', cursive;
    font-size: 2.8rem;
    color: var(--text-dark);
    margin-top: -10px;
    margin-bottom: 15px;
}
.sub-message {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1rem;
    color: #666;
    margin-bottom: 30px;
}

.stagger-text {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.2s forwards ease-out;
}
.delay-1 { animation-delay: 0.5s; }
.delay-2 { animation-delay: 1s; }
.delay-3 { animation-delay: 1.5s; }
.delay-4 { animation-delay: 2s; }

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

.glow-btn {
    padding: 12px 35px;
    font-size: 0.9rem;
    font-weight: bold;
    font-family: sans-serif;
    letter-spacing: 1px;
    background: var(--dark-pink);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(227, 91, 113, 0.3);
    position: relative;
    overflow: hidden;
    animation: pulse 2s infinite, fadeInUp 1.2s forwards ease-out;
    opacity: 0;
    display: block;
    margin: 0 auto;
    transition: transform 0.2s, box-shadow 0.2s;
}
.glow-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 25px rgba(227, 91, 113, 0.4);
}
.glow-btn.small-btn {
    padding: 12px 30px;
    animation: none;
    opacity: 1;
}
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 10px 20px rgba(227, 91, 113, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 15px 30px rgba(227, 91, 113, 0.5); }
    100% { transform: scale(1); box-shadow: 0 10px 20px rgba(227, 91, 113, 0.3); }
}

/* --- View 2: Envelope / Letter --- */
.envelope-container {
    perspective: 1000px;
    cursor: pointer;
    margin-top: 20px;
    transform-origin: center;
    transition: transform 1s ease-in-out; /* ONLY animating transform now, NO layout shifts! */
}
.envelope {
    position: relative;
    width: 320px;
    height: 200px;
    transform-style: preserve-3d;
}
.envelope-body {
    position: absolute;
    width: 100%; height: 100%;
    background: #e8c6c9;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 1;
}
.envelope-front {
    position: absolute;
    width: 100%; height: 100%;
    z-index: 3;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-bottom: 100px solid #f2d7d9;
    border-top: 100px solid transparent;
    pointer-events: none;
}
.envelope-front::after {
    content: '';
    position: absolute;
    top: -100px; left: -160px;
    border-left: 160px solid #ebd0d2;
    border-right: 160px solid transparent;
    border-bottom: 100px solid transparent;
    border-top: 100px solid transparent;
}
.envelope-front::before {
    content: '';
    position: absolute;
    top: -100px; right: -160px;
    border-right: 160px solid #ebd0d2;
    border-left: 160px solid transparent;
    border-bottom: 100px solid transparent;
    border-top: 100px solid transparent;
}
.flap {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100px;
    background: #dfb6b9;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top;
    z-index: 4;
    transition: transform 1s ease-in-out;
}
.wax-seal {
    position: absolute;
    bottom: -15px; left: 50%;
    transform: translateX(-50%);
    width: 45px; height: 45px;
    background: #b52c42;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease;
    z-index: 5;
    display: flex; justify-content: center; align-items: center;
}
.wax-seal::after {
    content: '♥'; color: white; font-size: 1.2rem;
}

.card-style {
    position: absolute;
    top: 10px; /* Anchored to TOP so it grows downwards */
    left: 10px; right: 10px;
    height: 180px; 
    background: #fffaee;
    z-index: 2;
    padding: 20px 15px;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 1.2s ease-in-out, height 1.2s ease-in-out, padding 1.2s ease;
    text-align: left;
    overflow: hidden; 
}
.card-seal {
    position: absolute;
    top: 15px; right: 15px;
    width: 25px; height: 25px;
    background: var(--dark-pink);
    color: white;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.card-style .greeting {
    margin-bottom: 5px;
    min-height: 25px;
    color: var(--text-dark);
}
.card-style p { margin-bottom: 5px; }
.card-footer {
    text-align: right;
    margin-top: 10px;
    font-size: 1.1rem;
}

/* NO SCROLLING FIX: Envelope drops down using transform, Letter stays still! */
.envelope-container.open {
    transform: translateY(180px); /* Envelope drops away cleanly */
}
.envelope-container.open .wax-seal { opacity: 0; }
.envelope-container.open .flap {
    transform: rotateX(180deg);
    z-index: 1;
}
.envelope-container.open .parchment {
    height: 360px; /* Grows DOWNwards due to top: 10px anchor */
    /* Move it UP relative to the envelope by EXACTLY the amount the envelope dropped. 
       This means the letter stays frozen perfectly on screen while envelope drops! */
    transform: translateY(-190px); 
    z-index: 200;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    overflow: visible; 
}

.nav-arrow {
    position: absolute;
    bottom: 20px; /* Stick to bottom of screen so it doesn't mess with flex */
    background: none; border: none;
    font-size: 2.5rem; color: var(--dark-pink);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease;
    z-index: 200;
}
.nav-arrow.visible {
    opacity: 1; visibility: visible;
}

.fade-in-msg {
    opacity: 0;
    transition: opacity 1.5s ease;
}
.fade-in-msg.visible {
    opacity: 1;
}

/* --- View 3: Memory Stack --- */
.card-stack {
    position: relative;
    width: 280px;
    height: 380px;
    margin-top: 10px;
}
.polaroid-card {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: white;
    padding: 12px 12px 50px 12px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s;
    transform: translateY(calc(var(--card-index) * 10px)) rotate(calc(var(--card-index) * 4deg)) scale(calc(1 - var(--card-index) * 0.05));
    z-index: calc(10 - var(--card-index));
    cursor: pointer;
}
.polaroid-card.swiped-out {
    transform: translateX(-150%) rotate(-20deg) !important;
    opacity: 0;
}
.polaroid-card .photo {
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
}
.polaroid-card .photo-caption {
    position: absolute;
    bottom: 12px; left: 0; width: 100%;
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

.swipe-btn {
    margin-top: 30px;
    padding: 10px 30px;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-family: sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.3s;
}
.swipe-btn:hover { color: var(--dark-pink); }

.bounce-btn {
    position: absolute;
    bottom: 30px;
    padding: 12px 30px;
    background: var(--dark-pink);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.5s ease;
}
.bounce-btn.visible {
    opacity: 1; visibility: visible;
    transform: translateY(0);
    animation: springBounce 2s infinite;
}

/* --- View 4: Balloons & Secret Message --- */
#balloon-container {
    position: fixed; 
    width: 100%; height: 100%;
    overflow: hidden; top: 0; left: 0;
}
.balloon {
    position: absolute;
    bottom: -120px;
    width: 60px; height: 80px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    cursor: pointer;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.1);
    animation: floatUpBalloon 10s linear infinite;
    transition: transform 0.2s;
    z-index: 5;
}
.balloon::after {
    content: '';
    position: absolute; bottom: -15px; left: 50%;
    transform: translateX(-50%);
    width: 1px; height: 40px;
    background: rgba(0,0,0,0.2);
}
.balloon:hover { transform: scale(1.1); }

@keyframes floatUpBalloon {
    0% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-60vh) rotate(5deg); }
    100% { transform: translateY(-130vh) rotate(-5deg); }
}

.glass-modal {
    position: relative;
    width: 90%; max-width: 400px;
    padding: 30px 20px;
    background: white;
    border-radius: 20px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
    box-shadow: 0 20px 50px rgba(227, 91, 113, 0.15);
}
.glass-modal.visible {
    opacity: 1; visibility: visible;
    transform: scale(1);
}
.gift-icon { font-size: 2.2rem; margin-bottom: 5px; }
.serif-title { font-size: 1.6rem; color: var(--text-main); margin-bottom: 10px; font-weight: normal; }
.italic { font-style: italic; }
.serif-text { font-size: 0.95rem; color: #777; line-height: 1.5; margin-bottom: 10px; }
.small-text { font-size: 0.85rem; }
.emojis { margin-top: 10px; font-size: 1.1rem; letter-spacing: 5px; }

/* --- View 5: Video Finale --- */
#view-5 {
    background: transparent;
}
.theater-frame {
    position: relative;
    width: 95vw; max-width: 800px;
    border-radius: 16px; 
    padding: 20px;
    background: white;
    border: 1px solid #eaeaea;
    box-shadow: 0 15px 40px rgba(227, 91, 113, 0.15);
    z-index: 10;
    opacity: 0; transform: scale(0.95);
    transition: all 1.5s ease 0.5s;
    text-align: center;
}
#view-5.finale-active .theater-frame {
    opacity: 1; transform: scale(1);
}
.finale-title {
    color: var(--dark-pink);
    font-size: 3.5rem;
    margin-bottom: 15px;
}
.video-container {
    width: 100%;
    aspect-ratio: 16 / 9;
}
video {
    width: 100%; height: 100%; border-radius: 8px; display: block; outline: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: cover;
}
.floating-hearts-fg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.heart {
    position: absolute; width: 20px; height: 20px;
    background: rgba(227, 91, 113, 0.3);
    transform: rotate(45deg);
    animation: driftHeart 15s linear infinite; filter: blur(3px);
}
.heart::before, .heart::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    background: rgba(227, 91, 113, 0.3); border-radius: 50%;
}
.heart::before { top: -10px; left: 0; }
.heart::after { top: 0; left: -10px; }


/* ====================================================
   MOBILE RESPONSIVENESS
==================================================== */
@media screen and (max-width: 768px) {
    .navbar {
        top: 0;
        padding: 15px 10px;
        gap: 8px 15px; /* smaller gaps to fit or wrap */
        flex-wrap: wrap; /* Allow it to neatly drop to a second line if phone is very narrow */
        justify-content: center;
        width: 100%;
        max-width: 100%;
        white-space: normal;
        transform: translateX(0);
        left: 0;
    }
    
    .nav-item {
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    /* Shared Typography */
    .section-title { font-size: 1.8rem; margin-bottom: 5px; }
    .section-subtitle { font-size: 0.9rem; margin-bottom: 10px; }

    /* View 1: Welcome */
    .main-title { 
        font-size: 3.2rem; 
        line-height: 1.1; 
        margin-bottom: 5px;
    }
    .script-title { 
        font-size: 2.2rem; 
        margin-top: 5px; /* Fixed overlap issue */
        margin-bottom: 15px;
    }
    .sub-message { font-size: 0.9rem; margin-bottom: 25px; }
    .glow-btn { padding: 12px 30px; font-size: 0.85rem; }
    .decor { font-size: 1.5rem; }
    .flower-1 { font-size: 2rem; }

    /* View 2: Envelope & Letter */
    .envelope-container {
        transform: scale(0.9);
        margin-top: 10px;
    }
    /* Fixed envelope mobile animation */
    .envelope-container.open {
        transform: scale(0.9) translateY(120px); 
    }
    .card-style {
        padding: 15px 12px;
    }
    .handwriting {
        font-size: 1.05rem; /* Ensure it fits on tiny phones */
    }
    .envelope-container.open .parchment {
        height: 330px;
        /* Matches the drop of the envelope so it stays put visually! */
        transform: translateY(-130px); 
    }
    
    /* View 3: Memory Stack */
    .card-stack {
        width: 250px;
        height: 330px;
        margin-top: 10px;
    }
    .polaroid-card {
        padding: 10px 10px 40px 10px;
    }
    .polaroid-card .photo-caption {
        font-size: 0.95rem;
        bottom: 8px;
    }
    .swipe-btn { margin-top: 15px; }

    /* View 4: Balloons */
    .glass-modal {
        padding: 20px 15px;
    }
    .serif-title { font-size: 1.4rem; margin-bottom: 8px; }
    .serif-text { font-size: 0.85rem; margin-bottom: 8px; }
    .small-text { font-size: 0.8rem; }
    .gift-icon { font-size: 1.8rem; margin-bottom: 5px; }

    /* View 5: Video Finale */
    .theater-frame {
        padding: 10px;
        width: 95vw;
    }
    .finale-title {
        font-size: 2rem;
        margin-bottom: 10px;
    }
}
