:root {
  --ink: #20252b;
  --muted: #626b74;
  --line: #dfe3e7;
  --footer-line: #ded3d6;
  --footer-bg: #f7f5f5;
  --thumb-border: #454b50;
  --soft: #f6f7f8;
  --link: #245f8f;
  --accent: #8b1e3f;
  --bg: #fff;
  --max: 940px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ededed;
  --muted: #b8bec4;
  --line: #555b60;
  --footer-line: #62565a;
  --footer-bg: #3e3a3b;
  --thumb-border: #858b90;
  --soft: #34383b;
  --link: #62b8da;
  --accent: #e197ad;
  --bg: #414141;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
}

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

a:hover { text-decoration: underline; }

.wrap {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
}

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav {
  min-height: 51px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
}

.brand img { display: block; width: 22px; height: 22px; border-radius: 6px; }

.brand:hover { color: var(--accent); text-decoration: none; }

.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-links { display: flex; align-items: center; gap: 19px; font-size: 0.86rem; }
.nav-links a { color: var(--muted); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  color: var(--accent);
  opacity: .72;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity .18s ease;
}
.theme-toggle:hover { opacity: 1; }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 52px;
  padding: 36px 0 26px;
  align-items: start;
}

.intro-copy { grid-column: 1; grid-row: 1; }
.portrait-column { grid-column: 2; grid-row: 1; width: 190px; margin-top: 26px; }

.portrait {
  display: block;
  width: 190px;
  height: 190px;
  object-fit: cover;
  border-radius: 3px;
  filter: saturate(0.88);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}

.affiliation-marks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 10px 12px;
  margin-top: 18px;
}

.affiliation-marks a {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .18s ease;
}

.affiliation-marks a:hover { opacity: .72; }
.affiliation-marks img { display: block; max-width: 100%; height: auto; }
.affiliation-ku { grid-column: 1 / -1; width: 112px; }
.affiliation-cmu,
.affiliation-su { width: 72px; }
.affiliation-su { flex-direction: column; gap: 2px; }
.affiliation-su .su-symbol { width: 33px; }
.affiliation-su .su-wordmark { width: 54px; }

h1, h2, h3 { color: var(--ink); }

h1 {
  margin: 0;
  font-size: clamp(2.05rem, 4.3vw, 2.5rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.03em;
}

.role { margin: 9px 0 11px; color: var(--muted); font-size: 1rem; }
.intro-copy > p:not(.role) { margin: 0 0 7px; }

.profile-links, .paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 10px;
  font-size: .9rem;
}

