/* COLOR PALLETE */
:root {
    --scale-factor: 1;


    --text-color: #eee;
    --box-text-color: var(--text-color);
    --text-hover-color: #c8c8c8;
    --background-color: #111;

    --keyboard-button-color: #444;
    --keyboard-button-incorrect-color: #222;

    --box-outline-color: #393939;
    --correct-spot-color: #373;
    --wrong-spot-color: #b49323;
    --incorrect-color: #333;

    --banner-background-color: #172944;
    --popup-background-color: #222;
    --drop-shadow-color: #000;

    --dist-bar-color: #484848;
    --dist-bar-text-color: var(--text-color);

    --button-color: #444;
    --button-hover-color: #333;
}

[theme="light"] {
    --text-color: #111;
    --box-text-color: #eee;
    --text-hover-color: #333;
    --background-color: #eee;

    --keyboard-button-color: #ccc;
    --keyboard-button-incorrect-color: #666;

    --box-outline-color: #bbb;
    --correct-spot-color: #429d42;
    --wrong-spot-color: #d2ab2a;
    --incorrect-color: #666;

    --banner-background-color: #1c58ad;
    --banner-text-color: #eee;
    --popup-background-color: #eee;
    --drop-shadow-color: #666;

    --dist-bar-color: #666;
    --dist-bar-text-color: #fff;

    --button-color: #bbb;
    --button-hover-color: #aaa;
}

/* I SHOULD PROBABLY SWITCH TO SASS */
.letter:nth-child(1) { --nth-child: 1 }
.letter:nth-child(2) { --nth-child: 2 }
.letter:nth-child(3) { --nth-child: 3 }
.letter:nth-child(4) { --nth-child: 4 }
.letter:nth-child(5) { --nth-child: 5 }
.letter:nth-child(6) { --nth-child: 6 }

/* MAIN STYLES */

body {
    margin: 0;
    height: 100vh;
    font-family: sans-serif;
    text-align: center;
    color: var(--text-color);
    background-color: var(--background-color);
}

h1 {
    margin: 35px;
    font-size: 2.7em;
    flex: 0 0;
}

.game-content-container {
    display: flex;
    min-width: 600px;
    height: 100%;
    flex-direction: column;
    align-items: center;
    transform-origin: top;
    transform: scale(var(--scale-factor));
}

.word-box-container {
    flex: 5 1 65%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.keyboard-container {
    text-align: center;
    flex: 1 1 35%;
    max-height: 320px;
    width: 600px;
    padding-bottom: 5px;
}

.letter, h1{
    user-select: none;
}

.word-box .letter {
    display: inline-block;
    vertical-align: middle;
    width: 55px;
    height: 55px;
    line-height: 55px;
    padding: 15px;
    margin: 5px;
    outline: solid var(--box-outline-color) 3px;
    outline-offset: -2px;
    font-size: 32pt;
    font-weight: bold;
}

.keyboard-container .letter {
    display: inline-block;
    min-width: 30px;
    height: 60px;
    line-height: 60px;
    padding: 10px;
    margin: 4px 3px;
    font-size: 20pt;
    background-color: var(--keyboard-button-color);
    cursor: pointer;
    touch-action: manipulation;
}

.word-box .correct-spot { animation: letter-correct; }
.word-box .in-word { animation: letter-wrong-spot; }
.word-box .not-in-word { animation: letter-incorrect; }

.word-box .correct-spot, .word-box .in-word, .word-box .not-in-word {
    animation-delay: calc(var(--nth-child)*50ms);
    animation-duration: 1ms;
    animation-fill-mode: forwards;
}

.keyboard-container .correct-spot, .keyboard-container .in-word, .keyboard-container .not-in-word {
    outline: none !important;
    color: var(--box-text-color);
}

.keyboard-container .correct-spot {
    background-color: var(--correct-spot-color) !important;
}

.keyboard-container .in-word {
    background-color: var(--wrong-spot-color) !important;
}


.keyboard-container .not-in-word {
    background-color: var(--keyboard-button-incorrect-color);
}

.corner-menu {
    position: absolute;
    z-index: 10;
    top: 41px;
    right: 50%;
    transform: translate(275px,0);
    transform-origin: right;
}

.corner-menu-item {
    display: inline-block;
    font-size: 20pt;
    cursor: pointer;
    touch-action: manipulation;
    height: 35px;
    width: 35px;
}

#menu-stats-icon {
    display:inline-block;
    background: var(--text-color);
    -webkit-mask:url("stats-icon.png") center/contain;
    mask:url("stats-icon.png") center/contain;
}

