/* Resets styles to known defaults to work around weird user agents.
   Based on http://meyerweb.com/eric/tools/css/reset/ */

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    display: block;
}

body {
    line-height: 1;
}

ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

blockquote:before, blockquote:after, q:before, q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* Consistent box models */
*, *:before, *:after {
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* -- End reset -- */

:root {
    --accent: #3c658d;
    --background: #15151A;
    --background-alt: #202026;
    --text: #d0d0dA;
    --text-highlight: #efefff;
    --text-alt: #90909A;
    --link: #7099c4;

    --small-space: 0.5em;
    --medium-space: 1.5em;
    --large-space: 5em;

    --content-width: calc(100vw - 2 * var(--large-space));
    --content-margin: calc((100vw - var(--content-width)) / 2);

    --font-size-tiny: 11pt;
    --font-size-small: 13pt;
    --font-size-regular: 16pt;
    --font-size-large: 19pt;
    --font-size-giant: 40pt;

    @media (max-width: 1200px) {
        --small-space: 0.5em;
        --medium-space: 1.2em;
        --large-space: 4em;
    }

    @media (max-width: 800px) {
        --small-space: 0.4em;
        --medium-space: 1em;
        --large-space: 2em;
    }

    @media (max-width: 500px) {
        --content-width: calc(100vw - 20px);
    }

    @media (max-width: 500px) and (min-resolution: 2dppx) {
        --font-size-tiny: 8pt;
        --font-size-small: 9pt;
        --font-size-regular: 12pt;
        --font-size-large: 15pt;
        --font-size-giant: 30pt;
    }
}

body {
    font-size: var(--font-size-regular);
    font-family: 'Bitter', serif;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Berkeley Mono", monospace;
    font-size: var(--font-size-regular);
    color: var(--text-highlight);
    line-height: 1;
}

h1 {
    font-size: var(--font-size-giant)
}

/** General **/

body {
    background-color: var(--background);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    min-width: 100vw;
    padding: var(--medium-space);
}

main {
    flex-grow: 1;
}

hr {
    border: 0;
    border-top: 5px solid var(--accent);
    margin: var(--medium-space) 0;
}

*[hidden] {
    display: none;
}

button {
    background-color: var(--accent);
    color: var(--text-highlight);
    border: 0;
    border-radius: 5px;
}

input[type="text"] {
    background-color: var(--background-alt);
    color: var(--text-highlight);
    border: 1px solid var(--accent);
    border-radius: 5px;
}

/** Inherited */

main {
    display: grid;
    grid-column-gap: var(--medium-space);
    grid-template-columns: 80% 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
    "title info"
    "puzzle info"
    "input info";
}

#title {
    grid-area: title;
    margin-bottom: var(--small-space);
}

#puzzle {
    grid-area: puzzle;
    overflow: scroll;
}

#input {
    grid-area: input;
    display: flex;
    gap: var(--small-space);

    [type=text] {
        flex-grow: 1;
    }

    input, button {
        padding: var(--small-space);
        font-size: var(--font-size-regular);
    }
}

#info {
    grid-area: info;
    display: flex;
    flex-direction: column;

    h2 {
        text-align: right;
        margin: var(--small-space) 0;
    }
}

#hints, #unlocks, #guesses {
    flex-grow: 1;
    flex-basis: 33%;
    padding: 10px;
    overflow-y: scroll;
    border: 1px solid var(--background-alt);
}

.error {
    position: relative;
    animation: shake .1s linear;
    animation-iteration-count: 3;
}

@keyframes shake {
    0% {
        left: -5px;
    }
    100% {
        right: -5px;
    }
}

.correct > input[type=text] {
    background-color: darkseagreen;
}

.error > input[type=text] {
    background-color: indianred;
}

.hint {
    display: grid;
    margin: 0 0 var(--medium-space) 0;

    * {
        grid-column: 1;
        grid-row: 1;
    }

    p {
        &.locked {
            filter: blur(8px);
        }

        &.unlocked {
            transition: filter 1s;
        }
    }

    button {
        justify-self: center;
        align-self: center;
        cursor: pointer;
        z-index: 10;
        padding: 5px 15px;
    }
}
