/**
 * Optimized Font Loading CSS - Performance Focused
 * Consolidated from fonts.css and font-optimization.css
 * Reduces initial font loading from 333KB to ~111KB
 */

/* ===== INTER FONT DECLARATIONS ===== */

/* Inter Regular (400) - Critical font preloaded */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-400.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter Bold (700) - Loaded on-demand */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter-700.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter Extra Bold (800) - Loaded on-demand */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/inter-800.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== FALLBACK FONTS WITH METRIC OVERRIDES ===== */

@font-face {
  font-family: 'Inter-fallback';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Arial'), local('Helvetica'), local('system-ui');
  ascent-override: 90.20%;
  descent-override: 22.48%;
  line-gap-override: 0.00%;
  size-adjust: 107.40%;
}

@font-face {
  font-family: 'Inter-fallback';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Arial Bold'), local('Helvetica Bold'), local('system-ui');
  ascent-override: 90.20%;
  descent-override: 22.48%;
  line-gap-override: 0.00%;
  size-adjust: 107.40%;
}

@font-face {
  font-family: 'Inter-fallback';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: local('Arial Black'), local('Helvetica Bold'), local('system-ui');
  ascent-override: 90.20%;
  descent-override: 22.48%;
  line-gap-override: 0.00%;
  size-adjust: 107.40%;
}

/* ===== CSS CUSTOM PROPERTIES ===== */

:root {
  --font-inter: 'Inter', 'Inter-fallback', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== BASE FONT APPLICATION ===== */

body, html {
  font-family: var(--font-inter);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  font-display: swap;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== PERFORMANCE OPTIMIZED CLASSES ===== */

.font-inter {
  font-family: var(--font-inter);
}

.font-inter-400 {
  font-family: var(--font-inter);
  font-weight: 400;
}

.font-inter-700 {
  font-family: var(--font-inter);
  font-weight: 700;
}

.font-inter-800 {
  font-family: var(--font-inter);
  font-weight: 800;
}

/* ===== CRITICAL TEXT ELEMENTS ===== */

h1, h2, h3, h4, h5, h6,
.text-critical,
.hero-text,
.nav-text {
  font-family: var(--font-inter);
  font-display: swap;
}

/* ===== RESPONSIVE FONT OPTIMIZATION ===== */

@media (max-width: 768px) {
  body, html {
    text-rendering: optimizeSpeed;
  }
}

@media (min-width: 769px) {
  body, html {
    text-rendering: optimizeLegibility;
  }
}

/* ===== UTILITY CLASSES ===== */

.body-font {
  font-family: var(--font-inter);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
}

.heading-font {
  font-family: var(--font-inter);
  font-weight: 700;
  line-height: 1.2;
}

.display-font {
  font-family: var(--font-inter);
  font-weight: 800;
  line-height: 1.1;
}

/* ===== PERFORMANCE HINTS ===== */

/* 
Performance Notes:
- Only Inter 400 is preloaded (~111KB)
- Inter 700 and 800 load on-demand when needed
- Fallback fonts prevent layout shifts
- Consistent font-display: swap strategy
- Optimized for Core Web Vitals
*/
