/* ════════════════════════════════════════════════════════════
   SIQA Auth — "The One Answer" editorial system
   Ink-on-paper to match the landing page. Standalone:
   does NOT require design-system.css or auth.css.
   Left panel = ink (echoes landing CTA/footer),
   right panel = paper with the form.
   ════════════════════════════════════════════════════════════ */

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

:root {
  --paper:       #f5f5fa;
  --paper-deep:  #eaeaf4;
  --paper-card:  #fdfdff;
  --ink:         #14142b;
  --ink-soft:    #45456b;
  --ink-faint:   #7c7c9e;
  --rule:        rgba(20,20,43,.18);
  --rule-soft:   rgba(20,20,43,.09);
  --signal:      #4f46e5;
  --signal-deep: #4338ca;
  --signal-lite: #818cf8;   /* signal on ink */
  --good:        #15803d;
  --bad:         #dc2626;
  --good-soft:   rgba(34,197,94,.1);
  --warn-soft:   rgba(220,38,38,.08);
  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Schibsted Grotesk', 'Helvetica Neue', sans-serif;
  --mono:  'IBM Plex Mono', 'SF Mono', monospace;
  --ease: cubic-bezier(.22,1,.36,1);
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--signal); color: var(--paper); }

/* paper grain over everything */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 5; pointer-events: none;
  opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* legacy dark-theme decorations — retired */
.auth-orbs, .auth-grain { display: none !important; }

a { color: inherit; }

/* ── Layout ───────────────────────────────── */
/* Height is capped to the viewport — neither column may push the
   *page* into scroll. Each column scrolls independently instead, so
   a tall form (e.g. signup) never drags the static branding panel
   into a scroll it doesn't need. */
.auth-page {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr 1fr;
  height: 100vh;
  height: 100dvh;
}
@media (max-width: 768px) {
  .auth-page { grid-template-columns: 1fr; height: auto; min-height: 100vh; min-height: 100dvh; }
  .auth-left { display: none; }
}

/* ── Left panel — ink ─────────────────────── */
.auth-left {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px;
  background: var(--ink);
  color: rgba(245,245,250,.75);
  border-right: 1px solid var(--ink);
  height: 100%;
  overflow-y: auto;
}

/* ── Right panel — paper ──────────────────── */
.auth-right {
  display: flex; align-items: center; justify-content: center;
  align-items: safe center;
  padding: 48px 40px;
  background: var(--paper);
  height: 100%;
  overflow-y: auto;
}
.auth-form-wrap { width: 100%; max-width: 400px; }

/* ── Logo ─────────────────────────────────── */
.auth-logo {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  color: var(--paper); text-decoration: none;
  position: relative; z-index: 1;
}
.auth-logo-mark {
  display: inline-flex; width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-weight: 600; font-size: 19px;
  border-radius: 2px; flex-shrink: 0;
}

/* ── Left panel content ───────────────────── */
.auth-headline {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  font-weight: 400; line-height: 1.15; letter-spacing: -.01em;
  color: var(--paper);
  position: relative; z-index: 1;
}
.auth-headline span {
  font-style: italic; font-weight: 500; color: var(--signal-lite);
  background: none; -webkit-text-fill-color: currentColor;
}
.auth-left p { color: rgba(245,245,250,.65); }

.auth-features {
  list-style: none; display: flex; flex-direction: column; gap: 13px;
  margin-top: 28px; position: relative; z-index: 1;
}
.auth-features li {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; color: rgba(245,245,250,.75);
}
.auth-feat-dot {
  display: inline-flex; width: 20px; height: 20px;
  align-items: center; justify-content: center; flex-shrink: 0;
  background: transparent; border: 1px solid rgba(245,245,250,.3);
  border-radius: 50%;
}
.auth-feat-dot svg { color: var(--signal-lite); }

.auth-footer-copy {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: rgba(245,245,250,.4);
  position: relative; z-index: 1;
}

/* metrics strip (login) */
.auth-metrics {
  display: flex; gap: 28px; padding: 20px 24px;
  background: rgba(245,245,250,.05);
  border: 1px solid rgba(245,245,250,.15);
  border-radius: 2px; margin-bottom: 28px;
  position: relative; z-index: 1;
}
.auth-metric-val {
  font-family: var(--serif); font-size: 24px; font-weight: 400;
  letter-spacing: -.02em; color: var(--paper) !important;
}
.auth-metric-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(245,245,250,.45); margin-top: 3px;
}
.auth-metric-sep { width: 1px; background: rgba(245,245,250,.15); flex-shrink: 0; }

/* testimonial (signup) */
.auth-testimonial {
  border-top: 2px solid rgba(245,245,250,.85);
  padding-top: 20px; margin-bottom: 28px;
  position: relative; z-index: 1;
  background: none; border-left: none; border-right: none; border-bottom: none;
  border-radius: 0;
}
.auth-testimonial-text {
  font-family: var(--serif); font-size: 17px; line-height: 1.55;
  color: rgba(245,245,250,.85); font-style: italic;
}
.auth-testimonial-author { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.auth-testimonial-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--ink);
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.auth-testimonial-name { font-size: 13px; font-weight: 600; color: var(--paper); }
.auth-testimonial-role {
  font-family: var(--mono); font-size: 11px; color: rgba(245,245,250,.45); margin-top: 1px;
}