.profile-links a, .paper-links a { font-weight: 600; }
.profile-links a { color: var(--ink); }
.profile-links a:hover { color: var(--link); }
.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.profile-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-icon-fill { fill: currentColor; stroke: none; }
.profile-icon .icon-fill { fill: currentColor; stroke: none; }
.placeholder-link { color: #7b848d; }
.placeholder-link small { margin-left: 2px; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }

.section {
  padding: 18px 0;
  scroll-margin-top: 18px;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -.02em;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.section-heading h2 { margin: 0; }
.section-heading > p { margin: 0; color: var(--muted); font-size: .9rem; }
.news { padding-top: 18px; }
.news-list { margin: 0; padding: 0; list-style: none; }
.news-list li { display: grid; grid-template-columns: 88px 1fr; gap: 12px; margin: 3px 0; }
.news-list time { color: var(--muted); font-size: .84rem; font-weight: 600; }
.news-list time::before { content: "["; }
.news-list time::after { content: "]"; }

.talk-list { margin: 0; padding: 0; list-style: none; }
.talk-list li { display: grid; grid-template-columns: 50px 1fr; gap: 15px; padding: 3px 0; }
.talk-list time { color: var(--muted); font-size: .84rem; }
.talk-list strong { font-weight: 600; }
.item-link { font-size: .88em; font-weight: 600; white-space: nowrap; }

.publication {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 18px;
  padding: 10px 0;
}

.publication > div { grid-column: 1; grid-row: 1; }

.publication:first-of-type { padding-top: 2px; }
.publication-thumb {
  grid-column: 2;
  grid-row: 1;
  display: block;
  width: 285px;
  padding: 0;
  overflow: hidden;
  align-self: start;
  border: 1px solid transparent;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  cursor: zoom-in;
}
.publication-thumb { transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease; }
.publication-thumb:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.publication-thumb img { display: block; width: 100%; height: auto; transition: transform .28s cubic-bezier(.2,.7,.2,1); }

@media (hover: hover) and (pointer: fine) {
  .publication-thumb:hover {
    box-shadow: 0 5px 16px rgba(0,0,0,.14);
    transform: translateY(-1px);
  }
  .publication-thumb:hover img { transform: scale(1.055); }
}
.publication-year { color: var(--muted); font-size: .82rem; }
.publication h3, .patent-list h3, .timeline h3, .education-grid h3 {
  margin: 4px 0 5px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}
.publication p { margin: 3px 0; }
.authors { color: var(--ink); font-size: .93rem; }
.publication-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }

.status {
  display: inline-block;
  padding: 0;
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.under-review { color: #7a1d39; }
.in-preparation { color: #536571; }
html[data-theme="dark"] .under-review { color: #f0a6bb; }
html[data-theme="dark"] .in-preparation { color: #b9c9d3; }

.figure-viewer {
  box-sizing: border-box;
  width: min(94vw, 1420px);
  max-width: none;
  max-height: 94vh;
  margin: auto;
  padding: 14px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: var(--bg);
  box-shadow: 0 18px 60px rgba(0,0,0,.34);
}
.figure-viewer[open] { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.figure-viewer::backdrop { background: rgba(13,17,20,.72); }
.figure-viewer img {
  display: block;
  width: min(calc(94vw - 28px), 1392px);
  min-width: 0;
  max-width: 100%;
  max-height: calc(94vh - 62px);
  height: auto;
  object-fit: contain;
}
.figure-viewer p { margin: 0; color: var(--muted); font-size: .84rem; text-align: center; }
.figure-viewer-close {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(20,24,28,.72);
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.figure-viewer-close:hover { background: rgba(20,24,28,.92); }

.patent-list { margin: 0; padding-left: 1.45rem; }
.patent-list li { padding: 1px 0 5px 8px; }
.patent-list h3 { margin-bottom: 2px; }
.patent-list p { margin: 0; color: var(--muted); font-size: .9rem; }

.timeline article {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  padding: 5px 0;
  align-items: start;
}
.timeline article:first-child { padding-top: 0; }
.timeline-date { padding-top: 2px; color: var(--muted); font-size: .84rem; }
.entry-location, .entry-separator { color: var(--muted); font-size: .82rem; }
.timeline h3 { margin-top: 0; }
.timeline .entry-body > p { margin: 1px 0 0; line-height: 1.4; }

.education-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 32px; }
.education-grid article { padding: 4px 0; }
.education-grid h3 { margin-top: 0; }
.education-grid p { margin: 2px 0; }
.education-grid span { color: var(--muted); font-size: .85rem; }

.contact-intro { margin: 0 0 9px; }
.contact-list { margin: 0; }
.contact-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  padding: 3px 0;
}
.contact-list dt { color: var(--muted); font-size: .84rem; }
.contact-list dd { margin: 0; }

.site-footer { margin-top: 8px; padding: 21px 0 28px; background: var(--footer-bg); border-top: 1px solid var(--footer-line); color: var(--muted); font-size: .82rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .wrap { width: min(calc(100% - 30px), var(--max)); }
  .nav { min-height: 52px; }
  .nav-links { display: none; }
  .intro { grid-template-columns: 1fr; gap: 19px; padding: 27px 0 23px; }
  .intro-copy { grid-column: 1; grid-row: 2; }
  .portrait-column { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: 112px 150px; align-items: center; gap: 25px; width: 100%; margin-top: 0; }
  .portrait { width: 112px; height: 112px; }
  .affiliation-marks { margin-top: 0; grid-template-columns: 1fr 1fr; gap: 7px 9px; }
  .affiliation-ku { width: 98px; }
  .affiliation-cmu,
  .affiliation-su { width: 64px; }
  .affiliation-su .su-symbol { width: 30px; }
  .affiliation-su .su-wordmark { width: 49px; }
  h1 { font-size: 2rem; }
  .role { font-size: .94rem; }
  .section { padding: 17px 0; }
  .section-heading { display: block; }
  .section-heading h2 { margin-bottom: 5px; }
  .news-list li { grid-template-columns: 80px 1fr; gap: 8px; }
  .talk-list li { grid-template-columns: 44px 1fr; gap: 10px; }
  .publication { grid-template-columns: 1fr; gap: 3px; }
  .publication > div { grid-column: 1; grid-row: 2; }
  .publication-thumb { grid-column: 1; grid-row: 1; width: min(100%, 285px); margin-bottom: 4px; }
  .publication-year { font-size: .82rem; }
  .timeline article { grid-template-columns: 1fr; gap: 2px; }
  .timeline-date { grid-column: 1; grid-row: 1; }
  .entry-body { grid-column: 1; grid-row: 2; }
  .education-grid { grid-template-columns: 1fr; gap: 0; }
  .contact-list > div { grid-template-columns: 1fr; gap: 0; padding: 4px 0; }
  .site-footer .wrap { display: block; }
  .site-footer a { display: inline-block; margin-top: 7px; }
}

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