/* The sign-in page's preview (src/login-preview.ts, staging only), shared by its three directions: one ground for the
   whole page, the form half (the ids and words of /login, styled here), the brand side's frame (mark, headline, small
   lines) and how both collapse on a phone. Colours, type and spacing are the site's (tokens.css, loaded before this
   file); what tokens.css has no word for is set here under --lx-*. Each direction's own file (login-x-<d>.css) sets its
   display type and where the brand side sits. The picture is drawn by ui/login-x.js on the one canvas. */

:root {
  /* the picture's ink: the foreground as r,g,b, drawn at low alphas (ui/login-x-<d>.js) */
  --lx-ink: 244,244,245;
  /* the hover ring around buttons and the focus ring of a field */
  --lx-ring: rgba(244,244,245,.14);
  /* motion, from the design language (tokens/dist/theme.css): durations and easings */
  --lx-d-fast: 150ms; --lx-d-base: 200ms;
  --lx-e-out: cubic-bezier(.32,.72,0,1); --lx-e-std: cubic-bezier(.25,.1,.25,1); --lx-e-inout: cubic-bezier(.77,0,.175,1);
}
:root[data-theme="light"] { --lx-ink: 11,11,12; --lx-ring: rgba(11,11,12,.10); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) { --lx-ink: 11,11,12; --lx-ring: rgba(11,11,12,.10); } }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: var(--t-ui); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* the sign-in ways keep their place while app.js asks whether the visitor is already signed in: shown in place, the
   centred form does not move (a hidden block appearing would shift it) */
#view-sign-in[data-wait] { visibility: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* one ground: the picture is one canvas behind the whole page, faded out before it reaches the fields */
#art { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; z-index: 0; pointer-events: none; }
.page { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }

/* ---------- the form half (ids, words and flow as /login) ---------- */
.side { display: grid; grid-template-rows: 1fr auto; min-width: 0; padding: var(--s-6) var(--s-7); }
.form { align-self: center; justify-self: center; width: 100%; max-width: 360px; display: grid; gap: var(--s-5); padding-block: var(--s-7); }
.form h1 { margin: 0; font: var(--t-h3); letter-spacing: var(--ls-h3); }
.lead { margin: calc(var(--s-3) * -1 - 2px) 0 0; color: var(--fg-2); }
.stack, .signin-form { display: grid; gap: var(--s-3); }
/* the two provider rows are paragraphs: without this their default margins add to the stack's gap, and GitHub and
   Google read as two groups */
