/* Sign-in pages (login, forgot password): office-photo panel with moving
   particles on the left, the form on the right. Colours are the app's own
   light/dark palette (the --ex-* tokens in new-Exchange.css).
   Plain HTML pages; no Tailwind, no shared header CSS. */

:root {
    /* Panel (same in both themes) */
    --au-panel: #111827;
    --au-on-panel: #f9fafb;

    /* App light palette */
    --au-paper: #f3f4f6;
    --au-surface: #ffffff;
    --au-ink: #111827;
    --au-ink-2: #374151;
    --au-muted: #4b5563;
    --au-rule: #e5e7eb;
    --au-rule-strong: #d1d5db;
    --au-accent: #2563eb;
    --au-accent-strong: #1d4ed8;
    --au-accent-wash: #eff6ff;
    --au-focus: rgba(37, 99, 235, 0.28);
    --au-error: #b91c1c;
    --au-error-wash: #fef2f2;
    --au-ok: #047857;
    --au-ok-wash: #ecfdf5;

    --au-radius-field: 10px;
    --au-radius-button: 10px;
    color-scheme: light;
}

/* App dark palette */
:root[data-theme="dark"] {
    --au-paper: #111827;
    --au-surface: #1f2937;
    --au-ink: #f9fafb;
    --au-ink-2: #d1d5db;
    --au-muted: #9ca3af;
    --au-rule: #374151;
    --au-rule-strong: #4b5563;
    --au-accent: #60a5fa;
    --au-accent-strong: #3b82f6;
    --au-accent-wash: rgba(59, 130, 246, 0.18);
    --au-focus: rgba(96, 165, 250, 0.35);
    --au-error: #f87171;
    --au-error-wash: rgba(248, 113, 113, 0.14);
    --au-ok: #34d399;
    --au-ok-wash: rgba(52, 211, 153, 0.12);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--au-paper);
    color: var(--au-ink);
    font-family: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Layout ---------- */

.au-shell {
    min-height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
}

.au-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px clamp(24px, 6vw, 96px);
}

.au-panel {
    width: 100%;
    max-width: 380px;
}

/* ---------- Photo panel ---------- */

.au-orbit {
    position: relative;
    overflow: hidden;
    color: var(--au-on-panel);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 48px;
    isolation: isolate;
    /* Darker at the top (logo) and bottom (headline), with a blue wash */
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.9) 0%, rgba(17, 24, 39, 0.55) 22%, rgba(17, 24, 39, 0.5) 50%, rgba(17, 24, 39, 0.94) 100%),
        linear-gradient(rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.16)),
        url('/images/auth/office.jpg') center / cover no-repeat;
    /* No var() in this one, so a browser without image-set() drops it at parse time
       and keeps the JPEG line above */
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.9) 0%, rgba(17, 24, 39, 0.55) 22%, rgba(17, 24, 39, 0.5) 50%, rgba(17, 24, 39, 0.94) 100%),
        linear-gradient(rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.16)),
        image-set(url('/images/auth/office.webp') type('image/webp'), url('/images/auth/office.jpg') type('image/jpeg')) center / cover no-repeat;
    background-color: var(--au-panel);
}

.au-brand {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    align-self: flex-start;
    color: var(--au-on-panel);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.375rem;
    letter-spacing: -0.025em;
}
.au-brand svg { flex: none; }
.au-brand:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 6px;
    border-radius: 8px;
}

.au-statement {
    position: relative;
    z-index: 2;
    max-width: 22ch;
    margin: 0;
    font-size: clamp(1.75rem, 2.6vw, 2.5rem);
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--au-on-panel);
    text-wrap: balance;
}

/* ---------- Form side ---------- */

.au-title {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.au-lede {
    margin: 10px 0 0;
    color: var(--au-muted);
    font-size: 0.9375rem;
    max-width: 38ch;
}

.au-form {
    margin-top: 32px;
    display: grid;
    gap: 20px;
}

.au-field label,
.au-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--au-ink-2);
}

.input-group { position: relative; }

