/* ═══════════════════════════════════════════════════════════════════════
   auth.css — JagChess sign in / create account
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* the homepage's system (welcome.css): ink does "primary", colour means
     something — coral meetings, iris puzzles, sky games, mint points */
  --ink:        #1a1d24;
  --ink-hi:     #2c303a;
  --green:      #18bf86;
  --green-dark: #0a8a5e;
  --green-soft: #e3fbf1;
  --blue:       #2d8cff;
  --blue-dark:  #1a6fd6;
  --blue-soft:  #eaf3ff;
  --gold:       #e9a93a;
  --orange:     #ff6a4d;
  --iris:       #6e5bff;
  --red:        #ef4444;
  --red-dark:   #c62828;
  --red-soft:   #feeceb;
  --bg:         #ffffff;
  --bg-alt:     #f3f5f9;
  --border:     #e8ebf0;
  --border-2:   #dde1e8;
  --text:       #1a1d24;
  --text-2:     #4a5160;
  --muted:      #7b8394;

  --font:    'Geist', ui-sans-serif, -apple-system, 'Segoe UI', sans-serif;
  --font-ui: 'Geist', ui-sans-serif, -apple-system, 'Segoe UI', sans-serif;
  --ease:    cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { font-family: var(--font); font-weight: 650; letter-spacing: -0.04em; margin: 0; }
a { color: var(--blue-dark); text-decoration: none; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; border-radius: 10px; }

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── LEFT: BRAND PANEL ──────────────────────────────────────────────── */

/* an inset card of soft colour, with the six pieces from the homepage
   standing along the bottom */
.auth-brand {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin: 14px 0 14px 14px;
  padding: 36px 48px 0;
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f7f8fb, #eef1f7);
  color: var(--text);
}
.auth-brand::before, .auth-brand::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.auth-brand::before {
  width: 70%; height: 60%; left: -20%; top: -15%;
  background: radial-gradient(closest-side, rgba(255,217,154,.75), transparent);
}
.auth-brand::after {
  width: 70%; height: 60%; right: -25%; top: 25%;
  background: radial-gradient(closest-side, rgba(188,216,255,.8), transparent);
}

.ab-logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); align-self: flex-start; }
.ab-logo .brand-word, .auth-logo .brand-word { font: 700 18px/1 var(--font); letter-spacing: -0.035em; color: var(--text); }
.brand-mark-img { width: 30px; height: 30px; display: block; }

.ab-body { margin: auto 0 0; padding: 40px 0 8px; }
.ab-body h1 {
  font-size: clamp(36px, 3.8vw, 56px);
  line-height: .98;
  letter-spacing: -0.05em;
  margin-bottom: 18px;
  max-width: 12ch;
}
.ab-body p {
  font-size: 17px;
  color: var(--text-2);
  max-width: 38ch;
  margin: 0 0 26px;
}

.ab-points { display: grid; gap: 11px; }
.ab-point { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; color: var(--text); }
.ab-point i {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent);
}

.ab-lineup { position: relative; margin: 8px -48px 0; height: clamp(170px, 20vw, 240px); }
.ab-lineup canvas { width: 100%; height: 100%; display: block; }

.ab-foot {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 0 26px;
}
.ab-foot a { color: var(--text-2); }
.ab-foot a:hover { color: var(--text); }

/* ── RIGHT: FORM PANEL ──────────────────────────────────────────────── */

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--bg);
}

.auth-card { width: 100%; max-width: 412px; }

/* The brand panel already shows the wordmark on a wide screen, so this one
   waits for the width where that panel is dropped and the form is all that
   is left — the page should never carry two of them at once. */
.auth-logo { display: none; margin-bottom: 22px; align-items: center; gap: 9px; color: var(--text); }

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 26px;
  transition: color .16s;
}
.auth-back:hover { color: var(--text); }
.auth-back svg { width: 16px; height: 16px; }

.auth-head { margin-bottom: 24px; }
.auth-head h2 { font-size: 34px; margin-bottom: 6px; }
.auth-head p { margin: 0; font-size: 15px; color: var(--text-2); }

/* tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  margin-bottom: 26px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 550;
  color: var(--text-2);
  cursor: pointer;
  transition: background .22s var(--ease), color .22s, box-shadow .22s;
}
.auth-tab.on {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(26,29,36,.08), 0 4px 12px -4px rgba(26,29,36,.12);
}

/* form */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
  margin-bottom: 7px;
}
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-row a { font-family: var(--font); font-size: 13px; font-weight: 550; }

.input-wrap { position: relative; }
.input-wrap > svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: var(--muted);
  pointer-events: none;
  transition: color .18s;
}
.input-wrap:focus-within > svg { color: var(--blue); }

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(26,29,36,.04);
  padding: 14px 15px 14px 46px;
  font-family: var(--font-ui);
  font-size: 15px;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
input::placeholder { color: #a6adba; }
input:hover { border-color: var(--border-2); }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(45,140,255,.18); }
input.bad { border-color: var(--red); box-shadow: 0 0 0 4px rgba(239,68,68,.14); }

.peek {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .16s, color .16s;
}
.peek:hover { background: var(--bg-alt); color: var(--text); }
.peek svg { width: 19px; height: 19px; }

/* password strength */
.strength { display: flex; align-items: center; gap: 9px; margin-top: 10px; }
.strength-bars { display: flex; gap: 4px; flex: 1; }
.strength-bars i {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  transition: background .3s var(--ease);
}
.strength-label {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 54px;
  text-align: right;
}
.strength[data-level="1"] .strength-bars i:nth-child(-n+1) { background: var(--red); }
.strength[data-level="2"] .strength-bars i:nth-child(-n+2) { background: var(--orange); }
.strength[data-level="3"] .strength-bars i:nth-child(-n+3) { background: var(--gold); }
.strength[data-level="4"] .strength-bars i { background: var(--green); }
.strength[data-level="1"] .strength-label { color: var(--red-dark); }
.strength[data-level="2"] .strength-label { color: #b96b00; }
.strength[data-level="3"] .strength-label { color: #b08800; }
.strength[data-level="4"] .strength-label { color: var(--green-dark); }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  margin-bottom: 20px;
}
.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* buttons */
.btn3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 15px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 2px rgba(26,29,36,.2), 0 10px 24px -12px rgba(26,29,36,.6);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .18s, opacity .18s;
}
.btn3d:hover:not(:disabled) { background: var(--ink-hi); }
.btn3d:active:not(:disabled) { transform: scale(.98); }
.btn3d:disabled { opacity: .6; cursor: not-allowed; }

.btn3d.white {
  background: #fff;
  color: var(--text);
  border-color: var(--border-2);
  box-shadow: 0 1px 2px rgba(26,29,36,.05);
}
.btn3d.white:hover:not(:disabled) { background: var(--bg-alt); }
.btn3d svg { width: 19px; height: 19px; }

.spin {
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.or::before, .or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* alerts */
.alert {
  display: none;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
  animation: alert-in .28s var(--ease) both;
}
.alert.show { display: flex; }
.alert svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 1px; }
.alert.error { background: var(--red-soft); color: var(--red-dark); }
.alert.ok { background: var(--green-soft); color: var(--green-dark); }
@keyframes alert-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.auth-swap {
  margin-top: 22px;
  text-align: center;
  font-size: 14.5px;
  color: var(--text-2);
}
.auth-swap button {
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.auth-swap button:hover { text-decoration: underline; }

.legal { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* pane transitions */
.pane { display: none; }
.pane.on { display: block; animation: pane-in .34s var(--ease) both; }
@keyframes pane-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── MODALS ─────────────────────────────────────────────────────────── */

.acct-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(244,246,250,.6);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.acct-modal.show { display: grid; }
.acct-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: 0 30px 70px -22px rgba(26,29,36,.32);
  animation: alert-in .3s var(--ease) both;
}
.acct-card .acct-ico {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: var(--red-soft);
}
.acct-card h3 { font-size: 21px; margin-bottom: 10px; }
.acct-card p { font-size: 14.5px; color: var(--text-2); margin: 0 0 24px; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { padding: 40px 24px; align-items: flex-start; }
  .auth-card { padding-top: 20px; }
  .auth-logo { display: flex; width: max-content; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
