/* Homepage styles. Change --accent to re-theme the whole site. */
:root {
  --accent: #004191;        /* KAIST blue */
  --accent-dark: #002f6c;
  --accent-soft: #eef3fa;
  --text: #5f5f5f;
  --heading: #222;
  --link: #2a7ab8;
  --link-hover: #0b4f87;
  --line: #e6e6e6;
  --muted: #8a8a8a;
  --bg: #fff;
  --thumb-bg: #f3f5f8;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 50px 40px;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 "Ubuntu", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
b, strong { color: var(--heading); font-weight: 500; }
img { max-width: 100%; }

h1, h2, h3 { color: var(--heading); line-height: 1.15; }
h2 { font-size: 22px; font-weight: 500; margin: 44px 0 16px; }
h3 { font-size: 15px; font-weight: 500; color: var(--accent); margin: 16px 0 6px; }

#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent); z-index: 10;
}

/* ---------- Layout: fixed sidebar + content ---------- */
.wrapper {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 64px;
}

.sidebar {
  position: sticky;
  top: 50px;
  align-self: start;
}
.sidebar .avatar {
  width: 210px; height: 210px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}
.sidebar h1 { font-size: 28px; font-weight: 700; margin: 22px 0 4px; }
.sidebar .position { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.sidebar .email { display: flex; align-items: center; gap: 6px; margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.sidebar .email svg { width: 16px; height: 16px; flex-shrink: 0; }

.personal-links {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 12px 14px;
}
.personal-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  background: #fafbfd;
  color: #6b7280;
  transition: color .18s, background-color .18s;
}
.personal-link svg { width: 26px; height: 26px; }
.personal-link:hover, .personal-link:focus-visible {
  color: #fff; background: var(--accent);
}
.personal-link:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }

.content { min-width: 0; }
.content > section:first-child p:first-child { margin-top: 0; }
#about p { margin: 0 0 12px; }

/* ---------- News ---------- */
.news-window {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}
#news ul { margin: 0; padding-left: 18px; }
#news li { margin: 4px 0; }
.news-date { color: var(--heading); font-variant-numeric: tabular-nums; margin-right: 4px; }

/* ---------- Publications ---------- */
.legend { margin: -6px 0 12px; color: var(--muted); font-size: 13px; }

.categories { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.category-btn {
  font: inherit; font-size: 13px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid #d6dbe3;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.category-btn:hover { border-color: var(--accent); color: var(--accent); }
.category-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pub {
  display: flex;
  gap: 22px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.pub[hidden] { display: none; }
.pub-thumb { width: 28%; flex-shrink: 0; }
.pub-thumb img, .thumb-placeholder {
  width: 100%;
  border-radius: 10px;
  display: block;
  transition: transform .4s ease;
}
/* Paper figures keep their own aspect ratio so nothing is cropped. */
.pub-thumb img { height: auto; background: #fff; border: 1px solid var(--line); }
.thumb-placeholder { aspect-ratio: 2 / 1; }
.pub-thumb { overflow: hidden; border-radius: 10px; align-self: flex-start; margin-top: 3px; }
.pub:hover .pub-thumb img { transform: scale(1.05); }
.thumb-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--thumb-bg));
  color: var(--accent);
  font-weight: 500; font-size: 17px;
  text-align: center; padding: 10px;
}
.thumb-placeholder .yr { font-size: 13px; font-weight: 400; color: var(--muted); }

.pub-content { flex: 1; min-width: 0; }
.pub .title { color: var(--heading); font-weight: 500; font-size: 16px; line-height: 1.4; margin-bottom: 4px; }
.pub .authors { font-size: 14px; }
.me { color: var(--heading); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #bbb; }
.pub .venue { font-size: 14px; font-style: italic; margin-top: 2px; }
.badge {
  font-style: normal; font-size: 14px; font-weight: 700;
  color: #b3261e; background: #fdecea;
  border-radius: 6px; padding: 1px 9px; margin-left: 6px;
}
.pub-links { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 14px; }
.pub-links a { display: inline-flex; align-items: center; gap: 5px; }
.pub-links a + a::before { content: "|"; color: #ccc; margin: 0 10px; }
.pub-links svg { width: 15px; height: 15px; }

/* ---------- Lists (experience, awards, ...) ---------- */
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0 16px;
  padding: 5px 0;
}
ul.plain .when { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; grid-row: span 3; }
ul.plain .sub { font-size: 14px; }
ul.plain .code-link { font-size: 14px; margin-left: 2px; }
#service ul { margin: 0; padding-left: 18px; }

footer {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  body { padding: 28px 16px; }
  .wrapper { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sidebar { position: static; text-align: center; }
  .sidebar .avatar { width: 150px; height: 150px; margin: 0 auto; }
  .personal-links { grid-template-columns: repeat(4, 44px); justify-content: center; }
  .sidebar .email { justify-content: center; }
  h2 { margin-top: 36px; }
}
@media (max-width: 560px) {
  .pub { flex-direction: column; gap: 10px; }
  .pub-thumb { width: 100%; max-width: 320px; }
  ul.plain li { grid-template-columns: 1fr; }
  ul.plain .when { grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
