:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --text: #1c1e21;
  --text-muted: #5b6270;
  --border: #e2e4e9;
  --accent: #2f6feb;
  --accent-soft: #eaf1fe;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Malgun Gothic", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-alt: #1c1f24;
    --text: #e7e9ec;
    --text-muted: #9aa1ac;
    --border: #2a2e35;
    --accent: #6ea8fe;
    --accent-soft: #1d2b46;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero */
.hero {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  margin: 0 0 4px;
  font-size: 2.1rem;
  letter-spacing: -0.02em;
}
.hero .role {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}
.hero .meta {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.hero .contact {
  list-style: none;
  display: flex;
  gap: 16px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.hero .contact a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}
.hero .contact a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* TOC nav */
.toc {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  overflow-x: auto;
}
.toc .wrap {
  display: flex;
  gap: 20px;
  padding-top: 12px;
  padding-bottom: 12px;
  white-space: nowrap;
}
.toc a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.toc a:hover { color: var(--accent); }

main { padding-top: 40px; }

section { margin-bottom: 56px; scroll-margin-top: 56px; }

h2 {
  font-size: 1.3rem;
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
h3 {
  font-size: 1.05rem;
  margin: 28px 0 12px;
  color: var(--text);
}
h4 {
  font-size: 0.92rem;
  margin: 16px 0 6px;
  color: var(--text-muted);
}

ul.bullets, .core-skills, #etc ul {
  padding-left: 1.2em;
  margin: 0;
}
ul.bullets li, .core-skills li, #etc ul li {
  margin-bottom: 8px;
}

/* Career timeline */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
}
.timeline li {
  position: relative;
  padding: 4px 0 4px 20px;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-size: 0.95rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline .period {
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 130px;
}
.timeline .company { font-weight: 600; }
.timeline .role { color: var(--text-muted); }

/* Skills table */
.skills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.skills-table tr { border-bottom: 1px solid var(--border); }
.skills-table th, .skills-table td {
  text-align: left;
  padding: 10px 12px;
  vertical-align: top;
}
.skills-table th {
  width: 150px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Experience accordion */
.job {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--bg-alt);
}
.job summary {
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  list-style: none;
}
.job summary::-webkit-details-marker { display: none; }
.job summary::before {
  content: "▸";
  color: var(--accent);
  margin-right: 4px;
}
.job[open] summary::before { content: "▾"; }
.job summary .period {
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 120px;
}
.job summary .company { font-weight: 700; }
.job summary .role { color: var(--text-muted); font-size: 0.9rem; }
.job-body {
  padding: 4px 16px 18px;
  border-top: 1px solid var(--border);
}
.job-body .intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 12px 0;
}
.job-body ul {
  padding-left: 1.2em;
  margin: 0 0 12px;
  font-size: 0.92rem;
}
.job-body li { margin-bottom: 6px; }

/* Open source repo grid */
.repo-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.repo-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-alt);
}
.repo-card a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.repo-card a:hover .repo-name { color: var(--accent); }
.repo-name {
  font-weight: 700;
  font-size: 0.95rem;
  word-break: break-word;
}
.repo-stars {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.repo-desc {
  margin: 8px 0 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.repo-lang {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Education */
.edu { list-style: none; padding: 0; margin: 0; }
.edu li { margin-bottom: 8px; }
.edu .period { color: var(--text-muted); font-size: 0.85rem; margin-right: 8px; }

#intro p {
  margin: 0 0 14px;
  font-size: 0.95rem;
}

footer {
  padding: 32px 0 60px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

@media (max-width: 600px) {
  .hero { padding: 40px 0 24px; }
  .hero h1 { font-size: 1.7rem; }
  .timeline .period, .job summary .period { min-width: 0; width: 100%; }
  .skills-table th { width: 110px; }
}

@media print {
  .toc { display: none; }
  .job { break-inside: avoid; }
  .job:not([open]) .job-body { display: block !important; }
}
