/* Forms */

form {
    input:is([type="text"], [type="email"], [type="password"], [type="number"], [type="search"]), textarea, select {
        width: 100%;
        padding: 0.6rem 0.75rem;
        background-color: var(--dark-grey);
        color: var(--white);
        border: 1px solid var(--mid-grey);
        border-radius: 0;

        &::placeholder {
            color: var(--light-grey);
        }

        &:focus {
            outline: none;
            border-color: var(--orange);
        }

        /* After :focus, so a field stays marked while it's being fixed */
        &[aria-invalid="true"] {
            border-color: var(--error);
        }
    }

    /* Under each field */
    .form-error, .form-hint {
        font-size: 1rem;
    }

    .form-error {
        color: var(--error);
    }

    .form-hint {
        color: var(--light-grey);
    }

    /* The summary above the fields; after the rule above so its white text wins */
    > .form-error {
        padding: 0.75rem 1rem;
        border-left: 0.25rem solid var(--error);
        background-color: var(--dark-grey);
        color: var(--white);
    }

    textarea {
        resize: vertical;
    }
}

.submission-form {
    width: 100%;
    max-width: var(--width-text);
    display: flex;
    flex-direction: column;
    gap: 2rem;

    .form-field {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .submission-step {
        display: flex;
        flex-direction: column;
        row-gap: 2rem;
        scroll-margin-top: calc(var(--header-height) + 2rem);

        & + & {
            margin-top: 2rem;
        }

        &.is-done {
            opacity: 0.5;
        }

        .form-tags fieldset {
            legend {
                display: block;
                margin-bottom: 1rem;
            }
        }

        &:has(.form-tags) {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            align-items: start;

            > :not(.form-tags) {
                grid-column: 1 / -1;
            }

            .button {
                width: 100%;

                &:hover {
                    gap: 1rem;
                }
            }

            @media (width < 37.5rem) {
                grid-template-columns: minmax(0, 1fr);
            }
        }
    }

    .submission-actions {
        display: flex;
        justify-content: center;

        &:has(.form-back) {
            justify-content: space-between;
        }
    }
}