/*
 * Filename: gateway/static/style.css
 * Author: Orthantic gateway split
 * Date: 2026-09-15
 * Description:
 *     Styling for the gateway's few server-rendered pages: login, change
 *     password, and the two error pages.
 *
 *     Everything else -- the picker and the admin screens -- is the React app.
 *     This file stays small on purpose: the pages a user sees BEFORE the app
 *     loads, and the pages they see when it cannot load, need no JavaScript
 *     bundle at all. A login form should not cost several megabytes.
 *
 *     REWRITTEN 2026-09-26 against the app's Ocean & Sun theme (user
 *     direction: moving between the gateway and the app must not look like
 *     changing products). The tokens below are COPIED from web/src/design/
 *     tokens.css's :root, named the same so the two can be diffed by eye;
 *     the masthead is the app's masthead to the pixel (48px, the same two
 *     gradients, the same lockup), and the type is the app's (Geist for
 *     text, Sora for the wordmark and headings). If the app's palette
 *     changes, this block has to change with it.
 *
 *     No dark-mode block: the app ships light only, so a dark login page
 *     would hand the user a flash of light on their first navigation in.
 */

:root {
  /* --- copied from web/src/design/tokens.css :root (Ocean & Sun) --- */
  --c-canvas: #ffffff;
  --c-surface: #ffffff;
  --c-surface-alt: #f8fafc;
  --c-hover: #f1f5f9;
  --c-text: #0f172a;
  --c-text-secondary: #475569;
  --c-text-muted: #5b6b80;
  --c-border: #e2e8f0;
  --c-border-strong: #cbd5e1;
  --c-accent: #0279bb;
  --c-accent-hover: #075985;
  --c-accent-soft: #e0f2fe;
  --c-ink: #0c3b5e;

  --c-topbar-top: #0d4468;
  --c-topbar-bottom: #0c3b5e;
  --c-topbar-border: #082c47;
  --c-topbar-title: #ffffff;
  --c-topbar-text: #d6e8f5;
  --c-topbar-muted: #bcd5e8;
  --c-topbar-hover: #15608f;
  --c-topbar-ring: #fbbf24;
  --c-topbar-sheen: linear-gradient(90deg, rgba(14, 90, 138, 0) 0%, rgba(14, 90, 138, 0.85) 100%);

  --c-brand-1: #fbbf24;
  --c-brand-1-text: #0c3b5e;

  --c-success: #137a39;
  --c-success-bg: #f0fdf4;
  --c-success-border: #bbf7d0;
  --c-danger: #be123c;
  --c-danger-bg: #fff1f2;
  --c-danger-border: #fecdd3;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px -8px rgba(15, 23, 42, 0.10);
  --radius: 6px;
  --radius-card: 10px;
  --topbar-h: 48px;

  --font-ui: 'Geist', 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Sora', 'Geist', -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-surface-alt);
  color: var(--c-text);
  font: 13px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

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

/* --- The masthead: the app's, verbatim ------------------------------------ */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 16px 0 14px;
  background: var(--c-topbar-sheen), linear-gradient(180deg, var(--c-topbar-top) 0%, var(--c-topbar-bottom) 100%);
  border-bottom: 1px solid var(--c-topbar-border);
  color: var(--c-topbar-text);
}

.lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: var(--radius);
  color: var(--c-topbar-title);
  text-decoration: none;
}

.lockup svg {
  display: block;
  flex: none;
}

.wordmark {
  font-family: var(--font-brand);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.topbar .account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--c-brand-1);
  color: var(--c-brand-1-text);
  font-size: 11px;
  font-weight: 600;
}

.who {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.who .name {
  color: var(--c-topbar-title);
  font-weight: 500;
}

.who .role {
  color: var(--c-topbar-muted);
  font-size: 11px;
}

.topbar .link-button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--c-topbar-text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.topbar .link-button:hover {
  background: var(--c-topbar-hover);
  color: var(--c-topbar-title);
}

.topbar :focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-topbar-ring) 45%, transparent);
}

/* --- Page body ------------------------------------------------------------ */

main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Login and change-password: a narrow column near the optical centre. */
main.narrow {
  max-width: 400px;
  padding-top: 12vh;
}

h1 {
  margin: 0 0 4px;
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.subtitle {
  margin: 0 0 18px;
  color: var(--c-text-secondary);
  font-size: 13px;
}

/* --- Cards and forms: ui/Card + ui/Field ------------------------------------ */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 20px;
}

.card p:first-child {
  margin-top: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--c-text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  margin-bottom: 16px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

button {
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--c-accent);
  border-radius: var(--radius);
  background: var(--c-accent);
  color: #ffffff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

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

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

button.full {
  width: 100%;
  margin-top: 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Messages: ui/InlineNotice --------------------------------------------- */

.message {
  margin-bottom: 16px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
}

.message.error {
  background: var(--c-danger-bg);
  border-color: var(--c-danger-border);
  color: var(--c-danger);
}

.message.ok {
  background: var(--c-success-bg);
  border-color: var(--c-success-border);
  color: var(--c-success);
}

/* --- Narrow screens -------------------------------------------------------- */

@media (max-width: 480px) {
  main.narrow {
    padding-top: 8vh;
  }

  .who {
    display: none;
  }
}
