/* ==========================================================================
   theme-zhihu — authentication pages (login, signup, logout, password reset).

   Halo's gateway markup, forms and scripts stay untouched; this file only
   re-skins them with the theme tokens. It mirrors the feed: flat surface
   cards, quiet labels, accent-tinted focus and a single filled action.
   ========================================================================== */

html {
  background: var(--bg);
}

body.gateway-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  height: auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-shell {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 20px 56px;
}

/* ---------- brand ---------- */

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.auth-page .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-page .brand__logo {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  object-fit: cover;
}

.auth-page .brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-on);
  font-size: 17px;
  font-weight: 700;
}

.auth-page .brand__name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- card ---------- */

.auth-page .gateway-wrapper {
  /* Halo's form fragments read these variables; point them at the theme. */
  --color-primary: var(--accent);
  --color-secondary: var(--accent);
  --color-link: var(--accent);
  --color-text: var(--text-2);
  --color-border: var(--border);
  --rounded-sm: 3px;
  --rounded-base: var(--radius);
  --rounded-lg: var(--radius);
  --spacing-2xl: 20px;
  --spacing-xl: 16px;

  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
}

.auth-page .halo-logo {
  display: none;
}

.auth-page .halo-form-wrapper {
  padding: 30px 30px 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
}

.auth-page .form-title {
  all: unset;
  display: block;
  margin: 0 0 20px;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* ---------- fields ---------- */

.auth-page .halo-form .form-item {
  margin-bottom: 18px;
}

.auth-page .halo-form .form-item:last-of-type {
  margin-bottom: 0;
}

.auth-page .halo-form .form-item-group {
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.auth-page .halo-form .form-item-group .form-item {
  margin-bottom: 0;
}

.auth-page .halo-form .form-item label {
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.auth-page .halo-form .form-item .form-label-group {
  margin-bottom: 7px;
}

.auth-page .halo-form .form-item-extra-link {
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
}

.auth-page .halo-form .form-item-extra-link:hover {
  color: var(--accent-hover);
}

.auth-page .halo-form .form-input {
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-page .halo-form .form-input:focus-within {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.65);
}

.auth-page .halo-form .form-item input {
  color: var(--text);
  font-size: 15px;
  caret-color: var(--accent);
}

.auth-page .halo-form .form-item input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.auth-page .halo-form .form-input-stack {
  gap: 8px;
}

.auth-page .halo-form .form-input-stack-icon {
  color: var(--muted);
  transition: color 0.15s ease;
}

.auth-page .halo-form .form-input-stack-icon:hover {
  color: var(--accent);
}

.auth-page .halo-form .form-input-group {
  gap: 8px;
}

.auth-page .halo-form .form-input-group button {
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.auth-page .halo-form .form-input-group button:hover {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.auth-page .halo-form .form-input-group button:active {
  background: rgba(var(--accent-rgb), 0.16);
}

/* ---------- checkbox ---------- */

.auth-page .halo-form input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background-color: var(--surface);
  color: var(--accent);
}

.auth-page .halo-form input[type="checkbox"]:checked {
  border-color: var(--accent);
  background-color: var(--accent);
}

.auth-page .halo-form input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.auth-page .halo-form .form-item-compact {
  gap: 8px;
  margin-bottom: 18px;
  align-items: center;
}

.auth-page .halo-form .form-item-compact input[type="checkbox"] {
  margin-top: 0;
}

.auth-page .halo-form .form-item-compact label {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 20px;
}

.auth-page .halo-form .form-item-compact label a {
  color: var(--accent);
}

.auth-page .halo-form .form-item-compact label a:hover {
  color: var(--accent-hover);
}

/* ---------- action ---------- */

.auth-page .halo-form button[type="submit"] {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-on);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  transition: background-color 0.15s ease;
}

.auth-page .halo-form button[type="submit"]:hover {
  background: var(--accent-hover);
  opacity: 1;
}

.auth-page .halo-form button[type="submit"]:active {
  background: var(--accent-pressed);
  opacity: 1;
}

.auth-page .halo-form button[type="submit"]:disabled {
  opacity: 0.55;
}

/* ---------- messages ---------- */

.auth-page .alert {
  margin-bottom: 16px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.auth-page .alert:before {
  display: none;
}

.auth-page .alert strong {
  font-weight: 500;
}

.auth-page .alert-error {
  background: rgba(217, 83, 79, 0.1);
  color: #c0392b;
}

html.dark .auth-page .alert-error {
  background: rgba(239, 107, 107, 0.14);
  color: #f08a86;
}

.auth-page .halo-form .form-item > .alert {
  margin: 8px 0 0;
  padding: 7px 10px;
  font-size: 12px;
}

/* ---------- providers ---------- */

.auth-page .divider-wrapper {
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-page .divider-wrapper hr {
  border-top: 1px solid var(--divider);
}

.auth-page .pill-items {
  gap: 10px;
}

.auth-page .pill-items li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.auth-page .pill-items li:hover {
  border-color: transparent;
  background: var(--surface-2);
}

.auth-page .pill-items li a,
.auth-page .pill-items li button {
  padding: 9px 14px;
  color: var(--text-2);
  font-size: 13px;
}

.auth-page .pill-items li img {
  width: 20px;
  height: 20px;
}

/* ---------- notices ---------- */

.auth-page .signup-notice-content,
.auth-page .login-notice-content,
.auth-page .returntosite-content {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-page .signup-notice-content a,
.auth-page .login-notice-content a {
  color: var(--accent);
}

.auth-page .signup-notice-content a:hover,
.auth-page .login-notice-content a:hover {
  color: var(--accent-hover);
}

.auth-page .returntosite-content a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-strong);
  font-size: 13px;
}

.auth-page .returntosite-content a:hover {
  color: var(--accent);
}

/* ---------- language ---------- */

.auth-page .language-switcher {
  gap: 8px;
  margin: 16px 0 0;
}

.auth-page .language-switcher label {
  color: var(--muted);
}

/* Same control as the theme's filters: a quiet pill that still reads as a
   select, instead of plain text. */
.auth-page .language-switcher select {
  all: unset;
  box-sizing: border-box;
  height: 34px;
  min-height: 34px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  color: var(--text-2);
  font-size: 13px;
  line-height: 32px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

html:not(.dark) .auth-page .language-switcher select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23706f73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.auth-page .language-switcher select:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-2);
  color: var(--text);
}

.auth-page .language-switcher select:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.6);
  outline: none;
}

.auth-page .language-switcher select option {
  background: var(--surface);
  color: var(--text);
}

/* ---------- logout ---------- */

.auth-page .logout-page-wrapper .user-info {
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.auth-page .logout-page-wrapper .user-avatar {
  width: 44px;
  height: 44px;
  object-fit: cover;
}

.auth-page .logout-page-wrapper .user-details {
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.auth-page .logout-page-wrapper .user-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.auth-page .logout-page-wrapper .cancel-link {
  display: inline-block;
  color: var(--muted-strong);
  font-size: 13px;
}

.auth-page .logout-page-wrapper .cancel-link:hover {
  color: var(--accent);
}

/* ---------- small screens ---------- */

@media (max-width: 480px) {
  .auth-shell {
    padding: 28px 16px 40px;
  }

  .auth-page .halo-form-wrapper {
    padding: 24px 20px 22px;
  }

  .auth-page .form-title {
    margin-bottom: 16px;
    font-size: 20px;
  }
}
