/* ============================================================
   pouk-auth — pouk.ai design system (poukai-ui) subset.
   Faithful port of tokens + Button/Input/Wordmark for the auth UI.
   ============================================================ */

/* ---------- Self-hosted webfont (Geist, variable) ---------- */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src:
    url("fonts/Geist-Variable.woff2") format("woff2-variations"),
    url("fonts/Geist-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src:
    url("fonts/Geist-Italic-Variable.woff2") format("woff2-variations"),
    url("fonts/Geist-Italic-Variable.woff2") format("woff2");
}

/* ---------- Tokens (light) ---------- */
:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --surface: #f5f5f7;
  --bg-elevated: #ffffff;
  --fg: #1d1d1f;
  --fg-muted: #6e6e73;
  --hairline: #d2d2d7;
  --hairline-soft: #e5e5ea;
  --accent: #0071e3;
  --accent-glow: rgba(0, 113, 227, 0.18);
  --danger: #b3261e;
  --bg-danger: #fef0f0;
  --fg-on-danger: #5c1310;

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;

  --fs-body: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  --fs-meta: 0.875rem;
  --fs-micro: 0.75rem;
  --fs-wordmark: clamp(1.0625rem, 0.95rem + 0.6vw, 1.25rem);
  --lh-body: 1.55;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --radius-1: 2px;
  --radius-2: 4px;
  --radius-3: 8px;
  --radius-card: 14px;

  --btn-h-md: 44px;
  --easing: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-press: 80ms;
  --dur-fast: 180ms;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 34px rgba(0, 0, 0, 0.08);
}

/* ---------- Tokens (dark) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --bg-elevated: #1c1c1e;
    --fg: #f5f5f7;
    --fg-muted: #86868b;
    --hairline: #2c2c2e;
    --hairline-soft: #3a3a3c;
    --accent: #0a84ff;
    --accent-glow: rgba(10, 132, 255, 0.24);
    --danger: #ff453a;
    --bg-danger: #1c0a0a;
    --fg-on-danger: #ffb4b0;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 34px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Card ---------- */
.ds-card {
  width: min(92vw, 400px);
  background: var(--bg-elevated);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-card);
  padding: var(--space-8) var(--space-6);
  box-shadow: var(--shadow-card);
}
.ds-card.center { text-align: center; }

/* ---------- Wordmark ---------- */
.ds-brand { display: flex; align-items: center; margin-bottom: var(--space-6); }
.ds-card.center .ds-brand { justify-content: center; }
.ds-wordmark { display: inline-flex; color: var(--fg); }
.ds-wordmark svg { height: 32px; width: auto; display: block; }

/* ---------- Type ---------- */
.ds-title {
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 var(--space-1);
  color: var(--fg);
}
.ds-sub {
  margin: 0 0 var(--space-6);
  color: var(--fg-muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.ds-prose { color: var(--fg); font-size: 0.9375rem; line-height: 1.5; margin: 0; }

/* ---------- Field (Input) ---------- */
.ds-label {
  display: block;
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--fg);
  margin: var(--space-4) 0 var(--space-2);
}
.ds-input {
  display: block;
  width: 100%;
  min-height: var(--btn-h-md);
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: var(--lh-body);
  color: var(--fg);
  transition: border-color var(--dur-fast) var(--easing), box-shadow var(--dur-fast) var(--easing);
}
.ds-input::placeholder { color: var(--fg-muted); }
@media (hover: hover) {
  .ds-input:not(:disabled):hover { border-color: var(--fg-muted); }
}
.ds-input:focus-visible,
.ds-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.ds-input.code {
  font-size: 1.25rem;
  letter-spacing: 0.4em;
  text-align: center;
}

/* ---------- Password field with reveal toggle ---------- */
.ds-field { position: relative; display: block; }
.ds-input.has-reveal { padding-right: 44px; }
.ds-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-2);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--easing), color var(--dur-fast) var(--easing);
}
.ds-reveal:hover { background: var(--surface); color: var(--fg); }
.ds-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ds-reveal svg { width: var(--icon-md, 20px); height: var(--icon-md, 20px); display: block; }
.ds-reveal .eye-off { display: none; }
.ds-reveal[aria-pressed="true"] .eye { display: none; }
.ds-reveal[aria-pressed="true"] .eye-off { display: block; }

/* ---------- Button ---------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--btn-h-md);
  margin-top: var(--space-6);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-2);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--fg);
  color: var(--bg);
  transition: background var(--dur-fast) var(--easing), transform var(--dur-press) var(--easing);
}
.ds-btn:hover { background: color-mix(in oklab, var(--fg) 88%, transparent); }
.ds-btn:active { transform: translateY(1px); }
.ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ds-btn:disabled { opacity: 0.5; pointer-events: none; }
.ds-btn.secondary {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--hairline);
}
.ds-btn.secondary:hover { background: color-mix(in oklab, var(--surface) 90%, var(--fg)); }

/* ---------- Flash (error) ---------- */
.ds-flash {
  background: var(--bg-danger);
  border: 1px solid color-mix(in oklab, var(--danger) 35%, transparent);
  color: var(--fg-on-danger);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-2);
  font-size: var(--fs-meta);
  margin-bottom: var(--space-4);
}

/* ---------- Footer link ---------- */
.ds-foot { margin-top: var(--space-4); text-align: center; font-size: var(--fs-meta); }
.ds-link { color: var(--accent); text-decoration: none; }
.ds-link:hover { text-decoration: underline; }

/* ---------- Misc ---------- */
.ds-row { display: flex; gap: var(--space-3); }
.ds-row form { flex: 1; }
.ds-row .ds-btn { margin-top: 0; }
.ds-scopes { margin: 0 0 var(--space-6); padding-left: var(--space-4); color: var(--fg); font-size: 0.9375rem; }
.ds-scopes li { margin: var(--space-1) 0; }
