<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="Is it prime?">
        <meta property="og:image" content="https://prime.cringe-studios.com/query.png">
        <meta property="og:type" content="website">
        <meta property="og:url" content="https://yes.prime.cringe-studios.com/">
        <meta property="og:title" content="Is it prime?">
        <meta property="og:description" content="DNS based prime number checker">
        <meta name="theme-color" content="#9b9b9b" data-react-helmet="true" />

        <link rel="icon" href="https://prime.cringe-studios.com/query.png">

        <title>Is it prime?</title>

        <link rel="stylesheet" href="common.css">

        <style>
            * {
                background-color: #9b9b9b;
            }

            .queryInput {
                border: 0;
/*                border-bottom: 2px solid #333;*/
                outline: 0;
                font-size: 9rem;
                background: transparent;
/*                transition: border-color 0.2s;*/
                color: #333;
                width: 100%;

/*                &::placeholder {
                    color: transparent;
                }
*/
/*                &:placeholder-shown ~ .queryLabel {
//                    font-size: 9rem;
//                    cursor: text;
//                    top: 20px;
*/                }
            }

/*            .queryLabel {
//                top: 0;
//                display: block;
//                transition: 0.2s;
//                font-size: 4.5rem;
//                color: #333;
*/            }

            .queryInput:focus {
                color: #333;

/*                ~ .queryLabel {
//                    top: 0;
//                    display: block;
//                    transition: 0.2s;
//                    font-size: 4.5rem;
//                    color: #ffffff;
//                    font-weight:700;    
                }
*/                
            }

            /* reset input */
            .queryInput{
                &:required,&:invalid {
                    box-shadow:none;
                    color: #333;
                }
            }

            #inputButton {
                font-size: 9rem;
                color: #333;
                &:hover {
                    color: #FFFFFF;
                    cursor: pointer;
                }
            }

            #inputBox {
                border-bottom: 2px solid #333;
                display: flex;
                width: 69%;
                margin-left: auto;
                margin-right: auto;
            }
        </style>
        <script>
            function inputButtonClick() {
                let inputField = document.getElementById("name");
                let contents = inputField.value;
                if (contents == "" || contents == null) {
                    return;
                }

                document.location.href = window.location.protocol + "//" + encodeURIComponent(contents) + "." + window.location.hostname;
            }

            window.onload = (event) => {
                document.getElementById("name").addEventListener("keypress", function(event2) {
                    if(event2.key == "Enter") {
                        event2.preventDefault();
                        document.getElementById("button").click();
                    }
                })
            }
        </script>

    </head>
    
    <body id="wrapper">
        <div id="content">
            <h1 id="questionText">Is it prime?</h1>
            <div id="inputBox">
                <input type="input" class="queryInput" placeholder="Number" name="name" id='name' required />
                <input type="button" value="→" id="inputButton" onclick="inputButtonClick();" />
            </div>
            
        </div>
    </body>
</html>