:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1c1f24;
  --muted: #474e5a;
  --faint: #6b7280;
  --line: #e4e1d8;
  --accent: #1f4e8c;
  --accent-soft: #e8eef8;
  --me: #1c1f24;
  --conf: #9a3412;
  --shadow: 0 1px 2px rgba(20, 24, 33, .04), 0 4px 16px rgba(20, 24, 33, .05);
  --serif: "Source Serif 4", "Georgia", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --surface: #1b1e23; --ink: #ecebe7; --muted: #c0c4cc; --faint: #9ca2ad;
    --line: #2c3037; --accent: #93b9f0; --accent-soft: #1f2a3b; --me: #ffffff;
    --conf: #c2410c; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1b1e23; --ink: #ecebe7; --muted: #c0c4cc; --faint: #9ca2ad;
  --line: #2c3037; --accent: #93b9f0; --accent-soft: #1f2a3b; --me: #ffffff;
  --conf: #c2410c; --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  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; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 32px 40px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
}

/* ---------- Sidebar ---------- */
.profile { align-self: start; }
@media (min-width: 881px) and (min-height: 820px) {
  .profile { position: sticky; top: 40px; }
}
.avatar {
  width: 180px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 12px;
  display: block;
  box-shadow: var(--shadow);
}
.name {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.15;
  margin: 18px 0 4px;
  letter-spacing: -.01em;
}
.role { color: var(--muted); font-size: .93rem; line-height: 1.5; margin: 0; }
.grad { color: var(--muted); font-size: .86rem; margin: 6px 0 14px; }
.links { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 4px; font-size: .9rem; }
.links a, .links span { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.links a:hover { color: var(--accent); text-decoration: none; }
.links svg { width: 16px; height: 16px; flex: none; }
.nav { display: grid; gap: 0; border-top: 1px solid var(--line); padding-top: 12px; font-size: .9rem; }
.nav a { color: var(--muted); padding: 3px 0; }
.nav a.active { color: var(--ink); font-weight: 600; }
.nav a:hover { color: var(--accent); text-decoration: none; }

.theme-toggle {
  margin-top: 14px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--faint); }

/* ---------- Content ---------- */
main section { margin-bottom: 40px; }
h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  letter-spacing: -.005em;
}
.lead { font-size: 1.04rem; }
.lead p { margin: 0 0 12px; }


.year {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--faint);
  margin: 18px 0 2px;
}
.year:first-of-type { margin-top: 0; }
.pub {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  padding: 12px 0;
}
.venue {
  align-self: start;
  justify-self: start;
  margin-top: 3px;
  background: var(--conf);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.35;
  padding: 3px 8px;
  border-radius: 5px;
}
.pub-title { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; line-height: 1.4; margin: 0 0 3px; color: var(--ink); }
.authors { color: var(--muted); font-size: .92rem; margin: 0; }
.authors .me { color: var(--me); font-weight: 600; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.where { font-size: .9rem; margin: 1px 0 8px; color: var(--muted); font-style: italic; }
.where strong { font-style: normal; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .78rem; font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 0;
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.abstract {
  display: none;
  margin-top: 10px;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}
.abstract.open { display: block; }


.news { list-style: none; padding: 0; margin: 0; }
.news li { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 4px 0; font-size: .95rem; }
.news time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: .88rem; padding-top: 1px; }
.older { margin-top: 6px; }
.older summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.older .news { margin-top: 4px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline strong { font-weight: 600; }
.timeline .sub { color: var(--muted); font-size: .9rem; }
.timeline time { color: var(--faint); font-size: .88rem; font-variant-numeric: tabular-nums; text-align: right; }


footer { color: var(--faint); font-size: .82rem; border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .page { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 28px 16px; }
  .profile { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0 18px; align-items: start; }
  .avatar { width: 110px; }
  .name { margin-top: 0; font-size: 1.5rem; }
  .links, .theme-toggle { grid-column: 1 / -1; justify-self: start; }
  .links { margin-top: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-wrap: anywhere; width: 100%; }
  .nav, .theme-toggle { display: none; }
  .pub { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