/* ── Form card ────────────────────────────── */
/* standalone pages (magic link, verification) place the card
   directly in <body> — center it on the paper */
body > .auth-card {
  max-width: 430px;
  margin: max(10vh, 60px) auto 40px;
}
body > .auth-back-link { margin-bottom: 60px; }
.auth-card {
  background: var(--paper-card);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 36px 32px 32px;
  box-shadow: 6px 6px 0 rgba(20,20,43,.12);
  position: relative;
}
.auth-form-logo-mark {
  display: inline-flex; width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper);
  font-family: var(--serif); font-weight: 600; font-size: 22px;
  border-radius: 2px; margin-bottom: 20px;
}
.auth-form-title {
  font-family: var(--serif); font-size: 26px; font-weight: 500;
  letter-spacing: -.01em; color: var(--ink); margin-bottom: 6px;
}
.auth-form-sub { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 26px; line-height: 1.55; }

/* ── Fields ───────────────────────────────── */
.field { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
.field-label {
  display: block;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 7px;
}
.field-label .req { color: var(--bad); }
.domain-hint, .auth-field-sep { font-size: 12px; color: var(--ink-faint); }
.auth-field-sep {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 14px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
}
.auth-field-sep::before, .auth-field-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--rule-soft);
}
.input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  font-size: 14px; font-family: var(--mono);
  outline: none;
  transition: border-color .15s, background .15s;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { border-color: var(--ink); background: var(--paper-card); }
.input:focus-visible {
  border-color: var(--ink);
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* password toggle */
.auth-input-wrap { position: relative; }
.auth-input-wrap .input { padding-right: 42px; }
.auth-pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 2px;
  color: var(--ink-faint); cursor: pointer;
  transition: color .15s;
}
.auth-pw-toggle:hover { color: var(--ink); background: var(--paper-deep); }
.auth-pw-toggle:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }

/* remember / forgot */
.auth-remember-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.auth-checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.auth-checkbox-label input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 15px; height: 15px; border-radius: 2px;
  border: 1px solid var(--rule); background: var(--paper-card);
  cursor: pointer; flex-shrink: 0; transition: all .15s;
}
.auth-checkbox-label input[type="checkbox"]:checked {
  background: var(--ink); border-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23f5f5fa' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 10px;
}
.auth-checkbox-label span { font-size: 13px; color: var(--ink-soft); }
.auth-forgot-link {
  font-size: 13px; color: var(--signal-deep); font-weight: 500;
  text-decoration: none; border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.auth-forgot-link:hover { border-bottom-color: var(--signal-deep); }

.auth-terms { font-size: 12px; color: var(--ink-faint); line-height: 1.6; margin-bottom: 18px; }
.auth-terms a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.auth-terms a:hover { color: var(--ink); }

/* ── Buttons ──────────────────────────────── */
.auth-btn {
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--mono); font-size: 13.5px; font-weight: 500; letter-spacing: .02em;
  border-radius: 2px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  position: relative;
  transition: transform .18s var(--ease), background .18s, color .18s, border-color .18s, box-shadow .18s;
}
.auth-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.auth-btn[disabled], .auth-btn[aria-busy="true"] {
  opacity: .6; cursor: not-allowed; transform: none !important;
}

.auth-btn--primary {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
  box-shadow: 3px 3px 0 rgba(20,20,43,.18);
}
.auth-btn--primary::before { content: none; }
.auth-btn--primary:hover {
  background: var(--signal-deep); border-color: var(--signal-deep);
  transform: translate(-1px,-1px);
  box-shadow: 4px 4px 0 rgba(20,20,43,.22);
}
.auth-btn--primary:active { transform: translate(0,0); box-shadow: 2px 2px 0 rgba(20,20,43,.18); }

.auth-btn--ghost {
  background: transparent; border-color: var(--rule); color: var(--ink);
}
.auth-btn--ghost:hover { border-color: var(--ink); background: var(--paper-card); transform: none; }

.auth-btn--sm { width: auto; height: 38px; padding: 0 16px; font-size: 12px; }

.auth-btn__glyph { flex-shrink: 0; line-height: 0; }
.auth-btn__spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(127,127,127,.35); border-top-color: currentColor;
  border-radius: 50%;
  animation: authSpin .6s linear infinite;
  display: none;
}
.auth-btn[aria-busy="true"] .auth-btn__spinner { display: inline-block; }
.auth-btn[aria-busy="true"] .auth-btn__label,
.auth-btn[aria-busy="true"] .auth-btn__glyph { display: none; }
@keyframes authSpin { to { transform: rotate(360deg); } }

/* .btn used by password-reset pages */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--mono); font-size: 13.5px; font-weight: 500;
  border-radius: 2px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .18s var(--ease), background .18s, border-color .18s, box-shadow .18s;
}
.btn-primary {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
  box-shadow: 3px 3px 0 rgba(20,20,43,.18);
  height: 46px;
}
.btn-primary:hover {
  background: var(--signal-deep); border-color: var(--signal-deep);
  transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(20,20,43,.22);
}