#github-row, #g-own-row { margin: 0; }
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  width: 100%; height: 44px; padding: 0 20px; border-radius: var(--r-2);
  border: 1px solid var(--bg-inv); background: var(--bg-inv); color: var(--fg-inv); font: var(--t-btn);
  cursor: pointer; user-select: none; text-decoration: none;
  outline: 2px solid transparent; outline-offset: 0;
  transition: background-color var(--lx-d-fast) var(--lx-e-std), border-color var(--lx-d-fast) var(--lx-e-std), color var(--lx-d-fast) var(--lx-e-std),
    box-shadow var(--lx-d-base) var(--lx-e-out), transform var(--lx-d-fast) var(--lx-e-out), outline-offset var(--lx-d-fast) var(--lx-e-out), outline-color var(--lx-d-fast) var(--lx-e-std);
}
.btn:hover { background: color-mix(in srgb, var(--bg-inv) 86%, var(--bg)); box-shadow: 0 0 0 4px var(--lx-ring); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline-color: var(--focus); outline-offset: 3px; }
.btn.quiet { background: color-mix(in srgb, var(--bg) 72%, transparent); color: var(--fg); border-color: var(--line); }
.btn.quiet:hover { background: var(--bg-2); border-color: var(--control); box-shadow: none; }
.btn svg { width: 18px; height: 18px; flex: none; transition: transform var(--lx-d-base) var(--lx-e-out); }
.btn.quiet:hover svg { transform: translateX(-2px); }
/* busy (app.js): a turning ring and the word saying what is happening */
.btn[disabled], .btn[aria-busy="true"] { opacity: .75; cursor: progress; box-shadow: none; }
.btn[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 999px; border: 2px solid currentColor; border-right-color: transparent; animation: lx-spin 600ms linear infinite; }
@keyframes lx-spin { to { transform: rotate(360deg); } }
.or { margin: 0; display: flex; align-items: center; gap: var(--s-3); font: var(--t-label); color: var(--fg-3); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field { display: grid; gap: var(--s-2); }
.field label { font: var(--t-label); color: var(--fg-2); transition: color var(--lx-d-fast) var(--lx-e-std); }
.field:focus-within label { color: var(--fg); }
.input {
  font: var(--t-ui); color: var(--fg); background: var(--bg-1); border: 1px solid var(--control); border-radius: var(--r-2);
  height: 40px; padding: 0 var(--s-3); width: 100%; outline: none;
  transition: border-color var(--lx-d-fast) var(--lx-e-std), box-shadow var(--lx-d-base) var(--lx-e-out), background-color var(--lx-d-fast) var(--lx-e-std);
}
.input:hover { border-color: var(--fg-2); }
.input:focus { border-color: var(--fg); background: var(--bg); box-shadow: 0 0 0 4px var(--lx-ring); }
.input.code-in { font-variant-numeric: tabular-nums; letter-spacing: .3em; text-align: center; }
.hint { margin: 0; font: var(--t-label); color: var(--fg-3); }
/* Chinese: break at punctuation and spaces only, so a word ("点星") is never split, and no last line of one character */
:root[lang="zh-Hans"] .lead, :root[lang="zh-Hans"] .hint { word-break: keep-all; line-break: strict; text-wrap: pretty; }
.link-btn { justify-self: center; background: none; border: 0; padding: 0; font: var(--t-label); color: var(--fg-2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); transition: color var(--lx-d-fast) var(--lx-e-std), text-decoration-color var(--lx-d-fast) var(--lx-e-std); }
.link-btn:hover { color: var(--fg); text-decoration-color: currentColor; }
/* what app.js says (sent, refused, a failure): a hairline note, its kind on the left edge */
.note { margin: 0; border: 1px solid var(--line); border-left: 2px solid var(--fg-2); border-radius: var(--r-1); padding: var(--s-3) var(--s-4); font: var(--t-ui); color: var(--fg-2); background: color-mix(in srgb, var(--bg) 72%, transparent); }
.note.bad { border-left-color: var(--bad); } .note.warn { border-left-color: var(--warn); } .note.ok { border-left-color: var(--ok); }
#turnstile-code:empty { display: none; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); font: var(--t-label); color: var(--fg-3); }
.foot p { margin: 0; }
.foot a { color: var(--fg-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); transition: color var(--lx-d-fast) var(--lx-e-std), text-decoration-color var(--lx-d-fast) var(--lx-e-std); }
.foot a:hover { color: var(--fg); text-decoration-color: currentColor; }
.tools { display: flex; align-items: center; gap: var(--s-1); flex: none; }
.tool { white-space: nowrap; height: 32px; min-width: 32px; padding: 0 var(--s-2); display: inline-grid; place-items: center; border: 0; border-radius: var(--r-1); background: transparent; color: var(--fg-2); cursor: pointer; font: var(--t-label); transition: background-color var(--lx-d-fast) var(--lx-e-std), color var(--lx-d-fast) var(--lx-e-std); }
.tool:hover { background: var(--bg-2); color: var(--fg); }
.tool svg { width: 16px; height: 16px; }
.tool.proto { display: inline-flex; align-items: center; color: var(--fg-3); font-variant-numeric: tabular-nums; }
/* the theme switch shows the theme now showing, as on the rest of the site (ui.css) */
.theme .i-sun, :root[data-theme="light"] .theme .i-moon { display: none; }
:root[data-theme="light"] .theme .i-sun { display: block; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .theme .i-moon { display: none; } :root:not([data-theme]) .theme .i-sun { display: block; } }

/* ---------- the brand side: mark, headline, small lines; no frame, no ground of its own ---------- */
.brand { position: relative; min-width: 0; display: grid; grid-template-rows: auto 1fr auto; padding: var(--s-6) var(--s-8) var(--s-7); }
.mark { justify-self: start; display: inline-flex; align-items: center; gap: var(--s-2); font: 600 16px/20px var(--sans); letter-spacing: -.01em; color: var(--fg); text-decoration: none; }
.mark svg { width: 22px; height: 22px; }
.hl { margin: 0; color: var(--fg); font-kerning: normal; text-rendering: optimizeLegibility; }
.hl .ln { display: block; white-space: nowrap; }
.hl .ln-in { display: inline-block; }
.hl .w, .hl .ch { display: inline-block; }
.hl .base { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.sub { margin: 0; color: var(--fg-2); max-width: 34rem; text-wrap: pretty; }
.sub p { margin: 0; }
:root[lang="zh-Hans"] .sub { word-break: keep-all; line-break: strict; }
.sub p + p { margin-top: .35em; color: var(--fg-3); }

/* ---------- entrance: one orchestrated sequence, set per direction; nothing hidden without the script ---------- */
.js .hl .ln-in, .js .sub p { will-change: transform, opacity; }

/* ---------- reduced motion: no entrance, no hover movement, the picture one still frame (login-x.js) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation: none !important; }
  .btn:active { transform: none; }
  .btn.quiet:hover svg { transform: none; }
}

/* ---------- a phone: the form only; the brand side a strip on top that keeps the headline ---------- */
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand, .side { grid-row: auto !important; }
  .brand { order: -1; grid-column: 1 !important; grid-template-rows: auto auto; gap: var(--s-5); padding: var(--s-5) var(--s-5) var(--s-2); }
  .brand .sub { display: none; }
  .side { grid-column: 1 !important; padding: 0 var(--s-5) var(--s-5); }
  .form { align-self: start; padding-block: var(--s-6) var(--s-7); }
  .foot { flex-direction: column-reverse; align-items: flex-start; }
}
