/*
 * Standalone stylesheet for the interactive identity pages. These are Razor Pages served by the
 * auth server, so none of the SPA's Nuxt UI machinery is available here — the token values below
 * are copied from src/Client/app/assets/css/tailwind.css so the sign-in screens read as the same
 * product. Keep them in step with that file.
 *
 * The SPA toggles a .dark class; this service has no theme switch, so it follows the OS instead.
 */

:root {
    color-scheme: light dark;

    --bg: oklch(1 0 0);
    --surface: oklch(0.985 0 0);
    --border: oklch(0.922 0 0);
    --text: oklch(0.145 0 0);
    --muted: oklch(0.556 0 0);
    --error: oklch(0.577 0.245 27.325);

    /* Inverting monochrome primary — neutral-900 on light, neutral-50 on dark. Not a brand color;
       the brand green is --percept, reserved for the accent mark. */
    --accent: oklch(0.205 0 0);
    --accent-hover: oklch(0.145 0 0);
    --accent-text: oklch(0.985 0 0);

    --percept: oklch(67.503% 0.18021 137.649);
    --radius: 0.4rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: oklch(0.145 0 0);
        --surface: oklch(0.205 0 0);
        --border: oklch(0.269 0 0);
        --text: oklch(0.985 0 0);
        --muted: oklch(0.708 0 0);
        --error: oklch(0.637 0.237 25.331);

        --accent: oklch(0.985 0 0);
        --accent-hover: oklch(0.922 0 0);
        --accent-text: oklch(0.205 0 0);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 0.9375rem/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.card {
    width: 100%;
    max-width: 23rem;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

/* Brand mark: the same short percept-green accent bar the SPA's widget cards set before a title. */
h1 {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1::before {
    content: "";
    width: 0.1875rem;
    height: 1.125rem;
    background: var(--percept);
    border-radius: 999px;
}

.lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.muted {
    color: var(--muted);
    font-size: 0.8125rem;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    word-break: break-all;
}

/* The address confirmed at the email step, with the way back to change it. */
.identity {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    word-break: break-all;
}

.field {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.375rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    color: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}

input::placeholder {
    color: var(--muted);
}

a {
    color: inherit;
    text-decoration-color: var(--muted);
    text-underline-offset: 0.2em;
}

a:hover {
    text-decoration-color: currentColor;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button,
.button {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--accent);
    color: var(--accent-text);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font: inherit;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

button:hover,
.button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

button:active,
.button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Secondary action — federated sign-in sits beside the password form, not above it. */
button.secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

button.secondary:hover {
    background: var(--bg);
    border-color: var(--muted);
}

.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.5rem;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Alpine hides these until it initialises. Only ever applied to elements that must start hidden —
   never to one the form needs when script is unavailable, which would hide it permanently. */
[x-cloak] {
    display: none !important;
}

/* Enrolment QR. White plate regardless of theme — inverting a QR stops scanners reading it. */
.qr {
    display: block;
    width: 12.5rem;
    height: 12.5rem;
    margin: 0 auto 1rem;
    padding: 0.5rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem 1rem;
    margin: 0 0 1rem;
    padding: 0.875rem;
    list-style: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.error,
.field-error {
    color: var(--error);
    font-size: 0.8125rem;
}

.error {
    margin: 0 0 1rem;
    padding: 0.625rem 0.75rem;
    background: color-mix(in oklab, var(--error) 10%, transparent);
    border: 1px solid color-mix(in oklab, var(--error) 35%, transparent);
    border-radius: var(--radius);
}

@media (prefers-reduced-motion: reduce) {
    button,
    .button {
        transition: none;
    }

    button:active,
    .button:active {
        transform: none;
    }
}
