/* DIN Next LT Arabic Font Definitions */
/* Optimized for minimal FOUT (Flash of Unstyled Text) */

@font-face {
  font-family: 'DIN Next LT Arabic';
  src: url('./din-next-arabic/DINNextLTArabic-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: 'DIN Next LT Arabic';
  src: url('./din-next-arabic/DINNextLTArabic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: 'DIN Next LT Arabic';
  src: url('./din-next-arabic/DINNextLTArabic-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+1EE00-1EEFF;
}

@font-face {
  font-family: 'DIN Next LT Arabic';
  src: url('./din-next-arabic/DINNextLTArabic-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+1EE00-1EEFF;
}

/* Latin fallback for non-Arabic characters */
@font-face {
  font-family: 'DIN Next LT Arabic';
  src: url('./din-next-arabic/DINNextLTArabic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-05FF, U+0700-074F, U+0780-08FF, U+1E00-1EFF, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-21FF, U+2200-22FF;
}

/* Font Loading States - Minimize FOUT */
html.fonts-loading {
  /* Hide content briefly while fonts load */
  visibility: hidden;
}

html.fonts-loading body {
  opacity: 0;
  transition: opacity 0.1s ease-in;
}

html.fonts-loaded body {
  opacity: 1;
  transition: opacity 0.1s ease-in;
}

html.fonts-fallback body {
  opacity: 1;
  /* Use system fonts if custom fonts fail */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Ensure critical content is never hidden too long */
html.fonts-loading .loading-content,
html.fonts-loading .critical-content {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Performance optimization for font rendering */
.din-next-text {
  font-family: 'DIN Next LT Arabic', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
