/**
 * Vibecodr Self-Hosted Fonts - Multi-Tiered Font Loading Strategy
 *
 * WHY: Custom fonts can be blocked by strict CSP on embedding sites (e.g., claude.ai).
 * This file implements a defense-in-depth approach to ensure text remains readable:
 *
 * TIER 1: Self-hosted fonts from /fonts/ (CSP-safe, highest priority)
 * TIER 2: local() fallback to system-installed fonts (free bandwidth)
 * TIER 3: CDN fallback - Google Fonts (most compatible)
 * TIER 4: System font stack via CSS custom properties (guaranteed to work)
 *
 * FONT LICENSING:
 * - Inter: SIL Open Font License 1.1 (https://rsms.me/inter/)
 * - Fira Code: SIL Open Font License 1.1 (https://github.com/tonsky/FiraCode)
 */

/* ============================================
 * INTER - Primary Sans-Serif Font
 * Variable font with weight axis 100-900
 * ============================================ */

/* Inter Variable (full weight range) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap; /* WHY: Prevents invisible text during font load */
  src:
    /* TIER 1: Self-hosted (CSP-safe, works on any embedding site) */
    url("/fonts/Inter-VariableFont.woff2") format("woff2"),
    /* TIER 2: Try locally installed Inter (many devs have it) */
    local("Inter"),
    local("Inter Variable"),
    local("InterVariable"),
    /* TIER 3: CDN fallback - Google Fonts (widely whitelisted) */
    url("https://fonts.gstatic.com/s/inter/v18/UcCo3FwrK3iLTcviYwYZ8UA3.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;
}

/* Inter Italic Variable */
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src:
    /* TIER 1: Self-hosted (CSP-safe) */
    url("/fonts/Inter-Italic-VariableFont.woff2") format("woff2"),
    /* TIER 2: Local installation */
    local("Inter Italic"),
    local("Inter Variable Italic"),
    /* TIER 3: CDN fallback */
    url("https://fonts.gstatic.com/s/inter/v18/UcCm3FwrK3iLTcvnUwkT9nA4.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;
}

/* ============================================
 * FIRA CODE - Primary Monospace Font
 * Variable font with weight axis 300-700
 * ============================================ */

@font-face {
  font-family: "Fira Code";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src:
    /* TIER 1: Self-hosted (CSP-safe) */
    url("/fonts/FiraCode-VariableFont.woff2") format("woff2"),
    /* TIER 2: Try locally installed Fira Code */
    local("Fira Code"),
    local("FiraCode"),
    local("Fira Code Variable"),
    /* TIER 3: CDN fallback */
    url("https://fonts.gstatic.com/s/firacode/v22/uU9NCBsR6Z2vfE9aq3bh3dSD.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;
}

/* ============================================
 * SYSTEM FONT STACKS - Tier 4 Fallbacks
 * These CSS custom properties provide robust fallbacks
 * when custom fonts fail to load (CSP blocks, offline, etc.)
 * ============================================ */

:root {
  /* WHY: Define fallback stacks as CSS custom properties for easy reuse */
  /* These are the same values used in the runtime sandbox */
  --vibecodr-font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --vibecodr-font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
  --vibecodr-font-mono: "Fira Code", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