.au-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--au-rule-strong);
    border-radius: var(--au-radius-field);
    background: var(--au-surface);
    color: var(--au-ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.au-input::placeholder { color: var(--au-muted); opacity: 0.75; }
.au-input:hover { border-color: var(--au-muted); }
.au-input:focus {
    outline: none;
    border-color: var(--au-accent);
    box-shadow: 0 0 0 4px var(--au-focus);
}
.au-input[aria-invalid="true"] { border-color: var(--au-error); }
.au-input--with-toggle { padding-right: 52px; }

.au-input--code {
    height: 60px;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: 0.4em;
    padding-left: calc(14px + 0.4em);
    font-variant-numeric: tabular-nums;
}

.toggle-password {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--au-muted);
    cursor: pointer;
}
.toggle-password:hover { color: var(--au-ink); background: var(--au-accent-wash); }
.toggle-password:focus-visible {
    outline: 2px solid var(--au-accent);
    outline-offset: 0;
}
.toggle-password .au-eye-off { display: none; }
.toggle-password[aria-pressed="true"] .au-eye-on { display: none; }
.toggle-password[aria-pressed="true"] .au-eye-off { display: block; }

.error-message {
    font-size: 0.875rem;
    color: var(--au-error);
}
.error-message:not(:empty) { margin-top: 6px; }

.au-hint {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    color: var(--au-muted);
}

.au-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.au-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9375rem;
    color: var(--au-ink-2);
    cursor: pointer;
    user-select: none;
}
.au-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--au-accent);
    cursor: pointer;
}

.au-link {
    color: var(--au-accent);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s ease;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
}
.au-link:hover { text-decoration-color: currentColor; }
.au-link:focus-visible {
    outline: 2px solid var(--au-accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Primary button: blue with white text in both themes, like the app */
.au-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: var(--au-radius-button);
    background: #2563eb;
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
.au-button:hover { background: #1d4ed8; }
.au-button:active { transform: scale(0.99); }
.au-button:focus-visible {
    outline: 3px solid var(--au-focus);
    outline-offset: 2px;
}
.au-button:disabled { cursor: wait; }
a.au-button { text-decoration: none; }

.au-button--quiet {
    background: transparent;
    color: var(--au-ink);
    border: 1px solid var(--au-rule-strong);
}
.au-button--quiet:hover { background: var(--au-accent-wash); }

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: au-spin 0.8s linear infinite;
}
@keyframes au-spin { to { transform: rotate(360deg); } }

.au-foot {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--au-rule);
    font-size: 0.875rem;
    color: var(--au-muted);
}

/* Windows SSO welcome */
.au-sso {
    margin-top: 32px;
    display: grid;
    gap: 16px;
}
.au-sso-who {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--au-rule);
    border-radius: 12px;
    background: var(--au-surface);
}
.au-sso-initial {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--au-accent-wash);
    color: var(--au-accent);
    font-weight: 800;
    font-size: 1.125rem;
}
.au-sso-who p { margin: 0; }
.au-sso-who .au-sso-label { font-size: 0.8125rem; color: var(--au-muted); }
.au-sso-who .au-sso-name { font-weight: 700; font-size: 1.0625rem; }
.au-center { text-align: center; }

/* Notice (forgot-password result) */
.au-notice {
    margin-top: 32px;
    padding: 20px;
    border-radius: 12px;
    background: var(--au-ok-wash);
    border: 1px solid color-mix(in srgb, var(--au-ok) 30%, transparent);
}
.au-notice-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--au-ok);
}
.au-notice p { margin: 8px 0 0; font-size: 0.9375rem; }
.au-notice .au-notice-help { color: var(--au-muted); font-size: 0.875rem; }
#successMessage:focus { outline: none; }

/* Sign-in exit: the page fills out from the button, then redirects */
#signinWarp {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--au-panel);
    clip-path: circle(0 at var(--wx, 50%) var(--wy, 50%));
    pointer-events: none;
    transition: clip-path 0.55s cubic-bezier(0.65, 0, 0.35, 1);
}
body.signin-out #signinWarp {
    clip-path: circle(150vmax at var(--wx, 50%) var(--wy, 50%));
}

/* ---------- Small screens: the photo becomes a header band ---------- */

@media (max-width: 960px) {
    .au-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .au-orbit {
        min-height: 180px;
        padding: 24px 20px;
        background-position: center 35%;
    }
    .au-statement { display: none; }
    .au-main {
        justify-content: flex-start;
        padding: 36px 20px 48px;
    }
    .au-panel { margin: 0 auto; }
}

@media (max-width: 420px) {
    .au-orbit { min-height: 140px; }
    .au-title { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
    .loader { animation-duration: 2s; }
    #signinWarp { transition: none; }
}
