/* input */

label {
    display: block;
}

label,
button,
select,
option,
input[type="radio"],
input[type="checkbox"] {
    text-transform: capitalize;
}

.input-no-bg {
    padding: 0.4em;
    box-sizing: border-box;
    border-radius: 1px;
    color: var(--t100);
}

.input,
a.input,
input,
button,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    padding: 0.4em;
    box-sizing: border-box;
    border: 1px solid var(--bg300);
    border-radius: 1px;
    background: var(--bg150);
    color: var(--t100);
    box-shadow: var(--input-shadow);
    user-select: none;
}

.input:hover, button:hover {
    text-decoration: none;
    cursor: pointer;
}

input:disabled {
    color: var(--bg300);
    user-select: none;
}

button {
    outline: none;
}

button:disabled {
    opacity: 0.5;
}

button:not(:disabled):active {
    background-color: var(--bg200);
}

button:focus, a.input:focus {
    border-color: var(--bg400);
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type="text"],
input[type="number"] {
    -moz-appearance: textfield;
    outline: 0;
}

input[type="number"] {
    text-align: right;
}

input[type="text"]:focus,
input[type="number"]:focus {
    border-color: var(--bg400);
}

/* checkbox */
input[type="radio"],
input[type="checkbox"] {
    border-color: var(--bg300);
    -webkit-appearance: none;
    display: inline-block;
}

input[type="radio"],
input[type="checkbox"] {
    display: inline-block;
    position: relative;

    margin: 0em;
    width: 1em;
    height: 1em;

    background: var(--bg150);

    border-style: solid;
    border-width: 1px;
    border-color: var(--bg200);
    border-radius: 1px;

    cursor: default;
    transition: border-color 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
    border-color: var(--bg-checked);
}

input[type="radio"]::before,
input[type="checkbox"]::before {
    content: "";
    width: 0em;
    height: 0em;
    margin: 50%;
    display: block;
    position: absolute;
    left: 0px;
    top: 0px;
    pointer-events: none;

    background: var(--bg-checked);

    border-radius: 1px;

    transition: width 0.1s cubic-bezier(0.165, 0.84, 0.44, 1),
        height 0.1s cubic-bezier(0.165, 0.84, 0.44, 1),
        margin 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
}

input[type="radio"]:checked::before,
input[type="checkbox"]:checked::before {
    width: 60%;
    height: 60%;
    margin: 20%;
}

label {
    display: flex;
    align-items: center;

    line-height: 1em;
    gap: 0.5em;
    user-select: none;
}

input:invalid {
    border-color: var(--error);
}
