/* =====================================================================
 * 폰트 체계 (2026-09-08 원장님 확정)
 *
 *   본문           Pretendard        --font-body
 *   로고·제목·수치  Gmarket Sans      --font-display   (원본 그대로 승계)
 *   공식 문서       KoPub World 돋움  --font-official
 *
 * 셋 다 상업이용 무료. 라이선스 원문은 `/fonts/<폴더>/LICENSE-*` 에 함께 둔다.
 *
 * ★ 용도별로 **CSS 변수**를 나눠 둔 이유:
 *   페이지마다 `font-family` 를 직접 박으면 나중에 폰트를 바꿀 때 전 파일을 뒤져야 한다.
 *   변수 하나만 바꾸면 그 용도 전체가 따라오도록 한 겹을 둔다.
 *   페이지에서는 `font-family: var(--font-official)` 처럼 **용도로** 지정한다.
 * ===================================================================== */

/* ── @font-face ─────────────────────────────────────────────────────
 * woff2 를 먼저 쓰고 woff 로 떨어진다(구형 브라우저 폴백).
 * `font-display: swap` — 폰트가 늦게 와도 글자가 먼저 보인다.
 *   블로킹으로 두면 폰트 받는 동안 **본문이 통째로 안 보인다**(FOIT).
 *   병원 홈페이지에서 첫 화면이 비어 있는 쪽이 글꼴이 잠깐 바뀌는 것보다 나쁘다.
 * ------------------------------------------------------------------ */
@font-face {
	font-family: 'Pretendard';
	src: url('/fonts/pretendard/Pretendard-400.woff2') format('woff2'),
	     url('/fonts/pretendard/Pretendard-400.woff') format('woff');
	font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
	font-family: 'Pretendard';
	src: url('/fonts/pretendard/Pretendard-500.woff2') format('woff2'),
	     url('/fonts/pretendard/Pretendard-500.woff') format('woff');
	font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
	font-family: 'Pretendard';
	src: url('/fonts/pretendard/Pretendard-600.woff2') format('woff2'),
	     url('/fonts/pretendard/Pretendard-600.woff') format('woff');
	font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
	font-family: 'Pretendard';
	src: url('/fonts/pretendard/Pretendard-700.woff2') format('woff2'),
	     url('/fonts/pretendard/Pretendard-700.woff') format('woff');
	font-weight: 700; font-style: normal; font-display: swap;
}

/* Gmarket Sans — 원본이 Bold 1종만 쓴다. 없는 굵기를 지어내지 않는다. */
@font-face {
	font-family: 'GmarketSans';
	src: url('/fonts/gmarket/GmarketSans-700.woff2') format('woff2'),
	     url('/fonts/gmarket/GmarketSans-700.woff') format('woff');
	font-weight: 700; font-style: normal; font-display: swap;
}

@font-face {
	font-family: 'KoPubWorldDotum';
	src: url('/fonts/kopub/KoPubWorldDotum-300.woff2') format('woff2'),
	     url('/fonts/kopub/KoPubWorldDotum-300.woff') format('woff');
	font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
	font-family: 'KoPubWorldDotum';
	src: url('/fonts/kopub/KoPubWorldDotum-500.woff2') format('woff2'),
	     url('/fonts/kopub/KoPubWorldDotum-500.woff') format('woff');
	font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
	font-family: 'KoPubWorldDotum';
	src: url('/fonts/kopub/KoPubWorldDotum-700.woff2') format('woff2'),
	     url('/fonts/kopub/KoPubWorldDotum-700.woff') format('woff');
	font-weight: 700; font-style: normal; font-display: swap;
}

/* ── 용도별 변수 ─────────────────────────────────────────────────── */
:root {
	/* 폴백에 시스템 한글 글꼴을 남긴다 — 폰트를 못 받아도 한글이 깨지지 않아야 한다 */
	--font-body:     'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', '맑은 고딕', system-ui, sans-serif;
	--font-display:  'GmarketSans', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
	--font-official: 'KoPubWorldDotum', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', serif;
}

/* ── 원본이 쓰는 폰트 변수 채우기 ────────────────────────────────────
 * 실측으로 드러난 것: 원본 `sub_new.css` 는 `.main-font{font-family:var(--mainfont),sans-serif}`
 * 처럼 변수를 쓰는데, **그 변수를 어디에서도 정의하지 않는다.**
 * 그래서 `var(--mainfont)` 가 무효가 되고 뒤의 `sans-serif`·`serif` 로 떨어진다 —
 * `.point-font` 가 걸린 본문이 **Times New Roman** 으로 나오던 원인이 이것이었다.
 *
 * 이 변수들은 클래스 규칙(0,1,0)이라 우리 전역 규칙(0,0,3)보다 우선한다.
 * 선택자 싸움을 하는 대신 **원본이 비워 둔 변수를 채운다** — 원본 구조를 그대로 쓰면서
 * 폰트만 바뀌므로, 나중에 원본 CSS 를 다시 가져와도 충돌하지 않는다.
 * ------------------------------------------------------------------ */
