html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* ====== GENERAL ====== */
body {
    font-family: 'Cormorant Garamond', serif;
    background: url("./assets/background.png");
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

img {
    image-rendering: auto;
    max-width: 100%;
}

/* ====== CONTENEDOR ====== */
.envelope-container {
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px; 
}

/* ====== AVISO ====== */
.aviso {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;

    font-size: 1.6rem;
    color: #3b2f19;
    font-weight: 600;
    text-align: center;
    z-index: 9999;

    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ====== SOBRE ====== */
.envelope {
    width: min(600px, 90vw);
    aspect-ratio: 3 / 2;
    background: url("./assets/paper.jpg");
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 10px 28px rgba(0,0,0,0.25);
    overflow: hidden;
    z-index: 1;
    transition: transform 0.3s;
}

.envelope-container.open .envelope {
    transform: translateY(-250px) scale(1.02);
}


/* ====== TAPA DEL SOBRE ====== */
.flap-wrapper {
    position: absolute;
    top: 0;
    width: 100%;
    height: 55%;
    z-index: 4;
    overflow: visible;
}

.flap {
    width: 100%;
    height: 100%;
    background: url("./assets/paper.jpg");
    background-size: cover;
    transform-origin: top center;
    transition: transform 0.7s ease, filter 0.7s ease;
    transform: rotateX(0deg);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)); 
}

.envelope-container.open .flap {
    transform: rotateX(-60deg);
    filter: drop-shadow(0 14px 28px rgba(0,0,0,0.35)); 
}

/* ====== CARTA ====== */
.letter {
    position: absolute;
    top: -15%;
    left: 50%;
    width: min(520px, 92vw);
    background: url("./assets/paper.jpg");
    background-size: cover;
    background-position: center;
    border-radius: 12px;

    padding: 32px 32px 48px;
    box-sizing: border-box;

    transform-origin: bottom center;
    transform: translate(-50%, 35%) scaleY(0); 
    opacity: 0;
    box-shadow: 0 0 0 rgba(0,0,0,0);

    transition:
        transform 0.9s cubic-bezier(0.16, 0.84, 0.44, 1),
        opacity 0.6s ease,
        box-shadow 0.6s ease;

    z-index: 3;
}

.envelope-container.open .letter {
    transform: translate(-50%, -40px) scaleY(1);
    opacity: 1;
    box-shadow: 0 18px 40px rgba(0,0,0,0.4);
}

/* ====== FOTO DECORATIVA ====== */
.photo {
    width: 300px;
    position: absolute;
    right: -210px;
    bottom: -190px;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.45);
    transform: rotate(12deg);
    transform-origin: center;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.firma {
    width: 70%;
    height: auto;
    margin-top: 16px;
}

.envelope-container.open .photo {
    opacity: 1;
    animation: floatPhoto 4s ease-in-out infinite;
}

@keyframes floatPhoto {
    0%, 100% {
        transform: rotate(12deg) translateY(0);
    }
    50% {
        transform: rotate(14deg) translateY(-8px);
    }
}

/* =============================================================================== */

/* ====== TEXTO DE LA CARTA ====== */
h2 {
    margin: 0 0 12px 0;
    font-size: 2.1rem;
    font-weight: 600;
    text-align: center;
    color: #3b2f19;
}

.title {
    margin: 0 0 18px 0;
    font-size: 1.7rem;
    font-weight: 600;
    text-align: center;
    color: #3b2f19;
}

.line {
    margin: 4px 0;
    font-size: 1.35rem;
    text-align: center;
    color: #3b2f19;
}

.body-text {
    margin-top: 14px;
    font-size: 1.25rem;
    line-height: 1.4;
    text-align: center;
    color: #3b2f19;
}

/* ====== RESPONSIVE MÓVIL ====== */
@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .envelope {
        box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    }

    .letter {
        padding: 28px 20px 40px;
    }

    .envelope-container.open .letter {
        transform: translate(-50%, -110px) scaleY(1);
    }

    .aviso {
        font-size: 1.1rem;
    }

    h2 {
        font-size: 1.7rem;
    }

    .title {
        font-size: 1.4rem;
    }

    .line {
        font-size: 1.15rem;
    }

    .body-text {
        font-size: 1.1rem;
    }

    .photo {
        width: 130px;
        right: 12px;
        bottom: 2px;
    }
    
}
