/* Moule Lin — academic homepage & blog */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --faint: #8b929b;
  --line: #e7e4dd;
  --accent: #1d4ed8;
  --accent-soft: #e8eefc;
  --mark: #7a2e0e;
  --code-bg: #f4f2ee;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315; --surface: #181b1f; --text: #e6e6e3; --muted: #a3a9b1; --faint: #7b828b;
    --line: #2a2e34; --accent: #8ab4ff; --accent-soft: #1c2740; --mark: #f0a07a; --code-bg: #1c1f24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315; --surface: #181b1f; --text: #e6e6e3; --muted: #a3a9b1; --faint: #7b828b;
  --line: #2a2e34; --accent: #8ab4ff; --accent-soft: #1c2740; --mark: #f0a07a; --code-bg: #1c1f24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  max-width: 1040px; margin: 0 auto; padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--text); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted); font-size: 14.5px; padding: 6px 10px; border-radius: 6px;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.theme-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; margin-left: 6px;
  display: inline-grid; place-items: center;
}
.theme-btn:hover { color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }

/* ---------- home layout ---------- */
.home {
  max-width: 1040px; margin: 0 auto; padding: 56px 24px 80px;
  display: grid; grid-template-columns: 260px 1fr; gap: 64px;
}
.profile { position: sticky; top: 96px; align-self: start; }
.avatar {
  width: 180px; height: 180px; border-radius: 50%; object-fit: cover; display: block;
  border: 1px solid var(--line);
}
.profile h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.2; margin: 22px 0 4px; }
.profile .role { color: var(--muted); font-size: 15px; margin: 0 0 2px; }
.profile .affil { color: var(--muted); font-size: 15px; margin: 0; }
.links { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 8px; font-size: 14.5px; }
.links a { color: var(--muted); display: inline-flex; align-items: center; gap: 10px; }
.links a:hover { color: var(--accent); text-decoration: none; }
.links svg { width: 16px; height: 16px; flex: none; }

.content section { margin-bottom: 52px; scroll-margin-top: 80px; }
.content h2 {
  font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0 0 18px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.content p { margin: 0 0 14px; }
.lead { font-size: 17px; }
.interests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding: 0; list-style: none; }
.interests li { font-size: 13.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; background: var(--surface); }

