/* =============================================================================
   FONTS.CSS - Optimized Font Loading Strategy
   ============================================================================= */

/* Google Fonts import as fallback (only load what we need) */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700&display=swap');

/* Local fonts with fallback strategy */
@font-face {
  font-display: swap;
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  src: 
    local('Nunito Sans Regular'),
    local('NunitoSans-Regular'),
    url('../fonts/nunito-sans-v18-cyrillic_latin-regular.woff2') format('woff2'),
    url('../fonts/nunito-sans-v18-cyrillic_latin-regular.woff') format('woff');
}

@font-face {
  font-display: swap;
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 600;
  src: 
    local('Nunito Sans 600'),
    local('Nunito Sans SemiBold'),
    local('NunitoSans-SemiBold'),
    url('../fonts/nunito-sans-v18-cyrillic_latin-600.woff2') format('woff2'),
    url('../fonts/nunito-sans-v18-cyrillic_latin-600.woff') format('woff');
}

@font-face {
  font-display: swap;
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 700;
  src: 
    local('Nunito Sans 700'),
    local('Nunito Sans Bold'),
    local('NunitoSans-Bold'),
    url('../fonts/nunito-sans-v18-cyrillic_latin-700.woff2') format('woff2'),
    url('../fonts/nunito-sans-v18-cyrillic_latin-700.woff') format('woff');
}

/* =============================================================================
   CSS VARIABLES
   ============================================================================= */

:root {
  /* Font stacks with progressive fallback */
  --font-family-primary: 
    'Nunito Sans',
    system-ui,
    -apple-system,
    'Segoe UI',
    'Roboto',
    'Helvetica Neue',
    Arial,
    sans-serif;

  --font-family-mono: 
    'SF Mono',
    Consolas,
    'Liberation Mono',
    Menlo,
    monospace;

  /* Font sizes (only what we need) */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */

  /* Font weights (only what we have) */
  --font-weight-normal: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
}

/* =============================================================================
   GLOBAL FONT STYLES
   ============================================================================= */

html {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  font-weight: var(--font-weight-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Utility classes for quick application */
.font-normal { font-weight: var(--font-weight-normal); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }

/* Component-specific styles */
.top-nav {
  font-weight: var(--font-weight-semibold);
}

.logo {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xl);
}

.modal-title {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
}

/* Forms inherit font */
input, select, textarea, button {
  font-family: inherit;
}

/* Screen reader only text */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =============================================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================================= */

/* Mobile adjustments */
@media (max-width: 768px) {
  :root {
    --font-size-xs: 0.6875rem;  /* 11px */
    --font-size-sm: 0.8125rem;  /* 13px */
    --font-size-base: 0.9375rem; /* 15px */
    --font-size-lg: 1rem;       /* 16px */
    --font-size-xl: 1.125rem;   /* 18px */
    --font-size-2xl: 1.25rem;   /* 20px */
  }
}

/* Large screen enhancements */
@media (min-width: 1200px) {
  :root {
    --font-size-base: 1.0625rem; /* 17px */
    --font-size-lg: 1.1875rem;  /* 19px */
    --font-size-xl: 1.375rem;   /* 22px */
    --font-size-2xl: 1.625rem;  /* 26px */
  }
}