/**
 * ChaptrHQ login page, Continue page, and login form (build brief, 13.6).
 * Colors come only from tokens.css, so the page follows light and dark mode
 * and the chapter's brand colors.
 */

.chq-login {
  --chq-login-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.chq-login {
  margin: 0;
  background: var(--chq-bg);
  color: var(--chq-text);
  font-family: var(--chq-login-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.chq-login *,
.chq-login-form * {
  box-sizing: border-box;
}

.chq-login [hidden],
.chq-login-form [hidden] {
  display: none !important;
}

/* Page layout */

.chq-login__page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
}

.chq-login__column {
  flex: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 48px 0 24px;
}

.chq-login__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
  --chq-logo-height: 140px;
}

.chq-login__logo .chq-logo__text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.chq-login__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 20px 0 26px;
  color: var(--chq-text-muted);
  font-size: 13px;
  text-align: center;
}

.chq-login__foot a {
  color: var(--chq-text);
  font-weight: 700;
  text-decoration: none;
}

.chq-login__foot a:hover {
  text-decoration: underline;
}

.chq-login__foot .chq-theme-toggle {
  width: 34px;
  height: 34px;
}

/* The form, also used by [chq_login] and the Bricks element */

.chq-login-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: 400px;
  color: var(--chq-text);
  font-family: var(--chq-login-font, inherit);
}

.chq-login__main {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.chq-login__head {
  text-align: center;
}

.chq-login__title {
  margin: 0;
  color: var(--chq-text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.chq-login__head p {
  margin: 6px 0 0;
  color: var(--chq-text-muted);
}

/* Method switch */
.chq-login__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--chq-surface-2);
}

.chq-login-form .chq-login__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--chq-text-muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.chq-login-form .chq-login__tab:hover {
  color: var(--chq-text);
  text-decoration: none;
}

.chq-login-form .chq-login__tab[aria-selected="true"] {
  background: var(--chq-surface);
  color: var(--chq-text);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 1px 6px rgba(15, 23, 42, 0.06);
}

.chq-login__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.chq-login__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.chq-login__input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--chq-border);
  border-radius: 10px;
  background: var(--chq-surface);
  color: var(--chq-text);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
}

.chq-login__input::placeholder {
  color: var(--chq-text-muted);
  opacity: 0.8;
}

.chq-login__input:focus {
  border-color: var(--chq-focus);
  outline: 2px solid var(--chq-focus);
  outline-offset: 1px;
}

.chq-login__password {
  position: relative;
  display: flex;
}

.chq-login__password .chq-login__input {
  padding-right: 52px;
}

.chq-login__eye {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--chq-text-muted);
  cursor: pointer;
}

.chq-login__eye[aria-pressed="true"] {
  color: var(--chq-text);
}

.chq-login__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 14px;
}

.chq-login__check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--chq-text-muted);
  font-weight: 500;
}

.chq-login__check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--chq-button);
}

.chq-login-form a,
.chq-continue a {
  color: var(--chq-link);
  font-weight: 700;
  text-decoration: none;
}

.chq-login-form a:hover {
  text-decoration: underline;
}

.chq-login__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--chq-button);
  color: var(--chq-button-text);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.chq-login__button:hover {
  filter: brightness(1.06);
}

.chq-login__button[disabled] {
  opacity: 0.6;
  cursor: default;
}

.chq-login__button:focus-visible,
.chq-login__tab:focus-visible,
.chq-login__eye:focus-visible,
.chq-login-form a:focus-visible,
.chq-login__foot a:focus-visible {
  outline: 3px solid var(--chq-focus);
  outline-offset: 2px;
}

.chq-login__hint {
  margin: 0;
  color: var(--chq-text-muted);
  font-size: 13px;
  text-align: center;
}

.chq-login__msg {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
}

.chq-login__msg--error {
  background: var(--chq-danger-soft);
  color: var(--chq-danger);
}

.chq-login__msg--ok {
  background: var(--chq-success-soft);
  color: var(--chq-success);
}

/* Check your inbox */
.chq-login__sent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.chq-login__sent p {
  margin: 0;
  color: var(--chq-text-muted);
}

.chq-login__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chq-surface-2);
  color: var(--chq-text);
}

.chq-login__alt {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
}

.chq-login__alt a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 4px;
}

/* Request your account */
.chq-login__new {
  margin: 4px 0 0;
  color: var(--chq-text-muted);
  font-size: 14px;
  text-align: center;
}

.chq-login__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Continue page */

body.chq-login--continue {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
  background: var(--chq-surface-2);
}

.chq-continue {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  border: 1px solid var(--chq-border);
  border-radius: 16px;
  background: var(--chq-surface);
  text-align: center;
}

.chq-continue .chq-login__title {
  font-size: 24px;
}

.chq-continue > p {
  margin: 8px 0 22px;
  color: var(--chq-text-muted);
}

.chq-continue .chq-login__hint {
  margin-top: 14px;
  font-size: 12px;
}

@media (max-width: 420px) {
  .chq-login__column {
    padding-top: 32px;
  }

  .chq-login__title {
    font-size: 25px;
  }
}
