:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --text: #121518;
  --muted: #555e69;
  --faint: #8a929c;
  --line: #e6e8eb;
  --hover: #f1f3f4;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --gold: #a16207;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1117;
    --panel: #111820;
    --text: #e6e9ed;
    --muted: #9aa4b0;
    --faint: #6b7581;
    --line: #1f2731;
    --hover: #151d26;
    --accent: #5ec4b6;
    --accent-soft: rgba(94, 196, 182, 0.1);
    --gold: #e0b45a;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15.5px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { width: 1em; height: 1em; flex-shrink: 0; }
::selection { background: var(--accent); color: #fff; }

.layout { max-width: 1180px; margin: 0 auto; padding: 0 40px; display: grid; grid-template-columns: 380px 1fr; gap: 64px; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; height: 100vh; padding: 72px 0 48px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.portrait { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin-bottom: 20px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--line); }
.side h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.role { margin-top: 8px; font-size: 17px; font-weight: 500; color: var(--accent); }
.tagline { margin-top: 12px; color: var(--muted); max-width: 300px; }

.toc { margin-top: 44px; display: flex; flex-direction: column; gap: 2px; }
.toc a {
  display: flex; align-items: center; gap: 14px; padding: 7px 0;
  font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint);
  transition: color .2s;
}
.toc a span { display: block; width: 28px; height: 1px; background: currentColor; transition: width .2s; }
.toc a:hover, .toc a.active { color: var(--text); }
.toc a:hover span, .toc a.active span { width: 56px; }

.side-foot { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 9px; font-weight: 500; font-size: 14.5px;
  background: var(--text); color: var(--bg); transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn svg { width: 17px; height: 17px; }
.socials { display: flex; gap: 18px; }
.socials a { color: var(--faint); transition: color .2s; }
.socials a:hover { color: var(--text); }
.socials svg { width: 21px; height: 21px; }
.where { font-size: 13px; color: var(--faint); }

/* ---------- content ---------- */
main { padding: 72px 0 40px; min-width: 0; }
section { margin-bottom: 72px; scroll-margin-top: 48px; }
.sec { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 18px; }
#about > p { color: var(--muted); font-size: 16px; }
#about strong { color: var(--text); font-weight: 600; }

.path { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 24px; position: relative; }
.path::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--line); }
.path li { position: relative; padding-top: 22px; display: flex; flex-direction: column; font-size: 14px; }
.path li::before { content: ""; position: absolute; top: 1px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--faint); }
.path li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.path b { font-weight: 600; }
.path li.now b { color: var(--accent); }
.path span { color: var(--faint); font-size: 13px; }

.highlights { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 26px; }
.highlights li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; color: var(--muted); line-height: 1.4; }
.highlights b { display: block; font-size: 18px; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }

.group { font-size: 15px; font-weight: 600; margin: 4px 0 10px; }
.projects + .group { margin-top: 32px; }

/* project rows */
.projects { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.proj {
  position: relative; display: grid; grid-template-columns: 200px 1fr; gap: 22px;
  padding: 16px; margin: 0 -16px; border-radius: 12px; transition: background .2s;
}
.proj:hover { background: var(--hover); }
.proj img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); margin-top: 3px;
}
.proj img.light { background: #fff; object-fit: contain; padding: 6px; }
.proj img.contain { object-fit: contain; padding: 6px; }
.proj img.tl { object-position: top left; }
.proj h4 { font-size: 16px; font-weight: 600; line-height: 1.35; margin-bottom: 6px; }
.proj h4 a { display: inline; transition: color .2s; }
.proj h4 svg { width: 13px; height: 13px; margin-left: 2px; vertical-align: -1px; color: var(--faint); transition: transform .2s, color .2s; }
.proj:hover h4 a { color: var(--accent); }
.proj:hover h4 svg { color: var(--accent); transform: translate(2px, -2px); }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.proj p { color: var(--muted); font-size: 14.5px; }
.proj .award { display: inline-block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--gold); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tags span { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }

.projects.small .proj { grid-template-columns: 120px 1fr; gap: 18px; padding: 12px 16px; }
.projects.small h4 { font-size: 15px; margin-bottom: 2px; }
.projects.small p { font-size: 14px; }
.projects.small .tags { margin-top: 6px; }

/* experience & publications */
.rows { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.rows li { display: grid; grid-template-columns: 150px 1fr; gap: 22px; padding: 14px 16px; margin: 0 -16px; border-radius: 12px; transition: background .2s; }
.rows li:hover { background: var(--hover); }
.when { font-size: 12.5px; color: var(--faint); font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; padding-top: 3px; }
.rows h4 { font-size: 15.5px; font-weight: 600; line-height: 1.4; }
.rows h4 a:hover { color: var(--accent); }
.rows h4 svg { width: 12px; height: 12px; color: var(--faint); vertical-align: -1px; }
.rows p { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.rows .tags { margin-top: 8px; }
.pubs b { color: var(--text); font-weight: 600; }
.org { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.awards { margin-top: 36px; }
.awards p { color: var(--muted); font-size: 14.5px; margin-bottom: 8px; }
.org img, .edu img { width: 40px; height: 40px; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 3px; }
.logo-ph { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; font-size: 9px; font-weight: 700; color: var(--faint); letter-spacing: .02em; }
.cols p.edu { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 36px; }
.cols p { color: var(--muted); font-size: 14.5px; margin-bottom: 10px; }
.cols b { color: var(--text); font-weight: 600; }

footer { border-top: 1px solid var(--line); }
footer p { font-size: 13px; color: var(--faint); padding-top: 20px; }
footer a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (min-width: 1025px) and (max-height: 800px) {
  .side { padding: 40px 0 32px; }
  .portrait { width: 64px; height: 64px; margin-bottom: 14px; }
  .side h1 { font-size: 30px; }
  .toc { margin-top: 24px; }
  .toc a { padding: 5px 0; }
}
@media (max-width: 1024px) {
  .layout { display: block; max-width: 760px; padding: 0 24px; }
  .side { position: static; height: auto; padding: 48px 0 0; gap: 24px; }
  .toc { display: none; }
  .side-foot { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 20px; }
  main { padding-top: 48px; }
}
@media (max-width: 640px) {
  .layout { padding: 0 16px; }
  .side h1 { font-size: 28px; }
  .highlights { grid-template-columns: repeat(2, 1fr); }
  .path { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .path::before { display: none; }
  .proj { grid-template-columns: 1fr; gap: 12px; }
  .proj img { aspect-ratio: 2 / 1; }
  .projects.small .proj img { aspect-ratio: 1 / 1; }
  .projects.small .proj { grid-template-columns: 96px 1fr; }
  .rows li { grid-template-columns: 1fr; gap: 4px; }
  .cols { grid-template-columns: 1fr; gap: 8px; }
}