:root {
	--mainfont:   'Pretendard';        /* 본문 */
	--pointfont:  'GmarketSans';       /* 강조(원본이 serif 폴백을 뒀던 자리) */
	--pointfont2: 'Pretendard';
	--pointfont3: 'Pretendard';
	--pointfont4: 'GmarketSans';
	--koSerif:    'KoPubWorldDotum';   /* 원본의 "serif" 자리 — 공식문서 느낌 */
	--boldWeight: 400;
}

/* ── 1) 본문 전체 : Pretendard ──────────────────────────────────────
 * 원본은 곳곳에서 'Noto Sans KR' 을 직접 지정한다. 그 선언들을 하나하나 고치는 대신
 * 여기서 한 번에 덮는다 — 원본 CSS 를 건드리지 않는다는 원칙(original-fidelity)을 지키면서
 * 폰트만 바꾸는 방법이다. */
html, body,
body *:not(script):not(style) {
	font-family: var(--font-body);
}

/* ── 2) 로고·메인 제목·숫자 강조 : Gmarket Sans (원본 그대로) ────────
 * 원본이 Gmarket Sans 를 쓰던 자리를 그대로 유지한다.
 * 여기 없는 자리에 새로 씌우지 않는다 — 원본에 없던 강조를 만들어내는 셈이 된다. */
#header .logo, #header .logo *,
#footer .logo, #footer .logo *,
#main .sec01 .tab_bx_wrap a,
.hk-display, .hk-display * {
	font-family: var(--font-display);
	font-weight: 700;
}

/* 숫자 강조 — 예상키 결과·통계 수치.
 * 숫자만 다른 글꼴이 되면 문장 안에서 튀므로, **수치 블록에만** 건다. */
.calc_result .num, .calc_result .cm,
.stat_num, .rsYear, .hk-num {
	font-family: var(--font-display);
	font-weight: 700;
	font-feature-settings: 'tnum' 1;   /* 자릿수 정렬 — 표에서 숫자가 흔들리지 않는다 */
}

/* ── 3) 공식 문서 성격 : KoPub World 돋움 ───────────────────────────
 * 진료안내 · 의료진소개(임상연구센터) · 개인정보처리방침 등.
 * 페이지 단위로 `body.hk-official` 를 붙여 전환한다 —
 * 선택자를 페이지마다 나열하면 페이지가 늘 때마다 이 파일을 고쳐야 한다. */
body.hk-official #mainContent,
body.hk-official #mainContent *:not(script):not(style) {
	font-family: var(--font-official);
}
/* 원본의 변수 자체를 공식문서용으로 바꾼다.
 * 위 선택자 규칙만으로는 원본의 클래스 규칙(.main-font 등)이 남아 본문 일부가 안 바뀐다 —
 * 변수를 갈아끼우면 원본 규칙이 그대로 새 폰트를 가리키므로 빠짐없이 적용된다. */
body.hk-official {
	--mainfont:   'KoPubWorldDotum';
	--pointfont2: 'KoPubWorldDotum';
	--pointfont3: 'KoPubWorldDotum';
	--font-body:  var(--font-official);
}

/* 공식 문서라도 로고·수치는 위 규칙을 유지한다(문서 성격과 무관한 요소다) */
body.hk-official #header .logo, body.hk-official #header .logo *,
body.hk-official .hk-num, body.hk-official .rsYear {
	font-family: var(--font-display);
}

/* ---------------------------------------------------------------------
 * 외부 CDN 폰트 대체 (2026-09-08)
 *
 * 원본 CSS 가 같은 Pretendard 를 **외부 CDN(jsdelivr)에서 또 받는다**:
 *   sub_new.css:959 / sub.css:1787 — 'Pretendard-Regular' (woff, 서브셋 아님)
 * 우리는 이미 같은 글꼴을 서브셋으로 서빙하므로 외부 왕복이 순전한 낭비다.
 * 원본 CSS 를 고치지 않고, **같은 이름으로 로컬 파일을 다시 선언**해 덮는다
 * (뒤에 오는 @font-face 가 이긴다).
 * ------------------------------------------------------------------ */
@font-face {
	font-family: 'Pretendard-Regular';
	src: url('/fonts/pretendard/Pretendard-400.woff2') format('woff2'),
	     url('/fonts/pretendard/Pretendard-400.woff') format('woff');
	font-weight: 400; font-style: normal; font-display: swap;
}

/* `#subClinic01/02 { font-family:'Pretendard-Regular' !important }` 가 원본에 있다.
 * 이제 그 이름이 로컬 파일을 가리키므로 !important 를 이길 필요가 없다 — 그대로 둔다. */
