/* ============================================================
   Project R — Authentication surfaces
   Dark-primary. Tokens bound from the Project R design system.
   Saturated color is rationed to: review STATUS, the primary
   action, and the focus ring. Everything else is tinted neutral.
   ============================================================ */

:root {
  /* Brand ramp */
  --ds-brand-400: #6285FF;
  --ds-brand-500: #2E5BFF;
  --ds-brand-600: #1F46E0;
  --ds-brand-700: #1735B0;

  /* Neutral ramp */
  --ds-n-0:  #FFFFFF;
  --ds-n-50: #F7F8FA;
  --ds-n-200:#E1E5EC;
  --ds-n-300:#CBD2DC;
  --ds-n-400:#9AA3B2;
  --ds-n-500:#6B7280;
  --ds-n-600:#4B5563;
  --ds-n-700:#374151;
  --ds-n-800:#1F2937;
  --ds-n-900:#111827;
  --ds-n-950:#0A0F1A;

  /* Semantic roles — DARK (primary) */
  --bg-canvas:  var(--ds-n-950);
  --bg-surface: var(--ds-n-900);
  --bg-raised:  var(--ds-n-800);
  --bg-muted:   var(--ds-n-800);

  --text-primary:   var(--ds-n-50);
  --text-secondary: var(--ds-n-200);
  --text-muted:     var(--ds-n-400);
  --text-brand:     var(--ds-brand-400);

  --border-subtle:  var(--ds-n-800);
  --border-default: var(--ds-n-700);
  --border-strong:  var(--ds-n-600);
  --border-focus:   var(--ds-brand-400);

  --accent-bg:       var(--ds-brand-500);
  --accent-bg-hover: var(--ds-brand-400);

  /* Feedback */
  --fb-success: #34D399;
  --fb-warning: #FBBF24;
  --fb-danger:  #F87171;
  --fb-info:    #60A5FA;
  --fb-violet:  #A78BFA;

  /* Spacing (4px base) */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px; --s6:24px; --s8:32px; --s10:40px; --s12:48px;

  /* Radius */
  --r-sm:4px; --r-md:6px; --r-lg:8px; --r-xl:12px; --r-2xl:16px; --r-full:999px;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(0,0,0,.40);
  --shadow-2: 0 2px 6px rgba(0,0,0,.45);
  --shadow-3: 0 8px 24px rgba(0,0,0,.45);
  --shadow-4: 0 16px 48px rgba(0,0,0,.55);
  --shadow-focus: 0 0 0 3px rgba(98,133,255,.45);

  /* Type */
  --font-sans: "Inter var", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(.2,0,0,1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
}

/* ---------- Base ---------- */
*,*::before,*::after { box-sizing: border-box; }
html,body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "tnum","ss01";
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--text-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--r-sm); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ============================================================
   Split shell
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

/* ---------- Left: product showcase ---------- */
.showcase {
  position: relative;
  overflow: hidden;
  padding: var(--s10) clamp(var(--s8), 4.5vw, 64px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s8);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
}
/* one decisive flourish: a single low-opacity brand glow, not a wash */
.showcase::before {
  content: "";
  position: absolute;
  width: 560px; height: 560px;
  top: -180px; right: -160px;
  background: radial-gradient(circle at center, rgba(46,91,255,.22), transparent 62%);
  filter: blur(8px);
  pointer-events: none;
}
.showcase > * { position: relative; z-index: 1; }

.showcase-head { display: flex; align-items: center; gap: var(--s3); }
.showcase-tag {
  align-self: center;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  /* let the centered band shrink + scroll on short viewports instead of
     overflowing the clipped showcase and cropping the footer */
  min-height: 0;
  overflow-y: auto;
}
.showcase-tag .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* visual heading only — rendered as a non-heading element so the form's
   <h1> remains the first heading in the document outline */
.showcase-tag .sc-title {
  margin: var(--s4) 0 0;
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text-primary);
  text-wrap: balance;
}
.showcase-tag p {
  margin: var(--s4) 0 0;
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 44ch;
}