/* ── Divider ──────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 16px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--rule-soft);
}

/* ── Alerts ───────────────────────────────── */
.auth-msg {
  font-size: 13px; line-height: 1.5;
  padding: 11px 14px; border-radius: 2px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
}
.auth-msg--success { background: var(--good-soft); border: 1px solid var(--good); color: var(--good); }
.auth-msg--error   { background: var(--warn-soft); border: 1px dashed var(--bad); color: var(--bad); }
.auth-msg--info    { background: var(--paper-deep); border: 1px solid var(--rule); color: var(--ink-soft); }

/* ── Password strength ────────────────────── */
.password-strength-bar {
  display: flex; gap: 5px; margin-top: 8px;
}
.password-strength-bar span {
  flex: 1; height: 3px; border-radius: 0;
  background: var(--rule-soft);
  transition: background .25s;
}
.password-strength-hint {
  font-family: var(--mono); font-size: 11px; margin-top: 6px; min-height: 14px;
}

/* ── Footer links ─────────────────────────── */
.auth-link-row { text-align: center; font-size: 13px; color: var(--ink-soft); }
.auth-link-row a {
  color: var(--signal-deep); font-weight: 600; text-decoration: none;
  border-bottom: 1px solid transparent; transition: border-color .15s;
}
.auth-link-row a:hover { border-bottom-color: var(--signal-deep); }
.auth-back-link {
  display: block; text-align: center; margin-top: 18px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
  color: var(--ink-faint); text-decoration: none; transition: color .15s;
}
.auth-back-link:hover { color: var(--ink); }

/* resend-verification divider area (login) */
.auth-resend-sep { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule-soft); }

/* ── Mobile proof strip ───────────────────── */
.auth-mobile-proof { display: none; }
@media (max-width: 768px) {
  .auth-mobile-proof {
    display: flex; align-items: center; justify-content: center;
    gap: 24px; margin-bottom: 18px; padding: 14px 16px;
    background: var(--paper-card); border: 1px solid var(--rule);
    border-radius: 2px; flex-wrap: wrap;
  }
  .auth-mobile-proof .mp-item { text-align: center; }
  .auth-mobile-proof .mp-val {
    font-family: var(--serif); font-size: 17px; font-weight: 500;
    color: var(--ink) !important; letter-spacing: -.02em;
  }
  .auth-mobile-proof .mp-label {
    font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--ink-faint);
  }
}

/* ── Icon circles on confirmation pages ───── */
.icon-wrap, .success-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--good-soft); border: 1px solid var(--good);
  color: var(--good); margin-bottom: 18px;
}

/* sr-only helper */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .auth-btn__spinner { animation-duration: 1.4s !important; }
}

/* ── Compact rhythm on short viewports ──────
   Tightens vertical spacing so login (and other lighter forms) fit
   a typical laptop screen with zero scrolling. Content-heavy forms
   (signup) may still scroll within .auth-right — that's the panel's
   own overflow, not the page's. */
@media (max-height: 860px) {
  .auth-left { padding: 32px 40px; }
  .auth-features { margin-top: 16px; gap: 9px; }
  .auth-testimonial { padding-top: 14px; margin-bottom: 16px; }
  .auth-metrics { padding: 14px 18px; margin-bottom: 16px; }
  .auth-right { padding: 24px 40px; }
  .auth-card { padding: 26px 28px 22px; }
  .auth-form-logo-mark { margin-bottom: 12px; }
  .auth-form-title { margin-bottom: 4px; }
  .auth-form-sub { margin-bottom: 16px; }
  .field { margin-bottom: 12px; }
  .auth-remember-row { margin-bottom: 12px; }
  .auth-terms { margin-bottom: 12px; }
  .auth-btn { height: 44px; }
  .auth-divider { margin: 12px 0 10px; }
  .auth-btn--ghost { margin-bottom: 6px !important; }
  .auth-link-row { margin-top: 10px !important; }
  .auth-resend-sep { padding-top: 10px; }
  .auth-back-link { margin-top: 10px; }
}

@media (max-height: 740px) {
  .auth-right { padding: 12px 40px; }
  .auth-card { padding: 16px 24px 14px; }
  .auth-form-logo-mark { width: 32px; height: 32px; font-size: 16px; margin-bottom: 8px; }
  .auth-form-title { font-size: 21px; }
  .auth-form-sub { margin-bottom: 10px; }
  .input { height: 40px; }
  .field { margin-bottom: 8px; }
  .auth-remember-row { margin-bottom: 8px; }
  .auth-terms { font-size: 11px; line-height: 1.45; margin-bottom: 8px; }
  .auth-btn { height: 40px; }
  .auth-divider { margin: 8px 0; }
  .auth-btn--ghost { margin-bottom: 4px !important; }
  .auth-link-row { margin-top: 6px !important; }
  .auth-resend-sep { padding-top: 6px; }
  .auth-back-link { margin-top: 6px; }
}
