/* Author: Adrian Martinez Fuentes - UO295454 */

/* Especificidad 002 */
main > section {
    display: flex;
    flex-direction: unset;
    flex-wrap: wrap;
    justify-content: center; 
    gap: 1em;
    text-align: center;
    width: 100%;
    margin: auto;
}

/* Especificidad 002 */
main > menu {
    order: -1; 
}

/* Especificidad 003 */
main > section > h2 {
    flex: 100%; 
    text-align: center;
    font-size: 1.5em;
    text-decoration: underline;
}

/* Especificidad 003 */
main > section article {
    position: relative;
    display: flex; 
    justify-content: center;
    align-items: center;
    width: 20%;
    height: 28vh;
    border: 0.25em solid #000;
    background-color: #FFFFFF;
    /* color heredado del body */
    box-sizing: border-box;
    border-radius: 0.5em;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

/* Especificidad 004 */
main > section article h3 {
    color: #000000;
    /* background-color heredado del article */
    position: absolute;
    text-align: center;
    text-decoration: none;
}

/* Especificidad 004 */
main > section article img {
    position: relative;
    width: 30%;
    margin: auto;
    transform: rotateY(180deg);
    backface-visibility: hidden;
}

/* Especificidad 013 en cada selector */
main > section article[data-state="revealed"],
main > section article[data-state="flip"] {
    transform: rotateY(180deg);
}

/* Especificidad 014 */
main > section article[data-state="hidden"] img {
    display: none;
}

/* Especificidad 014 */
main > section article[data-state="revealed"] img {
    backface-visibility: visible;
}

/* Especificidad 014 en cada selector */
main > section article[data-state="revealed"] h3,
main > section article[data-state="flip"] h3 {
    display: none;
}

/* Especificidad 001 */
dialog {
    width: 100%;
    max-width: 31.25em;
    padding: 1em;
    border: none;
    border-radius: 0.75em;
    box-shadow: 0 0.22em 0.75em #00000033;
    text-align: center;
}

/* Especificidad 002 */
dialog::backdrop {
    background: #00000080;
    /* color heredado del dialog */
}

/* Pantallas pequeñas (teléfonos) */
@media (max-width: 767px){
    /* Especificidad 002 */
    main > section {
        /* Redefine el tamaño del contenedor de las cartas para que se muestren correctamente */
        width: 90%;
    }

    /* Especificidad 003 */
    main > section > h2 {
        /* Reducir el tamaño del texto es necesario para garantizar la legibilidad */
        font-size: 0.8em;
        margin: 0.5em auto;
    }

    /* Especificidad 003 */
    main > section article {
        flex: 1 1 calc(33.33% - 1em); 
        max-width: calc(33.33% - 1em);
        /* Redefinir el tamaño de la carta es necesario para que se muestre correctamente */
        height: 16vh; 
    }

    /* Especificidad 004 */
    main > section article img {
        /* Redeinir el tamaño de la imagen es necesario para que se muestre correctamente */
        width: 50%;
    }

    /* Especificidad 004 */
    main > section article h3 {
        font-size: 0.75em;
    }

    /* Especificidad 001 */
    dialog {
        /* Redefinir el padding es necesario para que el diálogo se muestre correctamente */
        padding: 0.5em;
        font-size: 0.9em; 
    }
}

@media (max-width: 525px){
    /* Especificidad 004 */
    main > section article img {
        /* Redeinir el tamaño de la imagen es necesario para que se muestre correctamente */
        width: 70%;
    }
}