/*
 * The sign-in and forgot-password boxes (owner, 2026-10-08; tidied 2026-10-10)
 * ============================================================================
 * Override stylesheet, loaded after every other one; platform.css is untouched.
 *
 * "Forgot password?" and "New member? Register here" were 12px grey text, too small
 * to read or tap. They are now 14px, with the link part bold, underlined and in the
 * brand colour, on a tap area of their own.
 *
 * 2026-10-10, "the login popup for the desktop site is messy": on a laptop the box was
 * taller than the window — the desktop is drawn at 120% (platform.css zooms the body),
 * so its 637px became 765 and the heading and the Continue button were cut off — and it
 * read as a stack of loose parts: a 28px heading under a large padlock, two
 * three-line hints, a CAPTCHA picture, Refresh and a code box of three different widths,
 * and "Forgot password?" alone on a line of its own. Now:
 *
 *   - the padlock sits beside a smaller heading, and every gap is tighter;
 *   - each hint is one short line;
 *   - "Forgot password?" sits on the Password label's line, at the right;
 *   - the CAPTCHA is one row the width of the form: picture, code box, a ↻ to change it;
 *   - the box never grows past the window: if it must, it scrolls inside itself.
 *
 * The phone (a sheet from the bottom, ui-system.css) gets the same rows.
 */

/* --- the box ----------------------------------------------------------------- */

.modal-overlay .modal.modal--auth {
  width: min(420px, 95vw);
  padding: 1rem 1.35rem 1.05rem;
}

/* Never taller than the window: the desktop's 120% zoom counted in. */
@media (min-width: 1025px) {
  .modal-overlay .modal.modal--auth {
    max-height: calc(100vh / 1.2 - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .modal-overlay .modal.modal--auth {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* --- the heading: padlock beside the title, the line under it ------------------ */

.modal--auth .modal-auth-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: .45rem;
  margin: 0 1.6rem .85rem;
  text-align: center;
}

.modal--auth .modal-auth-head__icon {
  font-size: 1.3rem;
  line-height: 1;
  margin: 0;
}

/* typography.css sizes every public-page h2 with !important (and an #app selector),
   which made this 28px; the box's own title is smaller. */
#app .modal-overlay .modal.modal--auth .modal-auth-head h2,
.modal-overlay .modal.modal--auth .modal-auth-head h2 {
  margin: 0 !important;
  font-size: 20px !important;
  line-height: 1.25 !important;
  font-weight: 700;
}

.modal--auth .modal-auth-head p {
  flex-basis: 100%;
  margin: .25rem 0 0;
  font-size: 12.5px;
  line-height: 1.4;
}

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

.modal--auth .form-group {
  margin-bottom: .7rem;
}

.modal--auth .form-group label {
  margin-bottom: .25rem;
}

.modal--auth .modal-field-hint {
  margin-top: .25rem;
  font-size: 11.5px;
  line-height: 1.35;
}

/* Password, with "Forgot password?" on the same line at the right. */
.modal--auth .modal-auth-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .25rem;
}

.modal--auth .modal-auth-label-row label {
  margin-bottom: 0;
}

.modal--auth .modal-auth-label-row .modal-auth-link {
  min-height: 0;
  padding: .1rem 0;
  font-size: 13px;
}

/* CAPTCHA: one row the form's width — picture, code box, ↻ for a new code. */
.modal--auth .captcha-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: .5rem;
  margin: 0;
}

.modal--auth .modal-captcha-img {
  flex: 0 0 auto;
  width: 148px;
  height: 44px;
  object-fit: contain;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #f7f9fd;
}

.modal--auth .captcha-row input#ucaptcha {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
  height: 44px;
  margin: 0;
}

.modal--auth .modal-captcha-refresh {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal--auth .modal-captcha-refresh svg {
  width: 18px;
  height: 18px;
}

/* "Remember device", when the sign-in mode offers it (login-security.css). */
.modal--auth .modal-auth-actions-row {
  margin: .05rem 0 .7rem;
}

.modal--auth .modal-remember {
  font-size: 13.5px;
}

.modal--auth .modal-auth-submit {
  margin-top: .2rem;
}

/* --- links ------------------------------------------------------------------------ */

.modal--auth .modal-auth-link,
.modal--auth .form-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--primary, #1a2d5a) !important;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.modal--auth .modal-auth-link:hover,
.modal--auth .form-footer a:hover {
  color: #2f6fbf !important;
}

.modal--auth .modal-auth-link:focus-visible,
.modal--auth .form-footer a:focus-visible {
  outline: 2px solid #2f6fbf;
  outline-offset: 2px;
  border-radius: 4px;
}

.modal--auth .form-footer {
  margin-top: .45rem;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

/* --- phones: the same rows, a little narrower ------------------------------------- */

@media (max-width: 640px) {
  .modal-overlay .modal.modal--auth {
    padding: .9rem 1rem 1rem;
  }

  .modal--auth .modal-captcha-img {
    width: 124px;
  }
}

/* --- CAPTCHA code boxes: capitals, spaced like the picture ------------------------ */

input#ucaptcha,
input#contact_captcha {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600;
}

/* The contact page draws its own box (platform.js) with the longer "Enter the code
   shown above": the picture's width rather than the form's, with room for the words. */
input#contact_captcha {
  display: block;
  width: 100%;
  max-width: 260px;
}

input#ucaptcha::placeholder,
input#contact_captcha::placeholder {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
