:root {
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --bg: #fdfdfc;
  --rule: #e4e2dd;
  --accent: #14508c;
  --code-bg: #f4f3f0;
  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e4df;
    --muted: #a1a09b;
    --bg: #14140f;
    --rule: #2e2d28;
    --accent: #7db2e8;
    --code-bg: #1d1d18;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", serif;
  padding: 0 1.25rem;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img { max-width: 100%; height: auto; }

/* ---------- header ---------- */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.brand { font-size: 1.05rem; font-weight: 600; color: var(--fg); letter-spacing: 0.01em; }

.site-head nav { display: flex; align-items: center; gap: 1.25rem; font-size: 0.9rem; }
.site-head nav a { color: var(--muted); }
.site-head nav a:hover { color: var(--accent); }

.site-head nav a.lang-switch {
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.05rem 0.45rem;
  line-height: 1.5;
}
.site-head nav a.lang-switch:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- layout ---------- */

main { flex: 1; padding: 2.25rem 0 3rem; }

h1, h2, h3 { line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.65rem; margin: 0 0 0.5rem; }
h2 {
  font-size: 0.82rem;
  margin: 2.6rem 0 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }

p { margin: 0 0 0.9rem; }

/* ---------- hero ---------- */

.hero {
  display: flex;
  align-items: flex-start;
  gap: 1.6rem;
  padding: 0.5rem 0 0.5rem;
}

.portrait {
  width: 168px;
  height: 168px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--rule);
}

.hero-text { min-width: 0; }
.hero h1 { font-size: 1.9rem; margin-bottom: 0.15rem; }
.affil { color: var(--muted); margin-bottom: 0.7rem; font-size: 0.95rem; }
.tagline { font-size: 1.02rem; margin-bottom: 0.6rem; }
.links { font-size: 0.88rem; color: var(--muted); margin: 0; }
.sep { color: var(--rule); margin: 0 0.3rem; }

/* ---------- news ---------- */

.news-body ul { list-style: none; padding: 0; margin: 0; }
.news-body li { padding: 0.28rem 0; font-size: 0.94rem; }
.news-body strong {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-right: 0.55rem;
  font-size: 0.86rem;
}

/* ---------- publication list ---------- */

.pub-list { list-style: none; padding: 0; margin: 0; }

.pub-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}
.pub-item:first-child { border-top: 1px solid var(--rule); }

.pub-item.has-thumb {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 1.1rem;
  align-items: start;
}

.pub-thumb { display: block; }
.pub-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--code-bg);
}

.pub-title { font-weight: 600; }
.pub-meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 0.18rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.45rem;
  align-items: baseline;
}
.venue { font-style: italic; }
.venue::before { content: "·"; margin-right: 0.45rem; color: var(--rule); }
.pub-year { font-variant-numeric: tabular-nums; }
.pub-year::before { content: "·"; margin-right: 0.45rem; color: var(--rule); }
.pub-detail { color: var(--muted); font-size: 0.83rem; margin-top: 0.15rem; }
.pub-desc { font-size: 0.92rem; margin-top: 0.3rem; }

.pub-links {
  font-size: 0.8rem;
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pub-links a {
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.02rem 0.42rem;
  color: var(--muted);
}
.pub-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.more { margin-top: 0.9rem; font-size: 0.9rem; }

/* ---------- article ---------- */

.page-title { margin-bottom: 1.1rem; }
.page-intro { margin-top: 0; }

.teaser {
  margin: 1.5rem 0;
  text-align: center;
}
.teaser img {
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--code-bg);
}

.prose { margin-top: 1.4rem; }
.prose h2 {
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg);
  font-size: 1.02rem;
  margin-top: 1.9rem;
}
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: 0.25rem 0; }

code, pre {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 0.88em;
}
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; }
pre { background: var(--code-bg); padding: 0.9rem 1rem; overflow-x: auto; border-radius: 4px; line-height: 1.5; }
pre code { background: none; padding: 0; }

blockquote { margin: 1.2rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }

.bibtex { margin-top: 2rem; }
.bibtex summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.back { margin-top: 2.5rem; font-size: 0.9rem; }

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 2rem;
  font-size: 0.83rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

/* ---------- small screens ---------- */

@media (max-width: 40rem) {
  .hero { flex-direction: column; gap: 1rem; }
  .portrait { width: 128px; height: 128px; }
  .hero h1 { font-size: 1.6rem; }
  .pub-item.has-thumb { grid-template-columns: 1fr; gap: 0.6rem; }
  .pub-thumb img { aspect-ratio: 16 / 9; }
}

@media (max-width: 34rem) {
  .site-head { flex-direction: column; align-items: flex-start; }
  body { padding: 0 1rem; }
}
