text-input {
    display: block;
    margin: 1.4rem 0;
}
text-input .input {
        /* margin: 1.4rem 0; */
        position: relative;
    }
:is(text-input .input) label {
            color: var(--gray-text, #999999);
            margin-top: 0;
            font-size: 1.2rem;
            position: absolute;
            pointer-events: none;
            transition: 0.2s ease all;
            left: 0.8rem;
            font-size: 1.2rem;
        }
:is(text-input .input) input {
            border: 2px solid black;
            border-radius: var(--radius, 4px);
            padding-bottom: .4rem;
            padding-top: .5rem;
            font-size: 1.2rem;
            padding: 10px 10px 10px 5px;
            display: block;
        }
:is(:is(text-input .input) input):disabled {
                opacity: 0.4;
            }
:is(:is(text-input .input) input):disabled:hover {
                    cursor: not-allowed;
                }
:is(:is(text-input .input) input):disabled ~ label {
                    opacity: 0.4;
                }
:is(:is(text-input .input) input):focus ~ label {
                    color: black;
                    left: 0.5rem;
                }
:is(:is(text-input .input) input):focus {
    
                border-bottom: 2px solid black;
            }
:is(:is(text-input .input) input):not(:placeholder-shown) ~ label {
                color: black;
                left: 0.5rem;
            }
:is(text-input .input) input {

            /* this is a hack to fix the input width
            don't know why we need this */
            width: calc(100% - 1rem);
        }
:is(:is(text-input .input) input):focus {
                outline: none;
            }
:is(:is(text-input .input) input):focus ~ label {
                    color: black;
                    left: 0.5rem;
                }
:is(:is(text-input .input) input):focus{
    
                border-bottom: 2px solid black;
            }
/* When input is...
                1. NOT empty
                2. NOT in focus
                3. NOT valid
            */
:is(:is(text-input .input) input):invalid:not(:focus):not(:placeholder-shown) {
                border-color: var(--text-input-error-border, red);
            }
:is(:is(text-input .input) input):invalid:not(:focus):not(:placeholder-shown) ~ .requirements {
                    max-height: 200px;
                    padding: 0 30px 20px 50px;
                }
:is(text-input .input) .requirements {
            padding: 0 30px 0 50px;
            max-height: 0;
            transition: 0.28s;
            overflow: hidden;
            color: var(--text-input-error-text);
            font-style: italic;
        }
:is(text-input .input) label {
            color: #5f5f5f;
            font-size: 18px;
            font-weight: normal;
            position: absolute;
            pointer-events: none;
            left: 8px;
            top: 14px;
            transition: 0.2s ease all;
        }
/* this part makes the `label` float */
/* input:valid ~ label, */
:is(text-input .input) input:focus ~ label,:is(text-input .input) input:not(:placeholder-shown) ~ label {
            top: -18px;
            font-size: 14px;
            color: black;
        }
:root {
    --text-input-error-border: pink;
}

body {
    font-family: sans-serif;
}

body > div {
        max-width: 20rem;
        margin: 0 auto;
    }

.input-demo, h1 {
    max-width: 20rem;
    margin: 0 auto;
    margin-top: 2rem;
}

.input-demo {
    margin-bottom: 4rem;
}

h2 {
    border-bottom: 2px solid;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.2rem;
    border-bottom: 2px solid black;
    padding-bottom: 0.2rem;
    max-width: 30rem;
    margin-bottom: 4rem;
}
