/*
 * Sign-in screen.
 *
 * Modelled on the sign-in screens of the other Konekallio applications
 * (konekallio-kai, konekallio-messaging): a light grey page, one bordered white
 * card, a dark square mark above the name. The slate ramp comes from
 * app-chrome.css, which the login layout loads first; the indigo of that file
 * is kept for focus rings only, where it matches the signed-in app.
 */

/*
 * app-chrome.css locks the document so the signed-in shell can own the only
 * scrolling region (#521). This page has no such shell — it is one card that
 * has to stay reachable on a short viewport (a laptop in landscape with the
 * on-screen keyboard up), so the lock is lifted here.
 */
html,
body.kk-login {
    height: auto;
    min-height: 100%;
    overflow: auto;
}

body.kk-login {
    margin: 0;
    color: var(--kk-slate-900);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

.kk-login-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2.5rem 1rem;
    box-sizing: border-box;
}

@supports (min-height: 100dvh) {
    .kk-login-stage {
        min-height: 100dvh;
    }
}

/* ------------------------------------------------------------------- card */

.kk-login-card {
    width: 100%;
    max-width: 26rem;
    padding: 2rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .06);
}

/* ------------------------------------------------------------------ brand */

.kk-login-brand {
    margin-bottom: 1.5rem;
    text-align: center;
}

.kk-login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: .75rem;
    background: #212529;
    color: #fff;
    font-size: 1.5rem;
}

.kk-login-name {
    margin: 1rem 0 0;
    font-size: 1.25rem;
    font-weight: 500;
}

/* ------------------------------------------------------------------ form */

.kk-login-card .form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--kk-slate-700);
}

.kk-login-field .input-group-text {
    background: var(--kk-slate-100);
    border-color: var(--kk-slate-200);
    color: var(--kk-slate-500);
}

.kk-login-field .form-control {
    padding: .6rem .75rem;
    border-color: var(--kk-slate-200);
}

.kk-login-field .form-control:focus {
    border-color: var(--kk-accent-bright);
    box-shadow: 0 0 0 .2rem var(--kk-accent-soft);
}

/*
 * Bootstrap raises the focused control above its neighbours so its ring is not
 * clipped by them. The addons have to come along, or the ring stops at the
 * leading icon and the trailing reveal button.
 */
.kk-login-field:focus-within .input-group-text,
.kk-login-field:focus-within .kk-login-reveal {
    border-color: var(--kk-accent-bright);
}

.kk-login-reveal {
    border-color: var(--kk-slate-200);
    color: var(--kk-slate-500);
}

.kk-login-reveal:hover,
.kk-login-reveal:focus {
    background: var(--kk-slate-100);
    border-color: var(--kk-slate-300);
    color: var(--kk-slate-700);
}

.kk-login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border: 1px solid #212529;
    border-radius: .375rem;
    background: #212529;
    color: #fff;
    font-weight: 500;
}

.kk-login-submit:hover,
.kk-login-submit:focus {
    background: #424649;
    border-color: #373b3e;
    color: #fff;
}

.kk-login-submit:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .25rem var(--kk-accent-soft);
}

.kk-login-submit:disabled {
    background: #212529;
    color: #fff;
    opacity: .75;
}

/* ------------------------------------------------------------- footnotes */

.kk-login-help {
    margin: 1.25rem 0 0;
    color: var(--kk-slate-500);
    font-size: .8rem;
    text-align: center;
}

.kk-login-foot {
    margin: 1.25rem 0 0;
    color: var(--kk-slate-500);
    font-size: .78rem;
}

/*
 * The Flash element renders `.message error` (templates/element/flash/*), which
 * only cake.css styles — and cake.css is not loaded here. Give those messages
 * the same shape as the inline alert beside them.
 */
.kk-login-card .message {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border: 1px solid transparent;
    border-radius: .375rem;
    font-size: .875rem;
    cursor: pointer;
}

.kk-login-card .message.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.kk-login-card .message.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.kk-login-card .message.hidden {
    display: none;
}

@media (max-width: 480px) {
    .kk-login-card {
        padding: 1.5rem 1.25rem;
    }
}