/* publications */
.pub-group { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 26px 0 10px; font-weight: 600; }
.pub-group:first-of-type { margin-top: 0; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pub:last-child { border-bottom: 0; }
.venue {
  align-self: start; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 4px 6px;
}
.venue.review { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.pub .title { font-weight: 600; line-height: 1.45; margin: 0 0 3px; }
.pub .authors { color: var(--muted); font-size: 14.5px; margin: 0 0 1px; }
.pub .authors b { color: var(--text); font-weight: 600; }
.pub .where { color: var(--faint); font-size: 14px; font-style: italic; margin: 0; }

/* timeline lists */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.tl li:last-child { border-bottom: 0; }
.tl .what { font-weight: 600; }
.tl .when { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl .detail { grid-column: 1 / -1; color: var(--muted); font-size: 14.5px; }
.honors { margin: 0; padding-left: 18px; color: var(--muted); }
.honors li { margin: 4px 0; }
.honors b { color: var(--text); font-weight: 600; }

.blog-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 18px 20px;
}
.blog-cta p { margin: 0; color: var(--muted); font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--text); color: var(--bg); border-radius: 8px; padding: 9px 16px; font-size: 14.5px; font-weight: 500;
}
.btn:hover { text-decoration: none; opacity: .88; }

footer.site { border-top: 1px solid var(--line); color: var(--faint); font-size: 13.5px; }
footer.site .inner { max-width: 1040px; margin: 0 auto; padding: 22px 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- blog ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 56px 24px 80px; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; margin: 0 0 6px; }
.page-head p { color: var(--muted); margin: 0 0 28px; }
.search {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; outline: none;
}
.search:focus { border-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 30px; }
.tag {
  font: inherit; font-size: 13px; color: var(--muted); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 11px;
}
.tag:hover { color: var(--text); }
.tag.on { color: var(--bg); background: var(--text); border-color: var(--text); }
.year { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 34px 0 6px; color: var(--faint); }
.posts { list-style: none; padding: 0; margin: 0; }
.posts li { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.posts li:last-child { border-bottom: 0; }
.posts time { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.posts a { color: var(--text); font-weight: 500; }
.posts a:hover { color: var(--accent); }
.posts .sum { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.empty { color: var(--muted); padding: 24px 0; display: none; }

.back { font-size: 14.5px; color: var(--muted); }
.post-head { margin: 18px 0 30px; }
.post-head h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.25; margin: 0 0 10px; }
.post-meta { color: var(--faint); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.post-meta .chip { border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; font-size: 12.5px; color: var(--muted); }
.prose { font-size: 16.5px; line-height: 1.75; overflow-wrap: break-word; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); font-weight: 600; line-height: 1.3; margin: 1.8em 0 .6em; }
.prose h1 { font-size: 26px; } .prose h2 { font-size: 23px; } .prose h3 { font-size: 19.5px; } .prose h4 { font-size: 17px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 1.1em; }
.prose img { display: block; margin: 1.2em auto; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.prose blockquote { border-left: 3px solid var(--line); padding: 2px 0 2px 16px; color: var(--muted); margin-left: 0; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .12em .36em; border-radius: 4px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: 13.5px; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 14.5px; }
.post-nav a { display: block; color: var(--text); }
.post-nav span { display: block; color: var(--faint); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.post-nav .next { text-align: right; }

/* highlight.js tokens tuned to both themes */
.hljs-keyword, .hljs-built_in, .hljs-type { color: #8a3ffc; }
.hljs-string, .hljs-attr { color: #1a7f37; }
.hljs-comment { color: var(--faint); font-style: italic; }
.hljs-number, .hljs-literal { color: #b35900; }
.hljs-title, .hljs-function .hljs-title { color: #0550ae; }
.hljs-meta { color: #9a6700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hljs-keyword, :root:not([data-theme="light"]) .hljs-built_in, :root:not([data-theme="light"]) .hljs-type { color: #c7a4ff; }
  :root:not([data-theme="light"]) .hljs-string, :root:not([data-theme="light"]) .hljs-attr { color: #7ee2a8; }
  :root:not([data-theme="light"]) .hljs-number, :root:not([data-theme="light"]) .hljs-literal { color: #ffb86b; }
  :root:not([data-theme="light"]) .hljs-title { color: #8ab4ff; }
  :root:not([data-theme="light"]) .hljs-meta { color: #e3c07a; }
}
:root[data-theme="dark"] .hljs-keyword, :root[data-theme="dark"] .hljs-built_in, :root[data-theme="dark"] .hljs-type { color: #c7a4ff; }
:root[data-theme="dark"] .hljs-string, :root[data-theme="dark"] .hljs-attr { color: #7ee2a8; }
:root[data-theme="dark"] .hljs-number, :root[data-theme="dark"] .hljs-literal { color: #ffb86b; }
:root[data-theme="dark"] .hljs-title { color: #8ab4ff; }
:root[data-theme="dark"] .hljs-meta { color: #e3c07a; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .home { grid-template-columns: 1fr; gap: 36px; padding-top: 36px; }
  .profile { position: static; display: grid; grid-template-columns: 112px 1fr; gap: 0 20px; align-items: center; }
  .avatar { width: 112px; height: 112px; grid-row: span 3; }
  .profile h1 { margin-top: 0; font-size: 26px; }
  .links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 18px; }
}
@media (max-width: 560px) {
  .topbar .inner { padding: 0 16px; }
  .nav a { padding: 6px 7px; font-size: 14px; }
  .nav .hide-sm { display: none; }
  .home, .page { padding-left: 16px; padding-right: 16px; }
  .pub { grid-template-columns: 1fr; gap: 6px; }
  .venue { justify-self: start; }
  .tl li { grid-template-columns: 1fr; }
  .blog-cta { flex-direction: column; align-items: flex-start; }
  .posts li { grid-template-columns: 1fr; gap: 0; }
  .post-head h1, .page-head h1 { font-size: 28px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}
