/**
 * AgentMail Design System — Font Library
 *
 * Self-hosted variable fonts. No CDN dependency at runtime — all
 * @font-face URLs resolve to woff2 files in this directory.
 *
 * Usage from project root:
 *   <link rel="stylesheet" href="fonts/fonts.css">
 *
 * Usage from preview/ subdirectory:
 *   <link rel="stylesheet" href="../fonts/fonts.css">
 *   (paths are relative to *this* file, so they resolve correctly
 *    no matter where fonts.css is included from.)
 *
 * License notes:
 *   DM Sans, Plus Jakarta Sans, Outfit, Fira Code   — SIL Open Font License 1.1
 *   JetBrains Mono                                  — SIL Open Font License 1.1
 *   IBM Plex Sans, IBM Plex Mono                    — SIL Open Font License 1.1
 *   Geist                                            — SIL Open Font License 1.1
 *   All bundled here are subset to Latin (U+0000–00FF + a few punctuation).
 *
 * Source: fetched from Google Fonts CSS API (fonts.gstatic.com), latin subset.
 */

/* ─── DM Sans — DEFAULT UI font ─────────────────────────────────────────── */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;          /* variable axis */
  font-display: swap;
  src: url('./dm-sans-var.woff2') format('woff2-variations'),
       url('./dm-sans-var.woff2') format('woff2');
}

/* ─── JetBrains Mono — DEFAULT mono font ────────────────────────────────── */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('./jetbrains-mono-var.woff2') format('woff2-variations'),
       url('./jetbrains-mono-var.woff2') format('woff2');
}

/* ─── Plus Jakarta Sans — alt UI (ops/SaaS skin) ────────────────────────── */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('./plus-jakarta-sans-var.woff2') format('woff2-variations'),
       url('./plus-jakarta-sans-var.woff2') format('woff2');
}

/* ─── IBM Plex Sans — alt UI (enterprise/regulated skin) ────────────────── */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('./ibm-plex-sans-var.woff2') format('woff2-variations'),
       url('./ibm-plex-sans-var.woff2') format('woff2');
}

/* ─── IBM Plex Mono — alt mono (pairs with IBM Plex Sans) ───────────────── */
/* Plex Mono on Google Fonts is static; we ship 400 and 500 as separate files. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./ibm-plex-mono-500.woff2') format('woff2');
}

/* ─── Outfit — alt UI (growth-stage/creative skin) ──────────────────────── */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./outfit-var.woff2') format('woff2-variations'),
       url('./outfit-var.woff2') format('woff2');
}

/* ─── Fira Code — alt mono (ligatures, dev-tool skin) ───────────────────── */
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('./fira-code-var.woff2') format('woff2-variations'),
       url('./fira-code-var.woff2') format('woff2');
}

/* ─── Geist — alt UI (AI/dev-tool skin) ─────────────────────────────────── */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./geist-var.woff2') format('woff2-variations'),
       url('./geist-var.woff2') format('woff2');
}

/* ─── Token aliases (the system contract) ───────────────────────────────── */
/*
 * Consumers should NOT reference family names directly — read from these
 * tokens instead. Swap the default by overriding --font-sans / --font-mono
 * on the :root inside a host stylesheet, e.g. for an IBM Plex skin:
 *
 *   :root {
 *     --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
 *     --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
 *   }
 */
:root {
  /* Default token resolution */
  --font-sans: 'DM Sans', ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
               Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code',
               'Source Code Pro', Menlo, Monaco, Consolas, monospace;

  /* Named families (for the typography guide / skin-pickers) */
  --font-family-dm-sans:           'DM Sans', sans-serif;
  --font-family-plus-jakarta-sans: 'Plus Jakarta Sans', sans-serif;
  --font-family-ibm-plex-sans:     'IBM Plex Sans', sans-serif;
  --font-family-outfit:            'Outfit', sans-serif;
  --font-family-geist:             'Geist', sans-serif;
  --font-family-jetbrains-mono:    'JetBrains Mono', monospace;
  --font-family-ibm-plex-mono:     'IBM Plex Mono', monospace;
  --font-family-fira-code:         'Fira Code', monospace;

  /* Semantic weight tokens — variable axes pick the right cut */
  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  /* Type-scale tokens (px values keep math simple on data-dense screens) */
  --font-size-3xs: 10px;   /* table column headers */
  --font-size-2xs: 11px;   /* section caps, rail labels */
  --font-size-xs:  12px;   /* meta, agent notes */
  --font-size-sm:  13px;   /* body, list items */
  --font-size-md:  14px;   /* sm-600 — card subjects */
  --font-size-lg:  16px;   /* reading-pane subject */
  --font-size-xl:  20px;   /* page heading */

  /* Line-height tokens */
  --line-height-tight:  1.4;   /* condensed labels */
  --line-height-snug:   1.5;   /* body, default */
  --line-height-relaxed:1.65;  /* message bodies */

  /* Tracking */
  --tracking-tight: -0.025em; /* large display / wordmark */
  --tracking-normal: 0;
  --tracking-wide:  0.05em;   /* section caps */
  --tracking-wider: 0.08em;   /* 10px table headers */
}
