:root {
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-faint: #7a7a7a;
  --bg: #fdfdfc;
  --card-bg: #ffffff;
  --line: #e6e4df;
  --accent: #2f5d50;
  --accent-soft: #eef3f1;
  --nav-bg: rgba(253, 253, 252, 0.85);
  --max-width: 700px;
}
html[data-theme="dark"] {
  --ink: #f2f1ee;
  --ink-soft: #c9c7c0;
  --ink-faint: #8b8f8d;
  --bg: #14181a;
  --card-bg: #1b2021;
  --line: #2a3031;
  --accent: #6cbfa4;
  --accent-soft: #1d2a27;
  --nav-bg: rgba(20, 24, 26, 0.85);
}
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px; /* keeps anchored sections clear of the sticky nav */
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

/* Top nav */
nav.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.topnav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topnav .brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.topnav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.topnav-links a {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.topnav-links a:hover { color: var(--accent); }
@media (max-width: 560px) {
  .topnav-inner { flex-wrap: wrap; row-gap: 8px; padding: 14px 20px; }
  .topnav-links { gap: 12px 14px; flex-wrap: wrap; justify-content: flex-end; }
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0;
  flex: 0 0 auto;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: rotate(12deg); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

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

/* Hero */
header.hero {
  position: relative;
  text-align: center;
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
}
.avatar-stage {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 0;
  pointer-events: none;
}
.avatar {
  position: relative;
  z-index: 1;
  width: 116px;
  height: 116px;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 6px var(--bg);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.headline {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.affiliation {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0 0 4px;
}
.affiliation.advisor { color: var(--ink-faint); }
.affiliation.advisor a {
  color: var(--ink-faint);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 2px;
}
.affiliation.advisor a:hover { color: var(--accent); text-decoration-color: var(--accent); }
nav.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}
.link-pill {
  font-family: inherit;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.link-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.email-reveal {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
  transition: max-height 0.25s ease, opacity 0.25s ease, margin 0.25s ease;
}
.email-reveal.is-open {
  max-height: 40px;
  opacity: 1;
  margin-top: 12px;
}

section { margin-bottom: 48px; }
h2.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 0 0 18px;
}

.about p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}
.about .about-lede {
  margin: 0 0 30px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}
.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.skill-pills .pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  padding: 7px 14px;
  border-radius: 999px;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0 0 12px;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
  transition: background 0.2s ease;
}
a.stat:hover { background: var(--accent-soft); }
a.stat:hover .stat-num { text-decoration: underline; text-decoration-color: var(--accent); }
.stat-num {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.35;
}
/* Auto-scrolling logo marquee */
.logo-marquee {
  overflow: hidden;
  margin-top: 6px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.logo-track {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  animation: logo-scroll 24s linear infinite;
}
.logo-marquee:hover .logo-track { animation-play-state: paused; }
@keyframes logo-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.logo-chip {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  height: 40px;
  padding: 0 26px;
  box-sizing: border-box;
}
.logo-chip img {
  height: 26px;
  width: auto;
  display: block;
}

/* Shared grid-card teaser (used by Selected Publications and the projects.html index) */
.teaser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.teaser-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.teaser-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--accent);
}
.teaser-media {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: var(--accent-soft);
  overflow: hidden;
}
.teaser-media .placeholder-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.teaser-media .placeholder-icon svg { width: 44px; height: 44px; }
.teaser-media img,
.project-card-media img,
.project-hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.teaser-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 16px 18px 18px;
}
.teaser-body h3 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.35;
}
.teaser-body p {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.teaser-body .read-more {
  margin-top: auto;
  padding-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}
.projects .view-all,
.pub-teaser .view-all {
  margin-top: 18px;
}

/* Homepage Research Projects: swipeable carousel of rich cards */
.project-carousel-wrap { position: relative; }
.project-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
  margin: 0 -4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.project-carousel::-webkit-scrollbar { display: none; }
.project-card {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card-bg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}
.project-card-top { padding: 18px 22px 12px; }
.project-card-top h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink);
}
.project-card-media {
  position: relative;
  width: 100%;
  padding-top: 44%;
  background: var(--accent-soft);
  overflow: hidden;
}
.project-card-media .placeholder-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.project-card-media .placeholder-icon svg { width: 44px; height: 44px; }
.project-card-body { padding: 16px 22px 20px; }
.project-card-sub {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.project-card-meta .tag { margin-left: 0; font-size: 0.7rem; }
.project-card-meta .tag.role { color: #fff; background: var(--accent); font-weight: 600; }
.project-card .read-more { font-size: 0.8rem; font-weight: 600; color: var(--accent); }

.carousel-arrow {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: border-color 0.15s ease, color 0.15s ease;
  z-index: 2;
}
.carousel-arrow:hover { border-color: var(--accent); color: var(--accent); }
.carousel-prev { left: 6px; }
.carousel-next { right: 6px; }

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.carousel-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--line);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.carousel-dots .dot:hover { background: var(--ink-faint); }
.carousel-dots .dot.active { background: var(--accent); transform: scale(1.3); }

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .teaser-grid { grid-template-columns: 1fr; }
  .carousel-arrow { display: none; }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Research projects */
.projects-intro {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.project-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.project {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  background: var(--card-bg);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.project:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.project-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.project-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-icon svg { width: 22px; height: 22px; }
.project-headline h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.35;
}
.project-sub {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-faint);
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 14px;
}
.project-meta .tag {
  margin-left: 0;
  font-size: 0.72rem;
}
.project-meta .tag.role {
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}
.project-desc {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.project-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.fact-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.fact p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
@media (max-width: 640px) {
  .project { padding: 20px; }
  .project-facts { grid-template-columns: 1fr; }
}

/* Individual project detail pages */
.project-detail {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 26px 28px;
  background: var(--card-bg);
}
.project-media-block { margin-bottom: 22px; }
.project-hero-media {
  position: relative;
  width: 100%;
  padding-top: 50%;
  border-radius: 10px;
  overflow: hidden;
  background: var(--accent-soft);
}
.project-hero-media .placeholder-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.project-hero-media .placeholder-icon svg { width: 56px; height: 56px; }
.project-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.pager-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.pager-link:hover { text-decoration: underline; }
.pager-link.pager-all { color: var(--ink-faint); font-weight: 400; }
.pager-spacer { flex: 1 1 auto; }

.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-caption {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--ink-faint);
}
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .project-detail { padding: 20px; }
}

