/*------------------------------------*\
    FORM ELEMENTS (base)
\*------------------------------------*/

@use "../../helpers";
@use "../../settings";

legend {
    @include helpers.ds_h3-size;
    font-weight: settings.$bold;
    margin-bottom: 0.5rem;
}

fieldset {
    border: 0;
}

// Layout for standardised form
.ds_form {
    display: flex;
    flex-direction: column;

    &__content {
        // Move top margin to ds_question to handle when it has error state left border and avoid problems with fieldset and legend negative margins
        .ds_question:has(.ds_page-header) {
            margin-top: 1rem;
            @include helpers.ds_media-query(medium) {
                margin-top: 2rem;
            }
        }
        .ds_question {
            .ds_page-header {
                margin-top: 0;
            }
        }

        // Reduce bottom margin on final ds_question within a form
        // Reduce bottom margin on final datepicker within a form
        .ds_question:last-child,
        .ds_datepicker:last-child {
            @include helpers.ds_responsive-margin(3, bottom);
        }
    }


    &__actions {
        // Add block margins to buttons if in actions slot of form layout
        .ds_button {
            @include helpers.ds_block-margins;
        }
    }
}