/* Font definition for Pentagra with comprehensive fallback paths for all deployment scenarios */
@font-face {
  font-family: 'Pentagra';
  src: url('./pentagra.woff2') format('woff2'),
       url('./Pentagra-Regular.ttf') format('truetype'),
       url('/pentagra.woff2') format('woff2'),
       url('/Pentagra-Regular.ttf') format('truetype'),
       url('./fallback/pentagra.woff2') format('woff2'),
       url('./fallback/Pentagra-Regular.ttf') format('truetype'),
       url('/fallback/pentagra.woff2') format('woff2'),
       url('/fallback/Pentagra-Regular.ttf') format('truetype'),
       url('./static/fallback/pentagra.woff2') format('woff2'),
       url('./static/fallback/Pentagra-Regular.ttf') format('truetype'),
       url('/static/fallback/pentagra.woff2') format('woff2'),
       url('/static/fallback/Pentagra-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block; /* Force block period to avoid FOUT in Safari */
}

/* Specific Safari-focused font definition with longer block period */
@media not all and (min-resolution:.001dpcm) {
  @supports (-webkit-appearance:none) {
    @font-face {
      font-family: 'Pentagra';
      src: url('./pentagra.woff2') format('woff2'),
           url('./Pentagra-Regular.ttf') format('truetype'),
           url('/pentagra.woff2') format('woff2'),
           url('/Pentagra-Regular.ttf') format('truetype'),
           url('./fallback/pentagra.woff2') format('woff2'),
           url('./fallback/Pentagra-Regular.ttf') format('truetype'),
           url('/fallback/pentagra.woff2') format('woff2'),
           url('/fallback/Pentagra-Regular.ttf') format('truetype'),
           url('./static/fallback/pentagra.woff2') format('woff2'),
           url('./static/fallback/Pentagra-Regular.ttf') format('truetype'),
           url('/static/fallback/pentagra.woff2') format('woff2'),
           url('/static/fallback/Pentagra-Regular.ttf') format('truetype');
      font-weight: normal;
      font-style: normal;
      font-display: block; /* Longer display period for Safari */
    }
  }
}

/* Headings for all browsers */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Pentagra', serif;
  transition: color 0.2s ease; /* Smooth transition for FOUT prevention */
}

/* Android-specific font definitions - these have format priority on Android */
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
  @font-face {
    font-family: 'Pentagra';
    src: local('Pentagra'),
         url('./pentagra.woff2') format('woff2'),
         url('./Pentagra-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
  }
  
  /* Force inline styles for Android browsers */
  .android-device h1,
  .android-device h2,
  .android-device h3,
  .android-device h4,
  .android-device h5,
  .android-device h6 {
    font-family: 'Pentagra', serif !important;
  }
}

/* Fallback styles for older browsers or if Pentagra fails to load */
.font-not-loaded h1,
.font-not-loaded h2, 
.font-not-loaded h3,
.font-not-loaded h4,
.font-not-loaded h5,
.font-not-loaded h6 {
  font-family: 'Grenze Gotisch', serif !important;
}

/* Google Fonts are loaded via link in HTML head */

/* Fallback rule as a last resort */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Pentagra', 'Grenze Gotisch', serif;
}

body {
  font-family: 'Space Grotesk', sans-serif;
}