/* Publications */
.pub-list, .brief-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}
.pub-list li, .brief-list li {
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.pub-list li:last-child, .brief-list li:last-child { border-bottom: none; }
.venue { color: var(--ink-faint); font-style: italic; }
.tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}
.brief-list .meta { color: var(--ink-faint); }
a.pub-link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
a.pub-link:hover { color: var(--accent); }
a.pub-link:hover .tag { text-decoration: none; }
.view-all {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.view-all:hover { text-decoration: underline; }

.pub-group { margin-bottom: 28px; }
.pub-group:last-child { margin-bottom: 0; }
.pub-group.is-empty { display: none; }
.pub-group h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 4px;
}
.pub-list li.is-hidden, .brief-list li.is-hidden { display: none; }


/* Filter bar v2 */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.filter-row-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  flex: 0 0 auto;
  width: 42px;
}
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-btn {
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}
.filter-empty {
  font-size: 0.88rem;
  color: var(--ink-faint);
  display: none;
  padding: 8px 0 0;
}
.filter-empty.is-visible { display: block; }

.page-header {
  margin-bottom: 40px;
}
.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 16px;
}
.back-link:hover { text-decoration: underline; }
.page-header h1 {
  font-size: 1.5rem;
  margin: 0 0 6px;
}
.page-header p {
  color: var(--ink-faint);
  font-size: 0.92rem;
  margin: 0;
}
.page-header p a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 2px;
}
.page-header p a:hover {
  text-decoration-color: var(--accent);
}

footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-faint);
  text-align: center;
}
footer a { color: var(--accent); }
.footer-contact { margin: 6px 0 0; }
