/* =============================================================
   Base — Reset + Body Typography (Korean-tuned)
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -moz-text-size-adjust: 100%; text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--type-base);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  word-break: keep-all;       /* Korean: prevent mid-word breaks */
  overflow-wrap: anywhere;    /* but break pathological long tokens (URL·ID·무공백 CJK) — keep-all과 직교 */
  line-break: strict;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
img { background-repeat: no-repeat; background-size: cover; }

input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; color: inherit; }

a {
  color: var(--color-accent);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--motion-fast) var(--ease-out);
}
a:hover { color: var(--color-accent-hover); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Typography hierarchy (Korean-tuned: minimal letter-spacing) ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.005em;   /* 한글에 라틴 트래킹 금지 */
  color: var(--color-text);
  text-wrap: balance;
  word-break: keep-all;
  overflow-wrap: anywhere;    /* 제목의 무공백 긴 토큰 오버플로 방지 (카드 title 등) */
  line-break: strict;
}
h1 { font-size: var(--type-2xl); font-weight: 800; }
h2 { font-size: var(--type-xl); }
h3 { font-size: var(--type-lg); }

@media (min-width: 768px) {
  h1 { font-size: var(--type-3xl); }
}

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

/* Numerals: tabular for engineering precision */
.num { font-variant-numeric: tabular-nums; }

/* Utilities */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--space-4); }
.wrap-wide { max-width: var(--wrap-wide); margin-inline: auto; padding-inline: var(--space-4); }
.measure { max-width: var(--measure); }

.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;
}

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

@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 10px;
    border: 2px solid var(--color-bg);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--color-subtle); }
}
