/* ===== ROBOTO FONT IMPLEMENTATION ===== */
/* Google Fonts Import - Roboto Regular (400) and Bold (700) only */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

/* ===== GLOBAL FONT RESET ===== */
/* Set Roboto as the primary font for the entire website */
html,
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
  font-display: swap;
}

/* ===== HEADINGS - ROBOTO BOLD ===== */
/* All headings use Roboto Bold (700) */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 700 !important;
  font-display: swap;
}

/* ===== BODY TEXT - ROBOTO REGULAR ===== */
/* All body text, paragraphs, and general content use Roboto Regular (400) */
p, span, div, article, section, main, aside, nav, footer,
li, ul, ol, dl, dt, dd, blockquote, figcaption,
.f1, .f2, .f3, .f4, .f5, .f6, .f7,
.measure, .measure-wide, .measure-narrow {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
  font-display: swap;
}

/* ===== TACHYONS FONT UTILITY OVERRIDES ===== */
/* Override all Tachyons font utility classes to use Roboto */
.sans-serif {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

.system-sans-serif {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

.helvetica {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

.avenir {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* Keep serif fonts as fallback for specific serif classes */
.serif,
.system-serif,
.georgia,
.times,
.athelas,
.bodoni,
.calisto,
.garamond,
.baskerville {
  font-family: 'Roboto', Georgia, 'Times New Roman', Times, serif !important;
  font-weight: 400 !important;
}

/* ===== MONOSPACE FONTS - PRESERVE FOR CODE ===== */
/* Keep monospace fonts for code, pre, and technical content */
code, kbd, samp, pre,
.code,
.courier {
  font-family: Consolas, Monaco, 'Courier New', monospace !important;
  font-weight: 400 !important;
}

/* ===== FORM ELEMENTS - INHERIT ROBOTO ===== */
/* Ensure all form elements inherit Roboto from their parent */
input, textarea, button, select, optgroup, option {
  font-family: inherit !important;
  font-weight: inherit !important;
  font-display: swap;
}

/* Specific form element styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
select {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* Button elements */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn,
.button {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* ===== NAVIGATION AND MENU ELEMENTS ===== */
/* Ensure navigation uses Roboto */
nav, nav a, nav ul, nav li,
.nav, .navbar, .menu,
[role="navigation"],
[role="navigation"] a,
[role="navigation"] ul,
[role="navigation"] li {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* ===== SPECIFIC WEIGHT OVERRIDES ===== */
/* Ensure bold elements use Roboto Bold */
strong, b,
.b, .fw7, .fw8, .fw9,
.bold, .font-bold {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 700 !important;
}

/* Ensure normal weight elements use Roboto Regular */
.normal, .fw4,
.font-normal {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* Light weight elements - use Roboto Regular as fallback */
.fw1, .fw2, .fw3,
.font-light, .font-thin {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* Medium and semi-bold weights - use Roboto Bold */
.fw5, .fw6,
.font-medium, .font-semibold {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 700 !important;
}

/* ===== CUSTOM PAGE OVERRIDES ===== */
/* Override any existing custom font declarations */
.about-us-page,
.case-stories-page,
.achievement-page,
.project-intervention-page,
.get-involved-page {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  font-weight: 400 !important;
}

/* ===== FALLBACK AND PERFORMANCE ===== */
/* Font display optimization */
@supports (font-display: swap) {
  * {
    font-display: swap;
  }
}

/* Fallback for when Google Fonts fails to load */
@supports not (font-display: swap) {
  html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
  }
}

/* ===== ACCESSIBILITY AND READABILITY ===== */
/* Ensure consistent line heights and spacing with Roboto */
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Optimize text rendering for Roboto */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== PRINT STYLES ===== */
/* Ensure Roboto is used in print as well */
@media print {
  * {
    font-family: 'Roboto', Arial, sans-serif !important;
  }
  
  h1, h2, h3, h4, h5, h6 {
    font-weight: 700 !important;
  }
  
  body, p, span, div {
    font-weight: 400 !important;
  }
}

/* ===== RESPONSIVE FONT LOADING ===== */
/* Preload hint for better performance */
@media (prefers-reduced-motion: no-preference) {
  html {
    font-display: swap;
  }
}

/* ===== FINAL CATCH-ALL ===== */
/* Ultimate fallback to ensure everything uses Roboto */
* {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Preserve monospace for code elements */
code *, kbd *, samp *, pre *,
.code *, .courier * {
  font-family: Consolas, Monaco, 'Courier New', monospace !important;
}
