﻿/* =============================================================
   Login screen
   -------------------------------------------------------------
   The split-screen sign-in page: the navy brand panel and the
   white form panel beside it.

   Pushed onto the `styles` stack by
   resources/views/auth/login.blade.php, so no signed-in page
   loads it - and the login page never loads the app shell.
   ============================================================= */

/* -------------------------------------------------------------
   Two panels side by side: a navy brand panel and a white sign-in
   panel. Below 900px the brand panel is removed entirely so the
   form is the first thing a phone user sees.
   ------------------------------------------------------------- */

.login {
    display: grid;
    /* Brand panel slightly wider than the form panel. */
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
}

/* --- Brand panel --- */

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-8) var(--space-7);
    overflow: hidden;
    background-color: var(--color-brand-navy);
    background-image: linear-gradient(
        152deg,
        var(--color-navy-deep) 0%,
        var(--color-brand-navy) 48%,
        var(--color-blue-dark) 100%
    );
    color: #ffffff;
}

/*
 * Blueprint grid. A pair of repeating gradients is far lighter than
 * a background image and scales to any panel size. Sitting in a
 * pseudo-element keeps it behind the text without affecting layout.
 */
.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            to right,
            rgba(255, 255, 255, 0.06) 0 1px,
            transparent 1px 64px
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.06) 0 1px,
            transparent 1px 64px
        );
}

/* Soft glow in the brand blue, lifting the flat gradient. */
.login-brand::after {
    content: "";
    position: absolute;
    right: -14%;
    bottom: -22%;
    width: 62%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(9, 118, 188, 0.55), transparent 68%);
}

/* Raise the real content above both decorative layers. */
.login-brand-content,
.login-brand-footer {
    position: relative;
    z-index: 1;
}

.login-brand-content {
    max-width: 460px;
    /* Optically centres the block in the tall panel. */
    margin-top: auto;
    margin-bottom: auto;
}

/* Small label above the headline, with a short rule after it. */
.login-eyebrow {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    color: var(--color-blue-light);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-eyebrow::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: rgba(157, 200, 228, 0.4);
}

.login-headline {
    margin-bottom: var(--space-4);
    font-size: clamp(28px, 3.2vw, 40px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.login-standfirst {
    margin-bottom: var(--space-6);
    max-width: 42ch;
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
}

.login-highlights {
    display: grid;
    gap: var(--space-3);
}

.login-highlights li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
}

/* Small square marker, rotated into a diamond: a quiet nod to
   industrial drawing symbols without needing an icon font. */
.login-highlights li::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    background-color: var(--color-blue-light);
    transform: rotate(45deg);
}

.login-brand-footer {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

/* --- Sign-in panel --- */

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-7) var(--space-5);
    background-color: var(--color-surface);
}

.login-panel-inner {
    width: 100%;
    max-width: var(--login-form-width);
}

/*
 * Centred over the form rather than ranged left with it.
 *
 * The logo is the mark on the panel, not the first line of the form.
 * Sitting hard left above "Sign in" it read as a heading the fields
 * hung off; centred it reads as what the panel belongs to, and the
 * form below starts cleanly at its own left edge.
 *
 * A block with auto margins rather than text-align, because the
 * component renders an <img> whose width is its own.
 */
.login-logo {
    display: block;
    margin: 0 auto var(--space-6);
}

.login-title {
    margin-bottom: var(--space-1);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.login-subtitle {
    margin-bottom: var(--space-6);
    color: var(--color-text-muted);
    font-size: 14px;
}

.login-help {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
}

/*
 * Narrow screens: drop the brand panel and let the form fill the
 * viewport. `display: none` rather than a width change so the
 * decorative panel costs nothing to render on a phone.
 */
@media (max-width: 900px) {
    .login {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }

    .login-panel {
        /* A tinted page behind the white form reads better than an
           edge-to-edge white slab on a small screen. */
        padding: var(--space-6) var(--space-5);
    }
}



/* -------------------------------------------------------------
   The offer to install this as an app.

   A panel at the foot of the screen rather than a modal over the
   form. It is an offer, not a question that has to be answered
   before signing in, and anything covering a login box is
   something people learn to close without reading.

   Hidden until the script finds something real to offer - see
   public/js/install-app.js. It carries the `hidden` attribute in
   the markup, so it never flashes up and disappears on a browser
   that cannot install anything.
   ------------------------------------------------------------- */

.install-panel {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    z-index: 20;

    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 520px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-4);

    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;

    /* Lifted off the page, because it arrives after the page has
       been looked at and has to read as something new. */
    box-shadow: 0 10px 30px rgb(16 24 40 / 18%);
}

/* The `hidden` attribute is what the script toggles, and a
   display rule elsewhere would beat it. */
.install-panel[hidden] {
    display: none;
}

.install-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
}

.install-words {
    flex: 1;
    min-width: 0;
}

.install-title {
    margin: 0;
    font-weight: 600;
}

.install-note {
    margin: 2px 0 0;
    color: var(--color-text-muted);
    font-size: 12.5px;
}

.install-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-2);
}

/*
 * On a phone the panel stacks: the words above, the two buttons
 * across the foot of it. Side by side they leave the note two
 * words wide.
 */
@media (max-width: 560px) {
    .install-panel {
        flex-wrap: wrap;
    }

    .install-actions {
        flex: 1 0 100%;
    }

    .install-actions .button {
        flex: 1;
        justify-content: center;
    }
}
