/*
 * 기본 스타일: 리셋 + 글자 + 컨테이너 + 포커스 + 본문 바로가기.
 * 컴포넌트 스타일은 site.css 에 둔다.
 * 불러오는 순서: fonts.css → tokens.css → base.css → site.css
 */

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

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote,
ul, ol, dl, dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* 글자 */
body {
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  font-weight: var(--font-weight-regular);
  color: var(--color-text);
  background: var(--color-bg);
  word-break: keep-all;      /* 한글 낱말 중간에서 줄바꿈하지 않는다 */
  overflow-wrap: anywhere;   /* 긴 영문·주소는 넘치지 않게 끊는다 */
}

h1, h2, h3, h4 {
  line-height: var(--line-height-heading);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-lg); }

p + p {
  margin-top: var(--space-4);
}

a {
  color: var(--color-link);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-primary-strong);
}

strong,
b {
  font-weight: var(--font-weight-bold);
}

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

/* 컨테이너: 최대 1200px, 좌우 여백 16px(모바일)·24px(PC) */
.container {
  width: 100%;
  max-width: calc(var(--max-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 키보드 포커스 표시 */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* 본문 바로가기: 평소에는 숨기고 키보드 포커스 때 보인다 */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  color: var(--color-on-primary);
}

/* 화면에는 숨기고 화면 낭독기에는 읽히는 글자 */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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