/* ════════════════════════════════════════════════════════════════
   AELIUS — AUTH
   Shared design system for /login and /register.

   These two pages used to carry ~380 lines of near-identical inline
   CSS each, in a blue-on-charcoal theme that matched nothing else on
   the site. This file is the landing page's palette and type scale
   (see the :root block in landing.html) applied to a form: pure
   black, hairline borders, Inter + Instrument Serif, white pill CTA.

   Layout is a two-column shell — a brand panel that sells the
   product, and a form panel that gets out of the way. Below 980px
   the brand panel drops out and the form goes full width.
   ════════════════════════════════════════════════════════════════ */

:root {
  --black: #000;
  --ink: #050505;
  --panel: #0a0a0a;
  --hair: rgba(255, 255, 255, 0.07);
  --hair2: rgba(255, 255, 255, 0.13);
  --hair3: rgba(255, 255, 255, 0.22);
  --t1: #f5f5f6;
  --t2: #9b9ba1;
  --t3: #68686e;
  --t4: #3b3b40;
  --danger: #ff7b7b;
  --warn: #f5c451;
  --ok: #5ad19b;
  --info: #7cc4ff;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  background: var(--black);
  color: var(--t1);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: #fff; color: #000; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; }

.si { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }

/* Film grain over the whole page — the signature texture from the
   landing page. Pointer-events off so it never eats a click. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: .045;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── SHELL ──────────────────────────────────────────────────────── */
.auth-shell {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  min-height: 100vh;
  min-height: 100svh;
}

/* ── BRAND PANEL (left) ─────────────────────────────────────────── */
/* Sticky and exactly one viewport tall. The register form is taller
   than the screen, and a stretched grid item would have spread this
   panel's three blocks over the whole scroll height and then scrolled
   them away — the brand should hold still while the form moves. */
.auth-brand {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  border-right: 1px solid var(--hair);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 52px 46px;
}

/* Slow-drifting light behind the copy. Two soft radials, blurred, so
   the panel is never a flat black rectangle. */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: -35%;
  z-index: 0;
  background:
    radial-gradient(38% 38% at 28% 30%, rgba(255, 255, 255, .11), transparent 70%),
    radial-gradient(34% 34% at 72% 68%, rgba(255, 255, 255, .06), transparent 70%);
  filter: blur(28px);
  animation: drift 26s var(--ease) infinite alternate;
}

/* Faint engineering grid, masked to a soft oval so it fades at the edges. */
.auth-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--hair) 1px, transparent 1px),
    linear-gradient(90deg, var(--hair) 1px, transparent 1px);
  background-size: 68px 68px;
  -webkit-mask-image: radial-gradient(78% 66% at 50% 42%, #000 0%, transparent 76%);
  mask-image: radial-gradient(78% 66% at 50% 42%, #000 0%, transparent 76%);
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.02); }
}

.brand-top, .brand-body, .brand-foot { position: relative; z-index: 2; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: #fff;
}
.brand-mark img {
  height: 28px;
  width: 28px;
  object-fit: contain;
  border-radius: 8px;
  filter: grayscale(1) brightness(1.6);
}

.brand-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 22px;
}
.brand-eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--hair3); }

