/* ============================================================
   STARCHAN — Auth pages (login + register)
   Direction: Breviary (Tier 1 quiet utility — locked)
   Loaded only on /login and /register via {% block head %}.
   Tokens consumed from vars.css (loaded globally via base.html).
   ============================================================ */

.auth-page {
  --auth-page-bg: #0a0f1a;
  --auth-card: #111420;
  --auth-hairline: rgba(200, 146, 58, 0.22);
  --auth-error: #e58181;
  --auth-success: #6b9577;
  --auth-strength-weak: #c00;
  --auth-strength-fair: #e07d00;
  --auth-strength-good: var(--gold);
  --auth-strength-strong: #2a9d5c;
  background: var(--acct-page-bg);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* Page surface — overrides layout.css .auth-page main */
.auth-page main {
  min-height: calc(100vh - var(--header-height, 80px) - var(--tabs-height, 48px));
  padding: 64px 40px 80px;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
}

/* Card — slate panel on parchment, matching the account-page card family */
.auth-page .auth-card {
  background: var(--acct-card-bg);
  border: 1px solid var(--acct-card-border);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  padding: 44px 44px 38px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 26px rgba(40, 30, 12, 0.14);
  margin: 0;
}

.auth-page .auth-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 36px;
  color: var(--text-on-dark);
  margin: 0 0 32px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-align: left;
}

/* Banners */
.auth-page #reg-banner,
.auth-page #login-error,
.auth-page #reg-msg {
  display: none;
  margin: 0 0 24px;
  padding: 12px 14px;
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.5;
  border-radius: 2px;
}

.auth-page #reg-banner {
  background: rgba(107, 149, 119, 0.10);
  border: 1px solid rgba(107, 149, 119, 0.45);
  border-left: 2px solid var(--auth-success);
  color: #a7c8b3;
}

.auth-page #login-error,
.auth-page #reg-msg {
  background: rgba(229, 129, 129, 0.06);
  border: 1px solid rgba(229, 129, 129, 0.35);
  border-left: 2px solid var(--auth-error);
  color: var(--auth-error);
}

.auth-page.is-banner #reg-banner,
.auth-page.is-error #login-error,
.auth-page.is-error #reg-msg {
  display: block;
}

/* Field */
.auth-page .auth-field {
  margin-bottom: 22px;
}

.auth-page .auth-field > label {
  display: block;
  font-family: var(--font-main);
  font-size: 13px;
  color: rgba(221, 232, 244, 0.75);
  margin-bottom: 8px;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: none;
}

.auth-page .field-hint {
  font-family: var(--font-main);
  font-size: 11px;
  color: var(--text-muted-dark);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-left: 6px;
}

.auth-page .auth-field input[type="text"],
.auth-page .auth-field input[type="email"],
.auth-page .auth-field input[type="password"] {
  width: 100%;
  /* Was `transparent` → empty fields read as dead dark rectangles on the
     near-black page (2026-06-28 GPT review). Give them a real surface +
     visible border so they read as inputs. */
  background: rgba(221, 232, 244, 0.05);
  border: 1px solid rgba(221, 232, 244, 0.20);
  border-radius: 3px;
  padding: 12px 14px;
  color: var(--text-on-dark);
  font-family: var(--font-main);
  font-size: 15px;
  height: 48px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}
.auth-page .auth-field input[type="text"]:hover,
.auth-page .auth-field input[type="email"]:hover,
.auth-page .auth-field input[type="password"]:hover {
  border-color: rgba(221, 232, 244, 0.34);
}

.auth-page .auth-field input::placeholder {
  color: rgba(101, 133, 160, 0.5);
}

.auth-page .auth-field input:focus,
.auth-page .auth-field input.focused {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 146, 58, 0.14);
}

.auth-page .auth-field input[aria-invalid="true"],
.auth-page .auth-field input.invalid {
  border-color: rgba(229, 129, 129, 0.65);
  box-shadow: 0 0 0 3px rgba(229, 129, 129, 0.10);
}

/* Password show/hide toggle + caps-lock hint (2026-06-28 GPT review) */
.auth-page .pw-wrap { position: relative; display: flex; align-items: center; }
.auth-page .pw-wrap input { padding-right: 62px; }
.auth-page .pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(221, 232, 244, 0.6);
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 9px;
  cursor: pointer;
  border-radius: 3px;
  transition: color 150ms ease, background 150ms ease;
}
.auth-page .pw-toggle:hover { color: var(--gold-light); background: rgba(200, 146, 58, 0.10); }
.auth-page .pw-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.auth-page .pw-caps {
  margin-top: 7px;
  font-size: 12px;
  font-family: var(--font-main);
  color: rgba(229, 180, 100, 0.92);
  letter-spacing: 0.01em;
}

/* Field-level error text — note: overrides layout.css .auth-field-error */
.auth-page .field-error {
  display: none;
  font-family: var(--font-main);
  font-size: 12px;
  color: var(--auth-error);
  margin-top: 6px;
  line-height: 1.4;
  background: transparent;
  padding: 0;
  border: 0;
}
.auth-page .field-error.show {
  display: block;
}

