/* SpamSpike console: sign-in wall, evidence unlock, account menu.
   One sheet of light ground with a statement on the left and the way in on the right. Type, accent and
   radii come from console.css; the primary action is ink on white (white on ink in dark mode). */

:root {
  --auth-bg: #ffffff;
  --auth-ink: #1d1d1f;
  --auth-ink-press: #000000;
  --auth-on-ink: #ffffff;
  --auth-card: #ffffff;
  --auth-ring: rgba(0, 0, 0, 0.07);
  --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 44px -14px rgba(0, 0, 0, 0.2);
  --auth-input: #ffffff;
  --auth-input-line: rgba(0, 0, 0, 0.14);
  --auth-input-hover: rgba(0, 0, 0, 0.24);
  --auth-focus: rgba(0, 113, 227, 0.22);
  --auth-danger: #d70015;
  --auth-danger-tint: rgba(215, 0, 21, 0.07);
  --auth-good: #248a3d;
  --auth-glow-1: rgba(0, 122, 255, 0.24);
  --auth-glow-2: rgba(88, 86, 214, 0.2);
  --auth-glow-3: rgba(52, 199, 89, 0.12);
  --auth-glow-4: rgba(255, 149, 0, 0.1);
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --auth-bg: #000000;
    --auth-ink: #f5f5f7;
    --auth-ink-press: #ffffff;
    --auth-on-ink: #000000;
    --auth-card: #161617;
    --auth-ring: rgba(255, 255, 255, 0.1);
    --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 50px -12px rgba(0, 0, 0, 0.75);
    --auth-input: #1c1c1e;
    --auth-input-line: rgba(255, 255, 255, 0.14);
    --auth-input-hover: rgba(255, 255, 255, 0.26);
    --auth-focus: rgba(10, 132, 255, 0.35);
    --auth-danger: #ff453a;
    --auth-danger-tint: rgba(255, 69, 58, 0.12);
    --auth-good: #30d158;
    --auth-glow-1: rgba(10, 100, 255, 0.3);
    --auth-glow-2: rgba(94, 72, 230, 0.26);
    --auth-glow-3: rgba(48, 180, 160, 0.1);
    --auth-glow-4: rgba(255, 159, 10, 0.06);
  }
}
:root[data-theme="dark"] {
  --auth-bg: #000000;
  --auth-ink: #f5f5f7;
  --auth-ink-press: #ffffff;
  --auth-on-ink: #000000;
  --auth-card: #161617;
  --auth-ring: rgba(255, 255, 255, 0.1);
  --auth-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 50px -12px rgba(0, 0, 0, 0.75);
  --auth-input: #1c1c1e;
  --auth-input-line: rgba(255, 255, 255, 0.14);
  --auth-input-hover: rgba(255, 255, 255, 0.26);
  --auth-focus: rgba(10, 132, 255, 0.35);
  --auth-danger: #ff453a;
  --auth-danger-tint: rgba(255, 69, 58, 0.12);
  --auth-good: #30d158;
  --auth-glow-1: rgba(10, 100, 255, 0.3);
  --auth-glow-2: rgba(94, 72, 230, 0.26);
  --auth-glow-3: rgba(48, 180, 160, 0.1);
  --auth-glow-4: rgba(255, 159, 10, 0.06);
}

/* While the wall is up, the console behind it isn't rendered at all (no data is loaded yet anyway). */
html.gated .bar, html.gated .page, html.gated .thread { display: none; }
html.gated body { background: var(--auth-bg); }

.auth {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-rows: auto 1fr auto;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--auth-bg);
  color: var(--text);
}
.auth[hidden] { display: none; }

/* The light field: soft colored light pooled behind the form and falling away toward the statement, so the card
   has something to rest on. Static: no motion, nothing to animate. */
.auth-field { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.auth-field::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(34vmax 26vmax at 74% 34%, var(--auth-glow-1), transparent 70%),
    radial-gradient(30vmax 24vmax at 92% 66%, var(--auth-glow-2), transparent 70%),
    radial-gradient(26vmax 18vmax at 62% 4%, var(--auth-glow-3), transparent 72%),
    radial-gradient(26vmax 20vmax at 100% 100%, var(--auth-glow-4), transparent 70%);
  filter: blur(28px) saturate(1.1);
}
@media (prefers-reduced-transparency: reduce) { .auth-field { display: none; } }

.auth-top, .auth-main, .auth-foot { position: relative; z-index: 1; }

.auth-top { display: flex; align-items: center; padding: 22px 28px; }
.auth-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; letter-spacing: -0.015em; color: var(--text); }
.auth-brand .brand-mark { width: 22px; height: 22px; color: var(--auth-ink); }
.auth-brand .brand-mark path { fill: var(--auth-on-ink); }

