/*
 * Static login page — not bundled by Vite, so it cannot `@import` web/src/ui/theme.css across the
 * public/src boundary. Approach: hand-copy the ~15 CSS custom properties this page actually uses
 * from theme.css's :root block (kept in sync manually when the design tokens change), then write
 * this page's own CSS using those tokens, mirroring the kit's auth-layout/brand classes
 * (references/layouts.md "Sign-in") rather than importing them.
 */

:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #f1f5f9;
  --bg-deep-a: #e2e8f0;
  --bg-deep-b: #f8fafc;
  --bg-deep-c: #eef2f7;
  --bg-deep-d: #dbe4f0;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #617188;
  --danger: #e11d48;
  --danger-strong: #be123c;
  --danger-soft: #fff1f2;
  --danger-border: #fecdd3;
  --radius: 0.5rem;
  --font: 'Be Vietnam Pro', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --dur: 180ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

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

/* ── Atmosphere (same recipe as theme.css's .app-root/.app-atmosphere) ────── */

.app-root {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
}

.app-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      900px 520px at 8% -10%,
      color-mix(in srgb, var(--accent) 9%, transparent),
      transparent 55%
    ),
    radial-gradient(
      700px 480px at 92% 8%,
      color-mix(in srgb, var(--muted) 14%, transparent),
      transparent 50%
    ),
    linear-gradient(160deg, var(--bg-deep-a), var(--bg-deep-b) 48%, var(--bg-deep-c));
}

.app-content {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

/* ── Auth: split screen, brand plane left, form right ─────────────────────── */

.auth-layout {
  display: grid;
  min-height: 100dvh;
}

.brand-plane {
  position: relative;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 3rem;
  background:
    radial-gradient(
      700px 500px at 20% 20%,
      color-mix(in srgb, var(--accent) 18%, transparent),
      transparent 55%
    ),
    radial-gradient(
      500px 400px at 80% 70%,
      color-mix(in srgb, var(--muted) 20%, transparent),
      transparent 50%
    ),
    linear-gradient(145deg, var(--bg-deep-d), var(--bg-deep-c) 40%, var(--bg-deep-a));
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.auth-form {
  width: 100%;
  max-width: 24rem;
}

.auth-brand {
  margin-bottom: 2rem;
}

.auth-brand .brand-mark {
  margin-bottom: 1rem;
}

.auth-brand .brand-hero {
  font-size: 1.875rem;
  line-height: 2.25rem;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.75rem;
  letter-spacing: -0.025em;
  color: var(--text);
}

.auth-lede {
  margin: 0.25rem 0 1.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--muted);
}

.brand-plane .brand-mark {
  margin-bottom: 2rem;
}

.brand-lede {
  margin-top: 1rem;
  max-width: 24rem;
  line-height: 1.625;
  color: var(--text-secondary);
}

.copy {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--text-secondary);
}

@media (min-width: 1024px) {
  .auth-layout {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .brand-plane {
    display: flex;
  }

  .auth-brand {
    display: none;
  }
}

/* ── Brand mark + hero text ─────────────────────────────────────────────── */

.brand-mark {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
}

.brand-mark-md {
  width: 3rem;
  height: 3rem;
}

.brand-mark-lg {
  width: 3.5rem;
  height: 3.5rem;
}

.brand-hero {
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--text);
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  outline: none;
  transition:
    border-color var(--dur) ease-out,
    box-shadow var(--dur) ease-out;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
}

.field-error {
  margin: 0.375rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: var(--danger-strong);
}

.field-error:empty {
  display: none;
}

.alert[hidden] {
  display: none;
}

.alert {
  display: flex;
  align-items: flex-start;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.alert-error {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.btn-primary {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  cursor: pointer;
  transition: background-color var(--dur) ease-out;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: progress;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
