:root {
    --bg: #f9f4f5;
    --text-main: #4a4046;
    --text-light: #7a6a73;
    --accent: #a3879a;
    --card-bg: #ffffff;
    --shadow: 0 8px 30px rgba(0,0,0,0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
}

/* --- PASSWORD SCREEN --- */
#password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; 
}

#password-input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ecd8e3;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    text-align: center;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.3s;
}

#password-input:focus {
    border-color: var(--accent);
}

/* --- Landing Envelope Section --- */
#landing {
    min-height: 100dvh;
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    padding: 2rem;
}

.tiny-text {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

#landing h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

#landing p {
    font-size: 1rem;
    color: var(--text-light);
    font-style: italic;
    font-family: 'Playfair Display', serif;
    margin-bottom: 3rem;
}

.envelope-btn {
    background: var(--card-bg);
    border: 2px solid var(--accent);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.envelope-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-3px);
}

/* --- Main Content Sections --- */
.container {
    max-width: 600px;
    width: 100%;
    padding: 2rem;
    display: none; 
    flex-direction: column;
    gap: 3.5rem;
    position: relative;
    z-index: 10;
}

.section-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 1rem;
    line-height: 1.6;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

/* --- Timeline / Moments --- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    background: #fdfafb;
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px dashed var(--accent);
}

.date {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.timeline-item p {
    font-size: 0.85rem;
    line-height: 1.6;
}

/* --- Reasons Grid --- */
.reasons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.reason-box {
    background: #f9f0f4;
    padding: 1.2rem 1rem;
    border-radius: 15px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.flower-icon { font-size: 1.5rem; }

/* --- Letter text formatting --- */
.letter-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-main);
    text-align: left;
}

.signature {
    margin-top: 2rem;
    text-align: left; 
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.2rem;
}

.footer {
    text-align: center;
    margin-bottom: 2rem;
}

/* --- MOBILE OPTIMIZATIONS --- */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
        gap: 2.5rem;
    }
    
    #landing h1 {
        font-size: 2rem;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }

    .card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .reasons-grid {
        grid-template-columns: 1fr;
    }
}

/* --- HEART DOOR ANIMATIONS --- */
#door-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex; 
    z-index: 9999;
}

.door {
    width: 50vw;
    height: 100vh;
    background-color: var(--card-bg);
    position: relative;
    overflow: hidden;
    transition: transform 1.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.door-content {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
    color: var(--accent);
}

.left-door .door-content { left: 0; }
.right-door .door-content { right: 0; }

#door-overlay.open .left-door { transform: translateX(-100%); }
#door-overlay.open .right-door { transform: translateX(100%); }

.pulsing-heart {
    animation: heartbeat 1s infinite alternate;
}
@keyframes heartbeat {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

/* --- SURPRISE REVEAL ANIMATIONS --- */
.fade-out {
    animation: fadeOut 0.8s forwards ease-in-out;
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-20px); }
}

.fade-in-up {
    animation: fadeInUp 1.2s forwards ease-out;
    opacity: 0;
    transform: translateY(30px);
}
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* --- PETAL RAIN ANIMATIONS --- */
#petal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    display: none; 
}

.petal {
    position: absolute;
    background-color: #fbdce2;
    border-radius: 15px 0 15px 0;
    opacity: 0.7;
    box-shadow: 0 0 10px rgba(251, 220, 226, 0.6);
    animation: fall linear forwards, sway 2s ease-in-out infinite alternate;
}

@keyframes fall {
    0% { top: -10%; }
    100% { top: 110%; }
}

@keyframes sway {
    0% { transform: translateX(0) rotate(0deg); }
    100% { transform: translateX(25px) rotate(45deg); }
}

/* --- FLIP CARD (THE LETTER) --- */
.flip-container {
    perspective: 1000px;
    width: 100%;
}

.flipper {
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    position: relative;
    width: 100%;
}

.flip-container.is-flipped .flipper {
    transform: rotateY(180deg);
}

.letter-front, .letter-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    width: 100%;
}

.letter-front {
    position: relative;
    z-index: 2;
    transform: rotateY(0deg);
}

.letter-back {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    transform: rotateY(180deg);
    padding: 3rem 2rem; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.back-img {
    max-width: 100%;
    max-height: 80%; /* Stops the image from stretching to the full height */
    object-fit: contain; /* Keeps the perfect proportions of your 1086x1282 photo */
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); /* Adds a gorgeous drop shadow to make it pop */
}

/* --- THE PAGE FOLD CORNER --- */
.page-fold {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0; 
    height: 0; 
    border-bottom: 60px solid var(--bg); 
    border-left: 60px solid #f2e1e9; 
    border-bottom-right-radius: 20px;
    box-shadow: -4px -4px 10px rgba(0,0,0,0.08); 
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    animation: foldPulse 2s infinite alternate ease-in-out;
}

@keyframes foldPulse {
    0% { border-bottom-width: 55px; border-left-width: 55px; }
    100% { border-bottom-width: 65px; border-left-width: 65px; }
}

.letter-front:hover .page-fold, 
.letter-back:hover .page-fold {
    border-bottom-width: 75px;
    border-left-width: 75px;
    animation: none;
}