.auth-main {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 404px); gap: 72px;
  align-items: center; width: 100%; max-width: 1060px; margin: 0 auto; padding: 16px 40px 56px;
}
.auth-lede h1 {
  margin: 0;
  font: 600 50px/1.05 var(--font-display); letter-spacing: -0.026em; text-wrap: balance;
}
.auth-lede p { margin: 14px 0 0; max-width: 34ch; color: var(--text-2); font-size: 16px; line-height: 1.45; letter-spacing: -0.012em; text-wrap: pretty; }

.auth-card {
  background: var(--auth-card); border-radius: 20px;
  box-shadow: 0 0 0 1px var(--auth-ring), var(--auth-shadow);
  padding: 30px 30px 26px;
}
.auth-step { animation: auth-in 260ms var(--ease-out) both; }
@keyframes auth-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auth-foot {
  display: flex; align-items: center; gap: 7px; padding: 18px 28px 22px;
  color: var(--text-3); font-size: 12px; letter-spacing: -0.005em;
}
.auth-foot svg { width: 12px; height: 12px; flex: none; }

/* ---------- form ---------- */
.auth .af { display: grid; gap: 16px; }
.auth .af-head { margin: 0 0 2px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.auth .af-head strong { color: var(--text); font-weight: 600; }
.auth .af-field { display: grid; gap: 6px; }
.auth .af-label { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--text); letter-spacing: -0.008em; }
.auth .af-label a, .auth .af-link { color: var(--accent); text-decoration: none; font-weight: 400; cursor: pointer; background: none; border: 0; padding: 0; font-size: 13px; }
.auth .af-label a:hover, .auth .af-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.auth .af-input { position: relative; display: flex; }
.auth .af-input input {
  width: 100%; height: 44px; padding: 0 13px; border-radius: 11px;
  background: var(--auth-input); border: 1px solid var(--auth-input-line);
  font-size: 15px; letter-spacing: -0.01em; outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
/* Browser autofill keeps our ground instead of its own tint. */
.auth .af-input input:-webkit-autofill, .auth .af-input input:-webkit-autofill:hover, .auth .af-input input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text); caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px var(--auth-input) inset; transition: background-color 9999s;
}
.auth .af-input input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 40px var(--auth-input) inset, 0 0 0 4px var(--auth-focus); }
.auth .af-input input::placeholder { color: var(--text-3); }
.auth .af-input input:hover { border-color: var(--auth-input-hover); }
.auth .af-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--auth-focus); }
.auth .af-input input[aria-invalid="true"] { border-color: var(--auth-danger); }
.auth .af-input input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px var(--auth-danger-tint); }
.auth .af-input input[readonly] { color: var(--text-2); background: var(--fill-2); }
.auth .af-input .af-eye {
  position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; border: 0; background: none; color: var(--text-3); cursor: pointer;
}
.auth .af-input .af-eye:hover { color: var(--text-2); background: var(--fill-2); }
.auth .af-input .af-eye svg { width: 18px; height: 18px; }
.auth .af-input.has-eye input { padding-right: 44px; }
.auth .af-hint { font-size: 12px; color: var(--text-3); }
.auth .af-err { font-size: 12.5px; color: var(--auth-danger); display: flex; gap: 5px; align-items: flex-start; line-height: 1.35; }
.auth .af-err:empty { display: none; }
.auth .af-err svg { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.auth .af-banner { border-radius: 11px; padding: 10px 12px; background: var(--auth-danger-tint); color: var(--auth-danger); font-size: 13px; line-height: 1.4; }
.auth .af-banner:empty { display: none; }
.auth .af-banner.ok { background: var(--accent-tint); color: var(--accent); }

.auth .af-code input {
  height: 56px; text-align: center; font: 600 26px/1 var(--mono); letter-spacing: 0.42em; padding-left: 0.42em;
  font-variant-numeric: tabular-nums;
}

.auth .af-primary, .auth .af-secondary {
  position: relative; height: 44px; width: 100%; border-radius: 11px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 600; letter-spacing: -0.012em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 100ms ease-out, background-color 120ms ease, opacity 120ms ease;
}
.auth .af-primary { background: var(--auth-ink); color: var(--auth-on-ink); }
.auth .af-primary:hover { background: var(--auth-ink-press); }
.auth .af-primary:active, .auth .af-secondary:active { transform: scale(0.985); }
.auth .af-primary:focus-visible, .auth .af-secondary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--auth-focus); }
.auth .af-primary[disabled] { opacity: 0.55; cursor: default; transform: none; }
.auth .af-secondary { background: var(--fill-2); color: var(--text); font-weight: 500; }
.auth .af-secondary:hover { background: var(--fill); }
.auth .af-primary .auth-spin, .auth .af-secondary .auth-spin { display: none; }
.auth .af-primary.busy .label, .auth .af-secondary.busy .label { opacity: 0; }
.auth .af-primary.busy .auth-spin, .auth .af-secondary.busy .auth-spin { display: block; position: absolute; }
.auth-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: auth-spin 700ms linear infinite; opacity: 0.85; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth .af-alt { margin: 20px 0 0; text-align: center; font-size: 13px; color: var(--text-2); }
.auth .af-alt a, .auth .af-alt button { color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; font-size: 13px; }
.auth .af-alt a:hover, .auth .af-alt button:hover { text-decoration: underline; text-underline-offset: 2px; }
.auth .af-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.auth .af-back { display: inline-flex; align-items: center; gap: 4px; margin: -6px 0 2px -4px; padding: 4px; border: 0; background: none; color: var(--text-2); font-size: 13px; cursor: pointer; border-radius: 6px; }
.auth .af-back:hover { color: var(--text); }
.auth .af-back svg { width: 14px; height: 14px; }

