/* ============================================================
   base.css — 리셋 + 타이포 + 레이아웃 유틸 (토큰만 참조)
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  /* reveal 트랜스폼 등 일시적 돌출로 인한 가로 스크롤 원천 차단 */
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  word-break: keep-all;            /* 한국어 줄바꿈 */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

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

/* 컴포넌트가 display를 지정해도 hidden 속성이 항상 이기도록 (탭 필터 등 JS 계약) */
[hidden] { display: none !important; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, picture, svg, video { max-width: 100%; display: block; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
address { font-style: normal; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 3px solid var(--point);
  outline-offset: 2px;
  border-radius: 2px;
}

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

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

/* ---------- 타이포 유틸 ----------
   헤드라인 계열은 디스플레이 서체(G마켓 산스). 최대 가중치 700 — 800 사용 금지. */
h1, h2, h3 { font-family: var(--font-display); }
.t-hero    { font-family: var(--font-display); font-size: var(--fs-hero); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); font-weight: var(--fw-bold); }
.t-display { font-family: var(--font-display); font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); font-weight: var(--fw-bold); }
.t-h1      { font-family: var(--font-display); font-size: var(--fs-h1); line-height: var(--lh-snug); letter-spacing: var(--ls-tight); font-weight: var(--fw-bold); }
.t-h2      { font-family: var(--font-display); font-size: var(--fs-h2); line-height: var(--lh-snug); letter-spacing: var(--ls-tight); font-weight: var(--fw-bold); }
.t-h3      { font-size: var(--fs-h3); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
.t-lg      { font-size: var(--fs-lg); }
.t-sm      { font-size: var(--fs-sm); }
.t-xs      { font-size: var(--fs-xs); }
/* 접근성: --ink-mute(#8A8480)는 밝은 배경 위 본문 텍스트로 쓰면 3.69:1로 WCAG AA(4.5:1)
   미달 — --ink를 20%만 섞어 4.89:1로 끌어올린다(tokens.css 값 자체는 변경하지 않음). */
.t-mute    { color: color-mix(in srgb, var(--ink-mute) 80%, var(--ink) 20%); }

/* 오버라인(섹션 라벨) — 포인트 컬러 절제 사용처 */
.t-overline {
  font-family: var(--font-display);
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--point);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ---------- 레이아웃 ---------- */
.container        { width: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }
/* --wide/--narrow도 단독 사용 가능해야 함 — auto 마진 누락 시 좌측 0px에 붙는 정렬 붕괴 */
.container--wide  { width: min(100% - var(--gutter) * 2, var(--container-wide)); margin-inline: auto; }
.container--narrow{ width: min(100% - var(--gutter) * 2, var(--container-narrow)); margin-inline: auto; }

.section       { padding-block: var(--sect-pad); }
.section--sm   { padding-block: var(--sect-pad-sm); }
.section--dark {
  background: var(--dark-bg);
  color: var(--dark-text);
}
.section--tint { background: var(--point-tint); }
.section--sub  { background: var(--sub-tint); }

/* 자동 반응형 카드 그리드: 열 수 지정 없이 minmax로 흐름 */
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(16.5rem, 100%), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }

.stack   { display: flex; flex-direction: column; gap: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* ---------- 접근성 ---------- */
.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: fixed; top: -100%; left: var(--sp-4);
  z-index: calc(var(--z-header) + 1);
  padding: var(--sp-3) var(--sp-5);
  background: var(--point); color: var(--on-point);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: var(--fw-bold);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 0; }

/* ---------- scroll reveal 기본 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms),
    transform var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

.reveal--left  { transform: translateX(-36px); }
.reveal--right { transform: translateX(36px); }
.reveal--scale { transform: scale(0.94); }
.reveal--left.is-visible,
.reveal--right.is-visible,
.reveal--scale.is-visible { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
