/* ============================================================
   EdgeStacker — shared auth form language
   One stylesheet for every logged-out page: the centered card,
   the field pattern (label / input / error), the banner variants,
   buttons, and the footer switch line. Django renders the same
   markup server-side; error/notice states are toggled by adding
   the matching class or block, not by JS.

   Loaded on top of tokens.css (all colors/radii/shadows come from
   there). Source of truth: docs/design_handoff/auth/auth.css.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: var(--bg-app);
  background-image: var(--glow-radial);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--green-400); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Page scaffold ---------- */
.auth-page {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 56px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* Brand lockup, top-center */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  user-select: none;
}
.auth-brand .mark { width: 30px; height: 29px; display: block; }
.auth-brand .word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.auth-brand .word .edge { color: var(--text-primary); }
.auth-brand .word .stacker { color: var(--accent); }

/* ---------- Card ---------- */
.auth-card {
  width: 100%;
  max-width: 428px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 32px 28px;
}

.auth-head { margin-bottom: 22px; }
.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}
.auth-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  letter-spacing: var(--ls-display);
  line-height: 1.1;
  margin: 0;
}
.auth-sub {
  margin: 9px 0 0;
  font-size: 14.5px;
  color: var(--text-secondary);
}
.auth-sub .em { color: var(--text-primary); font-weight: 500; }

/* ---------- Fields ---------- */
.auth-form { display: flex; flex-direction: column; gap: 17px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.field-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface-well);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  outline: none;
  transition: border-color 120ms cubic-bezier(0.4,0,0.2,1), box-shadow 120ms cubic-bezier(0.4,0,0.2,1);
}
.field-input::placeholder { color: var(--text-muted); }
.field-input:focus {
  border-color: var(--border-accent);
  box-shadow: var(--focus-shadow);
}
/* field-level error: red border + message below */
.field.is-error .field-input {
  border-color: var(--down);
}
.field.is-error .field-input:focus {
  box-shadow: 0 0 0 3px var(--down-soft);
}
.field-error {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--down);
  margin: 0;
}
.field-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

/* label + forgot link on one row */
.field-labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-labelrow a { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; }

/* remember-me / inline checkbox */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}
.check-box {
  width: 18px; height: 18px;
  flex: none;
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-well);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.check-box::after {
  content: "";
  width: 9px; height: 9px;
  border-radius: 2px;
  transform: scale(0);
  transition: transform 120ms cubic-bezier(0.4,0,0.2,1);
  background: var(--gradient-brand);
}
.check-box:checked { border-color: var(--border-accent); }
.check-box:checked::after { transform: scale(1); }
.check-box:focus-visible { box-shadow: var(--focus-shadow); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 120ms cubic-bezier(0.4,0,0.2,1), box-shadow 200ms, background 120ms, border-color 120ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--gradient-brand);
  color: var(--text-on-accent);
  box-shadow: var(--glow-md);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(46,224,138,0.18), 0 12px 34px -6px rgba(46,224,138,0.5); text-decoration: none; }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-accent); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); text-decoration: none; }

.form-actions { display: flex; flex-direction: column; gap: 11px; margin-top: 3px; }
.form-actions.row { flex-direction: row; }
.form-actions.row .btn { flex: 1; }

/* ---------- Banners (non-field messages, top of card) ---------- */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 20px;
}
.banner svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.banner strong { font-weight: 600; }
.banner p { margin: 2px 0 0; color: var(--text-secondary); }

.banner-error {
  background: var(--down-soft);
  border-color: rgba(255,95,109,0.32);
  color: var(--down);
}
.banner-error strong { color: #ff8a93; }
.banner-notice {
  background: var(--info-soft);
  border-color: rgba(77,184,255,0.30);
  color: var(--info);
}
.banner-notice strong { color: #8fd0ff; }
.banner-success {
  background: var(--up-soft);
  border-color: var(--border-accent);
  color: var(--accent);
}
.banner-success strong { color: var(--green-400); }

/* ---------- Feature icon (form-less screens) ---------- */
.feature-mark {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: grid;
  place-content: center;
  margin: 0 0 22px;
  background: var(--accent-tint);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  box-shadow: var(--glow-md);
}
.feature-mark svg { width: 28px; height: 28px; }
.feature-mark.is-error {
  background: var(--down-soft);
  border-color: rgba(255,95,109,0.32);
  color: var(--down);
  box-shadow: none;
}

/* address / value chip inside prose */
.value-chip {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface-well);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* turnstile / widget placeholder */
.widget-slot {
  min-height: 65px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.widget-slot:empty { display: none; }

/* ---------- Footer switch line ---------- */
.auth-foot {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.auth-foot a { font-weight: 500; }

.card-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ---------- Responsive: down to 360px ---------- */
@media (max-width: 460px) {
  .auth-page { padding: 40px 16px 32px; }
  .auth-card { padding: 26px 22px 24px; }
  .auth-title { font-size: 23px; }
}