/* ---------- unlock ---------- */
.auth .auth-unlock { display: grid; justify-items: center; text-align: center; gap: 18px; }
.auth .auth-unlock-glyph {
  position: relative; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-tint); margin-top: 2px;
}
.auth .auth-unlock-glyph svg { width: 40px; height: 40px; }
.auth .auth-loading svg { width: 30px; height: 30px; }
.auth .auth-unlock-glyph.busy::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent);
  border-right-color: transparent; border-bottom-color: transparent; animation: auth-spin 900ms linear infinite;
}
.auth .auth-unlock-glyph.done { color: var(--auth-good); background: color-mix(in srgb, var(--auth-good) 12%, transparent); }
.auth .auth-who {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px;
  background: var(--fill-2); text-align: left;
}
.auth .auth-who .acct-av { width: 32px; height: 32px; font-size: 12px; }
.auth .auth-who .who-t { min-width: 0; display: grid; }
.auth .auth-who .who-t b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth .auth-who .who-t span { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth .auth-unlock .af-primary { margin-top: 2px; }
.auth .auth-unlock-links { display: flex; gap: 18px; justify-content: center; font-size: 13px; }
.auth .auth-unlock-note.auth-setup-note { text-align: left; max-width: none; justify-self: stretch; font-size: 13px; }
.auth .auth-unlock-note { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.45; max-width: 32ch; }
.auth .af-file {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1px dashed var(--auth-input-line);
  cursor: pointer; text-align: left; font-size: 13px; color: var(--text-2); width: 100%; background: none;
}
.auth .af-file:hover { border-color: var(--auth-input-hover); color: var(--text); }
.auth .af-file svg { width: 20px; height: 20px; flex: none; color: var(--text-3); }
.auth .af-file.picked { border-style: solid; color: var(--text); }

/* ---------- avatar + account menu (in the console's bar) ---------- */
.acct-av {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--avatar); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0;
}
.acct-av img { width: 100%; height: 100%; object-fit: cover; }
.acct-btn { margin-left: 4px; padding: 2px; border: 0; background: none; border-radius: 50%; cursor: pointer; display: grid; }
.acct-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--auth-focus); }
.acct-btn:active .acct-av { transform: scale(0.95); }
.acct-pop { width: 288px; padding: 6px; }
.acct-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 10px; }
.acct-head .acct-av { width: 36px; height: 36px; font-size: 13px; }
.acct-head .t { min-width: 0; display: grid; }
.acct-head b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head span { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-sec { padding: 6px 8px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.acct-sep { height: 1px; margin: 5px 8px; background: var(--sep); }
.acct-pop .acct-item { gap: 2px; padding: 0 8px 0 2px; font-size: 13px; color: var(--text); }
.acct-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-item .role { font-size: 12px; color: var(--text-3); }
.acct-item:focus-visible { outline: none; background: var(--fill); }
.acct-pop .acct-item.danger { color: var(--auth-danger); }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .auth-top { padding: 16px 20px; }
  .auth-main { grid-template-columns: minmax(0, 1fr); gap: 22px; max-width: 460px; padding: 6px 16px 28px; align-content: start; }
  .auth-lede { padding: 18px 4px 0; }
  .auth-lede h1 { font-size: 32px; letter-spacing: -0.028em; max-width: none; }
  .auth-lede p { font-size: 15px; margin-top: 8px; }
  .auth-card { padding: 24px 20px 22px; border-radius: 18px; }
  .auth-foot { display: block; text-align: center; padding: 8px 24px 22px; line-height: 1.5; }
  .auth-foot svg { display: inline-block; vertical-align: -1px; margin-right: 5px; }
}
@media (hover: none) and (pointer: coarse) {
  .auth .af-input input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-step { animation: auth-fade 160ms ease both; }
 @keyframes auth-fade { from { opacity: 0; } to { opacity: 1; } }
  .auth-spin, .auth .auth-unlock-glyph.busy::after { animation-duration: 1.6s; }
}
@media (prefers-contrast: more) {
  .auth-card { box-shadow: 0 0 0 1px var(--text); }
  .auth .af-input input { border-color: var(--text-2); }
}
