/* AUTH-UX-1 · Full-page sign-in surface.
 * Layout, spacing and font scale mirror chatgpt.com/auth/login — the same
 * information architecture (wordmark top-left, centered stack, footer
 * bottom-center) delivered in PixelMinify tokens (--surface, --text,
 * --muted, --line, --brand-2) and typography. */

.pm-auth-open { overflow: hidden; }

.pm-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  animation: pm-auth-in .18s var(--ease, ease-out);
}
@keyframes pm-auth-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.pm-auth-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg, #0a0d15);
}

.pm-auth-page {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 24px 28px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: var(--text);
  animation: pm-auth-fade-in .22s cubic-bezier(.16,1,.3,1);
}
.pm-auth-page *, .pm-auth-page *::before, .pm-auth-page *::after { box-sizing: border-box; }
@keyframes pm-auth-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Page chrome ─────────────────────────────────────────────────────── */
.pm-auth-brand {
  grid-row: 1;
  justify-self: start;
  align-self: start;
}
.pm-auth-brand svg {
  display: block;
  height: 28px;
  width: auto;
}

.pm-auth-close {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.pm-auth-close:hover { background: var(--surface-2); color: var(--text); }
.pm-auth-close:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

/* ── Centered main stack ─────────────────────────────────────────────── */
.pm-auth-main {
  grid-row: 2;
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.pm-auth-title {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-align: center;
  color: var(--text);
}

/* Provider stack — pill buttons, icon-left + text ChatGPT-style */
.pm-auth-providers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pm-auth-provider {
  display: grid;
  grid-template-columns: 20px 1fr 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text) !important;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.pm-auth-provider > .pm-auth-provider-icon { grid-column: 1; }
.pm-auth-provider > span:not(.pm-auth-provider-icon) { grid-column: 2; }
.pm-auth-provider:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
}
.pm-auth-provider:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}
.pm-auth-provider-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.pm-auth-provider-icon svg { width: 100%; height: 100%; display: block; }

/* "or" separator */
.pm-auth-sep {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0;
}
.pm-auth-sep-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.pm-auth-sep-label {
  font-size: 13px;
  color: var(--muted);
}

/* Email row */
.pm-auth-email {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pm-auth-email-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color .16s var(--ease);
}
.pm-auth-email-input::placeholder { color: var(--muted); }
.pm-auth-email-input:focus {
  border-color: var(--brand-2);
}
.pm-auth-email-continue {
  width: 100%;
  min-height: 52px;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .16s var(--ease);
}
.pm-auth-email-continue:hover { opacity: 0.92; }
.pm-auth-email-continue:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
}

/* Sub-line under a step-2 title */
.pm-auth-sub {
  margin: 0 0 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Code input — same pill geometry as email, monospaced digits. */
.pm-auth-code-input {
  text-align: center;
  letter-spacing: .32em;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
}

/* Error row below the CTA — always reserves ~1 line so the button doesn't
 * jump when a message appears. */
.pm-auth-err {
  min-height: 20px;
  margin-top: 8px;
  color: var(--bad, #ff6a6a);
  font-size: 13px;
  text-align: center;
}

/* Actions row (resend + change email) below the verify button. */
.pm-auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.pm-auth-linklike {
  background: transparent;
  border: 0;
  padding: 6px 4px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.pm-auth-linklike:hover:not(:disabled) { color: var(--brand-2); }
.pm-auth-linklike:disabled {
  color: var(--muted);
  text-decoration: none;
  cursor: default;
}

/* "Try it first" — guest-usage escape hatch */
.pm-auth-tryfirst {
  display: block;
  margin: 4px auto 0;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.pm-auth-tryfirst:hover { color: var(--brand-2); }
.pm-auth-tryfirst:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Page footer ─────────────────────────────────────────────────────── */
.pm-auth-foot {
  grid-row: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}
.pm-auth-foot-mark {
  opacity: 0.7;
}
.pm-auth-foot-mark-img {
  display: block;
  height: 30px;
  width: auto;
}
.pm-auth-legal {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.pm-auth-legal a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pm-auth-legal a:hover { color: var(--text); }
.pm-auth-legal-sep {
  opacity: 0.4;
  user-select: none;
  font-weight: 300;
}

@media (max-width: 520px) {
  .pm-auth-page { padding: 20px 20px; }
  .pm-auth-brand svg { height: 24px; }
  .pm-auth-title { font-size: 26px; }
  .pm-auth-main { max-width: 100%; }
}

/* Light theme opts in when the system asks for it or --theme=light is set */
:root[data-theme="light"] .pm-auth-backdrop { background: #ffffff; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .pm-auth-backdrop { background: #ffffff; }
}
