/* The station's own on-screen keyboard. It is built by js/onscreenKeyboard.js straight into the
   body, outside the Blazor render tree, so its styles cannot live in a scoped .razor.css file.

   Sizing is deliberately generous: this is tapped with a thumb on a Raspberry Pi touchscreen,
   often by someone holding a glider in the other hand. */

.osk {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2000; /* above Bootstrap's modal (1055) - the dialog is what is being typed into */
    display: none;
    flex-direction: column;
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid #d8d8d8;
    background: #eceef0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
    /* Never let a stray drag scroll the page or fire a text selection under the keys. */
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.osk-visible {
    display: flex;
}

.osk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.25rem 0.5rem;
}

.osk-hint {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.osk-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #d0d3d6;
    border-radius: 0.5rem;
    background: #fff;
    color: #575445;
}

.osk-close .osk-icon {
    width: 1.375rem;
    height: 1.375rem;
}

.osk-keys {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin: 0 auto;
}

/* The number pad is a pad, not a keyboard: keeping it narrow keeps the digits under one thumb. */
.osk-keys-numeric {
    max-width: 26rem;
}

.osk-row {
    display: flex;
    gap: 0.5rem;
}

.osk-key {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 4rem;
    padding: 0;
    border: 1px solid #c8ccd0;
    border-bottom-width: 2px;
    border-radius: 0.625rem;
    background: #fff;
    color: #212529;
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1;
}

.osk-keys-numeric .osk-key {
    height: 4.5rem;
    font-size: 1.875rem;
}

.osk-key .osk-icon {
    width: 1.625rem;
    height: 1.625rem;
}

/* No :hover rule on purpose - on a touchscreen it sticks to the last key pressed. */
.osk-key:active {
    background: #dfe3e6;
    transform: translateY(1px);
}

.osk-key-modifier,
.osk-key-space {
    background: #d7dbdf;
    color: #575445;
}

.osk-key-space {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #6c757d;
}

.osk-key-accept {
    border-color: #b43c2f;
    background: #b43c2f;
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
}

.osk-key-accept:active {
    background: #9a3327;
}

/* Shift armed for the next letter, and shift held down for good. */
.osk-key-active {
    border-color: #87a2a0;
    background: #87a2a0;
    color: #fff;
}

.osk-key-locked {
    border-color: #575445;
    background: #575445;
}

.osk-key-disabled,
.osk-key-disabled:active {
    background: #e4e7ea;
    color: transparent;
    transform: none;
}

/* Room to scroll the last field clear of the keys on pages that scroll at all. */
body.osk-open {
    padding-bottom: 22rem;
}

@media (max-height: 700px) {
    .osk-key {
        height: 3.25rem;
        font-size: 1.25rem;
    }

    .osk-keys-numeric .osk-key {
        height: 3.5rem;
        font-size: 1.5rem;
    }

    body.osk-open {
        padding-bottom: 18rem;
    }
}
