/*
 * The contact form's additions (Views/Partials/Chrome/ContactForm.cshtml; Lea, Trello 745, 30 Nov 2026; SPEC.md D53).
 * Loaded by the form itself, so it is on every page that has the form.
 */

/* The country code in front of the phone number. The native select is the field: invisible (opacity, not hidden, so
   it keeps the focus, the keyboard and the phone's own picker) and stretched over a box that shows only the code
   (»+45«). Opened, the list shows the countries by name. The box looks like the theme's floating fields beside it. */
/* 92 px: room for the longest code (»+358«) and the arrow, and as much as possible left for the number in the 320 px
   panel on tall screens (assets/child/style.css, #contact-overlay .overlay-panel). */
#contact-form .bmg-dial {
    position: relative;
    flex: 0 0 5.75rem;
}

#contact-form .bmg-dial__select {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    /* 16 px or more, or iOS zooms the page when the select gets the focus. */
    font-size: 1rem;
}

#contact-form .bmg-dial__shown {
    display: flex;
    align-items: center;
    height: calc(3.5rem + 2px);
    padding-left: 18px;
    background-position: right .625rem center;
    color: rgb(var(--bs-body-color-rgb));
    font-variation-settings: "wght" 450;
    white-space: nowrap;
}

/* The number's label beside it: the theme's floating label grows with its text and ran past the field in the narrow
   panel (»Telefonnummeret ditt*«). Here it stops at the field's edge with an ellipsis, and before the red mark when
   the field is marked. */
#contact-form .bmg-phone .form-floating > label {
    max-width: 100%;
    padding-right: 12px;
}

#contact-form .bmg-phone .form-floating > .form-control.is-invalid ~ label {
    padding-right: calc(1.5em + .75rem);
}

/* The focus as on the theme's .form-control:focus (assets/child/style.css). */
#contact-form .bmg-dial:focus-within .bmg-dial__shown {
    border-color: #d7d7d7;
    box-shadow: var(--bs-box-shadow);
}

#contact-form .bmg-dial.is-invalid .bmg-dial__shown {
    border-color: #dc3545;
}

/* The one message under the fields when some are missing or invalid; the fields themselves have the theme's
   .is-invalid (red border and mark). */
#contact-form .bmg-contact-invalid {
    margin-top: .25rem;
    color: #dc3545;
}