.brand-h {
  font-size: clamp(2.1rem, 3.2vw, 3.1rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.045em;
  color: #fff;
  margin-bottom: 20px;
}
.brand-h .dim { color: var(--t3); }
.brand-h .si { font-weight: 400; font-size: 1.05em; }

.brand-p {
  font-size: .96rem;
  color: var(--t2);
  line-height: 1.72;
  max-width: 400px;
  margin-bottom: 40px;
}

.brand-list { display: flex; flex-direction: column; gap: 15px; }
.brand-list li { display: flex; align-items: flex-start; gap: 13px; list-style: none; }
.brand-list .b {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid var(--hair2);
  background: rgba(255, 255, 255, .03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.brand-list .b svg { width: 11px; height: 11px; }
.brand-list .txt { font-size: .9rem; color: var(--t1); font-weight: 500; letter-spacing: -.01em; }
.brand-list .txt em { display: block; font-style: normal; font-weight: 400; color: var(--t3); font-size: .82rem; margin-top: 3px; line-height: 1.5; }

.brand-foot {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--t4);
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-foot .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 7px #fff;
  animation: pdot 2.4s ease-in-out infinite;
}
@keyframes pdot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* ── FORM PANEL (right) ─────────────────────────────────────────── */
.auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px 56px;
}

/* Logo + wordmark, shown only when the brand panel is gone. */
.mobile-mark { display: none; }

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

.card-head { margin-bottom: 30px; }
.card-head h1 {
  font-size: 1.95rem;
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 9px;
}
.card-head h1 .si { font-weight: 400; font-size: 1.06em; }
.card-head p { font-size: .92rem; color: var(--t2); line-height: 1.6; }
.card-head p a { color: #fff; font-weight: 500; border-bottom: 1px solid var(--hair3); transition: border-color .2s; }
.card-head p a:hover { border-color: #fff; }

/* ── FIELDS ─────────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.field-head label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--t2);
  letter-spacing: -.005em;
}
.field-head .hint-link {
  font-size: .78rem;
  color: var(--t3);
  transition: color .2s;
}
.field-head .hint-link:hover { color: #fff; }

.control { position: relative; }

.control input {
  width: 100%;
  height: 52px;
  background: rgba(255, 255, 255, .032);
  border: 1px solid var(--hair2);
  border-radius: 14px;
  padding: 0 16px 0 45px;
  color: var(--t1);
  font-family: inherit;
  font-size: .95rem;
  letter-spacing: -.01em;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.control input::placeholder { color: var(--t4); }
.control input:hover { border-color: var(--hair3); }
.control input:focus {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .055);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .07);
}
.control input.has-reveal { padding-right: 50px; }

/* Chrome paints its own baby-blue autofill background; this repaints
   it with a huge inset shadow, the only property autofill respects. */
.control input:-webkit-autofill,
.control input:-webkit-autofill:hover,
.control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--t1);
  -webkit-box-shadow: 0 0 0 1000px #0d0d0d inset;
  caret-color: #fff;
  transition: background-color 9999s ease-in-out 0s;
}

.control .ic {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .88rem;
  color: var(--t4);
  pointer-events: none;
  transition: color .2s;
}
.control input:focus ~ .ic { color: #fff; }

.reveal {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--t3);
  font-size: .85rem;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.reveal:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.reveal:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); color: #fff; }

/* Inline validation note under a field (e.g. "Passwords don't match"). */
.field-note {
  font-size: .76rem;
  line-height: 1.5;
  margin-top: 7px;
  color: var(--t3);
  display: none;
}
.field-note.show { display: block; }
.field-note.bad { color: var(--danger); }
.field-note.good { color: var(--ok); }

/* ── PASSWORD STRENGTH ──────────────────────────────────────────── */
.strength { margin-top: 10px; display: none; }
.strength.show { display: block; }
.strength-bars { display: flex; gap: 5px; }
.strength-bars i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--hair2);
  transition: background .3s var(--ease);
}
.strength-label {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t3);
  margin-top: 8px;
}
.strength[data-score="1"] .strength-bars i:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] .strength-bars i:nth-child(-n+2) { background: var(--warn); }
.strength[data-score="3"] .strength-bars i:nth-child(-n+3) { background: #b8d96b; }
.strength[data-score="4"] .strength-bars i { background: var(--ok); }

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn {
  position: relative;
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 100px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s, background .25s, border-color .25s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(255, 255, 255, .25); }

.btn-primary {
  background: #fff;
  color: #000;
  box-shadow: 0 6px 26px rgba(255, 255, 255, .12);
  margin-top: 6px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 38px rgba(255, 255, 255, .24); }

/* Google's dark-theme button: their guidelines allow a dark surface
   with white text, which is what belongs on a black page — a stark
   white Google button next to a white submit button read as two
   competing primary actions. */
.btn-google {
  background: rgba(255, 255, 255, .045);
  border-color: var(--hair2);
  color: var(--t1);
}
.btn-google:hover { background: rgba(255, 255, 255, .09); border-color: var(--hair3); }
.btn-google svg { width: 18px; height: 18px; flex: 0 0 18px; }

/* Submitting state: swap the label for a spinner so a slow POST
   can't be double-submitted. */
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading .btn-label, .btn.is-loading svg { visibility: hidden; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, .25);
  border-top-color: #000;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DIVIDER ────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--t4);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--hair); }

/* ── ALERTS ─────────────────────────────────────────────────────── */
/* The old rules styled `.alert-danger`, but Flask flashes the category
   `error` here — so every failed login rendered an unstyled box. All
   four categories the app actually flashes are covered below. */
.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 40px 13px 15px;
  margin-bottom: 14px;
  border: 1px solid var(--hair2);
  border-left-width: 2px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  font-size: .86rem;
  line-height: 1.55;
  color: var(--t1);
  animation: alertIn .45s var(--ease) both;
}
@keyframes alertIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* The vendored kit is Font Awesome 6; the old inline CSS asked for the
   v5 family name, so these glyphs quietly fell back to a system font
   and rendered as blank boxes. v5 is kept as a fallback in case the
   vendored kit is ever rolled back. */
.alert::before {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  font-size: .85rem;
  line-height: 1.55;
  flex: 0 0 auto;
}
.alert-error, .alert-danger { border-left-color: var(--danger); background: rgba(255, 123, 123, .08); }
.alert-error::before, .alert-danger::before { content: "\f057"; color: var(--danger); }
.alert-warning { border-left-color: var(--warn); background: rgba(245, 196, 81, .08); }
.alert-warning::before { content: "\f06a"; color: var(--warn); }
.alert-success { border-left-color: var(--ok); background: rgba(90, 209, 155, .08); }
.alert-success::before { content: "\f058"; color: var(--ok); }
.alert-info, .alert-message { border-left-color: var(--info); background: rgba(124, 196, 255, .08); }
.alert-info::before, .alert-message::before { content: "\f05a"; color: var(--info); }

