/* Code Owner: Aslam Jabri. Account access — same tokens as the product (tokens.css).
   Every account page (sign in, the code step, sign up, recovery, reset, email code) is this one
   layout: a brand panel and a form column with one primary action. */
@layer system {

html, body { min-height: 100%; margin: 0; }
body {
  background: var(--canvas);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---- Shell: brand panel | form column. One column under 880px. ---- */
.auth-shell { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-8);
  padding: var(--space-8) var(--space-8) var(--space-7);
  background: var(--surface); border-right: 1px solid var(--line);
}
/* One quiet light source behind the pitch; the accent appears in it, the logo and the primary button only. */
.auth-brand::after {
  content: ""; position: absolute; right: -180px; bottom: -220px; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 18%, transparent), transparent 68%);
  pointer-events: none;
}
.auth-wordmark { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--brand-ink); font-family: var(--font-serif); font-size: 1.5rem; letter-spacing: -0.01em; text-decoration: none; }
.auth-wordmark img { width: 40px; height: 40px; }
.brand-name b { color: var(--brand-key); font-weight: inherit; }
.auth-pitch { position: relative; z-index: 1; }
.auth-pitch-line { max-width: 15ch; margin: 0; color: var(--text-primary); font-family: var(--font-serif); font-size: clamp(1.75rem, 1.1rem + 1.4vw, 2.5rem); font-weight: var(--weight-regular); line-height: var(--leading-tight); letter-spacing: -0.015em; text-wrap: balance; }
.auth-facts { display: grid; gap: var(--space-2); margin: var(--space-6) 0 0; padding: 0; list-style: none; color: var(--text-muted); font-size: var(--text-sm); }
.auth-facts li { display: flex; align-items: center; gap: var(--space-2); }
.auth-facts svg { flex: none; color: var(--accent-ink); }
.auth-credit { position: relative; z-index: 1; margin: 0; color: var(--text-muted); font-size: var(--text-xs); }
.auth-credit-compact { display: none; }

.auth-panel { display: grid; place-items: center; padding: var(--space-9) var(--space-6); }
.auth-card { display: grid; gap: var(--space-5); width: min(380px, 100%); }

/* ---- Heading ---- */
.auth-head { display: grid; gap: var(--space-2); margin-bottom: var(--space-2); }
.auth-eyebrow { margin: 0; color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
h1 { margin: 0; color: var(--text-primary); font-family: var(--font-serif); font-size: 2rem; font-weight: var(--weight-regular); line-height: var(--leading-tight); letter-spacing: -0.015em; text-wrap: balance; }
.auth-lede { margin: 0; color: var(--text-secondary); font-size: var(--text-md); }
.auth-lede strong { color: var(--text-primary); font-weight: var(--weight-medium); }

/* ---- Fields ---- */
.auth-form { display: grid; gap: var(--space-4); }
.field { display: grid; gap: 6px; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
label { color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.field-help { margin: 0; color: var(--text-muted); font-size: var(--text-xs); }
.keep-signed-in { display: grid; gap: 2px; }
.keep-signed-in .check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.keep-signed-in input[type="checkbox"] { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--accent-ink); }
.keep-signed-in .field-help { padding-left: calc(16px + var(--space-2)); }
input {
  width: 100%; height: 44px; padding: 0 var(--space-3);
  border: 1px solid var(--line-input); border-radius: 6px;
  background: var(--surface-sunken); color: var(--text-primary); font: inherit; font-size: 0.9375rem;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
input::placeholder { color: var(--text-disabled); }
input:hover { border-color: var(--text-muted); }
input:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-ink) 22%, transparent); }
input:user-invalid, input[aria-invalid="true"] { border-color: var(--danger); }
input:user-invalid:focus, input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 22%, transparent); }
.code-input { height: 56px; font-family: var(--font-mono); font-size: 1.375rem; letter-spacing: 0.3em; text-align: center; }
.code-input::placeholder { letter-spacing: 0.3em; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 64px; }
.reveal {
  position: absolute; top: 6px; right: 6px; height: 32px; padding: 0 var(--space-3);
  border: 0; border-radius: 4px; background: transparent; color: var(--text-muted);
  font: inherit; font-size: var(--text-xs); font-weight: var(--weight-medium); cursor: pointer;
}
.reveal:hover { background: var(--surface-hover); color: var(--text-primary); }

