@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;1,500&family=Montserrat:wght@300;400;500&display=swap');


/* =========================================
   RESET
========================================= */

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

html {
    width: 100%;

    margin: 0;
    padding: 0;

    scroll-behavior: smooth;

    background: #f2dfca;
}

body {
    width: 100%;

    /* No obligamos al contenido a medir una pantalla */
    min-height: 0;
    height: auto;

    margin: 0;
    padding: 0;

    overflow-x: hidden;

    background:
        radial-gradient(
            circle at top,
            #fffaf3 0%,
            #f7eadb 48%,
            #ecd7c2 100%
        );

    background-color: #f2dfca;

    font-family: "Montserrat", sans-serif;

    color: #503a32;
}


/* =========================================
   CONTENEDOR GENERAL
========================================= */

.pagina {
    width: 100%;

    /* La altura la define únicamente el contenido */
    min-height: 0;
    height: auto;

    background:
        radial-gradient(
            circle at top,
            #fffaf3 0%,
            #f7eadb 48%,
            #ecd7c2 100%
        );

    background-color: #f2dfca;

    overflow-x: hidden;
}


/* =========================================
   PANTALLA PRINCIPAL
========================================= */

.inicio {
    width: min(100%, 430px);

    /* IMPORTANTE: nada de 100vh / 100dvh */
    min-height: 0;
    height: auto;

    margin: 0 auto;

    padding:
        clamp(30px, 5vh, 50px)
        clamp(18px, 5vw, 28px)
        30px;

    display: flex;
    flex-direction: column;
    align-items: center;

    position: relative;
}


/* =========================================
   FECHA
========================================= */

.fecha {
    font-family: "Cormorant Garamond", serif;

    font-size: clamp(24px, 5vw, 29px);
    font-style: italic;

    line-height: 1.2;

    margin-bottom: clamp(25px, 4vh, 34px);

    color: #71574d;

    text-align: center;
}


/* =========================================
   POLAROID
========================================= */

.polaroid {
    width: min(76vw, 270px);

    padding:
        clamp(9px, 2vw, 13px)
        clamp(9px, 2vw, 13px)
        clamp(15px, 3vw, 20px);

    background: #fffdf8;

    box-shadow:
        0 10px 30px rgba(83, 60, 49, 0.16);

    transform: rotate(-0.8deg);

    transition:
        transform 0.35s ease,
        box-shadow 0.35s ease;
}

.polaroid:hover {
    transform:
        rotate(0deg)
        translateY(-3px);

    box-shadow:
        0 14px 35px rgba(83, 60, 49, 0.2);
}


.foto-contenedor {
    width: 100%;

    aspect-ratio: 1 / 1.06;

    overflow: hidden;

    background: #e7d6c7;

    position: relative;
}


.foto {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
    object-position: center;
}


.sin-foto {
    width: 100%;
    height: 100%;

    display: none;

    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 10px;

    font-size: clamp(30px, 8vw, 38px);

    color: #95776a;
}


.sin-foto span {
    font-size: clamp(11px, 3vw, 13px);
}


.nombres {
    margin-top: clamp(10px, 2vh, 15px);

    text-align: center;

    font-family: "Cormorant Garamond", serif;

    font-size: clamp(21px, 5vw, 25px);

    line-height: 1.2;
}


/* =========================================
   SEPARADOR
========================================= */

.separador {
    margin:
        clamp(25px, 4vh, 35px)
        0;

    font-family: serif;

    font-size: clamp(28px, 7vw, 35px);

    line-height: 1;

    color: #a98c7b;
}


/* =========================================
   SOBRE
========================================= */

.sobre {
    width: min(82vw, 285px);

    aspect-ratio: 300 / 170;

    background: #e6c196;

    position: relative;

    overflow: hidden;

    box-shadow:
        0 12px 25px rgba(89, 58, 42, 0.15);

    cursor: pointer;

    transition:
        transform .3s ease,
        box-shadow .3s ease;
}


.sobre:hover {
    transform: translateY(-4px);

    box-shadow:
        0 16px 32px rgba(89, 58, 42, 0.2);
}


/* PARTE FRONTAL DEL SOBRE */

.sobre::before {
    content: "";

    position: absolute;

    inset: 0;

    background: #e3b987;

    clip-path: polygon(
        0 45%,
        50% 100%,
        100% 45%,
        100% 100%,
        0 100%
    );

    z-index: 3;
}


