/*
 * authd's login chrome.
 *
 * The role variables below are copied from scriptaforge-ui's design tokens
 * (src/assets/tailwind.css for light, src/assets/themes.css for dark) so the
 * sign-in page and the webmail it hands off to look like one product. The
 * values are duplicated rather than imported because that stylesheet is a
 * Tailwind build artifact and authd serves three static pages — pulling in a
 * build toolchain to render a login form would cost more than keeping these
 * few dozen lines in sync.
 *
 * If the webmail's palette changes, change it here too.
 */

:root {
    --canvas: #f9fafb;
    --surface: #ffffff;
    --surface-2: #f3f4f6;

    --ink: #1f2937;
    --ink-muted: #6b7280;
    --ink-faint: #9ca3af;
    --ink-inverse: #ffffff;

    --line: #e5e7eb;

    --accent: #2563eb;
    --accent-strong: #1d4ed8;

    --danger: #dc2626;
    --danger-surface: #fef2f2;

    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* The webmail lets the user pick a theme and remembers it. authd is a single
   page seen for a few seconds with nowhere to persist a preference, so it
   follows the operating system instead. */
@media (prefers-color-scheme: dark) {
    :root {
        --canvas: #131314;
        --surface: #1e1f20;
        --surface-2: #2d2e30;

        --ink: #e3e3e3;
        --ink-muted: #9aa0a6;
        --ink-faint: #80868b;

        --line: #3c4043;

        /* Accents lighten rather than darken: the same blue that reads as
           emphasis on white turns muddy on near-black. */
        --accent: #8ab4f8;
        --accent-strong: #a8c7fa;
        --ink-inverse: #1f2937;

        --danger: #f28b82;
        --danger-surface: #3d2220;

        --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    }

    /* Scrollbars, form controls and other native furniture stay light
       otherwise, which gives the theme away immediately. */
    :root {
        color-scheme: dark;
    }
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;

    background: var(--canvas);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.card {
    width: 100%;
    max-width: 24rem;
    padding: 2rem 2.5rem;

    background: var(--surface);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.card--wide {
    max-width: 28rem;
    text-align: center;
}

/* ── Brand ──────────────────────────────────────────────────────────────── */

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.brand svg {
    color: var(--accent);
}

.brand-name {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.subtitle {
    margin: 0 0 1.5rem;
    text-align: center;
    color: var(--ink-muted);
}

/* ── Form ───────────────────────────────────────────────────────────────── */

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.field input {
    width: 100%;
    padding: 0.5rem 0.75rem;

    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 0.125rem;
    font: inherit;
    font-size: 0.875rem;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
}

.field input::placeholder {
    color: var(--ink-faint);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;

    background: var(--accent);
    color: var(--ink-inverse);
    border: 0;
    border-radius: 0.125rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--accent-strong);
}

.btn svg {
    width: 1rem;
    height: 1rem;
}

.btn--inline {
    width: auto;
}

/* ── Notices ────────────────────────────────────────────────────────────── */

.error {
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;

    background: var(--danger-surface);
    color: var(--danger);
    border-radius: 0.125rem;
    font-size: 0.75rem;
    text-align: center;
}

.notice-icon {
    display: block;
    margin: 0 auto 1.5rem;
    color: var(--ink-faint);
}

.notice-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--ink);
}

.notice-text {
    margin: 0;
    color: var(--ink-muted);
}

.notice-text code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 0.8125rem;
    color: var(--ink);
    word-break: break-all;
}
