/**
 * Pretendard Variable Font - Local Hosted
 * 로컬 호스팅으로 CDN 의존성 제거 및 폰트 로딩 최적화
 *
 * 최적화 전략:
 * - font-display: swap → FOIT 방지, 텍스트 즉시 표시
 * - preload와 함께 사용 → 우선 다운로드
 * - 브라우저 캐싱 활용 → 재방문 시 즉시 로드
 * - Variable Font → 단일 파일로 모든 weight 지원
 *
 * 파일 크기: 2.0MB
 * 위치: theme/basic/fonts/PretendardVariable.woff2
 * 버전: 1.20250
 */

@font-face {
  font-family: 'Pretendard Variable';
  font-weight: 45 920; /* Variable Font: 전체 weight 범위 지원 */
  font-style: normal;
  font-display: swap; /* 텍스트 즉시 표시, 폰트 로드 후 교체 */
  src: local('Pretendard Variable'), /* 시스템 폰트 확인 */
       url('../fonts/PretendardVariable.woff2') format('woff2-variations');
  unicode-range: U+AC00-D7A3, /* 한글 음절 */
                 U+1100-11FF, /* 한글 자모 */
                 U+3130-318F, /* 한글 호환 자모 */
                 U+A960-A97F, /* 한글 자모 확장-A */
                 U+D7B0-D7FF, /* 한글 자모 확장-B */
                 U+0020-007E, /* 기본 라틴 문자 */
                 U+00A0-00FF, /* 라틴-1 보충 */
                 U+2000-206F, /* 일반 문장 부호 */
                 U+20A0-20CF; /* 통화 기호 */
}

/**
 * 구형 브라우저 Fallback
 * Variable Font를 지원하지 않는 브라우저용
 */
@supports not (font-variation-settings: normal) {
  @font-face {
    font-family: 'Pretendard Variable';
    font-weight: 400; /* Regular weight만 제공 */
    font-style: normal;
    font-display: swap;
    src: url('../fonts/PretendardVariable.woff2') format('woff2');
  }

  @font-face {
    font-family: 'Pretendard Variable';
    font-weight: 700; /* Bold weight 제공 */
    font-style: normal;
    font-display: swap;
    src: url('../fonts/PretendardVariable.woff2') format('woff2');
  }
}

/**
 * Size-adjust로 Fallback 폰트와 크기 맞추기
 * Layout Shift (CLS) 최소화
 */
@font-face {
  font-family: 'Pretendard Variable Adjusted';
  src: local('Arial'), local('Helvetica'), local('sans-serif');
  size-adjust: 105%; /* Pretendard와 비슷한 크기로 조정 */
  ascent-override: 85%;
  descent-override: 20%;
  line-gap-override: 0%;
}

/**
 * 글로벌 폰트 스택
 * 우선순위: Variable Font → Adjusted Fallback → 시스템 폰트
 */
body,
html {
  font-family:
    "Pretendard Variable",
    "Pretendard Variable Adjusted",
    -apple-system,
    BlinkMacSystemFont,
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    "Malgun Gothic",
    sans-serif;
}

/**
 * 성능 모니터링 (개발용)
 * 프로덕션에서는 제거 가능
 */
/*
console.log('Pretendard Variable Font 로딩 상태:');
document.fonts.ready.then(() => {
  console.log('✅ 모든 폰트 로드 완료');
  const pretendard = [...document.fonts.keys()].find(f => f.family.includes('Pretendard'));
  if (pretendard) {
    console.log('📊 Pretendard Variable:', pretendard);
  }
});
*/
