/* Design tokens from docs/theme.md. Light is the default ("The Fullerton"); dark follows the
   operating system ("The Active Modern"). There is no theme toggle: these pages are opened
   once, from an email, and a preference nobody comes back to is not worth a control. */
:root {
  color-scheme: light dark;

  --accent: #467193;
  --accent-hover: #3a5f7d;
  --on-accent: #ffffff;

  --background: #faf9f6;
  --surface: #ffffff;
  --text-primary: #2c3338;
  --text-secondary: #6b7280;
  --border: #e5e7eb;

  --danger: #b3261e;
  --success: #2f6b4f;

  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #121418;
    --surface: #1e2228;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border: #374151;

    --accent-hover: #5b88ac;
    --danger: #f2b8b5;
    --success: #7fc9a4;
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 27rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 4%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
  line-height: 1.3;
}

p {
  margin: 0 0 1rem;
  color: var(--text-secondary);
}

p:last-child,
form > *:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
}

/* One <section> per outcome; `hidden` on the rest. Panels are swapped by state.js, which also
   moves focus to the heading so a screen reader announces the new state. */
[hidden] {
  display: none !important;
}

/* showPanel focuses the panel heading so a screen reader announces the outcome. Nobody tabbed
   there, so the ring would just be noise on a non-interactive element. */
h1[tabindex="-1"]:focus {
  outline: none;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status.is-error { color: var(--danger); }
.status.is-success { color: var(--success); }

.spinner {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.field { margin-bottom: 1rem; }

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--text-primary);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

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

.field-error {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--danger);
}

button {
  width: 100%;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  /* Pure white on the accent in both themes — docs/theme.md, implementation guideline 1. */
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

button:hover:not(:disabled) { background: var(--accent-hover); }

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

.alert {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: 6px;
  color: var(--text-primary);
  background: var(--background);
}

.alert.is-success { border-left-color: var(--success); }

footer {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-align: center;
}
