/* ============================================================
   BASE — 리셋 + 기본 타이포그래피 + 접근성
   tokens.css 이후에 로드할 것.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 고정 헤더에 앵커가 가리지 않도록.
     .site-header 는 유틸리티 스트립까지 통째로 sticky 다. --header-h 만 빼면
     실측 117px 짜리 헤더에 104px 만 비워 두게 되어 앵커 대상의 윗줄이
     헤더 밑으로 13px 들어간다. --topbar-h 는 900px 미만에서 0 이다. */
  scroll-padding-top: calc(
    var(--header-h) + var(--topbar-h) + var(--space-2)
  );
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 한글 줄바꿈 —
   기본값(break-word)은 한 단어 중간에서 음절을 잘라 "해상운/송" 처럼 끊는다.
   keep-all 은 어절 단위로만 끊어 한국어 조판을 정상화한다.
   긴 영문 단어·URL이 컨테이너를 넘치는 것은 overflow-wrap 이 막는다. */
html[lang="ko"] body {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 모바일 하단 고정 CTA 바가 마지막 콘텐츠를 가리지 않도록 */
@media (max-width: 767px) {
  body {
    padding-bottom: var(--mobilebar-h);
  }
}

/* ---------- 제목 ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--color-heading);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-heading);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
}
h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-tight);
}
h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}
h4 {
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}

p {
  margin: 0;
  text-wrap: pretty;
}

/* 연속된 문단 사이 간격 (문단 하나짜리 블록에는 여백이 붙지 않는다) */
p + p {
  margin-top: var(--space-2);
}

/* ---------- 리스트 ---------- */
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- 링크 ---------- */
a {
  color: var(--color-link);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--color-link-hover);
}

/* 본문 안의 링크는 반드시 밑줄 — 색상만으로 구분하지 않는다 (WCAG 1.4.1) */
.prose a,
p > a:not(.btn):not(.link-plain) {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

/* ---------- 미디어 ---------- */
img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

svg {
  flex-shrink: 0;
}

/* 아이콘 기본 크기.
   SVG에 width/height 속성이 없으면 브라우저는 부모 폭을 채우려 든다.
   이 한 줄이 없으면 크기 규칙을 빠뜨린 컴포넌트에서 아이콘이 거대해진다.
   개별 컴포넌트 규칙(.btn svg 등)이 더 구체적이므로 자유롭게 덮어쓸 수 있다. */
.icon {
  width: 20px;
  height: 20px;
}

/* ---------- 폼 요소 ---------- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

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

textarea {
  resize: vertical;
}

/* ---------- 표 ---------- */
table {
  border-collapse: collapse;
  width: 100%;
}

/* ---------- 포커스 ---------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

/* 다크 배경 위 포커스 링은 흰색으로.
   .page-hero 도 네이비 위다 — 목차 링크가 들어가면서 실제로 포커스 대상이 생겼다. */
.on-dark :focus-visible,
.section--dark :focus-visible,
.page-hero :focus-visible {
  outline-color: var(--white);
}

/* ---------- 선택 영역 ---------- */
::selection {
  background-color: var(--navy-700);
  color: var(--white);
}

/* ============================================================
   유틸리티 — 최소한만 유지. 레이아웃 유틸은 layout.css.
   ============================================================ */

/* 스크린리더 전용 */
.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(--space-1);
  left: var(--space-1);
  z-index: var(--z-skiplink);
  padding: var(--space-1) var(--space-2);
  background-color: var(--navy-900);
  color: var(--white);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--white);
}

/* 숫자 조판 — 설립연도, 파트너 수, 전화번호 등 */
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 영문 라벨·수치를 한글 문서 안에서 Inter로 조판 */
.en {
  font-family: var(--font-en);
  letter-spacing: 0;
}

/* 카피의 줄바꿈(\n)을 그대로 살린다 — 어절이 아니라 의미 단위로 끊기 위함 */
.pre-line {
  white-space: pre-line;
}

/* 본문 최적 행 길이 제한 */
.measure {
  max-width: var(--measure);
}

.text-muted {
  color: var(--color-text-muted);
}

.caption {
  font-size: var(--fs-caption);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* 인쇄 시 불필요 요소 제거 */
@media print {
  .site-header,
  .mobile-bar,
  .skip-link {
    display: none !important;
  }
}
