@import url("https://fonts.googleapis.com/css2?family=Caveat+Brush&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Caveat+Brush&family=Caveat:wght@400..700&display=swap");

/*
z-indexes:
    overlay: 0,
    carta: 5,
    flap: 20,
    frente-carta: 15,
    content: 10,
    aparecer-carta-contenido: 25
*/

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

    -webkit-tap-highlight-color: transparent;
}

body {
    height: 100dvh;
    width: 100dvw;
    display: grid;
    place-items: center;
    background-color: #c0a6e8;
    background-image: url("imgs/patito.png");
    background-repeat: repeat;
    background-size: 100px 100px;
    overflow-y: auto;
}

/* Posee un opacity 0 por defecto */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    z-index: 0;
    transition: opacity 500ms ease-in-out;
}

/* En cuanto a tema de apilamiento, #carta es la parte trasera de la carta */
#carta {
    position: relative;
    width: 300px;
    height: 200px;
    max-height: 70dvh;
    max-width: 90dvw;
    border: 4px solid black;
    border-radius: 10px;
    background-color: #faebd7;
    z-index: 5;
    cursor: pointer;
    perspective: 1000px;
    transition: transform 450ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

#carta:active {
    transform: scale(0.97);
}

#flap {
    position: absolute;
    top: 0;
    width: 100%;
    height: 50%; /* Ocupa mitad de la carta */
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top;
    z-index: 20;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.flap-open {
    transform: rotateX(0.5turn);
}

#carta__contenido {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;
    height: fit-content;
    max-height: 80dvh;
    padding: 5px;
    background-color: #fff;
    font-size: 10px;
    z-index: 10;
    user-select: none;
    cursor: pointer;
    & .carta__contenido-titulo {
        font-family: "Caveat Brush", cursive;
        font-weight: 400;
        font-style: normal;
        filter: blur(0.5px);
    }
    & .carta__contenido-cuerpo {
        filter: blur(1px);
    }
}

#carta__frente {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #faebd7;
    border-radius: 10px;
    z-index: 15;
    transition: filter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#carta__frente.sombra-activa {
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.3));
}

.aparecer-carta-contenido {
    animation: aparecer 1s ease-in-out forwards;
    z-index: 25;
}

@keyframes aparecer {
    0% {
        transform: translateY(0);
    }
    80% {
        transform: translateY(calc(-1 * var(--carta-h) + 30px));
    }
    100% {
        transform: translateY(calc(-1 * var(--carta-h) + 50px));
    }
}

/* Empieza con display: none y opacity: 0 */
.contenido {
    background: #fff;
    max-height: 90dvh;
    max-width: 90dvw;
    overflow-y: auto;
    padding: 35px;
    display: none;
    opacity: 0;
    transition: opacity 500ms;
    z-index: 5;

    & .contenido__titulo {
        font-family: "Caveat Brush", cursive;
        font-weight: 400;
        font-style: normal;
        font-size: 3.2rem;
    }

    & .contenido__cuerpo {
        font-family: "Caveat Brush", cursive;
        font-weight: 400;
        font-style: normal;
        font-size: 2.1rem;
    }

    & .contenido__footer {
        font-family: "Caveat Brush", cursive;
        font-weight: 400;
        font-style: normal;
        font-size: 2.1rem;
    }

    & .contenido__footer-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 15px;
    }

    & .contenido__footer-boton {
        position: relative;
        font-family: "Caveat Brush", cursive;
        font-weight: 400;
        font-style: normal;
        font-size: 2.1rem;
        background-color: #fff;
        border: 0;
        cursor: pointer;
    }

    & .contenido__footer-boton::before {
        content: "_______";
        position: absolute;
        bottom: 0;
    }
}
