/*
  auth.css
  ────────
  Visual language for the standalone pre-auth surfaces (sign_up, sign_in).
  Sibling of splash.css: it adopts the SAME token set and the same idioms
  — cool blue-grey mat, paper cards, teal accent, DM Mono body, Fraunces
  italic display — so splash → sign-up → sign-in read as one system.

  Token values are copied from splash.css verbatim. The system currently
  redeclares its tokens per standalone stylesheet (splash does the same);
  the proper single-source fix is a shared /ui/tokens.css that splash,
  workbench, and these pages all link. Until then these MUST stay in step
  with splash.css.
*/

:root {
  --ink:         #1a2332;
  --paper:       #e9edf0;   /* card surface             */
  --warm:        #c6d5e0;   /* strip / inset surface    */
  --warm-deep:   #b8ccda;   /* page mat                 */
  --rule:        #a8bfce;   /* borders                  */
  --muted:       #5a7a8a;   /* secondary text on paper  */
  --muted-strong:#3d5663;   /* secondary text on the warm mat (contrast) */
  --accent:      #206d6e;   /* the single accent — teal */
  --accent-soft: rgba(32, 109, 110, 0.15);
  --header-bg:   #2d3748;   /* primary button fill      */
  --header-hover:#222b37;
  --field-bg:    #ffffff;
  --ok:          #206d6e;
  --ok-soft:     rgba(32, 109, 110, 0.10);
  --err:         #a23b2f;
  --err-soft:    rgba(162, 59, 47, 0.10);
  --pending:     #8a6d1f;
  --pending-soft: rgba(138, 109, 31, 0.12);

  --display: 'Fraunces', Georgia, serif;
  --mono:    'DM Mono', ui-monospace, monospace;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 8px 40px rgba(28, 26, 23, 0.12), 0 0 0 1px rgba(28, 26, 23, 0.05);
}

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

html, body {
  min-height: 100vh;
  font-family: var(--mono);
  background: var(--warm-deep);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Shell ─────────────────────────────────────────────────────────────── */

.auth-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) clamp(20px, 5vw, 40px) 56px;
}

.auth-head { margin-bottom: 26px; }

.auth-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-eyebrow::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--accent);
  display: inline-block;
}

.auth-title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 300;
  font-size: clamp(26px, 4.6vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.005em;
  margin: 16px 0 0;
  color: var(--ink);
}
.auth-title em { font-style: italic; font-weight: 200; color: var(--ink); }

.auth-subhead {
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--muted-strong);
  margin: 12px 0 0;
  max-width: 56ch;
}

/* ── Card ──────────────────────────────────────────────────────────────── */

.auth-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 3.5vw, 32px);
}

/* ── Fields ────────────────────────────────────────────────────────────── */

.field { margin-bottom: 15px; }

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field .optional { color: var(--rule); }

.field input {
  width: 100%;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: var(--muted); opacity: 0.6; }
.field input:hover { border-color: var(--muted); }
.field input:focus-visible,
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input.mono { text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  height: 42px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background: var(--header-bg);
  color: var(--paper);
  border-color: var(--header-bg);
  width: 100%;
}
.btn--primary:hover { background: var(--header-hover); border-color: var(--header-hover); }
.btn--primary:disabled {
  background: var(--warm);
  border-color: var(--rule);
  color: var(--muted);
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--rule);
}
.btn--ghost:hover { border-color: var(--muted); color: var(--ink); }

.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Banners ───────────────────────────────────────────────────────────── */

.banner {
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
}
.banner--error   { background: var(--err-soft);     color: var(--err);
                   border: 1px solid rgba(162,59,47,0.22); }
.banner--ok      { background: var(--ok-soft);      color: var(--accent);
                   border: 1px solid rgba(32,109,110,0.22); }
.banner--pending { background: var(--pending-soft);  color: var(--pending);
                   border: 1px solid rgba(138,109,31,0.30); }

/* ── Footer links ──────────────────────────────────────────────────────── */

.auth-foot {
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.auth-foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.auth-foot a:hover { color: var(--ink); border-bottom-color: var(--ink); }

.auth-request {
  margin-top: 13px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-request a {
  color: var(--muted-strong);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule);
}
.auth-request a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ═══════════════════ sign_up page ═══════════════════ */

.signup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(14px, 2.5vw, 24px);
  align-items: start;
}
@media (max-width: 840px) {
  .signup-grid { grid-template-columns: 1fr; }
}

.chosen {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--warm);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 4px 0 16px;
}
.chosen[data-empty="true"] { color: var(--muted); opacity: 0.8; }
.chosen strong { color: var(--ink); font-weight: 500; }

.offers-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.offer-list { display: flex; flex-direction: column; gap: 9px; }

.offer-card {
  text-align: left;
  font-family: var(--mono);
  background: var(--field-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name price" "desc desc";
  gap: 5px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.offer-card:hover { border-color: var(--muted); }
.offer-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.offer-card[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  background: #fff;
}

.offer-name {
  grid-area: name;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.offer-price {
  grid-area: price;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
  align-self: center;
}
.offer-price--free { color: var(--accent); }
.offer-desc {
  grid-area: desc;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}

.offers-empty {
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
}

.offer-detail {
  margin-top: 16px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}
.offer-detail-name {
  font-family: var(--display);
  font-weight: 400;
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 6px;
}
.offer-detail-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}

.detail-block { margin-bottom: 13px; }
.detail-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.detail-obl { font-size: 12px; color: var(--ink); line-height: 1.55; margin: 0; }

.scope { display: flex; flex-wrap: wrap; gap: 6px; }
.scope-chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(32, 109, 110, 0.25);
  border-radius: 4px;
  padding: 3px 8px;
}

.detail-terms {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border-top: 1px solid var(--rule);
  padding-top: 11px;
}
.terms-ref { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── Outcome screens (free confirmation / paid) ────────────────────────── */

.outcome { max-width: 560px; }
.outcome-title {
  font-family: var(--display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(24px, 4vw, 32px);
  color: var(--ink);
  margin: 16px 0 10px;
  line-height: 1.2;
}
.outcome-body {
  font-size: 13px;
  color: var(--muted-strong);
  line-height: 1.7;
  margin: 0 0 22px;
  max-width: 52ch;
}

.outcome-offer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 22px;
  max-width: 460px;
}
.outcome-offer-name { font-weight: 500; color: var(--ink); font-size: 13px; }
.outcome-offer-price { font-family: var(--mono); font-size: 12px; color: var(--accent); }

.outcome-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-top: 14px;
  line-height: 1.6;
}
.outcome-note a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent); }
.outcome-note a:hover { color: var(--ink); border-bottom-color: var(--ink); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 8px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════ sign_in page ═══════════════════ */

.signin-wrap { max-width: 400px; }
.signin-card { margin-top: 4px; }
.signin-card .btn--primary { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
