/* =========================================================================
   The Best Estimator Portal — sign-in page
   Loaded after style.css (it reuses that file's colour tokens, light/dark
   theme and fonts). Every class here starts with "lg-" so nothing else in the
   portal is affected. The old .login-* rules in style.css are no longer used.
   ========================================================================= */

.lg-body { margin: 0; }

.lg {
    --lg-line: #c5d0dc;
    --lg-title: var(--navy-900);
    --lg-link: var(--navy-800);
    display: grid;
    grid-template-columns: minmax(420px, 36%) 1fr;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--surface);
    color: var(--text);
}
html[data-theme="dark"] .lg {
    --lg-line: #2c4560;
    --lg-title: var(--text);
    --lg-link: #9dc4e6;
}

/* ---- form column ------------------------------------------------------ */
.lg-formcol {
    display: flex;
    flex-direction: column;
    padding: clamp(28px, 4vw, 56px) clamp(28px, 4.5vw, 64px);
    min-width: 0;
}
.lg-logo {
    display: block;
    height: 80px;
    width: auto;
    align-self: flex-start;
}
html[data-theme="dark"] .lg-logo {
    /* the mark is dark-on-transparent; give it a white plate on dark surfaces */
    background: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    box-sizing: content-box;
}
.lg-formwrap {
    width: 100%;
    max-width: 380px;
    margin: auto;
    padding: 40px 0;
}

.lg-title {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.5rem, 3.6vw, 3.25rem);
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--lg-title);
}
.lg-sub {
    margin: 0 0 32px;
    font-size: 1rem;
    color: var(--text-muted);
}

.lg .flashes { margin: 0 0 24px; }
.lg .flashes li { line-height: 1.4; }

.lg-field { margin: 0 0 20px; }
.lg .lg-field label {
    display: block;
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
}
.lg .lg-field input {
    display: block;
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 14px;
    font-size: 1rem;              /* 16px stops iOS zooming the page on focus */
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--lg-line);
    border-radius: 8px;
}
.lg .lg-field input::placeholder { color: var(--text-muted); opacity: 0.65; }
.lg .lg-field input:focus {
    background: var(--surface);
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.24);
}

.lg-pw { position: relative; }
.lg .lg-pw input { padding-right: 76px; }
.lg .lg-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    height: 38px;
    padding: 0 12px;
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--lg-link);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.lg .lg-toggle:hover { filter: none; text-decoration: underline; }
.lg .lg-toggle:active { transform: translateY(-50%); }
.lg .lg-toggle:focus-visible { outline: 2px solid var(--lg-link); outline-offset: -2px; }

.lg .lg-submit {
    width: 100%;
    height: 52px;
    margin-top: 8px;
    padding: 0 20px;
    background: var(--gold);
    color: var(--navy-900);
    border: 0;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
}
.lg .lg-submit:hover { filter: brightness(1.07); }
.lg .lg-submit:focus-visible { outline: 3px solid var(--lg-link); outline-offset: 3px; }
.lg .lg-submit:disabled { cursor: progress; filter: none; opacity: 0.75; }

.lg-foot {
    margin: 22px 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ---- visual column ---------------------------------------------------- */
.lg-visual {
    position: relative;
    overflow: hidden;
    min-height: 100%;
    background: #0b2339;        /* same as the drawing's field, so there is no flash before it paints */
}
.lg-visual canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.8s ease;
    touch-action: pan-y;        /* vertical scroll still works; horizontal drags reach the effect */
}
.lg-visual.is-ready canvas { opacity: 1; }
.lg-visual::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 42%;
    background: linear-gradient(to top, rgba(5, 16, 30, 0.82), rgba(5, 16, 30, 0));
    pointer-events: none;
}
.lg-caption {
    position: absolute;
    z-index: 2;
    left: clamp(28px, 4vw, 56px);
    bottom: clamp(28px, 5vh, 56px);
    max-width: min(520px, 80%);
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.9rem, 2.8vw, 2.7rem);
    line-height: 1.08;
    letter-spacing: 0.005em;
    color: #fff;
    pointer-events: none;
}

/* ---- tablet and phone: drawing becomes a banner above the form -------- */
@media (max-width: 900px) {
    .lg { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .lg-visual { order: -1; min-height: 0; height: clamp(180px, 28vh, 260px); }
    .lg-visual::after { display: none; }
    .lg-caption { display: none; }
    .lg-formcol { padding: 28px 24px 36px; }
    .lg-logo { height: 64px; }
    .lg-formwrap { max-width: 440px; margin: 0; padding: 28px 0 8px; }
    .lg-title { font-size: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .lg-visual canvas { transition: none; }
}
