@font-face {
    font-family: berkshire;
    src: url(BerkshireSwash-Regular.ttf);
}

*{
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body{
    overflow:hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background-color: oklch(27.8% 0.033 256.848);
}

div#message {
    margin-top: -2em;
    margin-bottom: 0.4em;
    font-size: 3em;
    font-family: berkshire, serif;
    color: oklch(57.7% 0.245 27.325);
}

.volume_controls{
    position: absolute;
    top: 0;
    right: 0;
    cursor: pointer;
}

.container {
    position: relative;
    width: min(110svh, 90vw);
    aspect-ratio: 2.29;
    perspective: 1200px;
}

.post-card {
    background-color: transparent;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    cursor: pointer;
    transform: translateY(18%) scale(0.96);
    opacity: 0;
    transition: transform 0.9s ease, opacity 0.9s ease;
    z-index: 2; /* La tarjeta por encima del cuerpo del sobre, por debajo de la solapa */
    pointer-events: none;
}

.post-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), 10px 18px 20px rgba(0,0,0,0.2);
}

/*.post-card:hover .post-card-inner,*/ .post-card-inner.flip {
    transform: rotateY(180deg);
}

.post-card-front, .post-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.post-card-front {
    background-color: white;
    border: 0px solid #fff;
}


.bottom {
    position: absolute;
    width: 400px;
    height:50px;
    background-color: #264653;
    top:250px;
}

.text {
    font-size:50px;
    color: white;
}

.post-card-back {
    background-color: white;
    border: 0px solid white;
    transform: rotateY(180deg);
    overflow: hidden;
}

/* -------- SOBRE (Envelope) -------- */
.envelope {
    position: absolute;
    inset: 0;
    z-index: 1; /* El cuerpo del sobre queda por debajo de la tarjeta */
    cursor: pointer;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.4s ease 0.3s, visibility 0s linear 0.7s;
}

/* Cuerpo del sobre 100% CSS */
.env-upper-panel {
    position: absolute;
    width: 100%;
    left: -1px;
    /* right: 5%; */
    top: 0;
    height: 47%;
    background: #f2e9e4;
    border: 1px solid #cebfb6;
    border-bottom: none;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.env-base {
    position: absolute;
    width: 100%;
    height: 80%;
    left: -1px;
    /* right: 5%; */
    top: 18%;
    bottom: 6%;
    background: #f2e9e4;
    border: 1px solid #cebfb6;
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.03);
}

.env-lower-fold {
    display: none;
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: 6%;
    height: 36%;
    background: #eaddd5;
    -webkit-clip-path: polygon(0% 0%, 50% 78%, 100% 0%, 100% 100%, 0% 100%);
    clip-path: polygon(0% 0%, 50% 78%, 100% 0%, 100% 100%, 0% 100%);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    border-top: 1px solid #cebfb6;
}

/* Solapa en HTML para animación 3D fluida */
.env-flap-html {
    position: absolute;
    width: 100% !important;
    /* left: 5%; */
    /* right: 5%; */
    top: 0px;
    border-radius: 12px;
    margin: 0 auto;
    width: auto;
    height: 46%;
    background: #e9dcd4;
    border-bottom: 1px solid #cebfb6;
    /* forma triangular de la solapa */
    -webkit-clip-path: polygon(0% 0%, 50% 70%, 100% 0%, 100% 0%, 0% 0%);
    clip-path: polygon(0% 0%, 50% 70%, 100% 0%, 100% 0%, 0% 0%);
    transform-origin: 50% 0%;
    transform: rotateX(0deg);
    transition: transform 0.8s cubic-bezier(.2,.65,.25,1.35), opacity 0.35s ease 0.55s;
    backface-visibility: hidden;
    z-index: 3; /* solapa por encima de la tarjeta */
    opacity: 1;
    pointer-events: none; /* deja pasar clics al .envelope */
}

/* Estado abierto: la solapa se levanta y la tarjeta emerge */
.container.open .env-flap-html {
    transform: rotateX(-160deg);
    opacity: 0; /* la solapa desaparece tras abrir */
}

.container.open .post-card.emerge {
    transform: translateY(-4%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.container.open .envelope {
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

/* Fin del sobre CSS */

.postCard {
    margin-top:30px;
}

.postCard:before {
    content:"";
    position: absolute;
    width:3px;
    height:200px;
    background-color: #333;
    left:200px;
    top:70px;
}

.postCard:after {
    content:"";
    position: absolute;
    height:3px;
    width:150px;
    background-color: #333;
    top:150px;
    left:230px;
    box-shadow: 0 30px #333, 0 60px #333, 0 90px #333;
}

.address {
    position: relative;
    top:0;
}

.address:before {
    content:"";
    position: absolute;
    width: 60px;
    height: 70px;
    border: 5px solid #333;
    outline-style: dashed;
    outline-color: #333;
    background-color: #cb997e;
    top:-40px;
    left:320px;
}

.address:after {
    content:"";
    position: absolute;
    border-radius: 50%;
    border-style: dashed;
    width: 50px;
    height: 50px;
    top:10px;
    left:290px;
}

.name, .street, .city, .country, .greetings {
    font-family: 'Brush Script MT', cursive;
    font-size:20px;
    position: absolute;
}

.name {
    left:250px;
    top:60px;
}

.street {
    left:250px;
    top:90px;
}

.city {
    left:250px;
    top:120px;
}

.country {
    left:250px;
    top: 150px;
}

.greetings {
    left: 0;
    top:100px;
    width: 200px;
}

img{
    width: 100%;
    height: 100%;
    user-select: none;
}

.address p {
    width: 200px;
    left: 205px;
}

/* NIEVE */
.snowflake {
    position: absolute;
    top: -10px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    pointer-events: none; /* Importante: permite hacer clic en cosas detrás de la nieve */
    animation: fall linear forwards;
    z-index: 50; /* Cae por encima, pero no bloquea clics */
    filter: blur(1px); /* Un ligero desenfoque para realismo */
}

@keyframes fall {
    0% {
        transform: translateY(0) translateX(0);
    }
    100% {
        transform: translateY(100svh) translateX(20px); /* 100vh es el final de la pantalla */
    }
}

#message2 {
    font-size: 2rem;
    color: oklch(0.74 0.2 21.98);
    margin-bottom: 1em;
}

.sello{
    cursor: pointer;
    width: min(20svh, 150px);
    display: block;
    height: min(20svh, 150px);
    position: relative;
    z-index: 9;
    margin: 0 auto;
    margin-top: min(7svh, 70px);
    transition: opacity 0.5s ease;
}

.sello.oculto{
    opacity: 0;
    pointer-events: none;
    display: none;
}