#menu-stats-icon:hover {
    background: var(--text-hover-color);
}

.corner-menu-item:hover {
    color: var(--text-hover-color);
}

/* STATUS BANNER */
.status-banner {
    display: block;
    position: absolute;
    z-index: 20;
    left: 50%;
    top: 100px;
    transform: translate(-50%, -50%);
    padding: 20px;
    color: var(--banner-text-color);
    background-color: var(--banner-background-color);
    font-size: 17pt;
    font-weight: bold;
    box-shadow: 0 0 20px var(--drop-shadow-color);
    animation: fadein 0.2s;
}

.fade-out {
    animation: fadeout 0.2s;
    opacity: 0;
}

.hidden {
    display: none;
}

/* POPUP STYLES */

.popup-global-fade {
    position: absolute;
    z-index: 30;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0.5, 0.5, 0.5, 0.3);
    animation: fadein 0.5s;
}

/*TODO add fadeout*/
.stats-popup-container {
    position: absolute;
    z-index: 40;
    left: 50%;
    top: calc(var(--scale-factor)*450px);
    transform: translate(-50%, -50%) scale(calc(var(--scale-factor)*1.8)); /* scale super hacky */
    background-color: var(--popup-background-color);
    padding: 20px;
    box-shadow: 0 0 20px var(--drop-shadow-color);
    animation: fadein 0.2s;
}

.popup-close-container {
    position: relative;
    width: 100%;
}

.popup-close-button {
    position: absolute;
    z-index: 50;
    right: -15px;
    top: -22px;
    padding: 5px;
    font-size: 20pt;
    cursor: pointer;
    touch-action: manipulation;
}

.popup-close-button:hover {
    color: var(--text-hover-color);
}

.stats-title {
    margin: 0 0 15px 0;
    font-size: 12pt;
}

.stats-sub-title {
    margin: 17px 0 13px 0;
    font-size: 10pt;
}

.info-box {
    display: inline-block;
    margin: 5px;
    width: 70px;
    vertical-align: top;
}

.info-title {
    font-size: 9pt;
    margin-top: 2px;
}

.info-data {
    font-size: 20pt;
}

.dist-container {
    text-align: left;
}

.dist-item {
    height: 18px;
    width: 230px;
    margin: 2px 5px;
}

.dist-label, .dist-bar-container, .dist-bar {
    display: inline-block;
    margin: 0 3px;
    padding-top: 1px;
    font-size: 9pt;
    height: 17px;
    line-height: 17px;
}

.dist-bar-container {
    height: 100%;
    width: 195px;
}

.dist-bar {
    text-align: right;
    color: var(--dist-bar-text-color);
    font-weight: bold;
    min-width: 7px;
    background-color: var(--dist-bar-color);
    padding-left: 5px;
    padding-right: 5px;
}

/* THEME BUTTONS */
.theme-button {
    display: inline-block;
    cursor: pointer;
    touch-action: manipulation;
    padding: 7px;
    font-size: 10pt;
    font-weight: bold;
    margin: 10px 5px 0 5px;
    background-color: var(--button-color);
}

.theme-button:hover {
    background-color: var(--button-hover-color);
}

/* ANIMATIONS */

@keyframes fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeout {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes letter-correct {
    to {
        background-color: var(--correct-spot-color);
        color: var(--box-text-color);
        outline: none;
    }
}

@keyframes letter-wrong-spot {
    to {
        background-color: var(--wrong-spot-color);
        color: var(--box-text-color);
        outline: none;
    }
}

@keyframes letter-incorrect {
    to {
        background-color: var(--incorrect-color);
        color: var(--box-text-color);
        outline: none;
    }
}

