/* ============================================================================
   The auth origin's stylesheet — auth.sitewave.me (7.7).

   ⚠️⚠️ THE TOKEN BLOCK BELOW IS A DELIBERATE MIRROR OF
   `admin/src/ui/tokens.css`, AND IT MUST STAY ONE. Do NOT "unify" it by
   reading tokens.css at runtime — `infra/deploy/deploy.sh` excludes `/admin/`
   wholesale (only the BUILT `public/admin` output is shipped), so a runtime
   read of tokens.css resolves perfectly on a dev machine and finds nothing on
   the box. That failure mode is an unstyled login screen in production with a
   green harness behind it, which is precisely the class of bug that put three
   defects on the box on 2026-07-22.

   The duplication is therefore forced by the deploy boundary, not chosen. What
   makes it safe is `tools/checks/90-auth-origin.php`, which asserts every token
   redefined here holds the SAME value as tokens.css — so the mirror cannot
   drift, and `tools/check-contrast.php`'s AA gate over tokens.css transitively
   covers this file too. Change a hex in tokens.css and this file goes red until
   it follows.

   ⚠️ DARK ONLY, on purpose. tokens.css ships two palettes; this origin ships
   one. A login screen has no theme toggle to honour and no actor to read a
   preference from — the person is, by definition, not signed in yet. Dark is
   the SiteWave admin identity and tokens.css's default, so arriving at the
   admin after sign-in is a continuation rather than a flash of a different
   product.

   ⚠️ `--font-system`, NOT `--font`. The admin's Geist is self-hosted out of
   `admin/node_modules` and emitted into the admin bundle by Vite — neither is
   reachable from this docroot (see the exclude above). Naming `--font` here
   would silently fall back to the system stack anyway; saying so out loud stops
   someone "fixing" a font that was never going to load.
   ========================================================================== */

:root {
  /* ---- Mirrored from tokens.css — see the warning above. ---- */
  --bg: #0d0d0f;
  --panel: #111114;
  --panel-2: #232327;
  --panel-3: #2b2b31;
  --line: #212124;
  --line-strong: #34343a;
  --menu-bg: #1b1b1f;

  --fg: #f2f2f4;
  --fg-2: #b8b8bd;
  --muted: #929299;
  --faint: #7d7d84;

  --accent: #6f8bff;
  --accent-hover: #8199ff;
  --accent-line: #3f5199;
  --on-accent: #0d0d0f;

  --ok: #3ddc97;
  --ok-soft: #14342a;
  --danger: #ff6b74;
  --danger-soft: #3a1c22;
  --on-danger: #0d0d0f;

  --ring: #7d96ff;

  --font-system: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;

  --fs-2: 11.5px;
  --fs-3: 12.5px;
  --fs-4: 13.5px;
  --fs-5: 15px;
  --fs-7: 23px;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semi: 600;

  --lh-normal: 1.45;
  --track-label: 0.08em;

  --sp-2: 4px;
  --sp-4: 8px;
  --sp-5: 12px;
  --sp-6: 16px;
  --sp-7: 20px;
  --sp-8: 24px;
  --sp-9: 32px;

  --r-2: 7px;
  --r-3: 9px;
  --r-4: 13px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-2: 180ms;
  --ring-w: 2px;
  --ring-offset: 2px;
}

/* ---- ground ------------------------------------------------------------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
  background: var(--bg);
  color: var(--fg);
  font: var(--fw-regular) var(--fs-4) / var(--lh-normal) var(--font-system);
  /* -webkit-font-smoothing matches the admin shell's base.css so the two
     origins render type at the same weight rather than one looking heavier. */
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  padding: var(--sp-9);
}

/* The home lists sites, so it needs more room than a login form. */
.card--wide { max-width: 460px; }

/* ---- brand -------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.brand__name {
  font-size: var(--fs-5);
  font-weight: var(--fw-semi);
  letter-spacing: -0.01em;
}

h1 {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-7);
  font-weight: var(--fw-semi);
  letter-spacing: -0.02em;
}

.sub {
  margin: 0 0 var(--sp-8);
  color: var(--muted);
  font-size: var(--fs-3);
}

/* ---- fields ------------------------------------------------------------- */

.field { margin-bottom: var(--sp-6); }

.field > label {
  display: block;
  margin-bottom: var(--sp-4);
  font-size: var(--fs-2);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-5);
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  font: var(--fw-regular) var(--fs-4) var(--font-system);
  transition: border-color var(--dur-2) var(--ease);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  /* A SOLID outline, not a box-shadow — tokens.css's own reasoning: Windows
     High Contrast Mode strips box-shadow, taking the keyboard's only signal
     with it for exactly the users most likely to be navigating by keyboard. */
  outline: var(--ring-w) solid var(--ring);
  outline-offset: var(--ring-offset);
}

input:focus { border-color: var(--accent-line); }

/* ---- buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-6);
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: var(--accent);
  color: var(--on-accent);
  font: var(--fw-semi) var(--fs-4) var(--font-system);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease);
}

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

.btn--quiet {
  background: var(--panel-2);
  color: var(--fg);
  border-color: var(--line-strong);
}

.btn--quiet:hover { background: var(--panel-3); }

/* ---- notices ------------------------------------------------------------ */

.notice {
  margin-bottom: var(--sp-6);
  padding: var(--sp-5);
  border-radius: var(--r-3);
  font-size: var(--fs-3);
}

.notice--error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.notice--ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok);
}

/* ---- the site list (the home) ------------------------------------------- */

.sites { display: flex; flex-direction: column; gap: var(--sp-4); }

.site {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  width: 100%;
  padding: var(--sp-5);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  color: var(--fg);
  font: var(--fw-regular) var(--fs-4) var(--font-system);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease);
}

.site:hover { background: var(--panel-3); }

/* A site with no host assigned cannot be entered — it has no address to go to.
   Shown rather than hidden: "it exists but isn't addressed yet" is an operator
   state worth seeing, and hiding it reads as the site having vanished. */
.site[disabled] { opacity: 0.55; cursor: not-allowed; }
.site[disabled]:hover { background: var(--panel-2); }

.site__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-2);
  background: var(--menu-bg);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-2);
  font-weight: var(--fw-semi);
  color: var(--fg-2);
  text-transform: uppercase;
}

.site__who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.site__name {
  font-weight: var(--fw-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site__meta { color: var(--faint); font-size: var(--fs-2); }

/* ---- foot --------------------------------------------------------------- */

.foot {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  font-size: var(--fs-2);
  color: var(--muted);
}

.foot a, .linkish {
  color: var(--fg-2);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.foot a:hover, .linkish:hover { color: var(--fg); text-decoration: underline; }

.label {
  font-size: var(--fs-2);
  font-weight: var(--fw-semi);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: var(--sp-5);
}

/* The handoff page is shown for a few hundred milliseconds at most, but it IS
   shown — a blank white flash between two dark screens reads as a crash. */
.handoff { text-align: center; color: var(--muted); font-size: var(--fs-3); }
