<form>
<div class="form-group">
<label for="email" class="form-label">Email</label>
<input required type="email" id="email" class="form-input" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" title="Enter valid email address" placeholder="Enter valid email address"/>
</div>
</form>
*,
*:after,
*:before {
box-sizing: border-box;
}
:root {
--red: hsl(18 100% 50%);
--green: hsl(130 52% 46%);
--yellow: hsl(44 83% 53%);
--blue: hsl(215 100% 53%);
--grey: hsl(0 0% 45%);
--text: var(--gray-5);
--transition: 0.2s;
--valid: var(--green);
--invalid: var(--red);
--focus: var(--violet-4);
--blur: var(--indigo-4);
--disabled: var(--grey);
}
:where(html) {
color-scheme: none;
}
body {
display: grid;
min-height: 100vh;
font-family: 'Google Sans', sans-serif, system-ui;
place-items: center;
overflow: hidden;
margin: 0;
background-color: transparent;
font-size: 1rem;
}
form {
display: grid;
grid-gap: 1rem;
}
input {
border: 4px solid var(--color);
border-radius: 4px;
padding: 1rem 2rem;
font-weight: 400;
transition: border-color var(--transition);
}
input:focus-visible {
outline-color: var(--color);
}
input::placeholder {
color: transparent;
}
.form-group {
display: flex;
align-items: center;
justify-content: flex-end;
}
label {
font-family: sans-serif;
display: flex;
font-weight: bold;
padding-right: 1rem;
transform-style: preserve-3d;
transition: color var(--transition);
color: var(--color);
font-size: 1.25rem;
}
.form-group:has(:invalid) {
--color: var(--invalid);
}
.form-group:has(:focus) {
--color: var(--focus);
}
.form-group:has(:valid) {
--color: var(--valid);
}
.form-group:has(:placeholder-shown) {
--color: var(--blur);
}