/* ═══════════════════════════════════════════════════════════════
   디자인 토큰
   라이트를 기본으로 정의하고, 시스템 다크 설정과 수동 토글
   (data-theme) 양쪽에서 같은 토큰을 덮어쓴다.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg:          #ffffff;
  --bg-alt:      #f7f8fa;
  --bg-card:     #ffffff;
  --fg:          #16181d;
  --fg-muted:    #5b6270;
  --border:      #e2e5ea;
  --accent:      #2563eb;
  --accent-weak: #eef2ff;
  --accent-fg:   #ffffff;
  --ph-bg:       #fff6d6;
  --ph-fg:       #7a5c00;

  --wrap:        920px;
  --radius:      10px;
  --shadow:      0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0e1116;
    --bg-alt:      #141920;
    --bg-card:     #161b22;
    --fg:          #e6eaf0;
    --fg-muted:    #98a2b3;
    --border:      #262d38;
    --accent:      #74a3ff;
    --accent-weak: #17233b;
    --accent-fg:   #0e1116;
    --ph-bg:       #3a3218;
    --ph-fg:       #f0d68a;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --bg:          #0e1116;
  --bg-alt:      #141920;
  --bg-card:     #161b22;
  --fg:          #e6eaf0;
  --fg-muted:    #98a2b3;
  --border:      #262d38;
  --accent:      #74a3ff;
  --accent-weak: #17233b;
  --accent-fg:   #0e1116;
  --ph-bg:       #3a3218;
  --ph-fg:       #f0d68a;
  --shadow:      0 1px 2px rgba(0, 0, 0, .4);
}

/* ═══════════════════════════════════════════════════════════════
   기본
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;   /* 고정 헤더 높이만큼 앵커 위치 보정 */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: -0.01em;
  word-break: keep-all;       /* 한국어 줄바꿈을 어절 단위로 */
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.3; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.dim { color: var(--fg-muted); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* 채워 넣어야 할 자리 표시 — 실제 내용으로 교체한 뒤 class="ph"를 지우세요. */
.ph {
  background: var(--ph-bg);
  color: var(--ph-fg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 .18em;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   헤더 / 내비게이션
   ═══════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: .925rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.site-nav a:hover {
  color: var(--fg);
  background: var(--bg-alt);
  text-decoration: none;
}
.site-nav a.active {
  color: var(--accent);
  background: var(--accent-weak);
}

.theme-toggle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--fg-muted); }

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ═══════════════════════════════════════════════════════════════
   Hero
   ═══════════════════════════════════════════════════════════════ */
.hero {
  padding: clamp(64px, 12vw, 120px) 0 clamp(48px, 8vw, 80px);
}

.hero-eyebrow {
  font-size: .95rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
}
.hero-eyebrow .ph { color: var(--ph-fg); }

.hero-name {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  font-weight: 800;
  margin-bottom: 20px;
}

.hero-tagline {
  max-width: 40rem;
  font-size: clamp(1.02rem, 2.2vw, 1.15rem);
  color: var(--fg-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--fg);
  font-size: .95rem;
  font-weight: 600;
  transition: border-color .15s, transform .15s, background-color .15s;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--fg-muted);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover {
  border-color: var(--accent);
  filter: brightness(1.06);
}

/* ═══════════════════════════════════════════════════════════════
   섹션 공통
   ═══════════════════════════════════════════════════════════════ */
.section { padding: clamp(56px, 9vw, 88px) 0; }

.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section-title {
  font-size: clamp(1.5rem, 3.4vw, 1.85rem);
  font-weight: 700;
  margin-bottom: 8px;
}
.section-title::after {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  margin-top: 12px;
  border-radius: 2px;
  background: var(--accent);
}

.section-lead {
  color: var(--fg-muted);
  margin: 20px 0 28px;
}

.subsection-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 48px 0 16px;
}

.prose { max-width: 42rem; margin-top: 28px; }
.prose p + p { margin-top: 16px; }

.plain-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.plain-list li:first-child { border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════
   기술 태그
   ═══════════════════════════════════════════════════════════════ */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  margin-top: 32px;
}

.skill-group h3 {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags li {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  font-size: .875rem;
  font-weight: 500;
}
.tags-sm li {
  padding: 3px 9px;
  font-size: .78rem;
  color: var(--fg-muted);
  background: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   경력 타임라인
   ═══════════════════════════════════════════════════════════════ */
.timeline { margin-top: 32px; }

.timeline-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
  position: relative;
  padding: 0 0 40px 0;
}
.timeline-item:last-child { padding-bottom: 0; }

/* 왼쪽 열과 본문 사이의 세로선 + 점 */
.timeline-body {
  position: relative;
  padding-left: 26px;
  border-left: 2px solid var(--border);
}
.timeline-body::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.section-alt .timeline-body::before { box-shadow: 0 0 0 4px var(--bg-alt); }

.timeline-period {
  display: inline-block;
  padding-top: 4px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.timeline-role { font-size: 1.12rem; font-weight: 700; }
.timeline-org { margin: 2px 0 14px; color: var(--fg-muted); font-size: .95rem; }

.bullets li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
  color: var(--fg);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-muted);
}

