@font-face {
    font-family: 'Ratanakiri';
    src: local('Khmer Ratanakiri'),
        url('/fonts/RataV53.ttf') format('truetype');
}

:root {
    --font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
    --font-size: min(5vw, 35px);
    font-family: var(--font-family);
    font-size: var(--font-size);
}

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

*:focus {
    outline: none;
}

body {
    margin: 0;
    padding: 0 0 2rem 0;
}

a {
    color: inherit;
}

p {
    display: block;
    line-height: 3rem;
    text-align: center;
    margin: 0;
    padding: 1rem 2rem;
}

h1 {
    text-align: center;
    margin: 2rem 0;
    font-weight: normal;
}

h1,
.ratanakiri {
    font-family: 'Ratanakiri' !important;
}

header {
    background-color: black;
    color: white;
    position: sticky;
    top: 0;
    width: 100%;
    overflow: auto;
    line-height: 82px;
}

header a {
    color: white;
    text-decoration: none;
}

header>a {
    margin-left: 1rem;
    display: inline-block;
}

nav,
.bottomBar {
    width: 100%;
    position: fixed;
    background-color: black;
    overflow: hidden;
    display: none;
    top: 82px;
    height: calc(100vh - 83px);
    border-top: 1px solid white;
}

nav>ul {
    list-style: none;
}

nav>ul>li {
    text-align: center;
    margin-top: 1rem;
}

nav a {
    display: block;
}

.letters a:hover,
main.home a.icon:hover,
main.words a:hover,
a:hover {
    text-decoration: underline;
}

header>label {
    cursor: pointer;
    float: right;
    padding: 40px 29px;
    background-color: red;
}

header>label>span {
    background: white;
    display: block;
    height: 2px;
    position: relative;
    width: 24px;
}

header>label>span::before,
header>label>span::after {
    background: white;
    content: '';
    display: block;
    height: 100%;
    position: absolute;
    transition: all .2s ease-out;
    width: 100%;
}

header>label>span::before {
    top: 5px;
}

header>label>span::after {
    top: -5px;
}

header>input {
    display: none;
}

header>input:checked~nav {
    display: block;
    height: 100%;
    background-color: black;
}

header>input:checked~label>span {
    background: transparent;
}

header>input:checked~label>span::before {
    transform: rotate(-45deg);
    top: 0;
}

header>input:checked~label>span::after {
    transform: rotate(45deg);
    top: 0;
}

main {
    max-width: 1000px;
    margin: 0 auto;
    overflow: auto;
}


main.letters span {
    display: block;
    float: left;
    width: 20%;
    height: 20vw;
    font-size: 7vw;
    line-height: 20vw;
    text-align: center;
}

main.letters span.second {
    background-color: aliceblue;
}

main div {
    display: block;
    overflow: auto;
}

main.letters .spacer {
    height: 20vw;
    display: block;
    width: 100%;
}

main.words span {
    float: left;
    width: calc(50% - 1rem);
    overflow: hidden;
    height: 2rem;
    line-height: 2rem;
    white-space: nowrap;
}

main.words span:nth-child(odd) {
    margin-left: 1rem;
}

main.words span:nth-child(even) {
    margin-right: 1rem;
}

main.words a {
    text-decoration: none;
    color: black;
}

main.practice {
    padding-top: 2rem;
    padding-bottom: calc(2rem + 82px);
}

main.practice p {
    font-size: 2rem;
    overflow-wrap: break-word;
}

.bottomBar {
    display: block;
    background-color: black;
    top: unset;
    bottom: 0;
    border-top: 0;
    height: 82px;
    line-height: 82px;
    left: 0;
}

.bottomBar a {
    float: left;
    display: block;
    width: 20%;
    color: white;
    text-decoration: none;
    text-align: center;
}

a#swap {
    font-size: 1.5rem;
}

.bottomBar a:nth-child(2) {
    width: 80%;
    background-color: red;
}

.bottomBar a.full {
    width: 100%;
    background-color: red;
}

main.home p {
    line-height: 1.5rem;
}

main.home form {
    margin: 2rem auto;
    max-width: 50%;
}

main.home form input {
    font-family: var(--font-family);
    font-size: var(--font-size);
    max-width: 100%;
    padding: 0.2rem;
}

.navTiles a {
    display: block;
    width: calc(100% - 2rem);
    background-color: lightgrey;
    float: left;
    text-align: center;
    padding-top: 7rem;
    padding-bottom: 3rem;
    margin: 1rem 1rem 0 1rem;
    text-decoration: none;
    color: black;
    background-image: url(/img/practice.svg);
    background-size: 4rem;
    background-position: center 2.5rem;
    background-repeat: no-repeat;
}

.navTiles .letters {
    background-image: url(/img/letters.svg);
}

.navTiles .words {
    background-image: url(/img/words.svg);
}

.navTiles .game {
    background-image: url(/img/game.svg);
}

.navTiles {
    overflow: auto;
    margin-bottom: 1rem;
}

main.home p {
    margin-top: 2rem;
}

main.home p:first-of-type {
    font-size: 1.5rem;
}

main.search a,
.target a {
    text-decoration: none;
}

main.search a:hover,
.target a:hover,
main.search h1.hasAudio:hover {
    text-decoration: underline;
    cursor: pointer;
}

main.search div {
    border-top: 1px solid lightgrey;
    padding: 1rem;
}

audio {
    display: none;
}

main.words div {
    border-top: 1px solid lightgrey;
}

main.words div:last-of-type,
main.search div:last-of-type {
    border-bottom: 1px solid lightgrey;
}

main.search div p {
    padding: 0;
    margin: 0;
    overflow-wrap: break-word;
}

main .definition {
    background-color: #fafafa;
}

main .sentence p {
    line-height: 1.8rem;
}

main .sentence p:nth-of-type(1) {
    border-bottom: 1px dashed lightgrey;
}

main.practice #sentence,
main p.sentence:nth-child(1),
main .sentence p:nth-child(1) {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

main .definition p {
    line-height: 1.5rem;
}

main .sentence,
main .sentence p {
    text-wrap: balance;
}

.letters a {
    text-decoration: none;
}

main.game input {
    background-color: yellow;
    border-width: 0;
    font-size: 1rem;
    line-height: 1;
    border: 3px solid yellow;
    padding: 0 3px;
    text-align: center;
}

@media (min-width: 800px) {
    nav {
        max-height: none;
        top: 0;
        position: relative;
        float: right;
        width: fit-content;
        background-color: transparent;
        display: inline-block;
        height: unset;
        border-top: none;
    }

    main {
        padding: 0 1rem;
    }

    nav>ul>li {
        float: left;
        margin-right: 1rem;
        text-align: left;
        margin-top: unset;
    }

    header>label {
        display: none;
    }

    header nav {
        font-size: 0.7rem;
    }

    main.letters span {
        font-size: 80px;
    }

    .navTiles {
        padding-bottom: 2rem;
    }

    .navTiles a {
        width: calc(50% - 1rem);
        margin: 2rem 0 0 0;
    }

    .navTiles a:nth-of-type(even) {
        float: right;
    }

    main.home p:first-of-type {
        font-size: 2rem;
    }
}