/* Leere Felder behalten ihren Platzhalter. Bei Fokus oder einer Eingabe
   wandert die Beschriftung in den oberen Bereich desselben Feldes. */
form label.kg-field-label {
    position: absolute !important;
    display: block !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

form .kg-form-field { position: relative; width: 100%; }

form .kg-form-field > :is(input, textarea, select) {
    transition-property: border-color, background-color, color, background-size, padding-top, padding-bottom !important;
    transition-duration: .25s, .25s, .25s, .3s, .25s, .25s !important;
    transition-timing-function: ease, ease, ease, cubic-bezier(.2,.9,.3,1.5), ease, ease !important;
}

form .kg-form-field.has-required-placeholder > :is(input, textarea)::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

form .kg-form-field .kg-placeholder-overlay,
form .kg-form-field .kg-floating-label {
    position: absolute;
    left: var(--kg-placeholder-padding-left);
    right: var(--kg-placeholder-padding-right);
    font-weight: 400;
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity .2s ease, transform .25s ease;
}

form .kg-form-field .kg-placeholder-overlay {
    top: var(--kg-placeholder-padding-top);
    font-size: var(--kg-placeholder-font);
    line-height: var(--kg-placeholder-line-height);
    white-space: nowrap;
    opacity: 0;
}

form .kg-form-field:has(> :placeholder-shown) .kg-placeholder-overlay { opacity: 1; }

form .kg-form-field .kg-placeholder-text {
    color: var(--kg-placeholder-color) !important;
    opacity: var(--kg-placeholder-opacity, 1);
}

form .kg-form-field .kg-floating-label {
    top: .22rem;
    font-size: .72rem;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(.3rem);
}

form .kg-form-field .kg-floating-label .kg-placeholder-text {
    opacity: .65;
}

form .kg-form-field:is(:focus-within, .is-filled, :has(> :is(input, textarea):not(:placeholder-shown))) > :is(input, textarea, select) {
    padding-top: calc(var(--kg-placeholder-padding-top) + .4rem) !important;
    padding-bottom: max(0px, calc(var(--kg-placeholder-padding-bottom) - .4rem)) !important;
}

form .kg-form-field:is(:focus-within, .is-filled, :has(> :is(input, textarea):not(:placeholder-shown))) .kg-floating-label {
    opacity: 1;
    transform: translateY(0);
}

form .kg-form-field:focus-within .kg-placeholder-overlay { opacity: 0; }
form .kg-form-field:focus-within > :is(input, textarea)::placeholder { opacity: 0 !important; }
form .kg-form-field:not(.is-filled):focus-within > select { color: transparent !important; }
form .kg-form-field:not(.is-filled):focus-within > select option { color: var(--kg-placeholder-color) !important; }
form .kg-form-field:has(textarea) .kg-placeholder-overlay { white-space: normal; }

form :is(input, textarea):is(:autofill, :-webkit-autofill) {
    background-color: #f1f5f9 !important;
    color: #273744 !important;
    -webkit-box-shadow: 0 0 0 1000px #f1f5f9 inset !important;
    box-shadow: 0 0 0 1000px #f1f5f9 inset !important;
    -webkit-text-fill-color: #273744 !important;
    caret-color: #273744;
}

form .kg-form-field:has(> :is(input, textarea):is(:autofill, :-webkit-autofill)) .kg-floating-label .kg-placeholder-text {
    color: #59636c !important;
    opacity: 1;
}

/* Der Autofill-Hintergrund liegt ueber dem Hintergrundbild des Feldes.
   Das Statuszeichen bleibt deshalb in diesem Fall als eigene Ebene sichtbar. */
form .kg-form-field:has(> :is(input, textarea):is(:autofill, :-webkit-autofill).kg-valid)::after,
form .kg-form-field:has(> :is(input, textarea):is(:autofill, :-webkit-autofill).is-invalid)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: .55rem;
    width: 1.05em;
    height: 1.05em;
    transform: translateY(-50%);
    pointer-events: none;
    background-color: var(--kg-field-valid, #22c55e);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3 8.6l3.4 3.4L13 5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3 8.6l3.4 3.4L13 5'/%3E%3C/svg%3E") center / contain no-repeat;
}

form .kg-form-field:has(> :is(input, textarea):is(:autofill, :-webkit-autofill).is-invalid)::after {
    background-color: var(--kg-field-invalid, #dc3545);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4.5 4.5l7 7M11.5 4.5l-7 7'/%3E%3C/g%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4.5 4.5l7 7M11.5 4.5l-7 7'/%3E%3C/g%3E%3C/svg%3E");
}

form .kg-form-field:has(> textarea:is(:autofill, :-webkit-autofill))::after {
    top: .85rem;
    transform: none;
}

/* Die Dienstleistungs-Heros verwenden eine dunkle, zum Seitenschema
   passende Autofill-Flaeche und helle Schrift. */
body.is-leistungen-page main #hero #kontaktformular .kg-form-field > :is(input, textarea):is(:autofill, :-webkit-autofill) {
    background-color: #253342 !important;
    color: #f3f6f9 !important;
    -webkit-box-shadow: 0 0 0 1000px #253342 inset !important;
    box-shadow: 0 0 0 1000px #253342 inset !important;
    -webkit-text-fill-color: #f3f6f9 !important;
    caret-color: #f3f6f9;
}

@supports (color: color-mix(in srgb, black, white)) {
    body.is-leistungen-page main #hero #kontaktformular .kg-form-field > :is(input, textarea):is(:autofill, :-webkit-autofill) {
        -webkit-box-shadow: 0 0 0 1000px color-mix(in srgb, var(--dienstkontakt-accent, #273744) 20%, #202a36) inset !important;
        box-shadow: 0 0 0 1000px color-mix(in srgb, var(--dienstkontakt-accent, #273744) 20%, #202a36) inset !important;
    }
}

body.is-leistungen-page main #hero #kontaktformular .kg-form-field .kg-floating-label .kg-placeholder-text {
    color: #f3f6f9 !important;
    opacity: .75;
}

@media (prefers-reduced-motion: reduce) {
    form .kg-form-field > :is(input, textarea, select),
    form .kg-form-field .kg-placeholder-overlay,
    form .kg-form-field .kg-floating-label { transition: none !important; }
}
