/* ===== Base ===== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #111111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; }

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

a {
  color: #1f4fa0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
a:hover { border-bottom-color: #1f4fa0; }

p { margin: 0 0 14px; }

hr {
  border: 0;
  border-top: 1px solid #e5e5e5;
  margin: 36px 0;
}

/* ===== Header / Nav ===== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid #e5e5e5;
}
.site-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.01em;
}
.site-name a { color: inherit; border: 0; }
.site-nav a {
  color: #444;
  margin-left: 20px;
  font-size: 0.95rem;
  border: 0;
}
.site-nav a:hover { color: #111; text-decoration: underline; }
.site-nav a.active { color: #111; font-weight: 600; }

/* ===== Intro block ===== */
.intro {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 36px;
}
.intro img.profile {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.intro .who h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.015em;
}
.intro .who .tagline {
  color: #555;
  font-size: 1rem;
  margin-bottom: 14px;
}
.intro .who p { font-size: 0.98rem; }
.intro .links {
  margin-top: 8px;
  font-size: 0.92rem;
  color: #555;
  word-break: break-word;
}
.intro .links a { color: #1f4fa0; }

/* ===== Sections ===== */
section { margin-top: 40px; }
section h2 {
  font-size: 1.08rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid #222;
  color: #111;
}
section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 22px 0 10px;
  color: #111;
}

/* ===== Entry row (used in CV, home experience) ===== */
.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 20px;
  align-items: baseline;
  padding: 8px 0;
}
.entry .left .title {
  font-weight: 600;
}
.entry .left .sub {
  color: #555;
  font-size: 0.94rem;
  margin-top: 2px;
}
.entry .left .note {
  color: #666;
  font-size: 0.9rem;
  margin-top: 2px;
  font-style: italic;
}
.entry .date {
  color: #555;
  font-size: 0.92rem;
  white-space: nowrap;
  text-align: right;
}

/* ===== Institution chip (logo + name inline) ===== */
.inst {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.inst img {
  height: 18px;
  width: auto;
  max-width: 100px;
  vertical-align: middle;
  object-fit: contain;
  flex-shrink: 0;
}
/* When the logo already includes the wordmark (UCSD, Amazon, KAIST, AIST),
   we only show the logo. .inst-name is used for cases where we want both. */
.inst .inst-name { font-weight: 600; }
/* Slightly larger logos in CV entry titles (more prominent) */
.entry .left .title .inst img { height: 22px; max-width: 130px; }
/* Logos with wide wordmarks (AIST, Amazon) normalized to the same horizontal extent */
.inst img.logo-fixed { height: auto; width: 66px; max-width: 66px; }
.entry .left .title .inst img.logo-fixed { height: auto; width: 77px; max-width: 77px; }

/* ===== Publications ===== */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li {
  padding: 10px 0;
  font-size: 0.96rem;
  border-bottom: 1px dashed #eee;
}
.pub-list li:last-child { border-bottom: 0; }
.pub-list .authors .me { text-decoration: underline; font-weight: 600; }
.pub-list .title { font-weight: 600; color: #111; }
.pub-list .venue { color: #555; font-style: italic; }

/* ===== Service lists ===== */
.service-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 16px;
  padding: 6px 0;
}
.service-row .role { font-weight: 500; color: #555; font-size: 0.94rem; }
.service-row .items { color: #222; font-size: 0.96rem; }

/* ===== Simple link list (demo / datasets cards) ===== */
.card-list { margin: 16px 0; }
.card {
  display: block;
  padding: 18px 20px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  margin-bottom: 14px;
  color: #111;
  transition: border-color 0.15s ease, background 0.15s ease;
  border-bottom: 1px solid #e5e5e5;
}
.card:hover {
  border-color: #111;
  background: #fafafa;
}
.card .card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}
.card .card-sub {
  font-size: 0.9rem;
  color: #555;
}

/* ===== Citation box (detail pages) ===== */
.citation-box {
  position: relative;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 16px 18px;
  margin: 16px 0 28px;
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-x: auto;
}
.citation-box pre {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #111;
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.copy-btn:hover { background: #333; }
.copy-btn.copied { background: #2b8c4a; }

/* ===== Download cards (dataset page) ===== */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0 28px;
}
.dl-card {
  display: block;
  padding: 20px 16px;
  text-align: center;
  border: 1px solid #111;
  border-radius: 6px;
  color: #111;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 0.92rem;
}
.dl-card:hover {
  background: #111;
  color: #fff;
  border-bottom-color: #111;
}
.dl-card .dl-title { font-weight: 700; margin-bottom: 4px; }
.dl-card .dl-sub { font-size: 0.8rem; opacity: 0.85; }

/* ===== Video embed ===== */
.video-embed {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  margin: 10px 0;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e5;
  color: #888;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.site-footer a { color: #666; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .wrap { padding: 24px 18px 60px; }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .site-nav { margin-left: -4px; }
  .site-nav a { margin-left: 0; margin-right: 14px; }

  .intro {
    grid-template-columns: 1fr;
    gap: 18px;
    text-align: left;
  }
  .intro img.profile {
    width: 180px;
    height: 180px;
  }
  .intro .who h1 { font-size: 1.5rem; }

  .entry {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .entry .date {
    text-align: left;
    font-size: 0.88rem;
    color: #777;
  }

  .service-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .dl-grid { grid-template-columns: 1fr; }

  .inst img { height: 18px; max-width: 80px; }
  .entry .left .title .inst {
    white-space: normal;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  section h2 { font-size: 1rem; }
}