/* SOLAPA */

.solapa {
    position: absolute;

    inset: 0;

    background: #efcea6;

    clip-path: polygon(
        0 0,
        100% 0,
        50% 58%
    );

    z-index: 4;

    transform-origin: top center;

    transition:
        transform .7s ease,
        z-index .2s ease;
}


/* PAPEL DENTRO DEL SOBRE */

.carta-preview {
    position: absolute;

    width: 84%;
    height: 76%;

    left: 8%;
    top: 18%;

    background: #fff9ee;

    z-index: 2;

    transition:
        transform .8s ease;
}


/* SELLO */

.sello {
    width: clamp(60px, 18vw, 72px);
    height: clamp(60px, 18vw, 72px);

    border: none;
    border-radius: 50%;

    position: absolute;

    left: 50%;
    top: 53%;

    transform:
        translate(-50%, -50%);

    z-index: 10;

    background:
        radial-gradient(
            circle at 35% 30%,
            #cf3e4a,
            #a71f2c 55%,
            #72101a 100%
        );

    color: white;

    font-family:
        "Cormorant Garamond",
        serif;

    font-size: clamp(12px, 3.4vw, 15px);

    font-style: italic;

    cursor: pointer;

    box-shadow:
        0 4px 8px rgba(0,0,0,.25);

    transition:
        transform .25s ease,
        box-shadow .25s ease;
}


.sello:hover {
    transform:
        translate(-50%, -50%)
        scale(1.06);

    box-shadow:
        0 6px 12px rgba(0,0,0,.3);
}


.indicacion {
    margin-top: 15px;
    margin-bottom: 0;

    padding-bottom: 0;

    font-size: clamp(10px, 2.8vw, 12px);

    opacity: .65;

    text-align: center;
}


/* =========================================
   ANIMACIÓN SOBRE
========================================= */

.sobre.abierto .solapa {
    transform: rotateX(180deg);

    z-index: 1;
}


.sobre.abierto .carta-preview {
    transform: translateY(-42%);
}


/* =========================================
   VENTANA DE LA CARTA
========================================= */

.mensaje {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100dvh;

    background:
        rgba(48, 31, 24, .74);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    display: none;

    align-items: center;
    justify-content: center;

    padding:
        clamp(14px, 4vw, 30px);

    z-index: 100;
}


.mensaje.visible {
    display: flex;

    animation:
        aparecer
        .45s ease;
}


/* =========================================
   PAPEL DE LA CARTA
========================================= */

.papel {
    width: min(100%, 400px);

    max-height: min(88dvh, 700px);

    overflow-y: auto;
    overflow-x: hidden;

    background: #fffaf1;

    padding:
        clamp(26px, 6vw, 40px)
        clamp(22px, 6vw, 35px)
        clamp(24px, 5vw, 34px);

    box-shadow:
        0 20px 50px rgba(0,0,0,.30);

    font-family:
        "Cormorant Garamond",
        serif;

    font-size: clamp(18px, 4.7vw, 21px);

    line-height: 1.55;

    text-align: center;

    animation:
        subir
        .65s ease;

    scrollbar-width: thin;
}


/* Espaciado general de párrafos */

.papel p {
    margin: 0 0 clamp(12px, 2vh, 18px);
}


/* "Para ti" */

.para {
    text-align: left;

    font-style: italic;

    margin-bottom: 16px !important;
}


/* Primer mensaje personal */

.st {
    line-height: 1.55;

    margin-bottom: 16px !important;
}


/* Corazón central */

.papel h1 {
    margin: 12px 0 16px;

    font-size: clamp(28px, 7vw, 38px);

    line-height: 1;
}


/* Mensaje destacado */

.mensaje-especial {
    font-size:
        clamp(23px, 6vw, 28px);

    font-style: italic;

    line-height: 1.3;

    color: #9b2631;

    margin:
        8px
        0
        16px !important;
}


/* Firma */

.firma {
    margin:
        6px
        0
        8px !important;

    text-align: right;

    font-style: italic;

    line-height: 1.45;
}


/* MENSAJE FINAL / REGALO */

.regalo {
    margin:
        8px
        0
        0 !important;

    padding-top: 14px;

    border-top:
        1px solid rgba(113, 87, 77, 0.18);

    text-align: center;

    font-size:
        clamp(19px, 5vw, 23px);

    line-height: 1.4;

    font-style: italic;

    color: #71574d;
}


