/* ═══════════════════════════════════════════════════════════════
   FW theme — the stark Joan-serif look shared across the drayzun suite.

   Single source of truth. Consumers:
     • workers/auth/login-page.js  — inlines this file (imported as text)
       and serves the fonts below from /fw/fonts/*.woff2.
     • apps/spellforge (later)      — may import the same file + serve the
       same /fw/fonts/ paths.

   Self-hosted Joan (OFL, from Google Fonts) so there's no external request
   and no flash of fallback. The font files live at shared/fw/fonts/ and are
   served at the absolute path /fw/fonts/<name>.woff2 by each host.

   Design tokens are scoped under [data-theme="fw"] so importing this file
   does NOT clobber another app's :root theme vars. Component classes are
   namespaced .fw-* for the same reason.
   ═══════════════════════════════════════════════════════════════ */

/* Joan — latin-ext subset (accents, extended punctuation). */
@font-face {
  font-family: 'Joan';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fw/fonts/joan-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Joan — latin subset (ASCII + common punctuation; covers the whole login). */
@font-face {
  font-family: 'Joan';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fw/fonts/joan-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Design tokens ─────────────────────────────────────────────── */
[data-theme="fw"] {
  --fw-bg: #2b2b2b;
  --fw-field-bg: #3f3f3f;                 /* flat fill for field + button (no border, no gradient) */
  --fw-field-bg-hover: #474747;
  --fw-shadow: #0f0f0f;                    /* hard 2px drop shadow under the button */
  --fw-text: #f2f2f2;                      /* typed text + button label */
  --fw-placeholder: rgba(242, 242, 242, 0.5);
  --fw-error: #d04949;                      /* red text — inline errors + Denied… */
  --fw-muted: #8a8a8a;                     /* Success… terminal text */
  --fw-denied: #d04949;                    /* Denied… */
  --fw-link: #8a8a8a;                      /* back link — intentionally NOT red */
  --fw-link-hover: #b8b8b8;
  /* The "←" glyph isn't in Joan's range, so it falls back to serif — by design. */
  --fw-serif: 'Joan', Georgia, 'Times New Roman', serif;
}

/* ── Page shell ────────────────────────────────────────────────── */
[data-theme="fw"] .fw-screen {
  margin: 0;
  min-height: 100vh;
  background: var(--fw-bg);
  color: var(--fw-text);
  font-family: var(--fw-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
[data-theme="fw"] .fw-screen *,
[data-theme="fw"] .fw-screen *::before,
[data-theme="fw"] .fw-screen *::after { box-sizing: border-box; }

[data-theme="fw"] .fw-stack { width: 220px; text-align: center; }

/* one screen visible at a time */
[data-theme="fw"] .fw-state { display: none; }
[data-theme="fw"] .fw-state.fw-active { display: block; }

[data-theme="fw"] .fw-form { margin: 0; }

/* ── Field (flat #3F3F3F, no border, no gradient) ──────────────── */
[data-theme="fw"] .fw-field {
  width: 100%;
  padding: 7px 10px;
  font-family: var(--fw-serif);
  font-size: 14px;
  color: var(--fw-text);
  background: var(--fw-field-bg);
  border: none;
  border-radius: 0;
  outline: none;
}
[data-theme="fw"] .fw-field::placeholder { color: var(--fw-placeholder); }
/* No border to recolor on focus — brighten the fill instead. */
[data-theme="fw"] .fw-field:focus { background: var(--fw-field-bg-hover); }
[data-theme="fw"] .fw-field.fw-code { letter-spacing: 0.12em; }

/* ── Button (flat #3F3F3F, hard 2px #0F0F0F drop shadow) ───────── */
[data-theme="fw"] .fw-btn {
  width: 100%;
  margin-top: 12px;
  padding: 8px 10px;
  font-family: var(--fw-serif);
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fw-text);
  background: var(--fw-field-bg);
  border: none;
  border-radius: 0;
  box-shadow: 4px 4px 0 0 var(--fw-shadow);
  cursor: pointer;
}
[data-theme="fw"] .fw-btn:hover:not(:disabled) { background: var(--fw-field-bg-hover); }
/* Press it fully into its own shadow. */
[data-theme="fw"] .fw-btn:active:not(:disabled) {
  transform: translate(4px, 4px);
  box-shadow: none;
}
[data-theme="fw"] .fw-btn:disabled { opacity: 0.55; cursor: default; }

/* ── Inline message — sits ABOVE the field (e.g. "Email Required").
   Collapses to nothing when empty so the clean state matches the mockups. */
[data-theme="fw"] .fw-msg {
  margin: 0 0 8px;
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
  color: var(--fw-muted);
}
[data-theme="fw"] .fw-msg:empty { display: none; }
[data-theme="fw"] .fw-msg.fw-error { color: var(--fw-error); }

/* ── Terminal text states (Success… / Denied…) ────────────────── */
[data-theme="fw"] .fw-terminal { font-size: 14px; color: var(--fw-muted); }
[data-theme="fw"] .fw-terminal.fw-denied { color: var(--fw-denied); }

[data-theme="fw"] .fw-goback {
  display: inline-block;
  margin-top: 18px;
  font-family: var(--fw-serif);
  font-size: 12px;
  color: var(--fw-link);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
[data-theme="fw"] .fw-goback:hover { color: var(--fw-link-hover); }
