/*
 FYNDA MILESTONE 2.8B

 Authentication layout stabilization.

 Scope:
 Login
 Registration
 Forgot password

 Does not modify Vue state, password visibility
 behaviour, submit actions or authentication APIs.
*/

/* --------------------------------------------
   1. MOBILE VIEWPORT CONTAINMENT
-------------------------------------------- */

#app .login-reference-page,
#app .auth-page {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;

    min-height: 100svh;
    height: auto;

    overflow-x: clip;
    overflow-wrap: break-word;
}

/* Keep form content inside the viewport. */

#app .login-reference-page *,
#app .auth-page *,
#app .register-card * {
    box-sizing: border-box;
}

/* --------------------------------------------
   2. LOGIN CARD
-------------------------------------------- */

#app .login-reference-page
.login-reference-card {
    width: min(100%, 460px);
    max-width: 100%;

    min-width: 0;

    margin-inline: auto;

    box-sizing: border-box;
}

/* Keep headings readable without horizontal
   clipping on narrow Android screens. */

#app .login-reference-page
.login-reference-heading {
    min-width: 0;
    max-width: 100%;
}

#app .login-reference-page
.login-reference-heading h1 {
    max-width: 100%;

    overflow-wrap: break-word;

    line-height: 1.2;
}

/* --------------------------------------------
   3. LOGIN INPUT STABILITY
-------------------------------------------- */

#app .login-reference-page
.login-reference-field {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#app .login-reference-page
.login-reference-field input {
    display: block;

    min-width: 0;
    max-width: 100%;

    box-sizing: border-box;

    font-size: 16px !important;
    line-height: 1.35;

    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Keep password visibility controls independent
   of the input width. */

#app .premium-login .password-field {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#app .premium-login .password-field input {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#app .premium-login .password-toggle {
    min-width: 44px;
    min-height: 44px;

    box-sizing: border-box;
    touch-action: manipulation;
}

/* --------------------------------------------
   4. REGISTRATION RESPONSIVENESS
-------------------------------------------- */

#app .register-card {
    width: min(100%, 560px);
    max-width: 100%;

    min-width: 0;

    margin-inline: auto;

    box-sizing: border-box;
}

#app .register-card
:is(label, fieldset, section, div) {
    min-width: 0;
    max-width: 100%;
}

#app .register-card
:is(
    input:not([type="checkbox"]):not([type="radio"]),
    textarea,
    select
) {
    min-width: 0;
    max-width: 100%;

    box-sizing: border-box;

    font-size: 16px;
    line-height: 1.35;
}

/* Prevent account-type labels from causing
   horizontal overflow. */

#app .register-card label {
    overflow-wrap: anywhere;
}

/* --------------------------------------------
   5. ACCESSIBILITY AND FOCUS
-------------------------------------------- */

#app .login-reference-page
:is(input, button, select, textarea):focus-visible,
#app .register-card
:is(input, button, select, textarea):focus-visible {
    outline-offset: 2px;
}

/* Remove unnecessary animation from the form
   controls themselves, not the whole application. */

#app .login-reference-page input,
#app .register-card input {
    transition-property:
        border-color,
        box-shadow,
        background-color !important;

    transition-duration: 120ms !important;
}

/* --------------------------------------------
   6. SMALL ANDROID SCREENS
-------------------------------------------- */

@media screen and (max-width: 320px) {

    #app .login-reference-page
    .login-reference-card {
        width: 100%;
        max-width: 100%;

        padding-inline: clamp(8px, 3vw, 12px);
    }

    #app .register-card {
        width: 100%;
        max-width: 100%;

        padding-inline: clamp(8px, 3vw, 12px);
    }

    #app .login-reference-page
    .login-reference-heading h1 {
        font-size: clamp(17px, 6vw, 22px);
    }

    #app .register-card button {
        max-width: 100%;
        box-sizing: border-box;
        overflow-wrap: anywhere;
    }
}

/* --------------------------------------------
   7. LANDSCAPE KEYBOARD ACCESSIBILITY
-------------------------------------------- */

@media screen and (max-height: 460px) {

    #app .login-reference-page,
    #app .auth-page {
        min-height: 0;
    }

    #app .login-reference-page
    .login-reference-card {
        margin-block: 8px;
    }
}

/*
 No global overflow locks.
 No fixed-height authentication form.
 No password value manipulation.
 No input replacement.
 No WebView event interception.
*/