/* ═══════════════════════════════════════════════════════════════
   프로젝트 카드
   ═══════════════════════════════════════════════════════════════ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  /* 스크린샷이 없는 카드까지 같은 행 높이로 늘리면 카드 안에 빈 공간이 생긴다.
     각 카드가 제 내용만큼만 차지하게 둔다. */
  align-items: start;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(16, 24, 40, .09);
}

/* 카드 상단 스크린샷: 카드 패딩을 거슬러 가장자리까지 채운다.
   화면 비율이 제각각(세로로 긴 메뉴바, 가로로 긴 메트릭 스트립)이라
   cover로 자르지 않고 contain으로 전체를 보여 준다. */
.card-shot {
  display: block;
  margin: -24px -24px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  overflow: hidden;
}
.card-shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  transition: transform .25s ease;
}
.card-shot:hover img { transform: scale(1.03); }

.card-title {
  font-size: 1.08rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.card-desc {
  flex: 1;
  font-size: .93rem;
  color: var(--fg-muted);
}

.card .tags { margin-top: 16px; }

.card-links {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   연락처
   ═══════════════════════════════════════════════════════════════ */
.contact-list { max-width: 34rem; }
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.contact-list li:first-child { border-top: 1px solid var(--border); }

.contact-label {
  min-width: 84px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--fg-muted);
}

/* ═══════════════════════════════════════════════════════════════
   푸터
   ═══════════════════════════════════════════════════════════════ */
.site-footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  font-size: .875rem;
  color: var(--fg-muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
}

/* ═══════════════════════════════════════════════════════════════
   스크롤 등장 애니메이션
   ═══════════════════════════════════════════════════════════════ */
/* JS가 켜져 있을 때만 숨긴다 — 스크립트가 죽어도 내용은 항상 보인다. */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════════
   반응형 (단일 브레이크포인트)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .wrap { padding: 0 20px; }

  .header-inner { gap: 10px; }
  .brand { display: none; }        /* 좁은 화면에서는 내비에 자리를 양보 */
  .site-nav { margin-left: 0; }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .timeline-period { padding-top: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   인쇄 (Cmd+P → A4 이력서)
   ═══════════════════════════════════════════════════════════════ */
@media print {
  @page { margin: 16mm 14mm; }

  /* 종이는 언제나 흰 바탕이다. 다크 토큰(:root:not([data-theme="light"]) 등)이
     명시도 0,2,0으로 걸려 있으므로 같은 수준의 선택자를 모두 나열해 덮어쓴다. */
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"],
  :root:not([data-theme="light"]) {
    --bg: #fff; --bg-alt: #fff; --bg-card: #fff;
    --fg: #000; --fg-muted: #444; --border: #bbb; --accent: #000;
    --ph-bg: #fff; --ph-fg: #000;
    --shadow: none;
  }

  html, body { background: #fff !important; color: #000 !important; }

  body { font-size: 10.5pt; line-height: 1.55; }

  .site-header,
  .theme-toggle,
  .skip-link,
  .hero-actions,
  .site-footer { display: none !important; }

  .js .reveal { opacity: 1 !important; transform: none !important; }

  .hero { padding: 0 0 12pt; }
  .hero-name { font-size: 22pt; }
  .section { padding: 14pt 0; break-inside: auto; }
  .section-alt { background: none; border: 0; border-top: 1px solid var(--border); }
  .section-title { font-size: 13pt; }
  .section-title::after { display: none; }

  /* 종이에서는 스크린샷을 뺀다 — 이력서는 글로 읽히면 되고,
     7장을 넣으면 페이지 수만 불어난다. 화면에서 보면 된다. */
  .card-shot { display: none !important; }

  .card, .timeline-item, .skill-group { break-inside: avoid; }
  .card { box-shadow: none; padding: 8pt 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
  .cards { gap: 0; grid-template-columns: 1fr; }
  .card-links { border: 0; padding-top: 4pt; }

  /* 종이에서는 링크 주소가 보여야 쓸모가 있다 */
  .card-links a::after,
  .contact-list a::after { content: " " attr(href); font-size: 8.5pt; color: #555; }
  a { text-decoration: none; }

  .ph { background: none; color: #000; outline: 1px dashed #999; }
}
