/* ------------------------------------------------------------------
   Auth pages (signup / signin / welcome)

   A centred card on the page colour, matching the marketing site's
   proportions. Typography and the @font-face declarations come from the
   mirrored marketing bundles, so this file only carries the
   page-specific styling.
   ------------------------------------------------------------------ */

:root {
  /* The page behind the card. #eaf7fb, the one background the whole product
     uses -- see the note at the foot of marketing.css for why that value and
     why its 95% lightness is the part to preserve.

     This was --auth-beige: #f7f3ee, the warm tone the marketing site started
     out on, and it was the last place that colour survived on a page anybody
     signs in through. Leaving it meant somebody who pressed "Start for free"
     on a blue landing page landed on a cream one and then arrived in a blue
     app: two colour changes inside one signup. Renamed as well as recoloured,
     because a token called --auth-beige holding a blue is a trap for whoever
     greps for it next.

     One consumer, .auth-body, and three pages through it: signin.php,
     signup.php and welcome.php. */
  --auth-page: #eaf7fb;
  --auth-card: #ffffff;
  --auth-dark: #222222;
  --auth-body: #484848;
  --auth-muted: #717171;
  --auth-border: #dddddd;
  --auth-border-hover: #b0b0b0;
  --auth-danger: #c62828;
  --auth-success: #188038;
  --auth-ring: rgba(34, 34, 34, 0.16);

  /* The submit button. Mirrors --kf-action in app.css: kept apart from
     --auth-dark, which is the ink for the title, the field labels and the typed
     value, so the button can move without dragging the page text with it. */
  --auth-action: #023872;
  --auth-action-hover: #012a56;
  --auth-action-ring: rgba(2, 56, 114, 0.22);
}

.auth-body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--auth-page);
  font-family: var(--font-figtree), ui-sans-serif, system-ui, sans-serif;
  color: var(--auth-body);
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
  .auth-body { padding: 2.5rem; }
}

.auth-shell {
  width: 100%;
  max-width: 36rem;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-logo img {
  width: 150px;
  height: auto;
}

.auth-card {
  background: var(--auth-card);
  border: 1px solid rgba(34, 34, 34, 0.1);
  border-radius: 22px;
  padding: 1.5rem 2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.auth-head {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-title {
  margin: 0;
  font-family: var(--font-nunito), ui-sans-serif, system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--auth-dark);
}

.auth-sub {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--auth-muted);
}

/* ------------------------------------------------------------- form layout */

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .auth-row { grid-template-columns: 1fr 1fr; }
}

.auth-field {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  /* Keeps rows at their natural height so an inline error under one field
     cannot push its neighbour's input out of alignment. */
  align-content: start;
}

.auth-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--auth-dark);
  user-select: none;
}

.auth-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 2.75rem;
  padding: 0 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--auth-dark);
  background: transparent;
  border: 1px solid var(--auth-border);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder { color: #a0a0a0; }
.auth-input:hover { border-color: var(--auth-border-hover); }

.auth-input:focus-visible {
  border-color: var(--auth-dark);
  box-shadow: 0 0 0 3px var(--auth-ring);
}

.auth-input[aria-invalid="true"] {
  border-color: var(--auth-danger);
}

.auth-input[aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.2);
}

/* password field + reveal toggle */

.auth-pw { position: relative; }
.auth-pw .auth-input { padding-right: 2.75rem; }

.auth-pw-toggle {
  position: absolute;
  inset-block: 0;
  right: 0;
  width: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: none;
  color: var(--auth-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.auth-pw-toggle:hover { color: var(--auth-dark); }
.auth-pw-toggle svg { width: 1.25rem; height: 1.25rem; }

/* --------------------------------------------------------------- messaging */

.auth-error {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--auth-danger);
}

.auth-alert {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.auth-alert-error {
  background: #fdecea;
  border: 1px solid rgba(198, 40, 40, 0.25);
  color: #8c1d18;
}

.auth-alert-ok {
  background: #e6f4ea;
  border: 1px solid rgba(24, 128, 56, 0.25);
  color: #14612c;
}

.auth-alert svg { flex: 0 0 auto; width: 1.125rem; height: 1.125rem; margin-top: 0.0625rem; }

.auth-hint {
  font-size: 0.8125rem;
  color: var(--auth-muted);
}

/* ----------------------------------------------------------------- buttons */

.auth-submit {
  margin-top: 0.5rem;
  width: 100%;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--auth-action);
  color: #ffffff;
  font-family: var(--font-nunito), ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.auth-submit:hover { background: var(--auth-action-hover); }
.auth-submit:active { transform: scale(0.995); }

.auth-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--auth-action-ring);
}

.auth-submit[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-foot {
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--auth-muted);
}

.auth-foot a {
  color: var(--auth-dark);
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 4px;
}

.auth-foot a:hover { text-decoration: underline; }

.auth-back {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
}

.auth-back a {
  color: var(--auth-muted);
  text-decoration: none;
}

.auth-back a:hover { color: var(--auth-dark); text-decoration: underline; }

/* --------------------------------------------------------------- welcome */

.auth-welcome-list {
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0;
  font-size: 0.875rem;
  border: 1px solid rgba(34, 34, 34, 0.08);
  border-radius: 0.75rem;
  overflow: hidden;
}

.auth-welcome-list dt {
  padding: 0.625rem 0.875rem 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--auth-muted);
}

.auth-welcome-list dd {
  margin: 0;
  padding: 0.125rem 0.875rem 0.625rem;
  color: var(--auth-dark);
  font-weight: 600;
  word-break: break-word;
}

.auth-welcome-list dd:not(:last-child) {
  border-bottom: 1px solid rgba(34, 34, 34, 0.06);
}
