/* === 기본 색상 및 간격 === */
:root {
  --bg: #fafaf7;
  --text: #1a1a1a;
  --text-sub: #6b6b6b;
  --line: #e2e2de;
  --accent: #6940db;

  --width: 760px;
  --gap-section: 160px;
}

/* === 기본 초기화 === */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
}

/* === 한 줄 컬럼: header, main, footer 공통 폭 === */
header, main, footer {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 24px;
}

/* === Hero === */
header {
  padding-top: 140px;
  padding-bottom: 40px;
}
header h1 {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
header .affiliation { color: var(--text-sub); margin-top: 8px; }

header .intro { margin-top: 32px; max-width: 36em; }
header .intro p { font-size: 1.125rem; line-height: 1.8; }
header .intro p + p { margin-top: 12px; }
header .intro strong { font-weight: 600; color: var(--accent); }

header nav { display: flex; gap: 16px; margin-top: 32px; }
header nav a { display: inline-flex; color: var(--text-sub); }
header nav svg { display: block; }

/* === 링크 === */
a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.55; }

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

/* 본문 링크 밑줄과 글자 선택 색을 포인트 컬러로 */
main a { text-decoration-color: var(--accent); }
::selection { background: rgb(105 64 219 / 0.15); }

/* === 섹션 내비게이션 (상단 고정) === */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px max(24px, calc((100% - var(--width)) / 2 + 24px));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.site-nav a { text-decoration: none; }
.site-nav > a { font-weight: 600; }
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  padding: 0;
}
.site-nav ul a { color: var(--text-sub); }

/* 메뉴로 이동 시 섹션 제목이 내비게이션에 가려지는 현상 방지*/
main > section, footer { scroll-margin-top: 80px; }

/* === 섹션 간격, 번호 붙은 라벨 (01 / Skill) === */
main { counter-reset: section; }
main > section { margin-top: var(--gap-section); }

main > section > h2,
footer h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 40px;
}
/* 섹션 제목을 상단 메뉴 아래에 고정 (작은 화면) */
main > section > h2 {
  position: sticky;
  top: 50px;
  z-index: 5;
  padding: 12px 0;
  margin-bottom: 28px;
  background: var(--bg);
}
main > section > h2::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero) " / ";
  color: var(--accent);
}

/* === 프로젝트 제목과 메타 줄 === */
h3 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
article > h3 + p {
  color: var(--text-sub);
  font-size: 0.9rem;
  margin-top: 4px;
}
article + article { margin-top: 72px; }

/* === 프로젝트 내부 소개 라벨 === */
article dl { margin-top: 20px; }
article dt {
  font-size: 0.875rem;
  color: var(--text-sub);
  margin-bottom: 4px;
}
article > p:last-child {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  font-size: 0.9rem;
}

/* === 대표 프로젝트: 왼쪽 라벨 / 오른쪽 내용 === */
.featured {
  border-top: 1px solid var(--line);
  padding-top: 40px;
}
.featured h3 { font-size: 1.75rem; }

#project { counter-reset: project; }
.featured { counter-increment: project; }
.featured::before {
  content: counter(project, decimal-leading-zero);
  display: block;
  margin-bottom: 12px;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #dcdcd6;
}

.featured dl {
  display: grid;
  grid-template-columns: 8rem 1fr;
  column-gap: 32px;
  row-gap: 28px;
  margin-top: 32px;
}
.featured dt {
  margin: 0;
  padding-top: 3px;
  font-weight: 600;
}
.featured dd ul {
  padding-left: 1.1em;
}
.featured dd li + li { margin-top: 6px; }
.featured dd li::marker { color: var(--text-sub); }

/* === Result: 3열 구성 === */
.result-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 -24px;
}
.result-group {
  padding: 0 24px;
  border-left: 1px solid var(--line);
}
.result-group:first-child {
  border-left: none;
}
.result-group + .result-group { margin-top: 0; }
.result-group h3 { font-size: 1.125rem; }
.result-group ul {
  list-style: none;
  padding: 0;
  margin-top: 16px;
}
.result-group li { font-size: 0.9rem; }
.result-group li + li { margin-top: 8px; }

/* === 기술 태그 === */
.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 12px 0 0;
}
.tags li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-sub);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  line-height: 1.5;
}
.tags li::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, #b8b8b2);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
}

/* === 기술별 고유 색상 (브랜드색이 없는 태그는 회색 점) === */
.t-python, .t-asyncio { --dot: #3776ab; }
.t-java       { --dot: #ed8b00; }
.t-c          { --dot: #a8b9cc; }
.t-godot, .t-gdscript { --dot: #478cbf; }
.t-fastapi    { --dot: #009688; }
.t-android    { --dot: #3ddc84; }
.t-linux      { --dot: #fcc624; }
.t-azure      { --dot: #0078d4; }
.t-git        { --dot: #f05032; }
.t-claude     { --dot: #d97757; }
.t-raspberrypi { --dot: #a22846; }

/* === Skill: 왼쪽 분류 / 오른쪽 태그 === */
.skill {
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 16px;
  align-items: center;
}
.skill dt { font-size: 0.9rem; color: var(--text-sub); }
.skill .tags { margin: 0; }

/* === Contact === */
footer {
  margin-top: var(--gap-section);
  padding-top: 48px;
  padding-bottom: 80px;
  border-top: 1px solid var(--line);
}
footer h2 { margin-bottom: 16px; }
footer p + p { margin-top: 4px; }

/* === 모바일 === */
@media (max-width: 600px) {
  :root { --gap-section: 112px; }
  header { padding-top: 96px; }
  header h1 { font-size: 2.25rem; }
  .skill { grid-template-columns: 1fr; row-gap: 6px; }
  .skill dd { margin-bottom: 12px; }
  .featured dl { grid-template-columns: 1fr; row-gap: 8px; }
  .featured dd { margin-bottom: 16px; }
  .featured h3 { font-size: 1.5rem; }
  .result-list { grid-template-columns: 1fr; margin: 0; }
  .result-group { border-left: none; border-top: 1px solid var(--line); padding: 24px 0; }
  .result-group:first-child { border-top: none; padding-top: 0; }
  .site-nav ul { gap: 14px; }
}

/* === 넓은 화면: 섹션 제목을 왼쪽에 고정 === */
@media (min-width: 1280px) {
  html { font-size: 18px; }
  :root { --width: 800px; }
  main > section {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    column-gap: 24px;
    margin-left: -224px;
  }
  main > section > h2 {
    grid-column: 1;
    grid-row: 1 / span 10;
    align-self: start;
    position: sticky;
    top: 96px;
    margin: 0;
    font-size: 1rem;
  }
  main > section > :not(h2) { grid-column: 2; }
}