/* Login page. Same paper, ink and team colors as landing.css. */

:root {
  color-scheme: light;

  --bg: #f6f3ec;
  --bg-2: #ede8dc;
  --surface: #ffffff;
  --ink: #0e0e10;
  --ink-2: #45454d;
  --ink-3: #5e5e66;
  --line: rgba(14, 14, 16, 0.1);
  --line-strong: rgba(14, 14, 16, 0.24);
  --primary: #0e0e10;
  --primary-hover: #2a2a30;
  --on-primary: #f6f3ec;
  --accent: #4635d8;
  --accent-soft: #eeebff;
  --accent-ink: #4635d8;
  --focus: #4635d8;
  --shadow-float: 0 1px 2px rgba(14, 14, 16, 0.06), 0 40px 80px -30px rgba(14, 14, 16, 0.36);
  --shadow-card: 0 1px 2px rgba(14, 14, 16, 0.05), 0 14px 34px -16px rgba(14, 14, 16, 0.22);

  --font: Vazirmatn, Tahoma, system-ui, sans-serif;
  --radius-btn: 999px;
  --radius-field: 14px;
  --radius-card: 28px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-soft: ease;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --grain: 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.05 0 0 0 0 0.06 0 0 0 0.3 -0.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg) var(--grain);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 16px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--narrow { max-width: 820px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-btn);
  font: inherit;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn--lg { min-height: 56px; padding: 0 30px; font-size: 18px; }

.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-hover); }

.btn--outline { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn--outline:hover { border-color: var(--ink); }

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

.btn--light { background: #ffffff; color: var(--ink); }
.btn--light:hover { background: var(--bg); }

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
}
.brand__mark {
  display: block;
  width: 24px;
  height: 30px;
  flex: none;
}

/* Top bar */
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

/* Sticky header: transparent at the top, frosted with a hairline after scrolling. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s var(--ease-soft), border-color 0.25s var(--ease-soft), backdrop-filter 0.25s var(--ease-soft);
}

.topbar[data-scrolled] {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--line);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar[data-scrolled] { background: color-mix(in srgb, var(--bg) 95%, transparent); }
}


/* ==========================================================================
   Login page (login.html). Scoped to .auth-* so the landing page is unaffected.
   ========================================================================== */

.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.auth {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(24px, 6vw, 72px) var(--gutter) clamp(48px, 8vw, 96px);
  position: relative;
  isolation: isolate;
  overflow: clip;
  /* Centred low enough to fade out before the top edge (no seam under the header). */
  background: radial-gradient(50% 42% at 50% 38%, rgba(124, 108, 255, 0.18), transparent 72%);
}

/* Halftone discs, as on the landing. */
.auth::before,
.auth::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background-image: radial-gradient(var(--ink) 1.1px, transparent 1.5px);
  background-size: 7px 7px;
  opacity: 0.14;
  -webkit-mask-image: radial-gradient(circle at 35% 35%, #000 0, rgba(0, 0, 0, 0.55) 38%, transparent 70%);
  mask-image: radial-gradient(circle at 35% 35%, #000 0, rgba(0, 0, 0, 0.55) 38%, transparent 70%);
  pointer-events: none;
}
.auth::before { width: 440px; height: 440px; top: -160px; inset-inline-end: -150px; }
.auth::after { width: 340px; height: 340px; bottom: -150px; inset-inline-start: -130px; }

.auth-card {
  width: min(440px, 100%);
  padding: clamp(28px, 5vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-float);
}

.auth-card__title {
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 900;
  line-height: 1.35;
}

.auth-card__lede {
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.85;
}

.auth-step { display: grid; gap: 18px; margin-top: 16px; }
.auth-step[hidden] { display: none; }

.auth-field { display: grid; gap: 8px; }

.auth-field__label { font-size: 14px; font-weight: 700; color: var(--ink); }

.auth-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-field);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.auth-input[dir="ltr"] { text-align: left; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.auth-input::placeholder { color: var(--ink-3); opacity: 1; }
.auth-input:hover { border-color: var(--ink-3); }

.auth-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.auth-input[aria-invalid="true"] { border-color: #c2413a; }

.auth-input--code { font-size: 22px; letter-spacing: 0.4em; text-align: center; }
.auth-input--code[dir="ltr"] { text-align: center; }

.auth-submit { width: 100%; }

/* Demo code: plain, selectable text — not a hidden field. */
.auth-demo {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius-field);
  background: var(--accent-soft);
}

.auth-demo__label { color: var(--accent-ink); font-size: 13px; font-weight: 700; }

.auth-demo__code {
  justify-self: start;
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
  user-select: text;
  -webkit-user-select: text;
}

.auth-link {
  justify-self: center;
  padding: 6px 8px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 5px;
  cursor: pointer;
}
.auth-link:hover { color: var(--ink); }

.auth-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-field);
  background: rgba(194, 65, 58, 0.1);
  color: #a3342e;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.7;
}

/* Busy state for any button that is waiting on the server. */
.btn[aria-busy] { cursor: progress; opacity: 0.75; }
.btn[aria-busy]::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin { to { transform: rotate(1turn); } }

@media (prefers-contrast: more) {
  .auth-input { border-color: var(--ink); }
}

/* The mark settles in and the card rises, in the landing's motion. */
@media (prefers-reduced-motion: no-preference) {
  .brand__mark { animation: auth-mark 760ms var(--spring) 120ms both; }
  .auth-card { animation: auth-rise 700ms cubic-bezier(0.25, 1, 0.5, 1) 120ms both; }
}

@keyframes auth-mark { from { opacity: 0; transform: rotate(-60deg) scale(0.5); } }
@keyframes auth-rise { from { opacity: 0; transform: translateY(14px); filter: blur(5px); } }
