/* Sign-in and setup (/next/login, /next/setup): the public pages' only stylesheet.
   The sign-in bundle carries no CSS and no Tailwind (vite.config.ts), so this file holds the
   Arrano tokens itself (docs/design/arrano-look/tokens.json; keep the two in step) and every
   rule below reads them, the same values the dashboard's Tailwind classes read.
   The layout is the sign-in page approved in the login-page design thread (12 Nov 2026) in its
   Graphite version (owner's pick, 29 Nov 2026): the dashboard's top bar (wordmark, theme), the mark
   beside one card, a foot line. Cards, type, controls and focus as on the dashboard.
   Dark by default; light for an explicit choice (data-theme, theme.js) or, on Auto, the system.
   Nothing moves here but the mark (login-mark.js), which holds still for reduced motion, and
   hover colours, which ease over 150ms as on the dashboard. */
@font-face { font-family: "Red Hat Text"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/red-hat-text-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Red Hat Text"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/red-hat-text-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Red Hat Display"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/red-hat-display-latin-500-normal.woff2") format("woff2"); }

:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-7: 28px; --space-12: 48px;
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px;
  --tap-target: 44px;
  --font-sans: "Red Hat Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Red Hat Display", "Red Hat Text", system-ui, sans-serif;
  /* Dark */
  --brand: #93b6da; --bg: #131518; --side: #0f1113; --panel: #1c1f24; --raised: #24282e;
  --line: #2a2f36; --heading: #eceef1; --text: #e0e3e7; --muted: #a2a9b2; --faint: #8d949d;
  --accent-soft: #1f2b38; --on-brand: #0f1822; --negative: #ec968b;
  --link: var(--brand); --card-border: transparent;
  --field: var(--bg);
  --topbar-height: 52px;
  --shadow-tint: #000000;
  --shadow-card: 0 1px 2px color-mix(in srgb, var(--shadow-tint) 25%, transparent);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --brand: #2d5d8a; --bg: #efebe2; --side: #efebe2; --panel: #fbf6ed; --raised: #f5f1e8;
    --line: #dad6cd; --heading: #1f1e1c; --text: #3b3a38; --muted: #535250; --faint: #5f5c57;
    --accent-soft: #e1e9f2; --on-brand: #ffffff; --negative: #a8392f;
    --card-border: var(--line); --field: var(--panel);
    --shadow-tint: #10161e;
    --shadow-card: 0 1px 3px color-mix(in srgb, var(--shadow-tint) 7%, transparent);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --brand: #2d5d8a; --bg: #efebe2; --side: #efebe2; --panel: #fbf6ed; --raised: #f5f1e8;
  --line: #dad6cd; --heading: #1f1e1c; --text: #3b3a38; --muted: #535250; --faint: #5f5c57;
  --accent-soft: #e1e9f2; --on-brand: #ffffff; --negative: #a8392f;
  --card-border: var(--line); --field: var(--panel);
  --shadow-tint: #10161e;
  --shadow-card: 0 1px 3px color-mix(in srgb, var(--shadow-tint) 7%, transparent);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; min-height: 100%; background: var(--bg); }
body {
  margin: 0; min-width: 0; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  color: var(--text); background: var(--bg);
  font: 400 14px/1.4 var(--font-sans);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent-soft); color: var(--heading); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Sign in: the dashboard's top bar, the mark beside the card (stacked on phones), a foot line. */
.topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: calc(var(--topbar-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--space-6), env(safe-area-inset-right)) 0 max(var(--space-6), env(safe-area-inset-left));
  background: var(--side); border-bottom: 1px solid var(--line);
}
/* The wordmark as in the dashboard's top bar (tokens.json "wordmark"). */
.brand { margin: 0; color: var(--heading); font: 500 15px/1.4 var(--font-display); letter-spacing: .16em; text-transform: uppercase; }
.stage {
  flex: 1 0 auto; width: min(1120px, calc(100% - var(--space-12))); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 680px) minmax(0, 368px);
  align-items: center; justify-content: center; gap: calc(var(--space-12) + var(--space-4));
  padding: var(--space-6) 0;
}
/* The mark's box: as tall as the window allows, so the card sits on the mark's centre line. */
.art { position: relative; width: 100%; height: clamp(280px, calc(100vh - 160px), 640px); height: clamp(280px, calc(100svh - 160px), 640px); }
.art canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* The card: as a dashboard card, with room for one form. */
.panel {
  width: 100%; min-width: 0; padding: var(--space-7);
  border: 1px solid var(--card-border); border-radius: var(--radius-lg);
  background: var(--panel); box-shadow: var(--shadow-card);
}
form { display: flex; flex-direction: column; }
h1 { margin: 0; color: var(--heading); font: 500 20px/1.2 var(--font-display); outline: none; }
/* What happens next; the step under way lights up while the page waits on it. */
.steps { margin: var(--space-1) 0 var(--space-4); color: var(--muted); font-size: 13px; line-height: 1.45; text-wrap: balance; }
/* A highlight is colour in the text (DESIGN.md, Colors): brand, and medium weight. */
#login[data-step="password"] .step-password, #login[data-step="passkey"] .step-passkey { color: var(--brand); font-weight: 500; }
#login[data-step="passkey"] .step-password, #login[data-step="done"] .step { color: var(--text); }

