/* base.css - 리셋과 기본 타이포 (design-kit v6.3 ). tokens.css 다음에 불러온다.
   여기에는 어느 사이트에나 필요한 바닥만 있다. 개성은 토큰과 컴포넌트에서 나온다. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem); /* 스티키 헤더가 포커스·앵커를 가리지 않게 */
  font-synthesis-style: none; /* 가짜 이탤릭만 막는다. 굵기 합성은 둔다: 굵은 한글 서체가 없는 기기에서 한글 제목만 얇아지는 것을 막는다 */
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100svh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  /* 한글: 어절 단위로 줄바꿈하되 긴 URL·영문은 끊는다 */
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}
h1 { font-size: var(--text-4xl); line-height: var(--leading-display); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
p, li, dd, blockquote { text-wrap: pretty; }
p { max-inline-size: var(--measure); }
small { font-size: var(--text-sm); }

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

input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
input, textarea, select { font-size: max(1rem, 16px); } /* iOS 포커스 확대 방지 */
button { cursor: pointer; }
textarea { resize: vertical; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }

/* 포커스: outline 을 지우지 않는다. 지웠다면 반드시 :focus-visible 로 대체한다 */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--color-accent); color: var(--color-on-accent); }

/* 본문 바로가기: <body> 의 첫 요소로 둔다 */
.skip-link {
  position: absolute; inset-inline-start: var(--space-4); inset-block-start: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-4);
  background: var(--color-text); color: var(--color-bg);
  border-radius: var(--radius-md);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.visually-hidden {
  position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* 레이아웃 바닥 */
.container { inline-size: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }
.container-wide { inline-size: min(100% - var(--gutter) * 2, var(--container-wide)); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section-tight { padding-block: var(--section-y-tight); }
.stack > * + * { margin-block-start: var(--stack-gap, var(--space-4)); } /* 세로 흐름 간격 */
.auto-grid { /* 미디어쿼리 없이 접히는 그리드 */
  display: grid; gap: var(--grid-gap, var(--space-6));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 18rem)), 1fr));
}
.auto-grid > *, .split > * { min-inline-size: 0; } /* 자식이 줄어들지 못해 생기는 가로 넘침 방지 */

/* hover 는 포인터 기기에서만. 터치 기기에서 hover 가 눌린 채 남는 것을 막는다 */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration-thickness: 0.14em; }
}

/* 마지막 안전망. 개별 컴포넌트에서 의도적으로 처리하는 편이 낫다 */
@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;
  }
}