/* review feed demo */
.feed { margin-top: var(--s8); display: flex; flex-direction: column; gap: var(--s4); width: 100%; }
.feed-label {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing:.06em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s1);
}
.asset-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  transition: border-color var(--dur-fast) var(--ease);
  opacity: 0;
  transform: translateY(8px);
  animation: rise .5s var(--ease) forwards;
}
.asset-row:hover { border-color: var(--border-default); }
.asset-row:nth-child(2){ animation-delay:.06s } .asset-row:nth-child(3){ animation-delay:.12s }
.asset-row:nth-child(4){ animation-delay:.18s } .asset-row:nth-child(5){ animation-delay:.24s }
@keyframes rise { to { opacity:1; transform:none } }
.asset-fmt {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
}
.asset-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.asset-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.showcase-foot {
  display: flex; align-items: center; gap: var(--s5);
  font-size: 13px; color: var(--text-muted);
}
.showcase-foot .dot { width:4px; height:4px; border-radius:50%; background: var(--border-strong); }

/* ---------- Right: form panel ---------- */
.panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s10) var(--s6);
  background: var(--bg-canvas);
}
.card {
  width: 100%;
  max-width: 408px;
}
.card-head { margin-bottom: var(--s8); }
.card-head .brand-inline { display: none; }
.card h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.card-head p {
  margin: var(--s3) 0 0;
  font-size: 15px;
  color: var(--text-muted);
}

/* ============================================================
   Brand mark
   ============================================================ */
.brand { display: inline-flex; align-items: center; gap: var(--s3); }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--ds-brand-500), var(--ds-brand-700));
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 17px;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,.22);
  flex: none;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.brand-mark.lg { width: 44px; height: 44px; font-size: 20px; }

/* ============================================================
   Form fields
   ============================================================ */
.field { display: block; margin-bottom: var(--s5); }
.field-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  margin-bottom: var(--s2);
}
.field-label a { font-size: 13px; font-weight: 500; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--s4);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--text-muted); }
.input:hover { border-color: var(--border-strong); }
.input:focus-visible { border-color: var(--border-focus); box-shadow: var(--shadow-focus); }
.input.has-icon { padding-left: 42px; }
.input.has-trail { padding-right: 44px; }
.input-icon {
  position: absolute; left: var(--s4); top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; display: grid; place-items: center;
}
.input-trail {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-muted); border-radius: var(--r-sm);
  display: grid; place-items: center;
}
.input-trail:hover { color: var(--text-secondary); }

.input.error { border-color: var(--fb-danger); }
.input.error:focus-visible { box-shadow: 0 0 0 3px rgba(248,113,113,.35); }
.help { margin-top: var(--s2); font-size: 12px; color: var(--text-muted); }
.error-msg {
  margin-top: var(--s2); font-size: 12px; color: var(--fb-danger);
  display: none; align-items: center; gap: 6px;
}
.error-msg.show { display: flex; }

/* password strength */
.strength { margin-top: var(--s3); display: none; }
.strength.show { display: block; }
.strength-bars { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.strength-bars span {
  height: 4px; border-radius: var(--r-full); background: var(--bg-raised);
  transition: background var(--dur-base) var(--ease);
}
.strength-label { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.strength[data-level="1"] span:nth-child(-n+1),
.strength[data-level="2"] span:nth-child(-n+2),
.strength[data-level="3"] span:nth-child(-n+3),
.strength[data-level="4"] span:nth-child(-n+4) { background: var(--accent-bg); }
.strength[data-level="1"] span:nth-child(-n+1){ background: var(--fb-danger) }
.strength[data-level="2"] span:nth-child(-n+2){ background: var(--fb-warning) }
.strength[data-level="3"] span:nth-child(-n+3){ background: var(--fb-info) }
.strength[data-level="4"] span:nth-child(-n+4){ background: var(--fb-success) }

/* checkbox */
.check { display: inline-flex; align-items: flex-start; gap: var(--s2); cursor: pointer; font-size: 13px; color: var(--text-secondary); user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 18px; height: 18px; flex: none; margin-top: 1px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-surface); display: grid; place-items: center;
  transition: all var(--dur-fast) var(--ease);
}
.check .box svg { opacity: 0; transform: scale(.6); transition: all var(--dur-fast) var(--ease); color:#fff; }
.check input:checked + .box { background: var(--accent-bg); border-color: var(--accent-bg); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { box-shadow: var(--shadow-focus); }

/* split variant: control sits in its own <label>, text (with links) is a
   sibling so anchors are never nested inside a label element */
.check-split { display: inline-flex; align-items: flex-start; gap: var(--s2); }
.check-split .check-hit { display: inline-flex; flex: none; margin-top: 1px; cursor: pointer; }
.check-split .check-text { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 44px; padding: 0 var(--s5);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  border-radius: var(--r-md); border: 1px solid transparent; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(.5px); }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-loading { cursor: not-allowed; opacity: .7; }

.btn-primary {
  color: #fff;
  background: var(--accent-bg);
  border-color: var(--ds-brand-700);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { background: var(--accent-bg-hover); }

.btn-secondary {
  color: var(--text-primary);
  background: var(--bg-surface);
  border-color: var(--border-default);
  box-shadow: var(--shadow-1);
}
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--border-strong); }

.btn-ghost { color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); }

.btn .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: none;
}
.btn.is-loading .spin { display: inline-block; }
.btn.is-loading .btn-text { opacity: .9; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-google .spin { border-color: rgba(255,255,255,.25); border-top-color: var(--text-secondary); }

/* ============================================================
   Divider
   ============================================================ */
.divider {
  display: flex; align-items: center; gap: var(--s4);
  margin: var(--s6) 0;
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 500;
}
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--border-subtle); }

