/* WIP 
    added for re-usable form elements
    things like common form, section, input layouts can be added and defined here. */

/* heading elements; navigate back button + h1 */
amp-button[button-type="help"],
amp-button[button-type="back"] {
    --button-background: transparent;
    --button-hover-background: transparent;
    --button-border-style: none;
    --button-border: none;
    --button-box-shadow: none;
    --button-color: var(--typeface-regular-color);
    --button-hover-color: var(--typeface-regular-color);
    --button-margin: 1.5rem 0;
    --button-padding: 0;
}

section[heading-back] {
    --section-max-width: 1024px;
    --section-width: 100%;
}

section[heading] {
    --section-align-items: center;
    --section-display: flex;
    --section-flex-direction: column;
    --section-margin: 0 0 2rem;
}

section[heading] h1 [typeface="subhead"] {
    --typeface-subhead-font-weight: var(--typeface-regular-font-weight);
    max-width: 100%;
}

section[heading] h1 span {
    align-items: center;
    display: flex;
    flex-direction: column;
    text-align: center;
}

/* common form elements, layout */
div[widget] {
    background: white;
    border-color: var(--panel-highlighted-border-color, var(--amplify-blue-60));
    border-radius: 0.3rem 0.3rem 0 0;
    border-style: solid;
    border-width: 4px 0 0;
    box-shadow:
        0 -10px 0 var(--amplify-light-5),
        0 1px 10px var(--amplify-light-30);
    max-width: 1140px;
    width: 100%;
}

amp-button[button-type="cancel"] {
    --button-background: transparent;
    --button-border-style: none;
    --button-border: none;
    --button-box-shadow: none;
    --button-color: royalblue;
}

amp-button[button-type="expand"] {
    --button-background: transparent;
    --button-border-style: none;
    --button-border: none;
    --button-box-shadow: none;
    --button-color: royalblue;
}

amp-page-template section[form-section] {
    --section-background: var(--amplify-white);
    --section-display: flex;
    --section-flex-direction: column;
    --section-padding: 2rem;

    --typeface-subhead-margin: 0 0 3rem;
}
amp-page-template section[form-section][layout] {
    --section-padding: 2rem;
}

amp-page-template section[form-section] amp-input {
    --input-margin: 0 0 2rem;
    --input-width: 100%;
}

amp-page-template section[form-section] amp-input:last-child {
    --input-margin: 0;
}
amp-page-template section[form-section] h2 {
    --h2-line-height: normal;
    --h2-padding: 0 0 1.5rem;
}
amp-page-template section[form-section] label {
    --input-label-color: var(--amplify-dark-90);
}
amp-page-template section[form-buttons] {
    align-items: var(--form-buttons-section-align-items, flex-start);
    background: var(--form-buttons-section-background);
    justify-content: flex-start;
    flex-direction: var(--form-buttons-section-flex-direction, row-reverse);
    flex-wrap: wrap;

    --button-flex: 0 1 auto;
    --button-justify-content: center;
    --button-margin: 0;
}

amp-page-template section[form-sub-section] {
    --section-position: relative;
    --section-margin: 3rem -2rem;
    --section-background: var(--amplify-light-0);
    --section-border-color: var(--amplify-light-20);
    --section-border-style: solid;
    --section-border-width: 1px 0;
}
amp-page-template section[form-sub-section]:before,
amp-page-template section[form-sub-section]:after {
    display: block;
    content: "";
    position: absolute;
    top: -0.75rem;
    left: calc(50% - 0.75rem);
    width: 0;
    height: 0;
    border-left: 0.75rem solid transparent;
    border-right: 0.75rem solid transparent;
    border-bottom: 0.75rem solid var(--amplify-light-0);
    font-size: 0;
    line-height: 0;
    z-index: 99;
    transform: translateY(1px);
}
amp-page-template section[form-sub-section]:after {
    transform: translateY(0px);
    z-index: 88;
    border-bottom: 0.75rem solid var(--amplify-light-20);
}

.visibility-hidden {
    visibility: hidden;
}

@media only screen and (min-width: 768px) {
    amp-page-template section[form-sub-section] {
        --section-margin: 0 -5rem 2rem -5rem;
        --section-padding: 2rem 5rem 2rem 5rem;
    }
    amp-page-template section[form-buttons] {
        flex-wrap: initial;
    }
}

@media only screen and (min-width: 1024px) {
    amp-page-template section[form-sub-section] {
        --section-margin: 0 -21rem 2rem -10rem;
        --section-padding: 2rem 21rem 2rem 10rem;
    }
}