/* An error takes room only while there is one: negative text with its icon, no box. */
.error-slot p, .setup .error {
  margin: 0; display: flex; align-items: flex-start; gap: var(--space-2);
  color: var(--negative); font-size: 13px; line-height: 1.45;
}
.error-slot p { margin-bottom: var(--space-4); }
.error-slot p::before, .setup .error::before {
  content: ""; flex: none; width: 14px; height: 14px; margin-top: 3px; background: currentColor;
  -webkit-mask: url("assets/icons/alert.svg") center/contain no-repeat;
  mask: url("assets/icons/alert.svg") center/contain no-repeat;
}

/* Fields: a label over a full-width input. The edge is faint (5.4:1 on the dark card, 6.2:1 on the
   light one), muted on hover. Focus is the dashboard's one ring (the 2px link outline from
   :focus-visible above); the edge itself stays put. */
.field { margin: 0 0 var(--space-4); }
.field.password-field { margin-bottom: var(--space-6); }
.field label, .setup label { display: block; margin-bottom: var(--space-2); color: var(--muted); font-weight: 500; font-size: 13px; line-height: 1.4; }
.field input, .setup input {
  display: block; width: 100%; min-width: 0; height: var(--tap-target); padding: 0 var(--space-3);
  border: 1px solid var(--faint); border-radius: var(--radius-sm);
  background: var(--field); color: var(--text);
  font-size: 14px; line-height: normal; caret-color: var(--brand);
  transition: border-color .15s ease-out;
}
.field input::placeholder, .setup input::placeholder { color: var(--muted); opacity: 1; }
.field input:hover, .setup input:hover { border-color: var(--muted); }
.field input[aria-invalid="true"] { border-color: var(--negative); }
#login[aria-busy="true"] .field input { color: var(--muted); }
.field input:-webkit-autofill, .setup input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 100px var(--field) inset; }

/* The one primary button on the dashboard's public pages: solid brand, the controls' radius. */
.primary, .setup button {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; min-height: var(--tap-target); margin: 0; padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--on-brand);
  font-size: 14px; line-height: 1.4; font-weight: 500; transition: background-color .15s ease-out;
}
.primary:hover:not(:disabled), .setup button:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 88%, var(--heading)); }
.setup button:disabled { opacity: .6; }
.lost-device { max-width: 320px; margin: var(--space-4) auto 0; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.5; }
.lost-device span { display: inline-block; }

/* Foot: who the page is for. */
.footer {
  flex: 0 0 auto; min-width: 0; width: 100%;
  padding: var(--space-3) var(--space-6) max(var(--space-6), env(safe-area-inset-bottom));
  color: var(--muted); font-size: 12px; line-height: 1.4;
}
.footer p { margin: 0; text-align: center; }
/* The theme, right in the top bar: the dashboard's segmented control (PillGroup in
   apps/dashboard-react/src/ui/parts.tsx), a raised track with the chosen option on the panel. */
.theme-switch { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--raised); }
.theme-switch button {
  min-height: 28px; padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm); color: var(--muted); background: transparent;
  font-size: 12px; line-height: 1.4; font-weight: 400; transition: color .15s ease-out;
}
.theme-switch button:hover { color: var(--heading); }
.theme-switch button[aria-pressed="true"] { background: var(--panel); color: var(--heading); font-weight: 500; box-shadow: var(--shadow-card), 0 0 0 1px var(--line); }

/* Set up: the top bar's text wordmark over one card, centred. */
.setup {
  flex: 1 0 auto; width: min(400px, calc(100% - 2 * var(--space-4))); margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; gap: var(--space-6);
  padding: var(--space-12) 0;
}
.setup-brand { display: flex; justify-content: center; }
.setup .panel { display: flex; flex-direction: column; gap: var(--space-4); }
.setup form { gap: var(--space-4); }
.setup .lede { margin: 0; color: var(--muted); }
.setup .lede strong { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.setup label { margin: 0; }
.setup label input { margin-top: var(--space-2); font-weight: 400; }
.setup form button { margin-top: var(--space-2); }

@media (min-width: 761px) and (max-width: 1120px) {
  .stage { grid-template-columns: minmax(0, 1fr) minmax(0, 352px); gap: var(--space-7); }
  .art { height: clamp(400px, calc(100svh - 160px), 560px); }
  .panel { padding: var(--space-6); }
}
@media (max-width: 760px) {
  .topbar { padding-left: max(var(--space-4), env(safe-area-inset-left)); padding-right: max(var(--space-4), env(safe-area-inset-right)); }
  .stage {
    width: min(420px, calc(100% - 2 * var(--space-4))); grid-template-columns: minmax(0, 1fr);
    align-content: start; gap: 0; padding: var(--space-4) 0 var(--space-3);
  }
  .art { width: calc(100% + 2 * var(--space-4)); margin: 0 calc(-1 * var(--space-4)); height: clamp(176px, 29svh, 244px); }
  .panel { padding: var(--space-6); }
  .field input, .setup input { font-size: 16px; }
  .footer { padding: var(--space-3) var(--space-4) max(var(--space-6), env(safe-area-inset-bottom)); }
  .theme-switch button { min-height: var(--tap-target); min-width: 56px; }
  .setup { padding: max(var(--space-6), env(safe-area-inset-top)) 0 var(--space-6); }
}
/* Short phones or a zoomed window: a smaller mark keeps the form in view. */
@media (max-width: 760px) and (max-height: 620px) {
  .art { height: 152px; }
  .stage { padding-top: var(--space-3); }
}
@media (prefers-reduced-motion: reduce) {
  .field input, .setup input, .primary, .setup button, .theme-switch button { transition: none; }
}
