/* The sign-in page.
 *
 * It is the first thing anyone at BAAC sees, and it used to be the one screen
 * that did not belong to the system: its own brown (#4b2d16, matching neither
 * the sidebar nor the token that claimed to define it), its own borders, its
 * own 6px corners against the system's 8 and 14, and a form floating loose on
 * the background while every other screen puts its content in a card.
 *
 * So there are no colours written in this file. Every value comes from the
 * tokens in app.css, which means the dark panel here and the sidebar behind it
 * are the same paint -- and stay the same paint if the company brown is ever
 * changed, because there is only one place to change it.
 *
 * Logical properties throughout: this page is used in Arabic more than in
 * English, and it must mirror without a second stylesheet.
 */

.login-layout {
    /* Not 100svh. ``svh`` is the viewport at its SMALLEST -- the height left
       when a phone's address bar is showing -- so a panel measured in it stops
       short and leaves a strip of page background along the bottom the moment
       that bar retracts. ``dvh`` follows the viewport as it actually is, which
       is what a full-bleed panel wants, and ``vh`` is the fallback for
       browsers that do not know ``dvh``. */
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* ---------- The dark half: the company ---------- */

.login-brand {
    /* The sidebar's own gradient, not an approximation of it. */
    background: var(--baac-sidebar-gradient);
    color: #fff;
    padding: clamp(32px, 5vw, 80px);

    display: flex;
    flex-direction: column;
    /* Centred as one block, so the mark and the sentence read together
       instead of being pushed to opposite ends of a tall screen. */
    justify-content: center;
    gap: clamp(40px, 6vh, 72px);

    position: relative;
    border-inline-end: 1px solid var(--baac-sidebar-edge);
}

/* The company's footer line sits at the foot of the panel without stretching
   everything above it apart to get there. */
.login-brand-footer {
    position: absolute;
    inset-block-end: clamp(24px, 4vw, 48px);
    inset-inline-start: clamp(32px, 5vw, 80px);
    inset-inline-end: clamp(32px, 5vw, 80px);
    margin: 0;
    font-size: 12px;
    color: var(--baac-on-dark);
    opacity: .75;
}

.login-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
}

.login-identity img {
    flex: none;
    object-fit: contain;
    width: clamp(104px, 11vw, 140px);
    height: auto;
}

.login-identity strong {
    display: block;
    font-size: clamp(34px, 3.8vw, 46px);
    letter-spacing: .14em;
    line-height: 1;
    text-indent: .14em;
}

.login-identity span {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: .18em;
    line-height: 1.7;
    color: var(--baac-on-dark);
    text-transform: uppercase;
}

html[dir="rtl"] .login-identity span {
    font-size: 15px;
    letter-spacing: normal;
    text-transform: none;
}

/* A hairline between the mark and the sentence: the two are related, and the
   rule says so without needing 130px of empty space to do it. */
.login-intro {
    max-width: 440px;
    margin-inline: auto;
    padding-top: clamp(28px, 4vh, 44px);
    border-top: 1px solid var(--baac-sidebar-edge);
}

.login-intro h1 {
    font-size: clamp(30px, 3.2vw, 46px);
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 20px;
}

.login-intro > p:last-child {
    margin: 0;
    color: var(--baac-on-dark);
    line-height: 1.9;
    font-size: 15px;
}

.login-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--baac-bronze);
    margin: 0 0 12px;
}

.login-brand .login-kicker {
    color: var(--baac-gold);
}

html[dir="rtl"] .login-kicker {
    letter-spacing: normal;
}

html[dir="rtl"] .login-identity strong {
    text-indent: 0;
}

/* ---------- The light half: the form ---------- */

.login-access {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 40px clamp(24px, 4vw, 64px);
    background: var(--baac-bg);
}

/* The language switch belongs to the card, directly above it and aligned to
   its edge -- not stranded in the far corner of the page. */
.login-language {
    width: 100%;
    max-width: 440px;
    display: flex;
    justify-content: flex-end;
    margin: 0;
}

.login-language button {
    background: var(--baac-surface);
    border: 1px solid var(--baac-border);
    border-radius: var(--radius-sm);
    color: var(--baac-text);
    padding: 9px 16px;
    min-height: 40px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), color var(--transition);
}

.login-language button:hover {
    border-color: var(--baac-bronze);
    color: var(--baac-bronze);
}

/* The card. Every other screen in this system puts its content on a white
   surface with the same border, corner and shadow; this one now does too. */
.login-card {
    width: 100%;
    max-width: 440px;
    min-width: 0;
    background: var(--baac-surface);
    border: 1px solid var(--baac-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: clamp(28px, 3.4vw, 44px);
}

.login-card h2 {
    font-size: 30px;
    line-height: 1.35;
    margin: 0;
    color: var(--baac-text);
}

.login-help,
.login-support {
    font-size: 14px;
    line-height: 1.8;
    color: var(--baac-text-soft);
}

.login-help {
    margin: 10px 0 0;
}

.login-form {
    display: grid;
    gap: 20px;
    margin-top: 26px;
}

.login-form .form-field {
    display: grid;
    gap: 8px;
}

.login-form label {
    font-size: 14px;
    font-weight: 600;
    color: var(--baac-text);
}

.login-form input {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--baac-border);
    border-radius: var(--radius-sm);
    background: var(--baac-surface);
    color: var(--baac-text);
    font: inherit;
    font-size: 16px;   /* 16px or iOS zooms the page on focus */
    transition: border-color var(--transition), box-shadow var(--transition);
}

.login-form input:hover {
    border-color: var(--baac-gold);
}

.login-form input:focus {
    border-color: var(--baac-bronze);
    box-shadow: 0 0 0 3px rgba(138, 87, 42, .12);
    outline: none;
}

.login-submit {
    min-height: 48px;
    margin-top: 2px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--baac-bronze-dark);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
}

.login-submit:hover {
    background: var(--baac-sidebar-2);
    box-shadow: var(--shadow-sm);
}

/* Focus must stay visible even where a border colour also changes. */
.login-page :focus-visible {
    outline: 3px solid var(--baac-bronze);
    outline-offset: 3px;
}

/* The two lines of small print: still both here, said once, quietly. */
.login-fineprint {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--baac-border);
}

.login-support {
    margin: 0;
}

.login-notice {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--baac-text-soft);
    line-height: 1.75;
    opacity: .85;
}

.login-error {
    background: #fff0ed;
    color: #8a1c13;
    padding: 14px;
    border-radius: var(--radius-sm);
    border-inline-start: 3px solid var(--danger);
    margin-top: 20px;
    line-height: 1.7;
}

/* ---------- One column on a phone ---------- */

@media (max-width: 860px) {
    .login-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-brand {
        padding: 28px 24px;
        gap: 0;
        border-inline-end: 0;
        border-block-end: 1px solid var(--baac-sidebar-edge);
    }

    /* The sentence and the footer are the company's introduction; on a phone
       the person is here to sign in, and the mark alone says where they are. */
    .login-intro,
    .login-brand-footer {
        display: none;
    }

    .login-identity {
        flex-direction: row;
        justify-content: center;
        gap: 16px;
        text-align: start;
    }

    .login-identity img {
        width: 56px;
    }

    .login-identity strong {
        font-size: 26px;
    }

    .login-identity span {
        margin-top: 4px;
        font-size: 11px;
    }

    html[dir="rtl"] .login-identity span {
        font-size: 12px;
    }

    .login-access {
        padding: 24px 20px 40px;
    }

    /* On a small screen the card's own border costs width it needs for the
       fields, so it becomes the page instead of sitting on it. */
    .login-card {
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 4px 0 0;
    }
}