/* ---- Buttons: one filled primary per screen, an outlined secondary, text links for the rest. ---- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 44px; padding: 0 var(--space-4);
  border-radius: 6px; font: inherit; font-size: var(--text-md); font-weight: var(--weight-semibold);
  cursor: pointer; transition: background-color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.btn-primary { margin-top: var(--space-1); border: 0; background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border: 1px solid var(--line-strong); background: transparent; color: var(--text-primary); }
.btn-secondary:hover { border-color: var(--accent-ink); background: var(--accent-soft); }
.btn:disabled { cursor: progress; opacity: 0.85; }
.btn-spinner { display: none; width: 16px; height: 16px; border: 2px solid color-mix(in oklab, currentColor 35%, transparent); border-top-color: currentColor; border-radius: 50%; animation: auth-spin 0.8s linear infinite; }
.btn[aria-busy="true"] .btn-spinner { display: inline-block; }
.btn[aria-busy="true"] svg { display: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 2.4s; } }

.text-link { padding: 0; border: 0; background: none; color: var(--accent-ink); font: inherit; font-size: var(--text-sm); text-decoration: none; cursor: pointer; }
.text-link:hover { color: var(--text-primary); text-decoration: underline; }
.text-link:disabled { color: var(--text-disabled); cursor: default; text-decoration: none; }

.auth-alt { display: grid; gap: var(--space-4); }
.auth-or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); color: var(--text-muted); font-size: var(--text-xs); }
.auth-or::before, .auth-or::after { content: ""; height: 1px; background: var(--line); }
.auth-center { margin: 0; text-align: center; }
.auth-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.auth-inset { padding: var(--space-4); border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }

/* ---- Messages: a quiet note, or an error with its reason. Both are announced. ---- */
#auth-message:empty { display: none; }
#auth-message, .auth-error {
  display: flex; gap: var(--space-2); margin: 0; padding: 10px var(--space-3);
  border: 1px solid color-mix(in oklab, var(--accent-ink) 30%, transparent); border-radius: 6px;
  background: var(--accent-soft); color: var(--text-primary); font-size: var(--text-sm);
}
#auth-message[data-tone="error"], .auth-error { border-color: color-mix(in oklab, var(--danger) 40%, transparent); background: color-mix(in oklab, var(--danger) 9%, transparent); }

.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) var(--space-5); margin: var(--space-2) 0 0; padding-top: var(--space-5); border-top: 1px solid var(--line); color: var(--text-muted); font-size: var(--text-sm); }
.auth-links a { color: var(--accent-ink); text-decoration: none; }
.auth-links a:hover { color: var(--text-primary); text-decoration: underline; }

@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: var(--space-4) var(--space-5); border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-brand::after, .auth-pitch, .auth-brand .auth-credit { display: none; }
  .auth-wordmark { font-size: 1.25rem; }
  .auth-wordmark img { width: 32px; height: 32px; }
  .auth-panel { place-items: start center; padding: var(--space-7) var(--space-4) var(--space-8); }
  .auth-credit-compact { display: block; }
}
@media (pointer: coarse) { input, .btn { height: 48px; } }

} /* @layer system */

/* Beta tester access (/join): the three steps, current one highlighted. */
.join-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.join-steps li { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) var(--space-3); border: 1px solid transparent; border-radius: 8px; color: var(--text-secondary); }
.join-steps li[data-state="current"] { border-color: var(--accent, currentColor); color: var(--text-primary); }
.join-steps li[data-state="done"] .join-step-num { background: var(--status-success-soft, transparent); color: var(--status-success, inherit); }
.join-step-num { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; font-size: var(--text-sm); }
.join-steps li[data-state="done"] .join-step-num { border-color: transparent; }
.join-step-text { display: grid; gap: 2px; }
.join-step-text small { color: var(--text-secondary); }

/* Editor sign-in (/ide/activate, ide-activate.js). */
.ide-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-3); margin: 0; font-size: var(--text-sm); }
.ide-facts dt { color: var(--text-muted); }
.ide-facts dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }

/* ---- Secure share recipient page (/s/<id>, secure-share-open.js). ---- */
#share-message:empty { display: none; }
#share-message { display: flex; gap: var(--space-2); margin: 0; padding: 10px var(--space-3); border: 1px solid color-mix(in oklab, var(--accent-ink) 30%, transparent); border-radius: 6px; background: var(--accent-soft); color: var(--text-primary); font-size: var(--text-sm); }
#share-message[data-tone="error"], .share-warning { border-color: color-mix(in oklab, var(--danger) 40%, transparent); background: color-mix(in oklab, var(--danger) 9%, transparent); }
.share-warning { margin: 0; padding: 10px var(--space-3); border: 1px solid; border-radius: 6px; font-size: var(--text-sm); }
.share-text { width: 100%; min-height: 160px; padding: 10px 12px; border: 1px solid var(--line-input); border-radius: 6px; background: transparent; color: var(--text-primary); font: inherit; font-family: var(--font-mono, monospace); font-size: var(--text-sm); resize: vertical; }
