:root {
    --primary-gold: #d4af37;
    --bg-color: #f9f9f9;
    --paper-color: #fffaf0;
    --envelope-color: #e0c097;
    --envelope-shadow: rgba(0,0,0,0.2);
    --text-dark: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: 'Montserrat', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    perspective: 1000px;
}

/* --- Envelope Styles --- */
.envelope-wrapper {
    position: absolute;
    cursor: pointer;
    transition: transform 1s ease, opacity 0.5s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    background: var(--envelope-color);
    box-shadow: 0 10px 20px var(--envelope-shadow);
    border-radius: 5px;
}

.envelope::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-bottom: 110px solid #dcb78b; /* Slightly darker inner */
    width: 0;
    height: 0;
    z-index: 1;
}

.front {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 3;
}

.flap {
    top: 0;
    left: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 110px solid #e6c9a8; /* Flap color */
    transform-origin: top;
    transition: transform 0.6s 0.2s ease, z-index 0.2s;
}

.pocket {
    bottom: 0;
    left: 0;
    border-left: 150px solid var(--envelope-color);
    border-right: 150px solid var(--envelope-color);
    border-top: 100px solid transparent;
    border-bottom: 100px solid #dcb78b;
    border-radius: 0 0 5px 5px;
    width: 100%;
    height: 100%;
    z-index: 4;
}

.letter {
    position: absolute;
    bottom: 0;
    width: 90%;
    height: 90%;
    background: #fff;
    left: 5%;
    transition: transform 0.6s 1s ease, z-index 0.2s;
    z-index: 2;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.letter-content h1 {
    font-family: 'Great Vibes', cursive;
    color: var(--primary-gold);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.wax-seal {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: #a81c1c;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #8f1616;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.wax-seal:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.instruction-text {
    margin-top: 250px;
    color: #666;
    font-size: 0.9rem;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Animation Classes --- */
.envelope-wrapper.open .flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.envelope-wrapper.open .envelope {
    animation: fallDown 1s 1.5s forwards;
}

.envelope-wrapper.open .letter {
    transform: translateY(-80px);
    z-index: 5;
    transition-delay: 0.6s;
}

.envelope-wrapper.open .wax-seal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* --- Main Invitation Card --- */
.invitation-card {
    position: absolute;
    width: 90%;
    max-width: 450px;
    background: #fff;
    padding: 40px 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-radius: 10px;
    text-align: center;
    opacity: 0;
    transform: translateY(50px) scale(0.9);
    pointer-events: none;
    transition: all 0.8s ease;
    z-index: 20;
    border: 1px solid #eee;
}

.invitation-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.card-inner {
    border: 2px solid var(--primary-gold);
    padding: 30px 15px;
    border-radius: 8px;
    position: relative;
}

.rings-img {
    width: 80px;
    height: auto;
    margin-bottom: 15px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.couple-names {
    font-family: 'Great Vibes', cursive;
    font-size: 3rem;
    color: var(--primary-gold);
    margin: 10px 0 30px 0;
    line-height: 1.2;
}

.header-section h2 {
    font-size: 1rem;
    font-weight: 300;
    color: #666;
    margin-bottom: 5px;
}

.detail-item {
    margin-bottom: 20px;
}

.detail-item h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
    margin-bottom: 5px;
}

.detail-item p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
}

.map-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 25px;
    background-color: var(--primary-gold);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s;
}

.map-btn:hover {
    background-color: #bfa032;
    transform: translateY(-2px);
}

.decoration-top {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-gold);
}

.footer-decoration {
    margin-top: 30px;
    font-style: italic;
    color: #666;
}

@keyframes fallDown {
    to {
        transform: translateY(100vh) rotate(10deg);
        opacity: 0;
    }
}
