/* ============================================================
   문AI · 로그인 (auth.moonai.kr) — standalone signup/signin page.
   Lifted from pt/pt.css (the modal + code-box + oauth rules) so the login
   surface matches the PT app. Self-contained; no dependency on pt.css.
   (c) 2026 Hyun Jae Moon / Moonai. Apache-2.0.
   ============================================================ */

:root {
  --bg: #0A0B0D;
  --surface: #14161A;
  --surface-2: #1B1E24;
  --fg: #ECEDF0;
  --fg-2: #C2C6CE;
  --fg-3: #888D97;
  --fg-4: #585C65;
  --line: rgba(236, 237, 240, 0.10);
  --line-2: rgba(236, 237, 240, 0.16);
  --accent: #5FCFC0;
  --accent-deep: #1F9E8B;
  --accent-tint: rgba(95, 207, 192, 0.12);
  --danger: #ff6b6b;
  --warn: #f0a04b;
  --display: "Newsreader", "Noto Serif KR", Georgia, serif;
  --sans: "Geist", "IBM Plex Sans KR", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
h1, h2, h3, p { margin: 0; }

/* ---------- i18n: data-lang-show, mirrors pt.css's mechanism ---------- */
[data-lang-show] { display: none; }
html[lang="ko"] [data-lang-show="ko"] { display: inline; }
html[lang="en"] [data-lang-show="en"] { display: inline; }
[hidden] { display: none !important; }

/* ---------- page shell (centers the card) ---------- */
.auth-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 20px 48px;
  background: radial-gradient(ellipse 72% 42% at 50% 0%, rgba(95, 207, 192, 0.05), transparent 62%);
}
.auth-top {
  width: 100%; max-width: 420px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; margin-bottom: auto;
}
.auth-brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; flex-shrink: 0; }
.auth-brand img { border-radius: 6px; flex-shrink: 0; }
.auth-brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }

.auth-lang { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; flex-shrink: 0; }
.auth-lang-btn { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; padding: 5px 10px; border-radius: 999px; color: var(--fg-3); }
.auth-lang-btn:hover { color: var(--fg-2); }
.auth-lang-btn.is-active { color: var(--accent); background: var(--accent-tint); }

.auth-main {
  width: 100%; max-width: 380px;
  margin-top: 40px; margin-bottom: auto;
}

/* ---------- card (mirrors pt.css .pt-modal-card, but static) ---------- */
.auth-card {
  width: 100%; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 16px; padding: 28px 24px 24px; position: relative;
  box-shadow: 0 24px 64px -24px rgba(0, 0, 0, 0.75);
}
.auth-title { font-family: var(--display); font-weight: 500; font-size: 23px; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--fg-3); margin-bottom: 20px; line-height: 1.5; }
.auth-step[hidden] { display: none; }

/* return_to notice — shown when no valid return_to was supplied */
.auth-return-notice {
  width: 100%; max-width: 380px; margin: 14px auto 0;
  font-size: 12px; color: var(--warn);
  background: rgba(240, 160, 75, 0.08); border: 1px solid rgba(240, 160, 75, 0.25);
  border-radius: 8px; padding: 9px 11px; text-align: center;
}

/* ---------- generic buttons / fields ---------- */
.auth-primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; padding: 10px 16px; border-radius: 999px;
  text-decoration: none; white-space: nowrap; background: var(--accent); color: #04201c;
  transition: background 160ms ease, box-shadow 160ms ease;
}
.auth-primary-btn:hover:not(:disabled) { background: #6fd9cb; box-shadow: 0 0 0 3px var(--accent-tint); }
.auth-primary-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.auth-block { width: 100%; }
.auth-link-btn { font-size: 12px; color: var(--fg-3); text-decoration: underline; text-decoration-color: var(--line-2); margin-top: 12px; display: block; text-align: center; width: 100%; }
.auth-link-btn:hover { color: var(--fg-2); }
.auth-link-btn:disabled { opacity: 0.5; cursor: not-allowed; text-decoration: none; }

.auth-field { display: block; margin-bottom: 14px; }
.auth-field-label { display: block; font-size: 12px; color: var(--fg-3); margin-bottom: 6px; }
.auth-field-input {
  width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); font-size: 14px;
}
.auth-field-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.auth-field-input::placeholder { color: var(--fg-3); }
.auth-field-error { min-height: 16px; font-size: 12px; color: var(--danger); margin: -6px 0 12px; }
.auth-field-error:empty { margin: 0; }

/* ---------- social sign-in lanes (copied from pt.css .pt-oauth-*) ---------- */
.auth-oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 10px 16px; margin-bottom: 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--fg-2); border: 1px solid var(--line);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.auth-oauth-btn:hover:not(:disabled) { color: var(--fg); border-color: var(--line-2); background: var(--surface-2); }
.auth-oauth-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.auth-oauth-btn svg { flex-shrink: 0; }
/* "준비 중" / "Coming soon" pill on a provider whose IdP is not provisioned. */
.auth-oauth-soon {
  font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0.04em;
  color: var(--fg-3); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 6px; margin-left: 2px;
}
.auth-oauth-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--fg-3); margin: 16px 0 14px;
}
.auth-oauth-divider::before, .auth-oauth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ---------- code boxes (copied from pt.css .pt-code-*) ---------- */
.auth-code-boxes { display: flex; gap: 8px; margin-bottom: 8px; }
.auth-code-box {
  width: 100%; aspect-ratio: 1; text-align: center; font-size: 18px; font-family: var(--mono);
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg);
}
.auth-code-box:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

/* ---------- toast ---------- */
.auth-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--fg);
  font-size: 13px; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.auth-toast[hidden] { display: none; }

.auth-foot { margin-top: 28px; text-align: center; }
.auth-foot span { font-size: 11.5px; color: var(--fg-3); }
.auth-foot a { text-decoration: underline; text-decoration-color: var(--line-2); }
.auth-foot a:hover { color: var(--fg-2); }

/* ---------- focus-visible baseline ---------- */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
