/* colorscheme: 
    dark blue: #566FA3,
    red: #F08C78,
    blue: #97B3F0,
    light green: #C7F07D,
    green: #AABF82 */

@import url('https://fonts.googleapis.com/css2?family=Outfit&family=Playfair+Display:wght@600&display=swap');

body {
    display: flex;
    flex-direction: row;
    justify-content: center;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
}

h1, h2 {
    font-family: 'Playfair Display', serif;
    padding-top: 10px;
    margin-top: 0;
}

h1 {
    font-size: 3rem;
    line-height: 3rem;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.5rem;
    margin-top: -2rem;
}

p {
    max-width: 600px;
    font-size: 18pt;
    font-family: Outfit, sans-serif;
}

.flex-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.flex-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

#wordle {
    max-width: 860px;
    text-align: center;
    height: 100%;
    min-height: 0;
}

#guesses {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    font-weight: bold;
    width: min-content;
    align-self: center;
}

#guesses > div {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

div.letter {
    border: 1px solid black;
    max-width: 5rem;
    max-height: 5rem;
    width: 8.3vh;
    height: 8.3vh;
    margin: 0.25rem;
    text-align: center;
    font-size: 3rem;
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    perspective: 1000px;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    user-select: none;
}

#keyboard {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    user-select: none;
    height: max-content;
}

#keyboard > div {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
}

.keyboard-key {
    padding: 1rem;
    margin: 0.5rem;
    border: 1px solid black;
    line-height: 1rem;
    min-width: 0.75rem;
    text-align: center;
    font-family: sans-serif;
    border-radius: 5px;
    justify-content: center;
}

@media (max-width: 650px) {
    .keyboard-key {
        font-size: 10pt;
        min-width: 4vw;
        padding: 2vw;
        margin: 0.5vw;
    }

    div.letter {
        width: 15vw;
    }
}

#keyboard .wrong {
    background-color: #DDDDDD;
    color: #888888;
}

#guesses .wrong {
    background-color: #F08C78;
    color: white;
    transform: rotateY(180deg) scaleX(-1);
}

.position {
    background-color: #97B3F0;
    color: white;
    transform: rotateY(180deg) scaleX(-1);
}

.correct {
    background-color: #AABF82;
    color: white;
    transform: rotateY(180deg) scaleX(-1);
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes winner {
    00% {transform: translate(0px, 0px);}
    25% {transform: translate(0px, 7px);}
    75% {transform: translate(0px, -7px);}
    100% {transform: translate(0px, 0px);}
}

div.not-a-word {
    animation: shake 0.5s;
}

div.winner-word {
    animation: winner 0.5s;
}

#end-modal {
    position: fixed;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.4);
}

#modal-content {
    background-color: #fefefe;
    margin: 10vh auto;
    padding: 20px;
    border: 1px solid black;
    border-radius: 5px;
    width: 80%;
    font-family: sans-serif;
    font-size: 20pt;
    max-width: 800px;
    max-height: 80%;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
}

#modal-content::-webkit-scrollbar {
    display: none;
}

#modal-content p {
    text-align: center;
    padding: 0;
    margin: 0;
}

#close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

#close-modal:hover,
#close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#leaderboard-graph {
    margin-bottom: 10px;
}

#emoji-grid {
    background-color: white;
    border: 1px solid black;
    padding: 5px;
    font-size: 14pt;
}

#emoji-grid:hover {
    cursor: pointer;
    background-color: #ddd;
    font-family: sans-serif;
}

#modal-holder {
    justify-content: space-between;
    width: 100%;
}

#grid-holder {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

#grid-actual {
    text-align: left;
    white-space: pre;
    background-color: #EEE;
    margin: 10px;
    padding: 10px;
    border: 1px solid black;
    width: max-content;
}

.hidden {
    display: none;
    visibility: hidden;
}

@media screen and (prefers-color-scheme: dark){
    body {
        background-color: #151821;
        color: #999;
    }
    
    #guesses {
        color: #666;
    }
    
    div.letter, .keyboard-key {
        border: 1px solid #999;
    }
    
    .position {
        background-color: #2F3340;
        color: #888;
    }
    
    #keyboard .wrong {
        background-color: #422E29;
        color: #666;
        border: 1px solid #666;
    }
    
    #guesses .wrong {
        background-color: #422E29;
        color: inherit;
    }
    
    .correct {
        background-color: #3A452B;
        color: #aaa;
    }
    
    #modal-content {
        background-color: #32353D;
        border: 1px solid #999;
    }
    
    #close-modal:hover,
    #close-modal:focus {
        color: #666;
    }
    
    #emoji-grid {
        background-color: #32353D;
        border: 1px solid #999;
    }
    
    #emoji-grid:hover {
        background-color: #666;
    }
    
    #grid-actual {
        background-color: #23262B;
        border: 1px solid #999
    }
}