.alert .close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--t3);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.alert .close:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* ── NOTICE CARDS (resend verification, uncensored warning) ─────── */
.notice {
  border: 1px solid var(--hair2);
  border-radius: 14px;
  padding: 15px 16px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, .025);
  font-size: .82rem;
  line-height: 1.6;
  color: var(--t2);
}
.notice-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 7px;
  letter-spacing: -.01em;
}
.notice-danger { border-color: rgba(255, 123, 123, .3); background: rgba(255, 123, 123, .05); }
.notice-danger .notice-title { color: #ffb0b0; }
.notice-warn { border-color: rgba(245, 196, 81, .3); background: rgba(245, 196, 81, .05); }
.notice-warn .notice-title { color: var(--warn); }

.resend-row { display: flex; gap: 8px; margin-top: 11px; }
.resend-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--hair2);
  border-radius: 11px;
  padding: 0 13px;
  color: var(--t1);
  font-family: inherit;
  font-size: .84rem;
  outline: none;
  transition: border-color .2s;
}
.resend-row input::placeholder { color: var(--t4); }
.resend-row input:focus { border-color: rgba(255, 255, 255, .5); }
.resend-row button {
  height: 42px;
  flex: 0 0 auto;
  padding: 0 16px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid var(--hair2);
  border-radius: 11px;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.resend-row button:hover { background: rgba(255, 255, 255, .16); border-color: var(--hair3); }

/* ── AGREEMENT CHECKBOXES ───────────────────────────────────────── */
.consent-label {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--t4);
  margin: 22px 0 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.consent-label::after { content: ''; flex: 1; height: 1px; background: var(--hair); }

.agree {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 13px;
  cursor: pointer;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--t2);
}
/* The real input stays in the layout at full size and merely invisible.
   display:none would make it unfocusable, and the browser refuses to
   show a "please tick this" bubble on a control it cannot focus. */
.agree input {
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.agree .box {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-top: 1px;
  border: 1px solid var(--hair3);
  border-radius: 6px;
  background: rgba(255, 255, 255, .03);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
}
.agree .box svg {
  width: 11px;
  height: 11px;
  stroke: #000;
  stroke-width: 3.4;
  fill: none;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .18s, transform .18s var(--ease);
}
.agree:hover .box { border-color: #fff; }
.agree input:checked ~ .box { background: #fff; border-color: #fff; }
.agree input:checked ~ .box svg { opacity: 1; transform: scale(1); }
.agree input:focus-visible ~ .box { box-shadow: 0 0 0 4px rgba(255, 255, 255, .16); border-color: #fff; }
.agree a { color: var(--t1); border-bottom: 1px solid var(--hair3); transition: border-color .2s; }
.agree a:hover { border-color: #fff; }
.agree strong { color: var(--t1); font-weight: 600; }

/* ── FINE PRINT + GUEST ─────────────────────────────────────────── */
.fine-print {
  font-size: .76rem;
  line-height: 1.6;
  color: var(--t3);
  text-align: center;
  margin-top: 12px;
}
.fine-print a { color: var(--t2); border-bottom: 1px solid var(--hair2); transition: color .2s, border-color .2s; }
.fine-print a:hover { color: #fff; border-color: #fff; }

.card-foot {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
  text-align: center;
  font-size: .86rem;
  color: var(--t2);
}
.card-foot .guest {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
  padding: 9px 18px;
  border: 1px solid var(--hair2);
  border-radius: 100px;
  color: var(--t1);
  font-size: .84rem;
  font-weight: 500;
  transition: background .2s, border-color .2s, transform .2s var(--ease);
}
.card-foot .guest:hover { background: rgba(255, 255, 255, .06); border-color: var(--hair3); transform: translateY(-1px); }
.card-foot .guest i { font-size: .8rem; color: var(--t3); }

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  font-size: .78rem;
  color: var(--t4);
  transition: color .2s;
}
.back-home:hover { color: var(--t1); }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-main { padding: 36px 24px 48px; justify-content: flex-start; }

  .mobile-mark {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.03em;
    color: #fff;
    margin-bottom: 34px;
  }
  .mobile-mark img {
    height: 28px;
    width: 28px;
    object-fit: contain;
    border-radius: 8px;
    filter: grayscale(1) brightness(1.6);
  }

  /* Ambient light so the mobile page isn't a flat black rectangle.
     Pinned to both edges rather than a fixed width centred with a
     transform — that overflowed a 390px viewport by ~65px each side
     and gave the page a horizontal scrollbar. */
  .auth-main::before {
    content: '';
    position: absolute;
    top: -180px;
    left: 0;
    right: 0;
    height: 420px;
    background: radial-gradient(46% 50% at 50% 50%, rgba(255, 255, 255, .1), transparent 70%);
    filter: blur(40px);
    pointer-events: none;
  }
  .auth-card { position: relative; z-index: 1; }
}

@media (max-width: 420px) {
  .card-head h1 { font-size: 1.7rem; }
  /* 16px keeps iOS Safari from zooming the viewport on focus. */
  .control input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand::before, .brand-foot .dot { animation: none; }
  .alert { animation: none; }
  * { transition-duration: .01ms !important; }
}
