/* Color Palette & Variables */
:root {
    --primary-pink: #ff4d6d;
    --secondary-pink: #ff8fa3;
    --dark-maroon: #590d22;
    --bg-color: #fff0f3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================
 * 1. HIDE SCROLLBARS (HTML + BODY TARGETING)
 * ========================================== */
html, body {
    font-family: 'Raleway', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(#ffccd5 3px, transparent 3px), 
        radial-gradient(#ff8fa3 3px, var(--bg-color) 3px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;

    /* Hide scrollbars visually across all browsers */
    -ms-overflow-style: none;  /* IE / Edge */
    scrollbar-width: none;     /* Firefox */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;             /* Chrome, Safari, Opera */
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px 120px 20px;
}

.birthday-container {
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* ==========================================
 * 2. TITLE SPACING
 * ========================================== */
.birthday-title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    color: var(--dark-maroon);
    margin-bottom: 120px; /* Locked headroom so the letter never reaches the title */
    text-shadow: 2px 2px 8px rgba(255, 77, 109, 0.2);
}

/* Envelope Container */
.envelope-wrapper {
    position: relative;
    width: 320px;
    height: 220px;
    margin-bottom: 60px;
    perspective: 1000px;
    transition: margin-bottom 0.5s ease;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #f7d6e0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

/* Envelope Top Flap */
.flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-top: 120px solid #f2b5d4;
    transform-origin: top;
    transition: transform 0.6s ease-in-out, z-index 0.6s;
    z-index: 4;
}

/* Envelope Front Pocket */
.pocket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 160px solid #f4acb7;
    border-right: 160px solid #f4acb7;
    border-bottom: 120px solid #f2a2b8;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    z-index: 3;
}

/* The Letter (Closed State) */
.letter {
    position: absolute;
    bottom: 10px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 290px;
    height: 190px;
    background: #ffffff;
    border-radius: 12px;
    border: 3.5px solid var(--primary-pink);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

.letter-content {
    color: var(--dark-maroon);
    text-align: center;
    width: 100%;
}

.letter-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--primary-pink);
    margin-bottom: 15px;
}

.letter-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #4a4a4a;
    margin-bottom: 12px;
}

.letter-content .signature {
    margin-top: 15px;
    font-weight: bold;
    color: var(--dark-maroon);
}

/* Open Flap State */
.envelope-wrapper.open .flap {
    transform: rotateX(180deg);
    z-index: 1;
}

/* ==========================================
 * 3. OPEN LETTER: LOCKED TOP EDGE (EXPANDS DOWNWARD)
 * ========================================== */
.envelope-wrapper.open .letter {
    bottom: auto;
    top: -80px; /* Locks top position safely below title */
    transform: translateX(-50%);
    width: 50vw;
    max-width: 650px;
    min-width: 320px;
    height: auto; /* Expands DOWNWARD as you add text */
    min-height: 300px;
    padding: 35px 40px;
    z-index: 5;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* Open Button Styling */
.open-btn {
    background: linear-gradient(45deg, var(--primary-pink), var(--secondary-pink));
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(255, 77, 109, 0.4);
    transition: all 0.3s ease;
    font-family: 'Raleway', sans-serif;
}

.open-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(255, 77, 109, 0.6);
}

.open-btn:active {
    transform: translateY(-1px);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .birthday-title {
        font-size: 2.2rem;
        margin-bottom: 100px;
    }

    .envelope-wrapper {
        width: 280px;
        height: 190px;
    }

    .flap {
        border-left-width: 140px;
        border-right-width: 140px;
        border-top-width: 105px;
    }

    .pocket {
        border-left-width: 140px;
        border-right-width: 140px;
        border-bottom-width: 105px;
    }

    .letter {
        width: 250px;
        height: 170px;
    }

    .envelope-wrapper.open .letter {
        top: -60px;
        width: 85vw;
        min-width: 280px;
        height: auto;
        padding: 20px;
    }
}