/* Font Optimization CSS */

/* Base font stack with system fonts as fallback */
body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Font loading states */
.font-loading {
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

.fonts-loaded .font-loading {
  opacity: 1;
}

/* Reserve space for text to prevent layout shift */
h1, h2, h3, h4, h5, h6, p, span, div {
  contain: content;
}

/* Specific font weight classes */
.font-regular {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-bold {
  font-weight: 700;
}

/* Font face declarations with font-display: swap */
@font-face {
  font-family: 'Noto Sans TC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/notosanstc/v36/-nF7OG829O4rZ59b3hwyGQxSg.woff2) format('woff2');
}

/* Add a class to the body when fonts are loaded */
.fonts-loaded {
  /* Add any additional styles needed when fonts are loaded */
}

/* Prevent layout shift for specific elements */
.ac-section {
  min-height: 100px; /* Adjust based on your content */
  contain: layout style paint;
}

/* Add specific height for first section to prevent layout shift */
.ac-section_first {
  min-height: 200px; /* Adjust based on your content */
  contain: layout style paint;
}

/* Font Awesome optimization */
@font-face {
  font-family: 'Font Awesome 5 Free';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../webfonts/fa-regular-400.woff2") format("woff2"),
       url("../webfonts/fa-regular-400.woff") format("woff");
}

@font-face {
  font-family: 'Font Awesome 5 Free';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("../webfonts/fa-solid-900.woff2") format("woff2"),
       url("../webfonts/fa-solid-900.woff") format("woff");
}

@font-face {
  font-family: 'Font Awesome 5 Brands';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url("../webfonts/fa-brands-400.woff2") format("woff2"),
       url("../webfonts/fa-brands-400.woff") format("woff");
}

/* Preload critical fonts */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://fonts.gstatic.com/s/roboto/v47/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWubEbVmUiAr0klQmz24.woff2") format("woff2");
}

@font-face {
  font-family: 'Roboto Condensed';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://fonts.gstatic.com/s/robotocondensed/v27/ieVo2ZhZI2eCN5jzbjEETS9weq8-_d6T_POl0fRJeyWyosBO5XxjLdSL17o.woff2") format("woff2");
} 