/* ───────── 공통 기반: 색·글자·간격 토큰, 머리말, 꼬리말 ─────────
   언어별 본문 스타일은 ko.css / en.css / ja.css 에 있습니다.        */

:root {
  /* 색 — 종이와 먹, 그리고 인주(印朱) 한 점 */
  --paper: #f6f4ee;
  --paper-2: #efece3;
  --surface: #fffefb;
  --ink: #17181c;
  --ink-2: #4a4c55;
  --ink-3: #7b7d87;
  --line: #dcd8cc;
  --line-strong: #17181c;
  --accent: #d8431f;
  --accent-ink: #b63412;
  --accent-soft: #f8e3da;
  --shadow: 0 1px 2px rgb(23 24 28 / 0.04), 0 8px 24px -12px rgb(23 24 28 / 0.12);

  /* 글자 */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
  --fs-2xl: clamp(1.7rem, 1.3rem + 1.8vw, 2.5rem);
  --fs-3xl: clamp(2.4rem, 1.5rem + 4.4vw, 4.75rem);

  /* 간격 */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;
  --sp-9: 7rem;

  --wrap: 68rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 10px;
  --header-h: 3.75rem;
}

:root[lang='en'] {
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
}
:root[lang='ja'] {
  --font-sans: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', Meiryo, sans-serif;
  --font-display: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
}

/* 어두운 테마: 시스템 설정을 따르되, 버튼으로 고른 값이 우선 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #111214;
    --paper-2: #17181b;
    --surface: #1b1c20;
    --ink: #eeece5;
    --ink-2: #b9b7b0;
    --ink-3: #85847f;
    --line: #2c2d32;
    --line-strong: #eeece5;
    --accent: #ff6a3d;
    --accent-ink: #ff8862;
    --accent-soft: #3a1d13;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
  }
}
:root[data-theme='dark'] {
  --paper: #111214;
  --paper-2: #17181b;
  --surface: #1b1c20;
  --ink: #eeece5;
  --ink-2: #b9b7b0;
  --ink-3: #85847f;
  --line: #2c2d32;
  --line-strong: #eeece5;
  --accent: #ff6a3d;
  --accent-ink: #ff8862;
  --accent-soft: #3a1d13;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
}

*,
*::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;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
:root[lang='ko'] body {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
:root[lang='ja'] body {
  line-break: strict;
  overflow-wrap: anywhere;
}
main {
  flex: 1;
}
h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
table {
  margin: 0;
  padding: 0;
}
ul,
ol {
  list-style: none;
}
a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--accent-ink);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
::selection {
  background: var(--accent);
  color: #fff;
}
img,
svg {
  max-width: 100%;
}

/* 도우미 */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.chip {
  display: inline-block;
  padding: 0.15em 0.65em;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
}
.skip-link:focus {
  top: 1rem;
  color: var(--paper);
}

/* 샘플 안내 띠 */
.sample-banner {
  padding: 0.4rem var(--gutter);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-xs);
  text-align: center;
}

/* 머리말 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.brand {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover {
  color: inherit;
}
.brand__dot,
.brand__hi {
  color: var(--accent);
}
.brand__rest {
  color: var(--ink-3);
  font-weight: 400;
}
.site-nav {
  display: flex;
  gap: var(--sp-5);
  margin-left: auto;
  font-size: var(--fs-sm);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  min-width: 0;
  padding-inline: 0.75rem;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
  mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
}
.site-nav::-webkit-scrollbar {
  display: none;
}
.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding-block: 0.4rem;
}
.site-nav a:hover {
  color: var(--ink);
}
.site-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.lang-switch {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lang-switch a {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  color: var(--ink-3);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}
.lang-switch a:hover {
  color: var(--ink);
}
.lang-switch a[aria-current='true'] {
  background: var(--ink);
  color: var(--paper);
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}
@media (max-width: 720px) {
  .site-nav {
    display: none;
  }
  .site-tools {
    margin-left: auto;
  }
}

/* 꼬리말 */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: var(--sp-9);
}
.site-footer__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: var(--sp-5) var(--gutter) var(--sp-6);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.site-footer a {
  text-decoration: none;
}

/* 스크롤 등장 효과 (자바스크립트가 켜져 있고, 움직임 줄이기 설정이 아닐 때만) */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js-reveal [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* 인쇄: 이력서로 뽑아도 깔끔하게 */
@media print {
  :root {
    --paper: #fff;
    --surface: #fff;
    --ink: #000;
    --ink-2: #222;
    --ink-3: #555;
    --line: #bbb;
  }
  .site-header,
  .site-footer,
  .sample-banner,
  .skip-link {
    display: none !important;
  }
  body {
    font-size: 10.5pt;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  a {
    text-decoration: none;
  }
}