/* Trust line under the submit button — answers "is this legitimate?" at the
   moment of data entry (2026-06-28 GPT review). */
.auth-page .auth-trust {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(221, 232, 244, 0.52);
}
.auth-page .auth-trust a {
  color: rgba(221, 232, 244, 0.78);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Primary CTA — overrides layout.css .auth-btn */
.auth-page .auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--gold);
  color: var(--auth-page-bg);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  height: 48px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 8px;
  text-transform: none;
  transition:
    background 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}
.auth-page .auth-btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(200, 146, 58, 0.28);
}
.auth-page .auth-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.auth-page .auth-btn:disabled,
.auth-page .auth-btn.loading {
  background: rgba(200, 146, 58, 0.45);
  color: rgba(10, 15, 26, 0.7);
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.auth-page .auth-btn .spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(10, 15, 26, 0.4);
  border-top-color: var(--auth-page-bg);
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}
.auth-page.is-loading .auth-btn .spinner {
  display: inline-block;
}
.auth-page.is-loading .auth-btn .auth-btn-label {
  display: none;
}
.auth-page.is-loading .auth-btn .auth-btn-loading-label {
  display: inline;
}
.auth-page .auth-btn .auth-btn-loading-label {
  display: none;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.auth-page .auth-footer {
  margin: 28px 0 0;
  text-align: center;
  color: rgba(221, 232, 244, 0.55);
  font-family: var(--font-main);
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.7;
}
.auth-page .auth-footer a {
  color: rgba(221, 232, 244, 0.78);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 150ms, border-color 150ms;
}
.auth-page .auth-footer a.gold {
  color: var(--gold);
  border-bottom-color: rgba(200, 146, 58, 0.55);
}
.auth-page .auth-footer a:hover {
  color: var(--gold);
  border-bottom-color: rgba(200, 146, 58, 0.55);
}
.auth-page .auth-footer .em {
  color: rgba(221, 232, 244, 0.25);
  margin: 0 6px;
}

/* Password strength meter */
.auth-page .pw-strength-bar {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  height: 4px;
  width: 100%;
  background: transparent;
}
.auth-page .pw-strength-bar > .seg {
  flex: 1;
  background: rgba(221, 232, 244, 0.08);
  border-radius: 1px;
  transition: background 200ms ease;
}
.auth-page .pw-strength-bar.weak   > .seg:nth-child(-n+1) { background: var(--auth-strength-weak); }
.auth-page .pw-strength-bar.fair   > .seg:nth-child(-n+2) { background: var(--auth-strength-fair); }
.auth-page .pw-strength-bar.good   > .seg:nth-child(-n+3) { background: var(--auth-strength-good); }
.auth-page .pw-strength-bar.strong > .seg:nth-child(-n+4) { background: var(--auth-strength-strong); }

.auth-page .pw-strength-label {
  font-family: var(--font-main);
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(221, 232, 244, 0.55);
  display: flex;
  justify-content: space-between;
}
.auth-page .pw-strength-label .level {
  color: var(--text-on-dark);
  font-weight: 500;
}
.auth-page .pw-strength-label .level.weak   { color: #ff8a8a; }
.auth-page .pw-strength-label .level.fair   { color: #f4a960; }
.auth-page .pw-strength-label .level.good   { color: var(--gold-light); }
.auth-page .pw-strength-label .level.strong { color: #6fcfa0; }

/* ToS row — overrides components.css .auth-tos-label */
.auth-page .auth-tos-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 22px;
  padding: 12px 14px;
  border: 1px solid rgba(200, 146, 58, 0.16);
  border-radius: 2px;
  background: rgba(200, 146, 58, 0.025);
  cursor: pointer;
  font-size: inherit;
  color: inherit;
  line-height: inherit;
}
.auth-page .auth-tos-label > span {
  font-family: var(--font-main);
  font-size: 12px;
  color: rgba(221, 232, 244, 0.7);
  line-height: 1.5;
  flex: 1;
}
.auth-page .auth-tos-label > span a {
  color: rgba(221, 232, 244, 0.85);
  border-bottom: 1px solid rgba(200, 146, 58, 0.5);
  text-decoration: none;
  transition: color 150ms;
}
.auth-page .auth-tos-label > span a:hover {
  color: var(--gold);
}

.auth-page .auth-tos-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--navy-border);
  border-radius: 2px;
  background: var(--auth-page-bg);
  cursor: pointer;
  flex-shrink: 0;
  margin: 1px 0 0;
  position: relative;
  transition: background 150ms, border-color 150ms;
  accent-color: var(--gold);
}
.auth-page .auth-tos-label input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.auth-page .auth-tos-label input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--auth-page-bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.auth-page .auth-tos-label input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Honeypot */
.auth-page .form-extra-fields {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Responsive */
@media (max-width: 480px) {
  .auth-page main  { padding: 32px 16px; }
  .auth-page .auth-card  { padding: 32px 24px; }
  .auth-page .auth-title { font-size: 30px; margin-bottom: 24px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .auth-page .auth-card *,
  .auth-page .auth-card *::before,
  .auth-page .auth-card *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