/* =========================================
   BOTÓN CERRAR
========================================= */

.cerrar {
    position: fixed;

    top:
        max(
            15px,
            env(safe-area-inset-top)
        );

    right:
        max(
            18px,
            env(safe-area-inset-right)
        );

    width: 45px;
    height: 45px;

    border: none;

    background: transparent;

    color: white;

    font-size: 38px;

    line-height: 1;

    cursor: pointer;

    z-index: 120;
}


/* =========================================
   ANIMACIONES
========================================= */

@keyframes aparecer {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }

}


@keyframes subir {

    from {
        opacity: 0;

        transform:
            translateY(50px)
            scale(.96);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }

}


/* =========================================
   CELULARES PEQUEÑOS
========================================= */

@media (max-width: 380px) {

    .inicio {
        padding-left: 15px;
        padding-right: 15px;
    }


    .polaroid {
        width: min(78vw, 245px);
    }


    .sobre {
        width: min(86vw, 270px);
    }


    .papel {
        font-size: 18px;

        padding:
            26px
            21px
            24px;
    }


    .regalo {
        font-size: 19px;
    }

}


/* =========================================
   CELULARES MUY PEQUEÑOS
========================================= */

@media (max-width: 330px) {

    .fecha {
        font-size: 22px;
    }


    .polaroid {
        width: 225px;
    }


    .sobre {
        width: 245px;
    }


    .separador {
        margin: 22px 0;
    }


    .papel {
        padding:
            24px
            18px
            22px;
    }

}


/* =========================================
   PANTALLAS CON POCA ALTURA
========================================= */

@media (max-height: 720px) and (min-width: 500px) {

    .inicio {
        padding-top: 25px;
    }


    .fecha {
        margin-bottom: 20px;
    }


    .polaroid {
        width: 225px;
    }


    .separador {
        margin: 20px 0;
    }


    .sobre {
        width: 250px;
    }

}


/* =========================================
   TABLETS Y COMPUTADORAS
========================================= */

@media (min-width: 768px) {

    .inicio {
        width: 460px;

        padding-top: 45px;
    }


    .polaroid {
        width: 255px;
    }


    .sobre {
        width: 275px;
    }


    .papel {
        max-height: min(86dvh, 720px);
    }

}


/* =========================================
   MONITORES GRANDES
========================================= */

@media (min-width: 1400px) {

    .inicio {
        transform: scale(.94);

        transform-origin: top center;
    }

}


/* =========================================
   ACCESIBILIDAD
========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

}

/* =========================================
   CORRECCIÓN DEFINITIVA DE SCROLL MÓVIL
========================================= */

/*
   El documento exterior nunca scrollea.
   Evita el espacio fantasma debajo del contenido
   en Chrome / Safari de iPhone y Android.
*/

html,
body {
    width: 100%;
    height: 100%;
    min-height: 0;

    margin: 0;
    padding: 0;

    overflow: hidden;
}


/*
   En iPhone evitamos que el BODY se desplace
   independientemente del contenido.
*/

body {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100dvh;

    overflow: hidden;

    overscroll-behavior: none;
}


/*
   ESTE es el único elemento que puede hacer scroll.
   
   Si el contenido cabe en la pantalla:
   NO habrá scroll.
   
   Si un teléfono es pequeño y no cabe:
   podrá bajar únicamente hasta "Abre la carta ❤️".
*/

.pagina {
    position: relative;

    width: 100%;
    height: 100dvh;
    min-height: 0;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior-y: contain;

    -webkit-overflow-scrolling: touch;
}


/*
   La sección termina EXACTAMENTE
   donde termina su contenido.
*/

.inicio {
    min-height: 0 !important;
    height: auto !important;

    padding-bottom: 20px;
}


/*
   El último texto no deja espacio adicional.
*/

.indicacion {
    margin-top: 15px;
    margin-bottom: 0;

    padding-bottom: 0;
}


/*
   Evita  margen 
   del último elemento.
*/

.inicio > :last-child {
    margin-bottom: 0 !important;
}


/*
   La carta emergente sigue ocupando

*/

.mensaje {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100dvh;

    overflow: hidden;
}


/*
   El scroll de la carta sucede solamente
   dentro del papel.
*/

.papel {
    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior-y: contain;
}