/* ---------- Design tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f6f6f4;
  --color-text: #111111;
  --color-text-muted: #5c5c5c;
  --color-border: #e2e2df;
  --color-invert-bg: #111111;
  --color-invert-text: #ffffff;

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --container-width: 880px;
  --section-space: 96px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; margin: 0 0 .5em; letter-spacing: -0.01em; }

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

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
.site-nav {
  display: flex;
  gap: 28px;
}
.site-nav a {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.site-nav a:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--color-text);
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 56px;
  padding: 88px 24px 64px;
}
.hero-text { flex: 1; min-width: 0; }
.hero-photo { flex: 0 0 220px; max-width: 220px; }
.hero-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  box-shadow: inset 0 0 48px 20px var(--color-bg);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: 0 0 12px;
}
.hero-text h1 {
  font-size: 2.75rem;
  margin-bottom: 8px;
}
.hero-kr {
  font-size: 1.4rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 10px;
}
.hero-affiliation {
  color: var(--color-text-muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
  white-space: nowrap;
}
.hero-summary {
  max-width: 56ch;
  margin: 0 0 28px;
}
.hero-links {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.btn {
  display: inline-block;
  padding: 10px 22px;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  border: 1px solid var(--color-text);
  transition: background .15s ease, color .15s ease;
}
.btn-primary {
  background: var(--color-text);
  color: var(--color-invert-text);
}
.btn-primary:hover { background: #333; }
.btn-outline {
  background: transparent;
  color: var(--color-text);
}
.btn-outline:hover { background: var(--color-text); color: var(--color-invert-text); }

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.social-links a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid transparent;
}
.social-links a:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* ---------- Sections ---------- */
.section {
  padding: var(--section-space) 24px;
}
.section-alt {
  position: relative;
  z-index: 0;
}
.section-alt::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--color-bg-alt);
  z-index: -1;
}
.section h2 {
  font-size: 1.9rem;
  margin-bottom: 28px;
}
.section-body p { margin: 0 0 16px; }
.section-body a { border-bottom: 1px solid var(--color-text-muted); }
.section-body a:hover { border-color: var(--color-text); }

/* ---------- Research grid ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.research-card {
  border-top: 2px solid var(--color-text);
  padding-top: 16px;
}
.research-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.research-card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ---------- Projects ---------- */
.section-intro {
  color: var(--color-text-muted);
  max-width: 62ch;
  margin: -8px 0 28px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
.project-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  padding: 24px;
}
.project-card h3 {
  font-size: 1.08rem;
  margin: 0 0 12px;
  line-height: 1.4;
}
.project-card p {
  font-size: 0.92rem;
  color: var(--color-text);
  margin: 0 0 16px;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.project-tags li {
  font-size: 0.76rem;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---------- Publications ---------- */
.pub-list { display: flex; flex-direction: column; gap: 32px; }
.pub-item {
  display: flex;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}
.pub-item:last-child { border-bottom: none; padding-bottom: 0; }
.pub-year {
  flex: 0 0 60px;
  font-family: var(--font-serif);
  color: var(--color-text-muted);
  font-size: 1rem;
  padding-top: 2px;
}
.pub-title {
  font-size: 1.1rem;
  margin: 0 0 6px;
}
.pub-title a { border-bottom: 1px solid var(--color-border); }
.pub-title a:hover { border-color: var(--color-text); }
.pub-authors { margin: 0 0 4px; font-size: 0.92rem; }
.pub-venue { margin: 0 0 8px; font-size: 0.88rem; color: var(--color-text-muted); font-style: italic; }
.pub-actions { margin: 0; font-size: 0.82rem; }
.pub-actions a { color: var(--color-text-muted); }
.pub-actions a:hover { color: var(--color-text); }

/* ---------- Timeline (CV) ---------- */
.timeline {
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.timeline-item {
  position: relative;
  padding-left: 28px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--color-text);
  border-radius: 50%;
}
.timeline-date {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.timeline-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.org-logo {
  height: 20px;
  width: auto;
  max-width: 90px;
  object-fit: contain;
  flex-shrink: 0;
}
.timeline-item h4 { font-size: 1.05rem; margin: 0; font-family: var(--font-serif); font-weight: 600; }
.timeline-item p { margin: 2px 0 0; color: var(--color-text-muted); font-size: 0.92rem; }
.timeline-org { margin-bottom: 4px; }
.timeline-detail {
  list-style: disc;
  margin: 10px 0 0 1.1em;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.timeline-detail li {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.55;
}
.cv-subheading {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  margin: 44px 0 20px;
}
.cv-subheading:first-of-type { margin-top: 0; }
.cv-download { margin-top: 36px; }

/* ---------- Certifications ---------- */
.cert-list { display: flex; flex-direction: column; gap: 0; }
.cert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}
.cert-item:last-child { border-bottom: none; }
.cert-name { font-size: 0.98rem; display: inline-flex; align-items: center; gap: 8px; }
.cert-meta { font-size: 0.85rem; color: var(--color-text-muted); }
.cert-logo {
  height: 16px;
  width: auto;
  object-fit: contain;
}

/* ---------- Empty state ---------- */
.empty-state {
  color: var(--color-text-muted);
  font-style: italic;
  max-width: 60ch;
}
.empty-state a { color: var(--color-text); border-bottom: 1px solid var(--color-text-muted); font-style: normal; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 24px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-inner p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.footer-inner .social-links a { font-size: 0.8rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  background: var(--color-invert-bg);
  color: var(--color-invert-text);
  font-size: 0.85rem;
  padding: 12px 20px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --section-space: 64px; }

  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
  }
  .site-nav.open { max-height: 320px; }
  .site-nav a {
    padding: 14px 24px;
    width: 100%;
    border-bottom: 1px solid var(--color-border);
  }

  .hero {
    flex-direction: column-reverse;
    text-align: left;
    padding-top: 48px;
  }
  .hero-photo { flex: 0 0 auto; max-width: 140px; }
  .hero-text h1 { font-size: 2.1rem; }
  .hero-affiliation { white-space: normal; }

  .research-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }

  .pub-item { flex-direction: column; gap: 6px; }
  .pub-year { flex: none; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}
