/* Modern CSS Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* body를 height:100%로 못박으면 sticky 헤더의 containing block이 첫 1화면으로
   한정되어, 그 아래로 스크롤할 때 헤더가 떨어져 나간다. min-height라야 콘텐츠
   높이만큼 늘어나 문서 전체가 containing block이 된다. */
html { height: 100%; }
body { min-height: 100%; }
/* anchor 이동 부드럽게 — reduced-motion 블록(하단)이 auto로 무효화 */
html { scroll-behavior: smooth; }
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: var(--lh-normal, 1.7);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  word-break: keep-all;
  overflow-wrap: break-word;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
/* keep-all 한글 헤딩의 고아 단어 방지 — 미지원 브라우저는 무시(점진 향상) */
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }

/* Sticky header가 가리는 앵커의 도착 위치와 모바일 터치 지연을 전역 보정 */
:where([id]) { scroll-margin-top: calc(var(--header-h) + env(safe-area-inset-top) + var(--sp-2)); }
button, a, input, select, textarea, summary { touch-action: manipulation; }

/* Skip link for accessibility */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-to-content:focus { left: 0; }

/* Screen-reader only — 시각 숨김, 접근성 트리 유지 */
.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;
}

/* Focus ring */
/* 골드 단색 링은 흰 카드 위에서 2.55:1로 WCAG 1.4.11(3:1) 미달 — 바깥에 네이비 링을 덧대
   어느 배경에서도 링 경계가 3:1을 넘도록 이중 처리 */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
  box-shadow: 0 0 0 6px rgba(var(--color-primary-rgb), 0.9);
}

/* Reduced motion */
@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;
  }
}
