:root {
  --paper: #f7f5f1; --ink: #14171a; --surface: #ffffff; --figbg: #ffffff;
  --line: #e2ddd4; --line2: #eeeae3; --track: #d6d0c6; --dash: #c2bcb2;
  --text: #24272b; --text2: #3c3f43; --text3: #5a5d61;
  --muted: #6b665e; --muted2: #8a847a; --muted3: #b0a99e;
  --accent: #1d7a52; --hl: rgba(44,168,107,0.07);
  --code-bg: #14171a; --code-fg: #e8e4dc;
  --figfilter: none;
}
[data-theme="dark"] {
  --paper: #15161a; --ink: #f2efe9; --surface: #1c1e23; --figbg: #f4f2ee;
  --line: #2f3238; --line2: #26282d; --track: #3a3d43; --dash: #4a4e55;
  --text: #e6e3dd; --text2: #cbc7c0; --text3: #a9a49b;
  --muted: #918b82; --muted2: #7f7a71; --muted3: #605c55;
  --accent: #4ec48a; --hl: rgba(78,196,138,0.13);
  --code-bg: #0e0f12; --code-fg: #e8e4dc;
  --figfilter: saturate(0.94) brightness(0.97);
}

html { scroll-behavior: smooth; background: var(--paper); }
html, body { overflow-x: clip; max-width: 100%; }
* { box-sizing: border-box; }
img { filter: var(--figfilter); max-width: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif; -webkit-font-smoothing: antialiased;
}
html, body, section, figure, nav, header, footer, div, span, p, h1, h2, h3, a, button, pre, img {
  transition: background-color 380ms ease, color 380ms ease, border-color 380ms ease, filter 380ms ease;
}
@media (prefers-reduced-motion: reduce) {
  html, body, section, figure, nav, header, footer, div, span, p, h1, h2, h3, a, button, pre, img { transition: none; }
}
[id] { scroll-margin-top: 86px; }
a { color: var(--ink); text-decoration-color: #b8b2a8; text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.mono { font-family: 'IBM Plex Mono', monospace; }
.sans { font-family: 'IBM Plex Sans', sans-serif; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(18px, 5vw, 40px) 120px; }

/* site-wide top nav */
.site-nav {
  position: sticky; top: 0; z-index: 40; background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-nav .wrap { padding: 16px clamp(18px, 5vw, 40px); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 1180px; }
.site-nav .brand { font-family: 'IBM Plex Mono', monospace; font-size: 15px; letter-spacing: 0.02em; text-decoration: none; color: var(--ink); font-weight: 500; }
.site-nav .brand:hover { color: var(--accent); }
.site-nav .links { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.site-nav .links a {
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 1px solid transparent;
}
.site-nav .links a:hover, .site-nav .links a.active { color: var(--ink); border-bottom-color: var(--accent); }
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
.theme-btn:hover { border-color: var(--ink); color: var(--ink); }

.badge { display: inline-block; padding: 5px 10px; border: 1px solid var(--ink); color: var(--ink); font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.badge.soft { border-color: var(--line); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 18px; text-decoration: none;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
}
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.btn:not(.btn-primary):hover { background: var(--ink); color: var(--paper); }
.btn.small { padding: 7px 13px; font-size: 12.5px; }
.btn .tag { font-family: 'IBM Plex Mono', monospace; opacity: 0.6; }

section.block { padding: clamp(48px, 7vw, 76px) 0 0; }
.section-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 26px; }

h1.page-title { margin: 0; font-size: clamp(30px, 5.6vw, 50px); line-height: 1.08; font-weight: 600; letter-spacing: -0.02em; max-width: 26ch; text-wrap: balance; }
.subtitle { margin: 0; max-width: 68ch; font-size: clamp(17px, 2.2vw, 21px); line-height: 1.55; color: var(--text2); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: clamp(28px, 4vw, 56px); align-items: start; }
.body-col { display: flex; flex-direction: column; gap: 18px; font-size: clamp(16px, 2vw, 19px); line-height: 1.62; color: var(--text); }

.feature-list { display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.feature-item { display: flex; flex-direction: column; gap: 6px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.feature-k { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.feature-v { font-size: 17px; line-height: 1.5; color: var(--text); }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.tag-row .badge { cursor: default; }

/* publication list */
.pub-list { display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.pub-item { padding: 24px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pub-venue-group { margin: 44px 0 18px; }
.pub-venue-group:first-child { margin-top: 0; }
.pub-title { font-size: 19px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.pub-authors { font-family: 'IBM Plex Sans', sans-serif; font-size: 14.5px; color: var(--text3); line-height: 1.5; }
.pub-authors strong { color: var(--text2); font-weight: 600; }
.pub-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pub-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

/* project cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; }
.card { border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--ink); }
.card .thumb { aspect-ratio: 16/10; overflow: hidden; background: var(--figbg); border-bottom: 1px solid var(--line); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .card-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 19px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
.card p { margin: 0; font-family: 'IBM Plex Sans', sans-serif; font-size: 14.5px; line-height: 1.55; color: var(--text3); flex: 1; }
.card .go { margin-top: auto; font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card:hover .go { color: var(--accent); }

.data-table { border-top: 2px solid var(--ink); overflow-x: auto; }
.t-head, .t-row { display: grid; align-items: baseline; }
.t-head { padding: 12px 0; border-bottom: 1px solid var(--ink); font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.t-row { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.t-name { font-weight: 400; }
.t-cell { text-align: right; font-family: 'IBM Plex Mono', monospace; font-size: 14.5px; }

footer.site { margin-top: 76px; padding-top: 26px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; color: var(--muted); }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--accent); }

@media (max-width: 620px) {
  .site-nav .links { gap: 14px; }
}
