/* ==========================================================================
   base.css — 웹폰트 로드 · 리셋 · 기본 타이포 · 접근성 유틸
   tokens.css 다음에 로드한다.
   ========================================================================== */

/* ---------- 웹폰트 (CDN 링크) ----------
   @import 는 파일 최상단에 있어야 한다.
   2026-09-28 브랜드 시스템 v1.0 으로 교체했다. 셋 다 OFL.
   - Saira: 로고·디스플레이·헤드라인·본문. width 축이 있는 가변 폰트라
     125%(디스플레이) ~ 100%(본문)를 font-stretch 로 조절한다
   - IBM Plex Mono: **2026-09-29 사용자 요청으로 화면에서 전부 걷어냈다.** 영문은 Saira 하나로 간다.
     웹폰트 내려받기도 멈췄다 (요청이 하나 줄어든다). --font-mono 토큰은 code/kbd/pre 용으로만 남으며
     그런 요소는 사이트에 없다 — 있으면 시스템 고정폭 글꼴로 떨어진다
   - Noto Sans KR: **한글 전용 폴백.** Saira 에는 한글 글리프가 없어 한글만 여기로 떨어진다
     (브랜드 요소는 영문뿐이라 100% Saira 로 간다). 2026-09-28 에 IBM Plex Sans KR 에서 교체했다 —
     획이 얇아 작은 글씨가 흐릿했고 굵기가 600 까지뿐이라 한글 제목만 가늘게 나왔다
   Google Fonts 가 unicode-range 로 잘라 주므로 쓰는 글자만 내려받는다 (display=swap).
   폐기: Space Grotesk (2026-09-22~2026-09-28 영문 포인트) · IBM Plex Sans KR (~2026-09-28 한글) */
@import url("https://fonts.googleapis.com/css2?family=Saira:wdth,wght@100..125,400..650&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400..700&display=swap");

/* ---------- 리셋 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

nav ul,
nav ol {
  list-style: none;
  padding: 0;
}

table {
  border-collapse: collapse;
}

[hidden] {
  display: none !important;
}

/* 영문 기본 — i18n.js 가 문자열을 바꿀 때까지 국문 원문을 숨긴다 (base.njk 머리 스크립트가 붙인다) */
html.i18n-pending body {
  visibility: hidden;
}

/* ---------- 기본 타이포 ---------- */
html {
  font-family: var(--font-sans);
  /* Saira 본문 폭. 헤드라인만 아래에서 넓힌다 */
  font-stretch: var(--wd-body);
  /* 한글·영문 글자 크기 정렬 (2026-09-29).
     Saira 에 한글 글리프가 없어 한글은 Noto Sans KR 로 떨어지는데, 같은 font-size 에서도
     Noto 쪽이 6.1% 크게 보인다 (x-height 0.543 vs Saira 0.510). "Leoverse는" 처럼
     한 줄에 두 폰트가 섞이면 이 차이가 눈에 띈다.
     Saira 의 x-height 비율을 기준값으로 주면 브라우저가 폰트마다 크기를 다시 맞춘다 —
     Saira 는 1.000배(그대로), Noto Sans KR 은 0.939배, Plex Mono 는 0.988배가 된다.
     두 폰트의 차이가 균일한 배율이라 cap height 도 같이 맞는다 (0.733 × 0.939 = 0.688).
     이 값을 바꾸면 **영문 크기까지** 흔들린다 — Saira 의 실측 x-height 그대로 두어야 한다.
     미지원 브라우저(Chrome 127·Safari 17 미만)는 이 선언을 무시하고 종전처럼 보인다 */
  font-size-adjust: ex-height 0.51;
}

body {
  background-color: var(--orbit-navy); /* 다크 기본 */
  color: var(--paper);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  word-break: keep-all;           /* 국문 어절 단위 줄바꿈 */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 제목 단계
   H1·H2·H3 모두 문장형(sentence case)에 자간 0 이다.
   브랜드 시스템의 H3 자간 0.08em 은 캡스 전용 값인데 우리 h3 는 캡스가 아니고 대부분 한글이라,
   자간을 벌리면 어절이 흩어져 읽힌다 (2026-09-29 실측 지적으로 0 으로 되돌렸다).
   Saira 의 width 축을 단계마다 달리해 위계를 만든다 */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-medium);
  font-stretch: var(--wd-h1);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-medium);
  font-stretch: var(--wd-h2);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  font-stretch: var(--wd-h3);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

h4 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  font-stretch: var(--wd-h3);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--electric-blue-dark);
  text-underline-offset: 0.2em;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9375em;
}

small {
  font-size: var(--fs-sm);
}

/* ---------- 접근성 유틸 ---------- */
:focus-visible {
  outline: 2px solid var(--electric-blue-dark);
  outline-offset: 3px;
}

/* 프로그램으로 포커스를 받는 요소(main 등)는 마우스 포커스 시 외곽선 생략 */
[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}

/* 화면에서 숨기되 스크린리더에는 읽힘 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 본문 바로가기: 키보드 포커스 시에만 노출 */
.skip-link {
  position: absolute;
  top: var(--sp-4);
  left: var(--sp-4);
  z-index: 1000;
  padding: var(--sp-2) var(--sp-4);
  background-color: var(--paper);
  color: var(--ink);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
