/* ====================================================================
   auth-pages.css — Shared chrome-less auth-page treatment
   ====================================================================
   Pattern A ("Anthropic on cream") — drops the .auth-card chrome so the
   form sits directly on the canvas. Mobile-first, 390px primary viewport.
   Type-scale per
     4-design/research/2026-05-27-saas-login-ux/findings-type-form-sizing.md
   Used by:
     /app/login.html
     /signup.html (revamp 2026-05-27)
   Page-specific extras (pw-strength, country-pill, OTP, success view)
   stay inline in the consuming file.
   ==================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--canvas);
  color: var(--heading);
  font-family: var(--font, Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif);
  font-feature-settings: "ss01", "cv01", "cv11";
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  height: 100svh; /* small viewport height — stable across iOS chrome retraction */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px 16px;
  overflow: hidden;
  min-height: 0;
}

/* ---- Back link (below header, left-aligned) ---- */
.auth-back {
  align-self: stretch;
  max-width: 360px;
  margin: 12px auto 8px;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  flex-shrink: 0;
}
.auth-back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 10px 4px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  letter-spacing: -0.005em;
  transition: color 180ms ease;
}
.auth-back a:hover { color: var(--heading); }
.auth-back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.auth-form-wrap {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Sits at its natural top size; .auth-footer's `margin-top: auto`
     pushes the footer to the viewport bottom regardless of content height. */
}

/* ---- Headline + lede (Cartridge voice) ---- */
.auth-form-wrap h1 {
  font-family: var(--font-display, inherit);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--heading);
  margin: 0 0 8px;
  text-wrap: balance;
  flex-shrink: 0;
}
.auth-form-wrap .lede {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--body);
  margin: 0 0 20px;
  max-width: none;
  flex-shrink: 0;
}

/* ---- Form (compressed mobile-first rhythm) ---- */
.auth-form,
.auth-form-wrap form { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; }
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 400;
  color: var(--heading);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.field input::placeholder { color: var(--muted); }
.field input:focus,
.field select:focus {
  border-color: var(--heading);
  box-shadow: 0 0 0 3px rgba(15, 20, 36, 0.08);
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7188'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.password-row { position: relative; }
.password-row .toggle-pw {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: -0.005em;
}
.password-row .toggle-pw:hover { color: var(--heading); }

.forgot-link {
  align-self: flex-end;
  margin: 0 -8px 0 0;
  padding: 12px 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.forgot-link:hover { color: var(--heading); text-decoration: underline; }

/* ---- Primary CTA (Cartridge orange, navy text) — mobile-class 56px ---- */
.auth-form-wrap .btn-primary,
.auth-form-wrap button[type="submit"] {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--accent);
  color: var(--text-on-accent, #0F1424);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
  margin-top: 4px;
  flex-shrink: 0;
}
.auth-form-wrap .btn-primary:hover,
.auth-form-wrap button[type="submit"]:hover {
  background: var(--accent-hover, #E55F00);
  border-color: var(--accent-hover, #E55F00);
  transform: translateY(-1px);
}
.auth-form-wrap .btn-primary:active,
.auth-form-wrap button[type="submit"]:active {
  background: #CC5500;
  border-color: #CC5500;
  transform: translateY(0);
}
.auth-form-wrap .btn-primary:focus-visible,
.auth-form-wrap button[type="submit"]:focus-visible {
  outline: 2px solid var(--heading);
  outline-offset: 2px;
}
.auth-form-wrap .btn-primary:disabled,
.auth-form-wrap button[type="submit"]:disabled {
  background: var(--muted);
  border-color: var(--muted);
  cursor: not-allowed;
  transform: none;
}
.auth-form-wrap .btn-primary .arrow,
.auth-form-wrap button[type="submit"] .arrow {
  display: inline-block;
  width: 18px;
  height: 10px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 12' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 6 H18 M13 2 L18 6 L13 10'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 12' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 6 H18 M13 2 L18 6 L13 10'/></svg>") no-repeat center / contain;
}

/* ---- Divider ---- */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 4px;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---- Google secondary ---- */
.btn-google {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--card);
  color: var(--heading);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease;
  flex-shrink: 0;
}

/* ---- Compact Google link (inline alternative on dense screens) ---- */
.google-alt-link {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  min-height: 36px;
  font-size: 14px;
  font-weight: 600;
  color: var(--body);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.google-alt-link:hover { color: var(--heading); }
.google-alt-link svg { width: 16px; height: 16px; }
.btn-google:hover {
  border-color: var(--heading);
  background: #fafafa;
}
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---- Bottom helper line (login: "Sign up", signup: "Log in") ---- */
.signup-prompt {
  text-align: center;
  margin-top: 24px;
  font-size: 15px;
  color: var(--body);
  letter-spacing: -0.005em;
}
.signup-prompt a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  padding: 8px 4px;
  margin: -8px -4px;
  display: inline-block;
}
.signup-prompt a:hover { text-decoration: underline; }

/* ---- Footer legal — minimal single line with copyright ---- */
.auth-footer {
  width: 100%;
  max-width: 360px;
  /* margin-top: auto pushes the footer to the bottom of the flex column,
     so it sits flush with the viewport bottom even when content is short */
  margin: auto auto 0;
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.auth-footer .sep { color: var(--border); }
.auth-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease;
}
.auth-footer a:hover { color: var(--body); border-bottom-color: var(--border); }

/* ---- Back icon (compact alternative to .auth-back row) ---- */
.auth-back-icon {
  align-self: flex-start;
  background: transparent;
  border: 0;
  padding: 8px;
  margin: 0 0 -4px -8px;
  cursor: pointer;
  color: var(--body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  transition: color 180ms ease, background 180ms ease;
  flex-shrink: 0;
}
.auth-back-icon:hover { color: var(--heading); background: rgba(15, 20, 36, 0.04); }
.auth-back-icon svg { width: 20px; height: 20px; }

/* ---- ≥520px: relax compression on taller / wider viewports ---- */
@media (min-height: 720px) {
  .auth-page { padding: 14px 20px 20px; }
  .auth-form-wrap h1 { font-size: 28px; }
  .auth-form,
  .auth-form-wrap form { gap: 14px; }
}