/* ============================================================
   SSO / Google button mark
   ============================================================ */
.g-mark { width: 18px; height: 18px; flex: none; }

/* ============================================================
   Status badge — bound vocabulary (used in showcase)
   ============================================================ */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.status-badge svg { width: 12px; height: 12px; }
.st-in_review     { color: var(--fb-warning); background: rgba(245,158,11,.13); }
.st-looks_good    { color: var(--fb-success); background: rgba(16,185,129,.14); }
.st-needs_changes { color: var(--fb-danger);  background: rgba(239,68,68,.14); }
.st-commented     { color: var(--fb-violet);  background: rgba(139,92,246,.15); }
.st-awaiting      { color: var(--text-muted); background: rgba(154,163,178,.12); }

/* ============================================================
   Verify-email: code input + resend
   ============================================================ */
.code-row { display: flex; gap: var(--s3); justify-content: space-between; }
.code-cell {
  width: 100%; height: 56px;
  text-align: center;
  font-family: var(--font-mono); font-size: 22px; font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.code-cell:focus-visible { border-color: var(--border-focus); box-shadow: var(--shadow-focus); }
.code-cell.filled { border-color: var(--border-strong); }
.code-cell.error { border-color: var(--fb-danger); }

.resend { margin-top: var(--s6); font-size: 13px; color: var(--text-muted); text-align: center; }
.resend button { border: 0; background: none; color: var(--text-brand); font-weight: 500; cursor: pointer; font-size: 13px; padding: 0; font-family: inherit; }
.resend button[disabled] { color: var(--text-muted); cursor: not-allowed; }

/* mail icon badge for success states */
.mailmark {
  width: 64px; height: 64px; border-radius: var(--r-2xl);
  display: grid; place-items: center; margin-bottom: var(--s6);
  background: rgba(46,91,255,.12);
  border: 1px solid rgba(46,91,255,.3);
  color: var(--text-brand);
}

/* ============================================================
   Footer / legal
   ============================================================ */
.card-foot { margin-top: var(--s8); font-size: 14px; color: var(--text-muted); }
.legal { margin-top: var(--s8); font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.legal a { color: var(--text-secondary); }

/* generic stacks */
.stack-sm > * + * { margin-top: var(--s3); }

/* ============================================================
   Responsive — hide showcase below 900px
   ============================================================ */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .showcase { display: none; }
  .panel { padding: var(--s8) var(--s5); align-items: flex-start; }
  .card { max-width: 440px; margin: 0 auto; padding-top: var(--s6); }
  .card-head .brand-inline { display: flex; margin-bottom: var(--s6); }
}
@media (max-width: 420px) {
  .card h1 { font-size: 25px; }
  .code-cell { height: 48px; font-size: 19px; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .asset-row { opacity: 1; transform: none; }
}
