/* 
    -- COULEURS DE REFERENCE --
    background des boutons: #ead9ce;
    texte principal et bordures : #31353a (gris foncé);
    defaite: rgb(183, 43, 43) (rouge);
    victoire: rgb(43, 119, 20) (vert);
*/
/* -- POLICE -- */
@font-face {
    font-family: "libreFranklin";
    src: url("../fonts/librefranklin-regular.ttf") format("truetype");
    font-weight: normal;
}
@font-face {
    font-family: "libreFranklin";
    src: url("../fonts/librefranklin-bold.ttf") format("truetype");
    font-weight: bold;
}
/* -- ANIMATIONS -- */
@keyframes cardio
{
    0% 
    {
        transform: scale3d(1, 1, 1);
    }
    15% 
    {
        transform: scale3d(0.9, 0.9, 1);
    }
    30% 
    {
        transform: scale3d(1, 1, 1);
    }
    45% 
    {
        transform: scale3d(0.9, 0.9, 1);
    }
    100% 
    {
        transform: scale3d(1, 1, 1);
    }
}
/* -- RESET -- */
html, body, div, form, input, fieldset, a, main, img, h1
{
    margin: 0;
    border: 0;
    padding: 0;
    box-sizing: border-box;
}
html
{
    min-height: 100vh;
    font-size: clamp(12px, 1vw, 1vw);
}
body
{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: libreFranklin;
    color: #31353a;
    background-color: #f6f7f0;
}
#jeuDuPendu
{
    margin: 0 auto;
    padding: 2rem;
    max-width: 70rem;
    width: 100%;
    display: grid;
    grid-template-columns: 46rem 20rem;
    align-items: center;
    justify-content: center;
    gap: 3rem;
}
#jeuDuPendu h1
{
    margin-bottom: 1rem;
    grid-column: span 2;
    width: 100%;
}
#jeuDuPendu .lettres-container
{
    width: 100%;
}
/* -- LETTRES DECOUVERTES -- */
#jeuDuPendu .lettresDecouvertes
{
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
}
#jeuDuPendu .lettresDecouvertes b.defaite
{
    color: rgb(183, 43, 43);
}
/* -- LETTRES PROPOSEES -- */
#jeuDuPendu form fieldset
{
    margin-bottom: 1rem;
    border: 2px solid #31353a;
    border-radius: 0.5rem;
    padding: 0.5rem;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}
#jeuDuPendu form fieldset > div b
{
    padding: 0.5rem;
    border: 2px solid #31353a;
    border-radius: 0.5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 1.5rem;
    color: #f6f7f0;
    font-weight: bold;
    text-transform: uppercase;
    transform: translate3d(-50%, -50%, 0) rotate3d(0, 0, 1, -5deg);
}
#jeuDuPendu form input[name="lettre"]
{
    margin: 0.2rem;
    border: 2px solid #31353a;
    border-radius: 0.5rem;
    width: 4rem;
    height: 4rem;
    font-size: 1.2rem;
    font-weight: bold;
    background-color: #ead9ce;
}
#jeuDuPendu form input[name="lettre"]:disabled
{
    opacity: 0.3;
}
/* -- BOUTON NOUVELLE PARTIE -- */
#jeuDuPendu form input[name="nouvellePartie"]
{
    border: 2px solid #31353a;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    font-weight: bold;
    background-color: #ead9ce;
}
/* -- COMMUN AUX LETTRES DISPONIBLES ET AU BOUTON NOUVELLE PARTIE -- */
#jeuDuPendu form input[type="submit"]
{
    transition: color 0.3s, background-color 0.2s;
}
#jeuDuPendu form input[type="submit"]:hover:not([disabled])
{
    cursor: pointer;
    color: #f6f7f0;
    background-color: #31353a;
}
/* -- STATUT DE FIN DE PARTIE -- */
#jeuDuPendu form fieldset > div b.defaite
{
    background-color: rgb(183, 43, 43);
}
#jeuDuPendu form fieldset > div b.victoire
{
    background-color: rgb(43, 119, 20);
}
/* -- VIES RESTANTES -- */
#jeuDuPendu .vies-container
{
    margin-left: auto;
    position: relative;
    width: 100%;
}
#jeuDuPendu .vies-container img
{
    width: 100%;
    height: auto;
}
#jeuDuPendu .vies-container > div.enVie, #jeuDuPendu .vies-container > div.defaite
{
    top: 2rem;
    position: absolute;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 5rem;
    height: 5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #f6f7f0;
    background-size: 100% auto;
    background-repeat: no-repeat;
}
#jeuDuPendu .vies-container > div.enVie
{
    background-image: url("../images/le-jeu-du-pendu-coeur.svg");
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-name: cardio;
    transition: transform 0.1s;
}
#jeuDuPendu .vies-container > div.defaite
{
    background-image: url("../images/le-jeu-du-pendu-coeur-brise.svg");
}
/* -- PRÉCHARGEMENT DES IMAGES -- */
#jeuDuPendu
{
    /* permet de mettre les images en cache dès le premier chargement de la page */
    background-image: url("../images/le-jeu-du-pendu-etape-1.svg"), url("../images/le-jeu-du-pendu-etape-2.svg"), url("../images/le-jeu-du-pendu-etape-3.svg"), url("../images/le-jeu-du-pendu-etape-4.svg"), url("../images/le-jeu-du-pendu-etape-5.svg"), url("../images/le-jeu-du-pendu-etape-6.svg"), url("../images/le-jeu-du-pendu-coeur-brise.svg");
    background-size: 0;
}
@media (max-width: 880px)
{
    #jeuDuPendu
    {
        padding: 1rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    #jeuDuPendu h1
    {
        margin-bottom: 0;
        grid-column: span 1;
        order: 1;
        text-align: center;
    }
    #jeuDuPendu .vies-container
    {
        margin: 0 auto;
        order: 2;
        max-width: 30rem;
    }
    #jeuDuPendu .vies-container > div.enVie, #jeuDuPendu .vies-container > div.defaite
    {
        width: 8rem;
        height: 8rem;
        font-size: 2rem;
    }
    #jeuDuPendu .lettres-container
    {
        order: 3;
    }
    #jeuDuPendu .lettresDecouvertes
    {
        text-align: center;
    }
    #jeuDuPendu form input[name="nouvellePartie"]
    {
        margin-left: auto;
        margin-right: auto;
        display: block;
    }
}